| 1 |
/* Target description definitions for remote server for GDB. |
| 2 |
Copyright (C) 2012-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GDB. |
| 5 |
|
| 6 |
This program is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3 of the License, or |
| 9 |
(at your option) any later version. |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 |
|
| 19 |
#ifndef GDBSERVER_TDESC_H |
| 20 |
#define GDBSERVER_TDESC_H |
| 21 |
|
| 22 |
#include "gdbsupport/tdesc.h" |
| 23 |
#include "gdbsupport/osabi.h" |
| 24 |
|
| 25 |
#include "regdef.h" |
| 26 |
#include <vector> |
| 27 |
|
| 28 |
/* A target description. Inherit from tdesc_feature so that target_desc |
| 29 |
can be used as tdesc_feature. */ |
| 30 |
|
| 31 |
struct target_desc final : tdesc_element |
| 32 |
{ |
| 33 |
/* A vector of elements of register definitions that |
| 34 |
describe the inferior's register set. */ |
| 35 |
std::vector<struct gdb::reg> reg_defs; |
| 36 |
|
| 37 |
/* The register cache size, in bytes. */ |
| 38 |
int registers_size; |
| 39 |
|
| 40 |
/* XML features in this target description. */ |
| 41 |
std::vector<tdesc_feature_up> features; |
| 42 |
|
| 43 |
#ifndef IN_PROCESS_AGENT |
| 44 |
/* A vector of register names. These are the "expedite" registers: |
| 45 |
registers whose values are sent along with stop replies. */ |
| 46 |
std::vector<std::string> expedite_regs; |
| 47 |
|
| 48 |
/* Defines what to return when looking for the "target.xml" file in |
| 49 |
response to qXfer:features:read. Its contents can either be |
| 50 |
verbatim XML code (prefixed with a '@') or else the name of the |
| 51 |
actual XML file to be used in place of "target.xml". |
| 52 |
|
| 53 |
If NULL then its content will be generated by parsing the target |
| 54 |
description into xml. */ |
| 55 |
mutable const char *xmltarget = NULL; |
| 56 |
|
| 57 |
/* The value of <architecture> element in the XML, replying GDB. */ |
| 58 |
gdb::unique_xmalloc_ptr<char> arch; |
| 59 |
|
| 60 |
/* The value of <osabi> element in the XML, replying GDB. */ |
| 61 |
gdb::unique_xmalloc_ptr<char> osabi; |
| 62 |
|
| 63 |
public: |
| 64 |
target_desc () |
| 65 |
: registers_size (0) |
| 66 |
{} |
| 67 |
|
| 68 |
bool operator== (const target_desc &other) const; |
| 69 |
|
| 70 |
bool operator!= (const target_desc &other) const |
| 71 |
{ |
| 72 |
return !(*this == other); |
| 73 |
} |
| 74 |
#endif |
| 75 |
|
| 76 |
void accept (tdesc_element_visitor &v) const override; |
| 77 |
}; |
| 78 |
|
| 79 |
/* Copy target description SRC to DEST. */ |
| 80 |
|
| 81 |
void copy_target_description (struct target_desc *dest, |
| 82 |
const struct target_desc *src); |
| 83 |
|
| 84 |
/* Initialize TDESC, and then set its expedite_regs field to |
| 85 |
EXPEDITE_REGS and its osabi to OSABI. */ |
| 86 |
|
| 87 |
void init_target_desc (struct target_desc *tdesc, |
| 88 |
const char **expedite_regs, |
| 89 |
enum gdb_osabi osabi); |
| 90 |
|
| 91 |
/* Return the current inferior's target description. Never returns |
| 92 |
NULL. */ |
| 93 |
|
| 94 |
const struct target_desc *current_target_desc (void); |
| 95 |
|
| 96 |
/* Return true if TDESC contains the feature described by string FEATURE. |
| 97 |
Return false otherwise. */ |
| 98 |
bool tdesc_contains_feature (const target_desc *tdesc, |
| 99 |
const std::string &feature); |
| 100 |
|
| 101 |
#endif /* GDBSERVER_TDESC_H */ |