Is there any way to extract the symbol table from an executable of the above file format.
Your question appears to be based on false premise -- that somehow extracting the symbol table info from an executable will give GDB more info than what GDB itself was able to extract from the executable. It will not.
The objcopy --keep-only-debug
is usable when you want to keep the debug symbols, but want to ship a stripped executable to the customer. It is not useful when you have a debug executable and a core dump that you want to debug.
Update:
In gdb if i am able to load the symbol table, I can get the values of local variables which would not be possible if i didnt.
Yes, but you don't need to extract the symbol table from the executable into a separate file for this -- GDB will load symbol table directly from the executable on its own, without any extra steps.
I suspect that you are not invoking GDB correctly. Don't do this: gdb -c core
. Do this instead: gdb /path/to/a.out /path/to/core
.
Update 2:
Yes i do gdb <binary> <core>
In that case, perhaps you are missing the pxdb
preprocessing step? HP-UX versions of GDB automatically run /opt/langtools/bin/pxdb
to transform debug info into format that GDB understands. But maybe you are using GDB that is too old, or your system does not have /opt/langtools/bin/pxdb
installed?