xref: /netbsd-src/external/gpl3/gdb/dist/gdbserver/tdesc.h (revision 64f917f5a88990e32dd65fcd4348042fa7f852b9)
18dffb485Schristos /* Target description definitions for remote server for GDB.
2*64f917f5Schristos    Copyright (C) 2012-2024 Free Software Foundation, Inc.
38dffb485Schristos 
48dffb485Schristos    This file is part of GDB.
58dffb485Schristos 
68dffb485Schristos    This program is free software; you can redistribute it and/or modify
78dffb485Schristos    it under the terms of the GNU General Public License as published by
88dffb485Schristos    the Free Software Foundation; either version 3 of the License, or
98dffb485Schristos    (at your option) any later version.
108dffb485Schristos 
118dffb485Schristos    This program is distributed in the hope that it will be useful,
128dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
138dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
148dffb485Schristos    GNU General Public License for more details.
158dffb485Schristos 
168dffb485Schristos    You should have received a copy of the GNU General Public License
178dffb485Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
188dffb485Schristos 
198dffb485Schristos #ifndef GDBSERVER_TDESC_H
208dffb485Schristos #define GDBSERVER_TDESC_H
218dffb485Schristos 
228dffb485Schristos #include "gdbsupport/tdesc.h"
238dffb485Schristos 
248dffb485Schristos #include "regdef.h"
258dffb485Schristos #include <vector>
268dffb485Schristos 
278dffb485Schristos /* A target description.  Inherit from tdesc_feature so that target_desc
288dffb485Schristos    can be used as tdesc_feature.  */
298dffb485Schristos 
308dffb485Schristos struct target_desc final : tdesc_element
318dffb485Schristos {
328dffb485Schristos   /* A vector of elements of register definitions that
338dffb485Schristos      describe the inferior's register set.  */
348dffb485Schristos   std::vector<struct gdb::reg> reg_defs;
358dffb485Schristos 
368dffb485Schristos   /* The register cache size, in bytes.  */
378dffb485Schristos   int registers_size;
388dffb485Schristos 
398dffb485Schristos   /* XML features in this target description.  */
408dffb485Schristos   std::vector<tdesc_feature_up> features;
418dffb485Schristos 
428dffb485Schristos #ifndef IN_PROCESS_AGENT
43*64f917f5Schristos   /* A vector of register names.  These are the "expedite" registers:
448dffb485Schristos      registers whose values are sent along with stop replies.  */
45*64f917f5Schristos   std::vector<std::string> expedite_regs;
468dffb485Schristos 
478dffb485Schristos   /* Defines what to return when looking for the "target.xml" file in
488dffb485Schristos      response to qXfer:features:read.  Its contents can either be
498dffb485Schristos      verbatim XML code (prefixed with a '@') or else the name of the
508dffb485Schristos      actual XML file to be used in place of "target.xml".
518dffb485Schristos 
528dffb485Schristos      If NULL then its content will be generated by parsing the target
538dffb485Schristos      description into xml.  */
548dffb485Schristos   mutable const char *xmltarget = NULL;
558dffb485Schristos 
568dffb485Schristos   /* The value of <architecture> element in the XML, replying GDB.  */
578dffb485Schristos   const char *arch = NULL;
588dffb485Schristos 
598dffb485Schristos   /* The value of <osabi> element in the XML, replying GDB.  */
608dffb485Schristos   const char *osabi = NULL;
618dffb485Schristos 
628dffb485Schristos public:
638dffb485Schristos   target_desc ()
648dffb485Schristos     : registers_size (0)
658dffb485Schristos   {}
668dffb485Schristos 
678dffb485Schristos   ~target_desc ();
688dffb485Schristos 
698dffb485Schristos   bool operator== (const target_desc &other) const;
708dffb485Schristos 
718dffb485Schristos   bool operator!= (const target_desc &other) const
728dffb485Schristos   {
738dffb485Schristos     return !(*this == other);
748dffb485Schristos   }
758dffb485Schristos #endif
768dffb485Schristos 
778dffb485Schristos   void accept (tdesc_element_visitor &v) const override;
788dffb485Schristos };
798dffb485Schristos 
808dffb485Schristos /* Copy target description SRC to DEST.  */
818dffb485Schristos 
828dffb485Schristos void copy_target_description (struct target_desc *dest,
838dffb485Schristos 			      const struct target_desc *src);
848dffb485Schristos 
858dffb485Schristos /* Initialize TDESC, and then set its expedite_regs field to
868dffb485Schristos    EXPEDITE_REGS.  */
878dffb485Schristos 
888dffb485Schristos void init_target_desc (struct target_desc *tdesc,
898dffb485Schristos 		       const char **expedite_regs);
908dffb485Schristos 
918dffb485Schristos /* Return the current inferior's target description.  Never returns
928dffb485Schristos    NULL.  */
938dffb485Schristos 
948dffb485Schristos const struct target_desc *current_target_desc (void);
958dffb485Schristos 
968dffb485Schristos /* Return true if TDESC contains the feature described by string FEATURE.
978dffb485Schristos    Return false otherwise.  */
988dffb485Schristos bool tdesc_contains_feature (const target_desc *tdesc,
998dffb485Schristos 			     const std::string &feature);
1008dffb485Schristos 
1018dffb485Schristos #endif /* GDBSERVER_TDESC_H */
102