Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "decrypt" linker method names?

I'm using backtrace to print application's stack trace and I'm getting something like

libQtCore.so.4(_ZN11QMetaObject8activateEP7QObjectPKS_iPPv+0x843) [0x7f889d20cf33]
libQtGui.so.4(_ZN7QAction9triggeredEb+0x32) [0x7f889d76c2f2]
libQtGui.so.4(_ZN7QAction8activateENS_11ActionEventE+0xb0) [0x7f889d76d670]
libQtGui.so.4(+0x6242f4) [0x7f889db862f4]

Is there any way to convert "linker-names" to "source-names" and get code line numbers from offsets?

I want to have backtrace, looking like this:

libQtCore.so.4 (QMetaObject::activate(QObject):1022)
libQtGui.so.4  (QAction::triggered()::47) 

UPD.

I understand, this technique may work or not work or work bad because of compiler specifics. I want to "demangle" linker symbols at least in gcc and visual c++.

like image 970
Arenim Avatar asked Dec 08 '11 16:12

Arenim


2 Answers

  • Under gcc you can use c++filt to decipher the mangling.

  • Under Visual studio you can undname

Once you have the function name you at least on Windows you can use DIA SDK to get the source file line numbers etc

like image 198
parapura rajkumar Avatar answered Oct 17 '22 11:10

parapura rajkumar


This is called name mangling. Read the article on Wikipedia please, since citing it here would be too much for an answer.

like image 27
Sergiy Belozorov Avatar answered Oct 17 '22 11:10

Sergiy Belozorov