gdb is jumping over lines

The library you are stepping into has been built with optimization and debug symbols (most likely -g -O2, which is the default for Linux builds).

Debugging optimized code is somewhat hard, as control flow optimization causes the code to “jump around”, some variables become “<optimized out>“, etc.

You can rebuild the library with CXXFLAGS = -g -O0, or you can learn to debug with optimization on.

The latter is a very useful skill, as many times your program will only crash in optimized mode, and you’ll have to debug it in that mode anyway.

Leave a Comment