gdb corefile not see function parameters

1.6k views Asked by At

My application crashed due to uncaught exception (my c++ code throws uncaught exception under certain condition). I am trying to gdb the corefile. The binary library is "not striped". And the stack trace shows the function (my code) from which an uncaught exception is thrown, but when I try to print the function arguments, I always get "no symbol xxx in current context". info args also return "No symbol table info available".

Can anyone shed a light why ? is it due to the uncaught exception which unwind/corrupts the stack ?

Thanks, Frank

1

There are 1 answers

5
Employed Russian On

Your binary lacks debug info.

If you built it with gcc, and want to debug the core you already have (if e.g. it's hard to reproduce the crash), you may be able to recover from this by rebuilding the binary with exactly the same source and command lines, adding -g to compile and link commands. (Note: you must use the same compile lines; replacing -O2 with -g wouldn't do.)

If the crash is not hard to reproduce, simply rebuild the binary with -g -O0, run it under GDB, and enjoy "easy" debugging.

The binary library is "not striped".

This doesn't mean what you think it means. Not stripped means that the symbol table is still present in the binary.

GDB will read this symbol table, and use it to map ranges of addresses to function names.

But to recover names and values of local variables and parameters, you must compile with debug info (which is what -g flag does for most compilers).