gcc-newbies-guide icon indicating copy to clipboard operation
gcc-newbies-guide copied to clipboard

Debugging and optimization

Open davidmalcolm opened this issue 1 year ago • 0 comments

Capturing this note here for now; should go on the debugging page:

Note that by default GCC is built with -O2 which lead to confusion in the debugger, where e.g. attempts to singlestep through the code fail, and it simply returns from the function you were hoping to debug. But if you cd into the "build/gcc" subfirectory and build there, it gets built without optimization. So it sometimes helps to rm some .o files that you plan to step through and rerun "make" (within build/gcc) to rebuild them without optimization.

davidmalcolm avatar May 21 '24 22:05 davidmalcolm