How can I demangle or look inside readelf .symtable names?

1.2k Views Asked by At

I only have access to an object file for my assignment. When I disassemble the file I can read most of the assembly, but I'm having some trouble with a few calls. A call will mention some mangled names like:

callq 0x147 <main+206> _ZNSirsERi-0x4

So I did some research and found that using readelf -s 'filename' shows the .symtable and gives me these mangled names

19: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZSt3cin
20: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZNSirsERi
21: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZNSolsEi

Is there a way to demangle this? Or find out what the -0x4 is referencing in the call? Obviously _ZSt3cin is a cin call. But I don't know what the rest are doing.

1

There are 1 best solutions below

1
Troutt025 On

It seems that nm had options that helped me.

nm -gC 'filename' gave me the demangled names I was looking for!