summaryrefslogtreecommitdiff
path: root/gdb/xml-support.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2007-09-03 23:06:35 +0000
committerPedro Alves <pedro@codesourcery.com>2007-09-03 23:06:35 +0000
commit35b7085151f468dc1262e8ed1eb21404ac5280f9 (patch)
treef43faccae19bbc55dfb3eb495fcff40d938cd19b /gdb/xml-support.c
parent4d220f4e3d806a4e2c5653f646ebda1361b39e4e (diff)
downloadgdb-35b7085151f468dc1262e8ed1eb21404ac5280f9.tar.gz
* gdbarch.sh (core_xfer_shared_libraries): New.
* corelow.c (core_xfer_partial): Handle TARGET_OBJECT_LIBRARIES. * gdb_obstack.h (obstack_grow_str, obstack_grow_str0): New. * xml-support.c (gdb_xml_parse): Debug output tweaks. (xml_escape_text): New. * xml-support.h (xml_escape_text): Declare. * config/i386/cygwin.mh (NATDEPFILES): Move corelow.o to ... * config/i386/cygwin.mt (TDEPFILES): ... here. * win32-nat.c: (fetch_elf_core_registers): Delete. (win32_elf_core_fn): Delete. (_initialize_core_win32): Delete. * i386-cygwin-tdep.c: Include "regset.h", "gdb_objstack.h", "xml-support.h" and "gdbcore.h". (i386_win32_gregset_reg_offset): New. (I386_WIN32_SIZEOF_GREGSET): New. (i386_win32_regset_from_core_section): New. (win32_xfer_shared_library): New. (struct cpms_data): New. (core_process_module_section): New. (win32_core_xfer_shared_libraries): New. (i386_cygwin_skip_trampoline_code): Register gregset_reg_offset, gregset_num_regs, sizeof_gregset members of tdep. Register regset_from_core_section and core_xfer_shared_libraries callbacks. * Makefile.in (i386-cygwin-tdep.o): Update dependencies. * gdbarch.h, gdbarch.c: Regenerate.
Diffstat (limited to 'gdb/xml-support.c')
-rw-r--r--gdb/xml-support.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 8a4762cb2b7..9cee5efbf77 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -544,6 +544,8 @@ gdb_xml_parse (struct gdb_xml_parser *parser, const char *buffer)
enum XML_Status status;
const char *error_string;
+ gdb_xml_debug (parser, _("Starting:\n%s"), buffer);
+
status = XML_Parse (parser->expat_parser, buffer, strlen (buffer), 1);
if (status == XML_STATUS_OK && parser->error.reason == 0)
@@ -869,8 +871,7 @@ xml_process_xincludes (const char *name, const char *text,
result = xstrdup (obstack_finish (&data->obstack));
if (depth == 0)
- gdb_xml_debug (parser, _("XInclude processing succeeded:\n%s"),
- result);
+ gdb_xml_debug (parser, _("XInclude processing succeeded."));
}
else
result = NULL;
@@ -934,6 +935,68 @@ show_debug_xml (struct ui_file *file, int from_tty,
fprintf_filtered (file, _("XML debugging is %s.\n"), value);
}
+/* Return a malloc allocated string with special characters from TEXT
+ replaced by entity references. */
+
+char *
+xml_escape_text (const char *text)
+{
+ char *result;
+ int i, special;
+
+ /* Compute the length of the result. */
+ for (i = 0, special = 0; text[i] != '\0'; i++)
+ switch (text[i])
+ {
+ case '\'':
+ case '\"':
+ special += 5;
+ break;
+ case '&':
+ special += 4;
+ break;
+ case '<':
+ case '>':
+ special += 3;
+ break;
+ default:
+ break;
+ }
+
+ /* Expand the result. */
+ result = xmalloc (i + special + 1);
+ for (i = 0, special = 0; text[i] != '\0'; i++)
+ switch (text[i])
+ {
+ case '\'':
+ strcpy (result + i + special, "&apos;");
+ special += 5;
+ break;
+ case '\"':
+ strcpy (result + i + special, "&quot;");
+ special += 5;
+ break;
+ case '&':
+ strcpy (result + i + special, "&amp;");
+ special += 4;
+ break;
+ case '<':
+ strcpy (result + i + special, "&lt;");
+ special += 3;
+ break;
+ case '>':
+ strcpy (result + i + special, "&gt;");
+ special += 3;
+ break;
+ default:
+ result[i + special] = text[i];
+ break;
+ }
+ result[i + special] = '\0';
+
+ return result;
+}
+
void _initialize_xml_support (void);
void