Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting function signature from compiler language to c++

Tags:

c++

g++

linker

Hey guys, I need to make a list of some functions that are listed in the linker output. The syntax i get is as follows:

int foo(int num,double dnum, Temp & temp) (in namespace "funcsns")

Turns into:

.text._ZN7funcsns3fooEidRNS_4TempE

(You might know it from the "undefined symbol" and some other linking errors that print functions names)

Now, i can write a script that somehow turns it into something readable but i wonder if there is a smart way of doing it.

Please share your ideas!
thanks.

like image 380
stnr Avatar asked Feb 10 '26 22:02

stnr


1 Answers

On a system using the GNU toolchain, the c++filt program does exactly what you're looking for. It's part of the "binutils" package. Dunno about other systems.

The ".text." isn't part of the mangled name. Running c++filt _ZN7funcsns3fooEidRNS_4TempE yields funcsns::foo(int, double, funcsns::Temp&).

like image 188
Wyzard Avatar answered Feb 16 '26 02:02

Wyzard