6

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++.

Arenim
  • 4,097
  • 3
  • 21
  • 31

2 Answers2

6
  • 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

parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85
2

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

Sergiy Belozorov
  • 5,856
  • 7
  • 40
  • 73