2

I was just looking at the Megabeets tutorial again, and it he has,

pd $r @ main

I don't see the the $r explained anywhere though. What does $r do in that? It's also not explained in pd?

4

$r is one of the variables available in radare2. More specifically, $r is a variable which holds the height of the console. This command is shown on Visual Disassembly mode (Vp) and usually is not executed by the user. The command is used by the mode in order to show N instructions from the binary where N is the height of the console (number of lines). This provides the user with a better, and more interactive, reverse engineering experience.

To show the full list of variables you can use the command ?$?. Here is a truncated list:

[0x000008cc]> ?$?
Usage: ?v [$.]
| flag          offset of flag
| $$            here (current virtual seek)
| $$$           current non-temporary virtual seek
| $?            last comparison value
| $alias=value  alias commands (simple macros)
| $b            block size
...
| $c,$r         get width and height of terminal
...
| $l            opcode length
| $m            opcode memory reference (e.g. mov eax,[0x10] => 0x10)
| $M            map address (lowest map address)
| $MM           map size (lowest map address)
| $o            here (current disk io offset)
| $p            getpid()
| $P            pid of children (only in debug)
| $s            file size
| $S            section offset
| $SS           section size
...
| ${ev}         get value of eval config variable
| $r            get console height
| $r{reg}       get value of named register
| $k{kv}        get value of an sdb query value
| $s{flag}      get size of flag
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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