TransWikia.com

Ghidra rename variable below current line

Reverse Engineering Asked by genghiskhan on March 30, 2021

I have been starting to use Ghidra and I find the decompiler view very useful. However, when I rename a variable, the name propagates through all uses of that register or stack pointer throughout the function. In most cases this is good, however often when the variable is stored in a register, the same register will be used to store a different variable later in the function.

My question is: Is there a way to only rename a variable in a function below the current line? This way, later uses of said register will have the correct variable name.

One Answer

As of 2020.11.13 the 9.2 release is available which includes this feature.

For registers you can do it:

Right click in the Decompiler → Commit Locals.
Right click on the variable → Split out as New Variable.

as per https://github.com/NationalSecurityAgency/ghidra/issues/975#issuecomment-593425470 in the issue that Jeff Muizelaar mentioned.

According to https://github.com/NationalSecurityAgency/ghidra/issues/1510#issuecomment-582052718 this only really works well for registers currently, but should also work for Stack variables.

Answered by Florian Magin on March 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP