[Haifux] Multi-thread debugging for C++ on Linux

Shachar Shemesh shachar at shemesh.biz
Sat Nov 29 18:48:16 MSK 2008


Hai Zaar wrote:
>   
> Insight did a best job for
> me debugging project that heavily used C++ templating, where ddd got
> lost tracking source code.
>   
When compiling code for use with a debugger, especially C++ code with 
complex code interleaving, always pass -O0 to the compiler. Despite what 
it may appear, not passing anything is not the same as telling the 
compiler to turn off all optimizations.

-O0 should allow you to sanely debug any application gcc can compile, no 
matter what (well, not including C preprocessor tricks. Those are still 
horrible).

It may be that that was all that insight did "correctly".

Shachar



More information about the Haifux mailing list