Ghidra: Use different names for a variable

Created on 4 Sep 2019  Â·  7Comments  Â·  Source: NationalSecurityAgency/ghidra

Is there some way to separate out uses of a variable and give them separate names.

i.e. sometimes a particular stack location or register is reused for a different purpose. It would be valuable to give this information to the decompiler so that it can treat it as a separate variable.

Question

Most helpful comment

I believe this should be labelled as a feature request.

All 7 comments

It is surely something to be wanted.

@emteere is there a recommended workflow to deal with this problem?

I believe this should be labelled as a feature request.

For registers you can do it:

  1. Right click in the Decompiler → _Commit Locals_.
  2. Right click on the variable → _Split out as New Variable_.

4,883.64

For registers you can do it:

1. Right click in the Decompiler → _Commit Locals_.

2. Right click on the variable → _Split out as New Variable_.

I don't see this option in either the decompiler or the listing.

  • OS: Windows 10
  • Java Version: 11.0.6
  • Ghidra Version: 9.1.2

The code is here, but I also have not been able to find this item in the right-click menu.

Looking over the code, it seems that this only applies to locals that are declared within the function in the assembly listing. Even then, the varnode associated with the variable must have a "HighVariable" whatever that is.
There is no support for reusing parameters, renamed registers or other parameters that don't have whatever "HighVariable" is.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loudinthecloud picture loudinthecloud  Â·  3Comments

rrivera1849 picture rrivera1849  Â·  3Comments

Merculous picture Merculous  Â·  3Comments

0x6d696368 picture 0x6d696368  Â·  3Comments

marcushall42 picture marcushall42  Â·  3Comments