10

It's easy to seek to a particular function and dump it's contents as Assembly language. However, I cannot find an obvious way to immediately disassemble and dump an entire binary. I want to use it more like I use IDA and objdump by seeing the entire disassembly at once.

2
  • Visual mode actually does what I want for the most part. I'm open to other approaches, though. Commented Mar 26, 2015 at 23:23
  • 1
    one trick - pd $s | less
    – R4444
    Commented Apr 9, 2020 at 14:01

2 Answers 2

13

You can use the special "'$' variables" $s to get the size of your binary, and pass it as an argument to the pd command to disassemble the whole file:

[0x004048bf]> pd $s
Do you want to print 188.0K chars?

For more information on '$' variables available see ?$?.

10
  • I usually use objdump -d binary | less command, is there anything similar can be done using r2. Just output the highlighted disassembly to stdout?
    – user
    Commented Nov 29, 2015 at 4:32
  • 1
    Why not using the radare2 shell instead? If you really want to disassemble the whole binary to stdout, you can use r2 -c 'pi $s', but it's much less convenient.
    – jvoisin
    Commented Nov 30, 2015 at 12:44
  • But it does not highlight the syntax, that is one of the reasons I am using radare2 - to get the highlighted syntax.
    – user
    Commented Nov 30, 2015 at 18:12
  • 1
    No, it did not disassemble the whole binary, it just disassembled _start function.
    – user
    Commented Dec 1, 2015 at 0:50
  • 1
    That's the whole point. Most of the time, you're like to explore the binary, to use r2's analysis capabilities, instead of dumping the whole disassembly. You can of course do that inside the shell with pi $s.
    – jvoisin
    Commented Dec 1, 2015 at 15:02
3

If you want more like an Ida experience you could try the GUI project for Radare called Bokken.

https://github.com/radare/bokken

Update: it seems to have been superseded by the cutter project.

1
  • Bokken is not really production-ready yet; I wouldn't recommend using it.
    – jvoisin
    Commented Aug 13, 2015 at 12:23

Your Answer

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

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