I would really like to change the registers during radare2's debugging sessiong. In GDB,

set $reg 0x2020 

was very useful.

1 Answer 1


TLDR: In radare2, while debugging, you use dr <register>=<val>

Use the -d flag to begin Radare2 in debugging mode

r2 -d /usr/bin

You'll have a prompt in front of you, type v and then p a few times to get to the debugging view.

Press colon to enter commands. You'll most likely want to analyze the binary. To do this, press colon and then aaa or aa. Note, that aaa does could take more time, but does performs a more in-depth analysis.

Once in debugging mode, use db [address] to set a breakpoint. For example, to set a breakpoint at main

db main

And you can get to main, enter s main. This jumps to main (s is for seek).

Then, if you want to change the register rdi

dr rdi=0x20

For more register options, see: https://r2wiki.readthedocs.io/en/latest/options/d/dr/

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.