Troubleshooting.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <- Manual.html | Back to main page
  2. Title: Troubleshooting
  3. To add a compiler flag when not using an IDE, append it to COMPILER_FLAGS in your build.sh script.
  4. ---
  5. Title2: To use or not use an IDE with a built-in debugger
  6. *
  7. If your low-level code is crashing often from advanced optimizations,
  8. you might need an IDE with a built-in debugger to quickly show where the crash happened.
  9. The IDE integration can then directly point to the code instead of showing line numbers from a separate debugger.
  10. *
  11. If your high-level code only crashes rarely but the amount of pixel data is too much for a debugger,
  12. create a debug window showing internal images or debug overlays with coordinates on top of the program's existing graphics.
  13. ---
  14. Title2: Finding the cause of bugs takes too long.
  15. *
  16. Unless you are profiling, test in debug mode using the -DDEBUG compiler flag.
  17. This catches bugs earlier with more information about the crash.
  18. Make sure that the release flag -DNDEBUG is not also active.
  19. *
  20. If using raw pointers, you might want to replace them with the SafePointer class to get tighter bound checks in debug mode.
  21. Debuggers will wait until your bugs write outside of the whole allocation before throwing an error.
  22. *
  23. Make sure that all your multi-threading can be turned off easily when finding the root cause.
  24. *
  25. Create a basic reference implementation without dangerous optimizations for every advanced feature.
  26. Both for finding the cause of instability and being able to remove a feature without sending emergency patches in panic with more bugs.
  27. Image filters are first written using lambdas returning the color of a pixel based on the pixel coordinate and exception-free pixel sampling.
  28. Then one can make an optimized version using SafePointer and SIMD vectors.
  29. ---
  30. Title2: Getting crashes after linking to an external library.
  31. *
  32. Try adding the -DDISABLE_ALLOCATOR compiler flag.
  33. This will disable the library's memory recycling at DFPSR/base/allocator.cpp in case that another library already has a memory recycler.
  34. ---
  35. Title2: Getting linker errors when creating a new project without a window.
  36. *
  37. Linking to a window manager without using it may cause linker errors because the renderer library makes a call to outside of the library.
  38. The solution is to use WINDOW_MANAGER=NONE in build.sh or include NoWindow.cpp manually in your project instead of the system's actual window manager.
  39. ---