Enum Data Type Editor

An Enumeration data type ("Enum") is a C-style data type that allows the substitution of a value for a more meaningful name. Ghidra provides a special editor for Enum data types.

Create an Enum data type using the Data Type Manager display. The editor for an Enum is shown below.

Enum Editor Fields

When you make any change to the enum, the (Apply) button is enabled.

Edit an Enum Entry

To edit an entry in the enum table, select an entry; double click in the field that you want to change, OR press F2. A cell editor is displayed; enter the value (press the <Enter> key).

While editing, you can use the Tab key to navigate the editing to the next cell, the Shift-Tab key to navigate backwards, the Up key to move editing to the cell above, and the Down to move editing to the cell below the currently edited cell.

Names and values must be unique.

Add an Enum Entry

Create an new enum entry by selecting the (Add) button on the editor's tool bar. An entry with default values is added to the table; the default name is "New Name;" the default value is the next highest value. Double click on the fields to change the entries.

Delete an Enum Entry

To delete enum entries, select the entries that you want to remove. Right mouse-click and choose the Delete option, OR select the button on the editor's tool bar.

Apply Changes

When you have completed making changes, select the button on the editor's tool bar. If you have changed the name of the enum, the Data Type Manager display is updated to reflect the new name in the tree.

Show In Data Type Manager

Select the icon in the toolbar to have the editor's data type be highlighted in the Data Type Manager's tree.

Change the Sort Order

As with most tables in Ghidra, you can change the sort order of a column by clicking on the column header. The icons on the header indicates the sort order, ascending ( ), or descending ( ). You can also rearrange the columns in the table by clicking on the column header and dragging it to the new position. Changing the sort order has no effect on the enum.

Provided By: Data Type Manager Plugin

Related Topics: