can c++filt be used to write the demangled name back in the .s file itself?

1.2k Views Asked by At

I am just trying to learn c++filt, there are not enough example usage available in the web....

I am writing a main.cpp file and trying to read the machine code....

g++ -S main.cpp -> gives me main.s

if I need to find out an demangled value, I could use

g++ -S main.cpp | c++filt <demangled name>

eg)

g++ -S main.cpp | c++filt _Z3gooi

gives me value goo(int i)// which is the signature,

Is there a way, where you replace the current main.s file with demangled values, for example, the _Z3gooi will be demangled as goo(int i) in the file itself, instead of console.... ????

2

There are 2 best solutions below

0
On BEST ANSWER

Can be done in

C++filt<main.s>temp.s
0
On

No, because the demangled name will usually be invalid as a symbol name.