mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
268a13a5a3
This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
402 lines
11 KiB
C
402 lines
11 KiB
C
/* Target description support for GDB.
|
|
|
|
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include "common-defs.h"
|
|
#include "gdbsupport/tdesc.h"
|
|
|
|
tdesc_reg::tdesc_reg (struct tdesc_feature *feature, const std::string &name_,
|
|
int regnum, int save_restore_, const char *group_,
|
|
int bitsize_, const char *type_)
|
|
: name (name_), target_regnum (regnum),
|
|
save_restore (save_restore_),
|
|
group (group_ != NULL ? group_ : ""),
|
|
bitsize (bitsize_),
|
|
type (type_ != NULL ? type_ : "<unknown>")
|
|
{
|
|
/* If the register's type is target-defined, look it up now. We may not
|
|
have easy access to the containing feature when we want it later. */
|
|
tdesc_type = tdesc_named_type (feature, type.c_str ());
|
|
}
|
|
|
|
/* Predefined types. */
|
|
static tdesc_type_builtin tdesc_predefined_types[] =
|
|
{
|
|
{ "bool", TDESC_TYPE_BOOL },
|
|
{ "int8", TDESC_TYPE_INT8 },
|
|
{ "int16", TDESC_TYPE_INT16 },
|
|
{ "int32", TDESC_TYPE_INT32 },
|
|
{ "int64", TDESC_TYPE_INT64 },
|
|
{ "int128", TDESC_TYPE_INT128 },
|
|
{ "uint8", TDESC_TYPE_UINT8 },
|
|
{ "uint16", TDESC_TYPE_UINT16 },
|
|
{ "uint32", TDESC_TYPE_UINT32 },
|
|
{ "uint64", TDESC_TYPE_UINT64 },
|
|
{ "uint128", TDESC_TYPE_UINT128 },
|
|
{ "code_ptr", TDESC_TYPE_CODE_PTR },
|
|
{ "data_ptr", TDESC_TYPE_DATA_PTR },
|
|
{ "ieee_half", TDESC_TYPE_IEEE_HALF },
|
|
{ "ieee_single", TDESC_TYPE_IEEE_SINGLE },
|
|
{ "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
|
|
{ "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
|
|
{ "i387_ext", TDESC_TYPE_I387_EXT }
|
|
};
|
|
|
|
void tdesc_feature::accept (tdesc_element_visitor &v) const
|
|
{
|
|
v.visit_pre (this);
|
|
|
|
for (const tdesc_type_up &type : types)
|
|
type->accept (v);
|
|
|
|
for (const tdesc_reg_up ® : registers)
|
|
reg->accept (v);
|
|
|
|
v.visit_post (this);
|
|
}
|
|
|
|
bool tdesc_feature::operator== (const tdesc_feature &other) const
|
|
{
|
|
if (name != other.name)
|
|
return false;
|
|
|
|
if (registers.size () != other.registers.size ())
|
|
return false;
|
|
|
|
for (int ix = 0; ix < registers.size (); ix++)
|
|
{
|
|
const tdesc_reg_up ®1 = registers[ix];
|
|
const tdesc_reg_up ®2 = other.registers[ix];
|
|
|
|
if (reg1 != reg2 && *reg1 != *reg2)
|
|
return false;
|
|
}
|
|
|
|
if (types.size () != other.types.size ())
|
|
return false;
|
|
|
|
for (int ix = 0; ix < types.size (); ix++)
|
|
{
|
|
const tdesc_type_up &type1 = types[ix];
|
|
const tdesc_type_up &type2 = other.types[ix];
|
|
|
|
if (type1 != type2 && *type1 != *type2)
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/* Lookup a predefined type. */
|
|
|
|
static struct tdesc_type *
|
|
tdesc_predefined_type (enum tdesc_type_kind kind)
|
|
{
|
|
for (int ix = 0; ix < ARRAY_SIZE (tdesc_predefined_types); ix++)
|
|
if (tdesc_predefined_types[ix].kind == kind)
|
|
return &tdesc_predefined_types[ix];
|
|
|
|
gdb_assert_not_reached ("bad predefined tdesc type");
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
struct tdesc_type *
|
|
tdesc_named_type (const struct tdesc_feature *feature, const char *id)
|
|
{
|
|
/* First try target-defined types. */
|
|
for (const tdesc_type_up &type : feature->types)
|
|
if (type->name == id)
|
|
return type.get ();
|
|
|
|
/* Next try the predefined types. */
|
|
for (int ix = 0; ix < ARRAY_SIZE (tdesc_predefined_types); ix++)
|
|
if (tdesc_predefined_types[ix].name == id)
|
|
return &tdesc_predefined_types[ix];
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
void
|
|
tdesc_create_reg (struct tdesc_feature *feature, const char *name,
|
|
int regnum, int save_restore, const char *group,
|
|
int bitsize, const char *type)
|
|
{
|
|
tdesc_reg *reg = new tdesc_reg (feature, name, regnum, save_restore,
|
|
group, bitsize, type);
|
|
|
|
feature->registers.emplace_back (reg);
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
struct tdesc_type *
|
|
tdesc_create_vector (struct tdesc_feature *feature, const char *name,
|
|
struct tdesc_type *field_type, int count)
|
|
{
|
|
tdesc_type_vector *type = new tdesc_type_vector (name, field_type, count);
|
|
feature->types.emplace_back (type);
|
|
|
|
return type;
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
tdesc_type_with_fields *
|
|
tdesc_create_struct (struct tdesc_feature *feature, const char *name)
|
|
{
|
|
tdesc_type_with_fields *type
|
|
= new tdesc_type_with_fields (name, TDESC_TYPE_STRUCT);
|
|
feature->types.emplace_back (type);
|
|
|
|
return type;
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
void
|
|
tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
|
|
{
|
|
gdb_assert (type->kind == TDESC_TYPE_STRUCT);
|
|
gdb_assert (size > 0);
|
|
type->size = size;
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
tdesc_type_with_fields *
|
|
tdesc_create_union (struct tdesc_feature *feature, const char *name)
|
|
{
|
|
tdesc_type_with_fields *type
|
|
= new tdesc_type_with_fields (name, TDESC_TYPE_UNION);
|
|
feature->types.emplace_back (type);
|
|
|
|
return type;
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
tdesc_type_with_fields *
|
|
tdesc_create_flags (struct tdesc_feature *feature, const char *name,
|
|
int size)
|
|
{
|
|
gdb_assert (size > 0);
|
|
|
|
tdesc_type_with_fields *type
|
|
= new tdesc_type_with_fields (name, TDESC_TYPE_FLAGS, size);
|
|
feature->types.emplace_back (type);
|
|
|
|
return type;
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
tdesc_type_with_fields *
|
|
tdesc_create_enum (struct tdesc_feature *feature, const char *name,
|
|
int size)
|
|
{
|
|
gdb_assert (size > 0);
|
|
|
|
tdesc_type_with_fields *type
|
|
= new tdesc_type_with_fields (name, TDESC_TYPE_ENUM, size);
|
|
feature->types.emplace_back (type);
|
|
|
|
return type;
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
void
|
|
tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
|
|
struct tdesc_type *field_type)
|
|
{
|
|
gdb_assert (type->kind == TDESC_TYPE_UNION
|
|
|| type->kind == TDESC_TYPE_STRUCT);
|
|
|
|
/* Initialize start and end so we know this is not a bit-field
|
|
when we print-c-tdesc. */
|
|
type->fields.emplace_back (field_name, field_type, -1, -1);
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
void
|
|
tdesc_add_typed_bitfield (tdesc_type_with_fields *type, const char *field_name,
|
|
int start, int end, struct tdesc_type *field_type)
|
|
{
|
|
gdb_assert (type->kind == TDESC_TYPE_STRUCT
|
|
|| type->kind == TDESC_TYPE_FLAGS);
|
|
gdb_assert (start >= 0 && end >= start);
|
|
|
|
type->fields.emplace_back (field_name, field_type, start, end);
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
void
|
|
tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
|
|
int start, int end)
|
|
{
|
|
struct tdesc_type *field_type;
|
|
|
|
gdb_assert (start >= 0 && end >= start);
|
|
|
|
if (type->size > 4)
|
|
field_type = tdesc_predefined_type (TDESC_TYPE_UINT64);
|
|
else
|
|
field_type = tdesc_predefined_type (TDESC_TYPE_UINT32);
|
|
|
|
tdesc_add_typed_bitfield (type, field_name, start, end, field_type);
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
void
|
|
tdesc_add_flag (tdesc_type_with_fields *type, int start,
|
|
const char *flag_name)
|
|
{
|
|
gdb_assert (type->kind == TDESC_TYPE_FLAGS
|
|
|| type->kind == TDESC_TYPE_STRUCT);
|
|
|
|
type->fields.emplace_back (flag_name,
|
|
tdesc_predefined_type (TDESC_TYPE_BOOL),
|
|
start, start);
|
|
}
|
|
|
|
/* See gdbsupport/tdesc.h. */
|
|
|
|
void
|
|
tdesc_add_enum_value (tdesc_type_with_fields *type, int value,
|
|
const char *name)
|
|
{
|
|
gdb_assert (type->kind == TDESC_TYPE_ENUM);
|
|
type->fields.emplace_back (name,
|
|
tdesc_predefined_type (TDESC_TYPE_INT32),
|
|
value, -1);
|
|
}
|
|
|
|
void print_xml_feature::visit_pre (const tdesc_feature *e)
|
|
{
|
|
string_appendf (*m_buffer, "<feature name=\"%s\">\n", e->name.c_str ());
|
|
}
|
|
|
|
void print_xml_feature::visit_post (const tdesc_feature *e)
|
|
{
|
|
string_appendf (*m_buffer, "</feature>\n");
|
|
}
|
|
|
|
void print_xml_feature::visit (const tdesc_type_builtin *t)
|
|
{
|
|
error (_("xml output is not supported for type \"%s\"."), t->name.c_str ());
|
|
}
|
|
|
|
void print_xml_feature::visit (const tdesc_type_vector *t)
|
|
{
|
|
string_appendf (*m_buffer, "<vector id=\"%s\" type=\"%s\" count=\"%d\"/>\n",
|
|
t->name.c_str (), t->element_type->name.c_str (), t->count);
|
|
}
|
|
|
|
void print_xml_feature::visit (const tdesc_type_with_fields *t)
|
|
{
|
|
const static char *types[] = { "struct", "union", "flags", "enum" };
|
|
|
|
gdb_assert (t->kind >= TDESC_TYPE_STRUCT && t->kind <= TDESC_TYPE_ENUM);
|
|
|
|
string_appendf (*m_buffer,
|
|
"<%s id=\"%s\"", types[t->kind - TDESC_TYPE_STRUCT],
|
|
t->name.c_str ());
|
|
|
|
switch (t->kind)
|
|
{
|
|
case TDESC_TYPE_STRUCT:
|
|
case TDESC_TYPE_FLAGS:
|
|
if (t->size > 0)
|
|
string_appendf (*m_buffer, " size=\"%d\"", t->size);
|
|
string_appendf (*m_buffer, ">\n");
|
|
|
|
for (const tdesc_type_field &f : t->fields)
|
|
{
|
|
string_appendf (*m_buffer, " <field name=\"%s\" ", f.name.c_str ());
|
|
if (f.start == -1)
|
|
string_appendf (*m_buffer, "type=\"%s\"/>\n",
|
|
f.type->name.c_str ());
|
|
else
|
|
string_appendf (*m_buffer, "start=\"%d\" end=\"%d\"/>\n", f.start,
|
|
f.end);
|
|
}
|
|
break;
|
|
|
|
case TDESC_TYPE_ENUM:
|
|
string_appendf (*m_buffer, ">\n");
|
|
for (const tdesc_type_field &f : t->fields)
|
|
string_appendf (*m_buffer, " <field name=\"%s\" start=\"%d\"/>\n",
|
|
f.name.c_str (), f.start);
|
|
break;
|
|
|
|
case TDESC_TYPE_UNION:
|
|
string_appendf (*m_buffer, ">\n");
|
|
for (const tdesc_type_field &f : t->fields)
|
|
string_appendf (*m_buffer, " <field name=\"%s\" type=\"%s\"/>\n",
|
|
f.name.c_str (), f.type->name.c_str ());
|
|
break;
|
|
|
|
default:
|
|
error (_("xml output is not supported for type \"%s\"."),
|
|
t->name.c_str ());
|
|
}
|
|
|
|
string_appendf (*m_buffer, "</%s>\n", types[t->kind - TDESC_TYPE_STRUCT]);
|
|
}
|
|
|
|
void print_xml_feature::visit (const tdesc_reg *r)
|
|
{
|
|
string_appendf (*m_buffer,
|
|
"<reg name=\"%s\" bitsize=\"%d\" type=\"%s\" regnum=\"%ld\"",
|
|
r->name.c_str (), r->bitsize, r->type.c_str (),
|
|
r->target_regnum);
|
|
|
|
if (r->group.length () > 0)
|
|
string_appendf (*m_buffer, " group=\"%s\"", r->group.c_str ());
|
|
|
|
if (r->save_restore == 0)
|
|
string_appendf (*m_buffer, " save-restore=\"no\"");
|
|
|
|
string_appendf (*m_buffer, "/>\n");
|
|
}
|
|
|
|
void print_xml_feature::visit_pre (const target_desc *e)
|
|
{
|
|
#ifndef IN_PROCESS_AGENT
|
|
string_appendf (*m_buffer, "<?xml version=\"1.0\"?>\n");
|
|
string_appendf (*m_buffer, "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">\n");
|
|
string_appendf (*m_buffer, "<target>\n<architecture>%s</architecture>\n",
|
|
tdesc_architecture_name (e));
|
|
|
|
const char *osabi = tdesc_osabi_name (e);
|
|
if (osabi != nullptr)
|
|
string_appendf (*m_buffer, "<osabi>%s</osabi>", osabi);
|
|
#endif
|
|
}
|
|
|
|
void print_xml_feature::visit_post (const target_desc *e)
|
|
{
|
|
string_appendf (*m_buffer, "</target>\n");
|
|
}
|