Igor’s tip of the week #24: Renaming registers
While register highlighting can help tracking how a register is used in the code, sometimes it’s not quite sufficient, especially if multiple registers are used by a complicated piece of code. In such situation you can try register renaming.
To rename a register:
- place the cursor on it and press N or Enter, or
- double-click it
A dialog appears where you can specify:
- new name to be used in the disassembly;
- comment to be shown at the place of the new name’s definition;
- range of addresses where to use the name.
The address range defaults to the current function boundaries but you can either edit them manually or select a range before renaming (this can be tricky since the cursor needs to be on the register). The new range cannot cross function boundaries (registers can be renamed only inside a function). The new name and the comment are printed at the start of the specified range.
Even if you don’t rename registers yourself, you may encounter them in your databases. For example, the DWARF plugin can use the information available in the DWARF debug info to rename and comment registers used for storing local variables or function arguments.
To undo renaming and revert back to the canonical register name, rename it to an empty string.
See also: Rename register in the IDA Help.