0

I have a binary of file format "PA-RISC2.0 shared executable". And a core dump by running this binary. I have the stack trace. To get more information I am trying to extract the symbol table and load it in gdb session.

The problem is I am not able to extract the symbol table PA-RISC2.0 SOM file format. The commands 'odump' and 'nm' output the symbol table in ascii text, which not loadable by the gdb.

In Linux, for ELF-file formats it is possible with 'objcopy --keep-only-debug' to extract the symbol table.

Is there any way to extract the symbol table from an executable of the above file format.

Operating system is HP-UX 11i

Thanks in advance.

tsmyelin
  • 7
  • 1

1 Answers1

0

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?

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Yes the executable has debug symbols. It is compiled with -g flag. I must be able to extract the symbol table. – tsmyelin Sep 08 '12 at 06:12
  • @tsmyelin "I must be able to extract the symbol table" -- What for? What are you hoping to achieve with the result of extraction? – Employed Russian Sep 08 '12 at 06:15
  • 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. For example: If i try 'info locals' in a gdb session, it gives 'No symbol table'. If i load the symbol table i can get the variable values in that frame. – tsmyelin Sep 08 '12 at 06:23
  • Thanks for the response! Yes i do gdb . I need to check why its not loading symbol table. Thanks for the help! – tsmyelin Sep 08 '12 at 17:39