2

I wonder if it is possible in r2 to make alias for the value that repeats itself many times.

For instance:

Image with movzx eax, byte [rbp + rax - 0x1020 assembly fragment

I want to have an alias for rbp + rax - 0x1020 to be named as cwd[i]. Can it be done?

I haven't found any similar question before, would be great if it was possible.

5
  • 1
    This would be very valuable, and is a surprising omission from radare2. Commented Apr 3 at 16:14
  • @SRobertJames Nice that you revived this question. I posted it on the on the official r2 discord, hopefully someone knows how to do it :)
    – satk0
    Commented Apr 3 at 17:09
  • 1
    Great! If you get an answer, please post it here. I'm wondering if there's a hack to do this via macros and command substitution. Commented Apr 3 at 18:00
  • @SRobertJames After discussing it with Pancake, I suggested such a feature on github, check it out (and bump it, pls XD): github.com/radareorg/radare2/issues/22813
    – satk0
    Commented Apr 9 at 16:57
  • @SRobertJames I developed a plugin that resolves this issue, check it in a free time.
    – satk0
    Commented May 20 at 14:38

1 Answer 1

2

So, it turns out, there is no way to do it in Radare2. However, I created a plugin with a huge help from pancake, that allows just that:

https://github.com/satk0/r2-afen-plugin

Installation is as simple as running:

r2pm -i r2afen

After installing, you must run radare2 with -e asm.parser=afen -e asm.pseudo=true arguments for the plugin to actually work:

r2 -e asm.parser=afen -e asm.pseudo=true <file>

Then, using this plugin, the command that renames rbp + rax - 0x1020 expression to cwd[i] would be the following:

> afen cmd[i] "rbp + rax - 0x1020"

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.