ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

Support "Apply Enum" on constants in decompiler view

Open huettenhain opened this issue 5 years ago • 2 comments

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.

huettenhain avatar Apr 24 '19 16:04 huettenhain

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.

comex avatar May 06 '19 01:05 comex

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)!

Nemoumbra avatar Jan 24 '24 12:01 Nemoumbra