ghidra
ghidra copied to clipboard
Support "Apply Enum" on constants in decompiler view
I often want to use the "Apply Enum" operation on a constant, especially for integer flags that are passed to functions. Currently, I have to find the corresponding constant in the disassembly and use the "Apply Enum" operation there; the change then propagates to the decompiler view.
I am suggesting to make this feature available for constants in the decompiler view directly.
PS: Along the same lines, it would be beneficial to be able to set and rename equates for constants in the decompiler window.
More generally, supporting "Retype Constant" would also help when the decompiler incorrectly displays addresses as integers.
RetypeVariableAction actually has commented out code that would add such an operation:
// getPopupMenuData().setMenuItemName("Retype Constant");
// return true;
But uncommenting it and trying to use it just leads to the error "Database support not provided for HighConstant" from HighFunctionDBUtil.java
.
Have there been any advancements regarding this issue? I have ran into a case where the value 0x80020323
was passed to a function. Unfortunately, it's not a define, but a enum => "Set equate" doesn't work.
At the same time I can't do anything from the Listing view because the constant is constructed by 2 instructions (hello 32bit world)!