radare2 icon indicating copy to clipboard operation
radare2 copied to clipboard

Rename expressions functionality

Open satk0 opened this issue 1 year ago • 7 comments

Description

r2 could enable renaming the expressions, like the afvn command renames locals/arguments.

For instance:

Instead of hard to remember expression, like rbp + rax - 0x1020:

image

There could be a command that renames it to e.g. cwd[i] (it is just a concept, drawn in GIMP):

image

As Pancake said, such a renaming should only affect the context of the function and not be global.

satk0 avatar Apr 09 '24 16:04 satk0

You can do this with rpase plugins in c and js. If its ok for you we can close the ticket because im not sure if this should be a core feature of r2 because it looks quitw custom and hacky when the proper fix must be improving the variable analysis code

trufae avatar Apr 10 '24 14:04 trufae

As far as I know, no other disassembler has such a functionality, so that would make radare2 even more unique and customizable.

satk0 avatar Apr 10 '24 18:04 satk0

Yeah i agree on that. It can be very useful because it gives the user the ability to mess with the disassembly the eay they need like if it was made with pen and paper. But as long as doing it natively will require abi breaking changes and i think its better to do the change as plugins for now, having that implemented in C can be also useful because it will provide the feature in place and do it in a modular way

trufae avatar Apr 11 '24 08:04 trufae

Great that you agree with me on it. If I manage to create a plugin like this I would definitely post it here.

satk0 avatar Apr 14 '24 08:04 satk0

Can you publish your plugin so the ticket is in sync with the current state? Feel free to submit it to the extras repo if you want

trufae avatar May 09 '24 00:05 trufae

Sure. But I need to improve this plugin, so that it stores each of the rename as well as support quoted arguments.

satk0 avatar May 16 '24 20:05 satk0

I submitted the plugin to the extras repo, but I don't know how can I publish my plugin to have this ticket in sync.

satk0 avatar May 19 '24 18:05 satk0

Closing this ticket as long as its now implemented in a plugin from extras. we may want to merge it back if its really used after refactoring all the asmparse apis. thanks!

trufae avatar Sep 06 '24 18:09 trufae