From de584861439dac10f422843cf2bf85d0ff4ad628 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 3 Sep 2007 23:06:35 +0000 Subject: * 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. --- gdb/xml-support.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) (limited to 'gdb/xml-support.c') diff --git a/gdb/xml-support.c b/gdb/xml-support.c index 8a4762c..9cee5ef 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, "'"); + special += 5; + break; + case '\"': + strcpy (result + i + special, """); + special += 5; + break; + case '&': + strcpy (result + i + special, "&"); + special += 4; + break; + case '<': + strcpy (result + i + special, "<"); + special += 3; + break; + case '>': + strcpy (result + i + special, ">"); + special += 3; + break; + default: + result[i + special] = text[i]; + break; + } + result[i + special] = '\0'; + + return result; +} + void _initialize_xml_support (void); void -- cgit v1.1