Skip to content

Debugging Cpp Code

Janek edited this page Nov 18, 2021 · 4 revisions

Tests

Run the tests with ctest --output-on-failure or set the environment variable CTEST_OUTPUT_ON_FAILURE to print logs of failed tests.

Debugging

gdb

Use gdb to get backtraces in case of crashes.

  • Enter gdb through gdb mixxx-test --gtest_filter=CLASS.TESTNAME from the build directory and wait until it has read all the symbols. (always isolate a single test when using mixxx-test directly)
  • run the test
  • Gdb will automatically stop on crash, then use backtrace to inspect the call-sites.

Use a debugger with breakpoints at suspicious lines to inspect program state.

gdb & Qt - gdbinit

For more helpful debug inspection results, create a .gdbinit file, here some instructions from KDE and Lekensteyn.

There are specific guides for CLion and Eclipse.

Clone this wiki locally