RAHUL GOYAL
2010-Jun-03 11:04 UTC
[LLVMdev] Getting rid of the dangling names of functions
Hi all, I am a beginner in llvm trying to write some basic passes like printing the name of all the functions in "Hello.cpp" file attached underneath. Also find attached "hello.cpp" on which i am testing the pass .When i run the command: "opt -load $HOME/llvm/src/Debug/lib/TEMP.so -hello < hello.bc > /dev/null" .The output shown is Hello: _GLOBAL__I_x Hello: main Hello: _Z4rajuif Hello: _Z4brtyv Hello: _Z4rajui Hello: __tcf_0 But we want output to be Hello: main Hello: raju Hello: brty Hello: raju How can we get this ..?? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100603/dab391cd/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: Hello.cpp Type: text/x-c++src Size: 1239 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100603/dab391cd/attachment.cpp> -------------- next part -------------- A non-text attachment was scrubbed... Name: hello.cpp Type: text/x-c++src Size: 200 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100603/dab391cd/attachment-0001.cpp>
Reid Kleckner
2010-Jun-03 15:05 UTC
[LLVMdev] Getting rid of the dangling names of functions
The names are mangled according the the C++ name mangling rules of your platform. Try piping the output through c++filt. Reid On Thu, Jun 3, 2010 at 7:04 AM, RAHUL GOYAL <rahulgoyal34 at gmail.com> wrote:> Hi all, > > I am a beginner in llvm trying to write some basic passes like printing the > name of all the functions in "Hello.cpp" file attached underneath. Also find > attached "hello.cpp" on which i am testing the pass .When i run the command: > "opt -load $HOME/llvm/src/Debug/lib/TEMP.so -hello < hello.bc > /dev/null" > .The output shown is > > Hello: _GLOBAL__I_x > Hello: main > Hello: _Z4rajuif > Hello: _Z4brtyv > Hello: _Z4rajui > Hello: __tcf_0 > > But we want output to be > > Hello: main > Hello: raju > Hello: brty > Hello: raju > > How can we get this ..?? > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Jim Grosbach
2010-Jun-03 15:31 UTC
[LLVMdev] Getting rid of the dangling names of functions
You're seeing the mangled names since you're compiling a C++ file, so you'll need to run them through a demangler to get the names used in the source code. There's one in libstdc++, I believe. On Jun 3, 2010, at 4:04 AM, RAHUL GOYAL wrote:> Hi all, > > I am a beginner in llvm trying to write some basic passes like printing the name of all the functions in "Hello.cpp" file attached underneath. Also find attached "hello.cpp" on which i am testing the pass .When i run the command: > "opt -load $HOME/llvm/src/Debug/lib/TEMP.so -hello < hello.bc > /dev/null" .The output shown is > > Hello: _GLOBAL__I_x > Hello: main > Hello: _Z4rajuif > Hello: _Z4brtyv > Hello: _Z4rajui > Hello: __tcf_0 > > But we want output to be > > Hello: main > Hello: raju > Hello: brty > Hello: raju > > How can we get this ..?? > <Hello.cpp><hello.cpp>_______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev