From 05a4558a934667e0e219e95d2c898f5c069b860c Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Mon, 26 Feb 2007 19:20:21 +0000 Subject: * Makefile.in (XMLFILES): Include $(TDEP_XML). (filenames_h): New variable. (clean): Clean up xml-builtin.c and stamp-xml. (arm-linux-nat.o): Update. * config/arm/linux.mh (TDEP_XML): Define. * arm-linux-nat.c (PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS): Define. (arm_linux_has_wmmx_registers): New. (GET_THREAD_ID): Fix typo. (IWMMXT_REGS_SIZE): Define. (fetch_wmmx_regs, store_wmmx_regs): New. (arm_linux_fetch_inferior_registers): Use fetch_wmmx_regs. (arm_linux_store_inferior_registers): Use store_wmmx_regs. (super_xfer_partial, arm_linux_xfer_partial): New. (_initialize_arm_linux_nat): Use them. * xml-support.c (fetch_xml_builtin): Move outside HAVE_LIBEXPAT. (xml_builtin_xfer_partial): New function. * xml-support.h (xml_builtin_xfer_partial): New prototype. * NEWS: Update mention of iWMMXt support. --- gdb/xml-support.c | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'gdb/xml-support.c') diff --git a/gdb/xml-support.c b/gdb/xml-support.c index c9196ec..49a10d7 100644 --- a/gdb/xml-support.c +++ b/gdb/xml-support.c @@ -21,6 +21,11 @@ #include "defs.h" #include "gdbcmd.h" +#include "exceptions.h" +#include "xml-support.h" + +#include "gdb_string.h" +#include "safe-ctype.h" /* Debugging flag. */ static int debug_xml; @@ -29,12 +34,7 @@ static int debug_xml; available. */ #ifdef HAVE_LIBEXPAT -#include "exceptions.h" -#include "xml-support.h" - #include "gdb_expat.h" -#include "gdb_string.h" -#include "safe-ctype.h" /* The maximum depth of nesting. No need to be miserly, we just want to avoid running out of stack on loops. */ @@ -880,6 +880,7 @@ xml_process_xincludes (const char *name, const char *text, do_cleanups (back_to); return result; } +#endif /* HAVE_LIBEXPAT */ /* Return an XML document which was compiled into GDB, from @@ -897,7 +898,36 @@ fetch_xml_builtin (const char *filename) return NULL; } -#endif /* HAVE_LIBEXPAT */ +/* A to_xfer_partial helper function which reads XML files which were + compiled into GDB. The target may call this function from its own + to_xfer_partial handler, after converting object and annex to the + appropriate filename. */ + +LONGEST +xml_builtin_xfer_partial (const char *filename, + gdb_byte *readbuf, const gdb_byte *writebuf, + ULONGEST offset, LONGEST len) +{ + const char *buf; + LONGEST len_avail; + + gdb_assert (readbuf != NULL && writebuf == NULL); + gdb_assert (filename != NULL); + + buf = fetch_xml_builtin (filename); + if (buf == NULL) + return -1; + + len_avail = strlen (buf); + if (offset >= len_avail) + return 0; + + if (len > len_avail - offset) + len = len_avail - offset; + memcpy (readbuf, buf + offset, len); + return len; +} + static void show_debug_xml (struct ui_file *file, int from_tty, -- cgit v1.1