diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-11 22:36:29 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-23 22:17:19 +0100 |
commit | fbf42f4e6d04745fe615dce1abd0190b78e368a6 (patch) | |
tree | 5a2ea61b2d64947bc402ffa9609995603a46e096 /gdbserver | |
parent | 20821f4ed1c3b93344a8a40e9344fe356c2605c2 (diff) | |
download | gdb-fbf42f4e6d04745fe615dce1abd0190b78e368a6.zip gdb-fbf42f4e6d04745fe615dce1abd0190b78e368a6.tar.gz gdb-fbf42f4e6d04745fe615dce1abd0190b78e368a6.tar.bz2 |
gdb: Print compatible information within print_xml_feature
The gdbsupport directory contains a helper class print_xml_feature
that is shared between gdb and gdbserver. This class is used for
printing an XML representation of a target_desc object.
Currently this class doesn't have the ability to print the
<compatible> entities that can appear within a target description, I
guess no targets have needed that functionality yet.
The print_xml_feature classes API is based around operating on the
target_desc class, however, the sharing between gdb and gdbserver is
purely textural, we rely on their being a class called target_desc in
both gdb and gdbserver, but there is no shared implementation. We
then have a set of functions declared that operate on an object of
type target_desc, and again these functions have completely separate
implementations.
Currently then the gdb version of target_desc contains a vector of
bfd_arch_info pointers which represents the compatible entries from a
target description. The gdbserver version of target_desc has no such
information. Further, the gdbserver code doesn't seem to include the
bfd headers, and so doesn't know about the bfd types.
I was reluctant to include the bfd headers into gdbserver just so I
can reference the compatible information, which isn't (currently) even
needed in gdbserver.
So, the approach I take in this patch is to wrap the compatible
information into a new helper class. This class is declared in the
gdbsupport library, but implemented separately in both gdb and
gdbserver.
In gdbserver the class is empty. The compatible information within
the gdbserver is an empty list, of empty classes.
In gdb the class contains a pointer to the bfd_arch_info object.
With this in place we can now add support to print_xml_feature for
printing the compatible information if it is present. In the
gdbserver code this will never happen, as the gdbserver never has any
compatible information. But in gdb, this code will trigger when
appropriate.
gdb/ChangeLog:
* target-descriptions.c (class tdesc_compatible_info): New class.
(struct target_desc): Change type of compatible vector.
(tdesc_compatible_p): Update for change in type of
target_desc::compatible.
(tdesc_compatible_info_list): New function.
(tdesc_compatible_info_arch_name): New function.
(tdesc_add_compatible): Update for change in type of
target_desc::compatible.
(print_c_tdesc::visit_pre): Likewise.
gdbserver/ChangeLog:
* tdesc.cc (struct tdesc_compatible_info): New struct.
(tdesc_compatible_info_list): New function.
(tdesc_compatible_info_arch_name): New function.
gdbsupport/ChangeLog:
* tdesc.cc (print_xml_feature::visit_pre): Print compatible
information.
* tdesc.h (struct tdesc_compatible_info): Declare new struct.
(tdesc_compatible_info_up): New typedef.
(tdesc_compatible_info_list): Declare new function.
(tdesc_compatible_info_arch_name): Declare new function.
Diffstat (limited to 'gdbserver')
-rw-r--r-- | gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdbserver/tdesc.cc | 21 |
2 files changed, 27 insertions, 0 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index c5c3b09..43b8bc8 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com> + + * tdesc.cc (struct tdesc_compatible_info): New struct. + (tdesc_compatible_info_list): New function. + (tdesc_compatible_info_arch_name): New function. + 2020-06-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Use std::list to stop pending signal instead of manually-created diff --git a/gdbserver/tdesc.cc b/gdbserver/tdesc.cc index 8d97def..d21688b 100644 --- a/gdbserver/tdesc.cc +++ b/gdbserver/tdesc.cc @@ -122,6 +122,27 @@ current_target_desc (void) return current_process ()->tdesc; } +/* An empty structure. */ + +struct tdesc_compatible_info { }; + +/* See gdbsupport/tdesc.h. */ + +const std::vector<tdesc_compatible_info_up> & +tdesc_compatible_info_list (const target_desc *target_desc) +{ + static std::vector<tdesc_compatible_info_up> empty; + return empty; +} + +/* See gdbsupport/tdesc.h. */ + +const char * +tdesc_compatible_info_arch_name (const tdesc_compatible_info_up &c_info) +{ + return nullptr; +} + /* See gdbsupport/tdesc.h. */ const char * |