Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are using a debugger and heavy usage of C++ templates incompatible in the long run?

I'm working on a project that uses a lot of templates and libraries like boost:: fusion and found myself struggling with an executable that, as of today, is 600MB and gdb needs 1.7 GB of memory to just load it, and a symbol lookup would make it use nearly 3GBs.. The stripped binary is about 5 MBs.

The question is, is there anything to be done in order to generate smaller debug symbols? This is not only a problem with gdb but also with the linker, which uses another 1.2 GB of RAM when linking objects compiled with the -g flag

I've tried -g1 -g2 and -g3 and the problem remains the same.

like image 684
Gustavo Avatar asked Mar 24 '14 17:03

Gustavo


1 Answers

is there anything to be done in order to generate smaller debug symbols?

You can use GNU gold linker with --compress-debug-sections=zlib option instead of default ld linker to compress output debug symbols. Gdb supports compressed debug sections since 7.0 version.

like image 157
ks1322 Avatar answered Sep 17 '22 16:09

ks1322