diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-12-01 11:07:12 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-12-01 11:22:24 +0000 |
commit | 54e75f291ef10f2ccb0549b25e0d9d207b325c79 (patch) | |
tree | b57a8e8bc2fc5adaccaf191fc470d7c3a0ac0bdf /gdbsupport | |
parent | 4f36e61b2dee8de793b09670378229dfe2750803 (diff) | |
download | gdb-54e75f291ef10f2ccb0549b25e0d9d207b325c79.zip gdb-54e75f291ef10f2ccb0549b25e0d9d207b325c79.tar.gz gdb-54e75f291ef10f2ccb0549b25e0d9d207b325c79.tar.bz2 |
gdbsupport/tdesc: print enum fields using 'evalue' syntax
Currently when printing an XML description GDB prints enum values like
this:
<enum id="levels_type" size="4">
<field name="low" start="0"/>
<field name="high" start="1"/>
</enum>
This is incorrect, and is most likely a copy and paste error with the
struct and flags printing code. The correct syntax is:
<enum id="levels_type" size="4">
<evalue name="low" value="0"/>
<evalue name="high" value="1"/>
</enum>
A test is included to cover this functionality.
gdb/testsuite/ChangeLog:
* gdb.xml/maint-xml-dump-03.xml: New file.
gdbsupport/ChangeLog:
* tdesc.cc (print_xml_feature::visit): Print enum fields using
'evalue' syntax.
Diffstat (limited to 'gdbsupport')
-rw-r--r-- | gdbsupport/ChangeLog | 5 | ||||
-rw-r--r-- | gdbsupport/tdesc.cc | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog index a77f1c9..88a0413 100644 --- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,8 @@ +2020-12-01 Andrew Burgess <andrew.burgess@embecosm.com> + + * tdesc.cc (print_xml_feature::visit): Print enum fields using + 'evalue' syntax. + 2020-12-01 Chungyi Chi <demonic@csie.io> * tdesc.cc (print_xml_feature::visit): Print enum size attribute. diff --git a/gdbsupport/tdesc.cc b/gdbsupport/tdesc.cc index 2bc0247..c062a77 100644 --- a/gdbsupport/tdesc.cc +++ b/gdbsupport/tdesc.cc @@ -355,8 +355,10 @@ void print_xml_feature::visit (const tdesc_type_with_fields *t) string_appendf (tmp, " size=\"%d\"", t->size); string_appendf (tmp, ">"); add_line (tmp); + /* The 'start' of the field is reused as the enum value. The 'end' + of the field is always set to -1 for enum values. */ for (const tdesc_type_field &f : t->fields) - add_line (" <field name=\"%s\" start=\"%d\"/>", + add_line (" <evalue name=\"%s\" value=\"%d\"/>", f.name.c_str (), f.start); break; |