[binutils-gdb] gdbsupport/tdesc: print enum size attribute
Andrew Burgess
aburgess@sourceware.org
Tue Dec 1 11:24:30 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4f36e61b2dee8de793b09670378229dfe2750803
commit 4f36e61b2dee8de793b09670378229dfe2750803
Author: Chungyi Chi <demonic@csie.io>
Date: Tue Dec 1 11:06:08 2020 +0000
gdbsupport/tdesc: print enum size attribute
According to gdb online docs[1], XML target description enum types
have both name and size attributes. Currently GDB does not print the
size attribute. This commit fixes this. This change will be visible
in the output of the command `maint print xml-tdesc`.
There are other bugs with the print of enum types in XML target
descriptions, the next commit will fix these and include a test that
covers this patch.
[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Enum-Target-Types.html#Enum-Target-Types
gdbsupport/ChangeLog:
* tdesc.cc (print_xml_feature::visit): Print enum size attribute.
Diff:
---
gdbsupport/ChangeLog | 4 ++++
gdbsupport/tdesc.cc | 2 ++
2 files changed, 6 insertions(+)
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index d1e46a3dca8..a77f1c9fd86 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -1,3 +1,7 @@
+2020-12-01 Chungyi Chi <demonic@csie.io>
+
+ * tdesc.cc (print_xml_feature::visit): Print enum size attribute.
+
2020-11-20 Tom Tromey <tromey@adacore.com>
* thread-pool.cc (thread_pool::set_thread_count): Ignore system
diff --git a/gdbsupport/tdesc.cc b/gdbsupport/tdesc.cc
index c2a3af700e3..2bc0247907d 100644
--- a/gdbsupport/tdesc.cc
+++ b/gdbsupport/tdesc.cc
@@ -351,6 +351,8 @@ void print_xml_feature::visit (const tdesc_type_with_fields *t)
break;
case TDESC_TYPE_ENUM:
+ if (t->size > 0)
+ string_appendf (tmp, " size=\"%d\"", t->size);
string_appendf (tmp, ">");
add_line (tmp);
for (const tdesc_type_field &f : t->fields)
More information about the Gdb-cvs
mailing list