D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] gnu compiler experts anywhere?

 

I should have added that compiling for debugging makes the damn thing
work. It should be possible to generate a separate symbol file that the
debugger can use to follow the code after a segfault rather than adding
it to the executable.

Meh. I hate those. Had more than one myself. Almost as much 'fun' as a multithreaded program.

I've done a bit of googling, and I'm actually really surprised that I haven't found anything on this. It happens often enough. I can't see anything in the man pages for gcc or gdb.

I'm not sure a symbol table is what you're looking for. In the man page for gcc, -g says "produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2)". Whereas -s (not normally used) says "remove all symbol table and relocation information from the executable". I think this implies that all executables have at least some form of symbol table unless explicitly removed, and -g just gives more information.

Check out -d for gdb which lets you tell it where to find source code. It might be able to give you enough debugging information without using -g.

Maybe you could try some other options that change the debugging information and see if that causes the program to fail:
-fno-merge-debug-strings
-feliminate-unused-debug-symbols
-feliminate-unused-debug-types
-femit-class-debug-always

[edit]: I've just noticed the link James posted. I think that's what you're looking for:
http://www.bytetalk.net/2010/07/how-to-generate-seperate-g-symbol-file.html

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq