3

I am learning radare2. Is there a way to demangle c++ functions during disassembling? For example in gdb

set print asm-demangle

changes

callq 0x400a30 <_ZNSo3putEc@plt>

to

callq 0x400a30 <_std::ostream::put(char)@plt>

edit: I had radare2 0.9.6 which comes with Ubuntu's synaptic package manager. I reinstalled it from https://github.com/radare/radare2. Now I see the asm.demangle variable after entering Ve, it is set to true, but names are still mangled.

1 Answer 1

4

Check e asm.demangle, and set it to true or false as required.

Is the radare2 version you are using the latest one?

You should be able to view all the configuration data with e.

Typing e?? should show you a complete list of configuration variables with their description. You can grep through the output for all the vars that have the pattern demangle with

[0x00001d52]> e??~demangle
        asm.demangle: Show demangled symbols in disasm
        bin.demangle: Import demangled symbols from RBin
            bin.lang: Language for bin.demangle
[0x00001d52]>

Radare2 needs to be told to load the demangle informations at startup, so you can set bin.demangle to true, and reopen the file:

 e bin.demangle = true
 oo 

Last but not least, you can provide a symbol name in its mangled form on a case by case basis, using the command iD:

[0x7c810705]> iD cxx _ZNSo3putEc
std::ostream::put
[0x7c810705]>

By the way, a tip instead of asking a question here and waiting forever: radare2 is self documented, so you can begin by typing ? to get help, and then append ? to each command, like a?, or pd? and so on…

1
  • Sorry, but how? If I enter e asm.demangle=true, I get: variable 'asm.demangle' not found
    – robert
    Dec 18, 2015 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.