aboutsummaryrefslogtreecommitdiff
path: root/gdb/xml-support.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-02-26 19:20:21 +0000
committerDaniel Jacobowitz <drow@false.org>2007-02-26 19:20:21 +0000
commit05a4558a934667e0e219e95d2c898f5c069b860c (patch)
treed962e2e61d078058a03b181e6b9a39026f153e8a /gdb/xml-support.c
parentff6f572f8b0a1f60246f90683e51635744cb7d36 (diff)
downloadgdb-05a4558a934667e0e219e95d2c898f5c069b860c.zip
gdb-05a4558a934667e0e219e95d2c898f5c069b860c.tar.gz
gdb-05a4558a934667e0e219e95d2c898f5c069b860c.tar.bz2
* 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.
Diffstat (limited to 'gdb/xml-support.c')
-rw-r--r--gdb/xml-support.c42
1 files changed, 36 insertions, 6 deletions
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 <xi:include> 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,