Enum Target Types (Debugging with GDB)

From Get docs

G.4 Enum Target Types

Enum target types are useful in ‘struct’ and ‘flags’ register descriptions. See Target Description Format.

Enum types have a name, size and a list of name/value pairs.

<enum id="id" size="size">
  <evalue name="name" value="value"/>

Enums must be defined before they are used.

<enum id="levels_type" size="4">
  <evalue name="low" value="0"/>
  <evalue name="high" value="1"/>
<flags id="flags_type" size="4">
  <field name="X" start="0"/>
  <field name="LEVEL" start="1" end="1" type="levels_type"/>
<reg name="flags" bitsize="32" type="flags_type"/>

Given that description, a value of 3 for the ‘flags’ register would be printed as:

(gdb) info register flags
flags 0x3 [ X LEVEL=high ]