binutils-gdb/gdb/xml-support.c

1024 lines
27 KiB
C
Raw Permalink Normal View History

gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
/* Helper routines for parsing XML using Expat.
Copyright (C) 2006-2020 Free Software Foundation, Inc.
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
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
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
(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/>. */
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
#include "defs.h"
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
#include "gdbcmd.h"
#include "xml-builtin.h"
#include "xml-support.h"
Rename common to gdbsupport 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.
2019-05-06 04:29:24 +02:00
#include "gdbsupport/filestuff.h"
#include "safe-ctype.h"
#include <vector>
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
#include <string>
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Debugging flag. */
Change boolean options to bool instead of int This is for add_setshow_boolean_cmd as well as the gdb::option interface. gdb/ChangeLog: 2019-09-17 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_ignore_descriptive_types_p): Change to bool. (print_signatures): Likewise. (trust_pad_over_xvs): Likewise. * arch/aarch64-insn.c (aarch64_debug): Likewise. * arch/aarch64-insn.h (aarch64_debug): Likewise. * arm-linux-nat.c (arm_apcs_32): Likewise. * arm-linux-tdep.c (arm_apcs_32): Likewise. * arm-nbsd-nat.c (arm_apcs_32): Likewise. * arm-tdep.c (arm_debug): Likewise. (arm_apcs_32): Likewise. * auto-load.c (debug_auto_load): Likewise. (auto_load_gdb_scripts): Likewise. (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * auto-load.h (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * breakpoint.c (disconnected_dprintf): Likewise. (breakpoint_proceeded): Likewise. (automatic_hardware_breakpoints): Likewise. (always_inserted_mode): Likewise. (target_exact_watchpoints): Likewise. (_initialize_breakpoint): Update. * breakpoint.h (target_exact_watchpoints): Change to bool. * btrace.c (maint_btrace_pt_skip_pad): Likewise. * cli/cli-cmds.c (trace_commands): Likewise. * cli/cli-cmds.h (trace_commands): Likewise. * cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument to bool*. * cli/cli-logging.c (logging_overwrite): Change to bool. (logging_redirect): Likewise. (debug_redirect): Likewise. * cli/cli-option.h (option_def) <boolean>: Change return type to bool*. (struct boolean_option_def) <get_var_address_cb_>: Change return type to bool. <boolean_option_def>: Update. (struct flag_option_def): Change default type of Context to bool from int. <flag_option_def>: Change return type of var_address_cb_ to bool*. * cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*. (get_setshow_command_value_string): Likewise. * cli/cli-style.c (cli_styling): Change to bool. (source_styling): Likewise. * cli/cli-style.h (source_styling): Likewise. (cli_styling): Likewise. * cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change to bool. * command.h (var_types): Update comment. (add_setshow_boolean_cmd): Change int* var argument to bool*. * compile/compile-cplus-types.c (debug_compile_cplus_types): Change to bool. (debug_compile_cplus_scopes): Likewise. * compile/compile-internal.h (compile_debug): Likewise. * compile/compile.c (compile_debug): Likewise. (struct compile_options) <raw>: Likewise. * cp-support.c (catch_demangler_crashes): Likewise. * cris-tdep.c (usr_cmd_cris_version_valid): Likewise. (usr_cmd_cris_dwarf2_cfi): Likewise. * csky-tdep.c (csky_debug): Likewise. * darwin-nat.c (enable_mach_exceptions): Likewise. * dcache.c (dcache_enabled_p): Likewise. * defs.h (info_verbose): Likewise. * demangle.c (demangle): Likewise. (asm_demangle): Likewise. * dwarf-index-cache.c (debug_index_cache): Likewise. * dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2read.c (check_physname): Likewise. (use_deprecated_index_sections): Likewise. (dwarf_always_disassemble): Likewise. * eval.c (overload_resolution): Likewise. * event-top.c (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * event-top.h (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * exec.c (write_files): Likewise. * fbsd-nat.c (debug_fbsd_lwp): Likewise (debug_fbsd_nat): Likewise. * frame.h (struct frame_print_options) <print_raw_frame_arguments>: Likewise. (struct set_backtrace_options) <backtrace_past_main>: Likewise. <backtrace_past_entry> Likewise. * gdb-demangle.h (demangle): Likewise. (asm_demangle): Likewise. * gdb_bfd.c (bfd_sharing): Likewise. * gdbcore.h (write_files): Likewise. * gdbsupport/common-debug.c (show_debug_regs): Likewise. * gdbsupport/common-debug.h (show_debug_regs): Likewise. * gdbthread.h (print_thread_events): Likewise. * gdbtypes.c (opaque_type_resolution): Likewise. (strict_type_checking): Likewise. * gnu-nat.c (gnu_debug_flag): Likewise. * guile/scm-auto-load.c (auto_load_guile_scripts): Likewise. * guile/scm-param.c (pascm_variable): Add boolval. (add_setshow_generic): Update. (pascm_param_value): Update. (pascm_set_param_value_x): Update. * hppa-tdep.c (hppa_debug): Change to bool.. * infcall.c (may_call_functions_p): Likewise. (coerce_float_to_double_p): Likewise. (unwind_on_signal_p): Likewise. (unwind_on_terminating_exception_p): Likewise. * infcmd.c (startup_with_shell): Likewise. * inferior.c (print_inferior_events): Likewise. * inferior.h (startup_with_shell): Likewise. (print_inferior_events): Likewise. * infrun.c (step_stop_if_no_debug): Likewise. (detach_fork): Likewise. (debug_displaced): Likewise. (disable_randomization): Likewise. (non_stop): Likewise. (non_stop_1): Likewise. (observer_mode): Likewise. (observer_mode_1): Likewise. (set_observer_mode): Update. (sched_multi): Change to bool. * infrun.h (debug_displaced): Likewise. (sched_multi): Likewise. (step_stop_if_no_debug): Likewise. (non_stop): Likewise. (disable_randomization): Likewise. * linux-tdep.c (use_coredump_filter): Likewise. (dump_excluded_mappings): Likewise. * linux-thread-db.c (auto_load_thread_db): Likewise. (check_thread_db_on_load): Likewise. * main.c (captured_main_1): Update. * maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt, xx2_opt, boolean_opt>: Change to bool. * maint-test-settings.c (maintenance_test_settings_boolean): Likewise. * maint.c (maintenance_profile_p): Likewise. (per_command_time): Likewise. (per_command_space): Likewise. (per_command_symtab): Likewise. * memattr.c (inaccessible_by_default): Likewise. * mi/mi-main.c (mi_async): Likewise. (mi_async_1): Likewise. * mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise. * nat/fork-inferior.h (startup_with_shell): Likewise. * nat/linux-namespaces.c (debug_linux_namespaces): Likewise. * nat/linux-namespaces.h (debug_linux_namespaces): Likewise. * nios2-tdep.c (nios2_debug): Likewise. * or1k-tdep.c (or1k_debug): Likewise. * parse.c (parser_debug): Likewise. * parser-defs.h (parser_debug): Likewise. * printcmd.c (print_symbol_filename): Likewise. * proc-api.c (procfs_trace): Likewise. * python/py-auto-load.c (auto_load_python_scripts): Likewise. * python/py-param.c (union parmpy_variable): Add "bool boolval" field. (set_parameter_value): Update. (add_setshow_generic): Update. * python/py-value.c (copy_py_bool_obj): Change argument from int* to bool*. * python/python.c (gdbpy_parameter_value): Cast to bool* instead of int*. * ravenscar-thread.c (ravenscar_task_support): Change to bool. * record-btrace.c (record_btrace_target::store_registers): Update. * record-full.c (record_full_memory_query): Change to bool. (record_full_stop_at_limit): Likewise. * record-full.h (record_full_memory_query): Likewise. * remote-notif.c (notif_debug): Likewise. * remote-notif.h (notif_debug): Likewise. * remote.c (use_range_stepping): Likewise. (interrupt_on_connect): Likewise. (remote_break): Likewise. * ser-tcp.c (tcp_auto_retry): Likewise. * ser-unix.c (serial_hwflow): Likewise. * skip.c (debug_skip): Likewise. * solib-aix.c (solib_aix_debug): Likewise. * spu-tdep.c (spu_stop_on_load_p): Likewise. (spu_auto_flush_cache_p): Likewise. * stack.c (struct backtrace_cmd_options) <full, no_filters, hide>: Likewise. (struct info_print_options) <quiet>: Likewise. * symfile-debug.c (debug_symfile): Likewise. * symfile.c (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symfile.h (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symtab.c (basenames_may_differ): Likewise. (struct filename_partial_match_opts) <dirname, basename>: Likewise. (struct info_print_options) <quiet, exclude_minsyms>: Likewise. (struct info_types_options) <quiet>: Likewise. * symtab.h (demangle): Likewise. (basenames_may_differ): Likewise. * target-dcache.c (stack_cache_enabled_1): Likewise. (code_cache_enabled_1): Likewise. * target.c (trust_readonly): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. (auto_connect_native_target): Likewise. (target_stop_and_wait): Update. (target_async_permitted): Change to bool. (target_async_permitted_1): Likewise. (may_write_registers_1): Likewise. (may_write_memory_1): Likewise. (may_insert_breakpoints_1): Likewise. (may_insert_tracepoints_1): Likewise. (may_insert_fast_tracepoints_1): Likewise. (may_stop_1): Likewise. * target.h (target_async_permitted): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. * thread.c (struct info_threads_opts) <show_global_ids>: Likewise. (make_thread_apply_all_options_def_group): Change argument from int* to bool*. (thread_apply_all_command): Update. (print_thread_events): Change to bool. * top.c (confirm): Likewise. (command_editing_p): Likewise. (history_expansion_p): Likewise. (write_history_p): Likewise. (info_verbose): Likewise. * top.h (confirm): Likewise. (history_expansion_p): Likewise. * tracepoint.c (disconnected_tracing): Likewise. (circular_trace_buffer): Likewise. * typeprint.c (print_methods): Likewise. (print_typedefs): Likewise. * utils.c (debug_timestamp): Likewise. (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * utils.h (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * valops.c (overload_resolution): Likewise. * valprint.h (struct value_print_options) <prettyformat_arrays, prettyformat_structs, vtblprint, unionprint, addressprint, objectprint, stop_print_at_null, print_array_indexes, deref_ref, static_field_print, pascal_static_field_print, raw, summary, symbol_print, finish_print>: Likewise. * windows-nat.c (new_console): Likewise. (cygwin_exceptions): Likewise. (new_group): Likewise. (debug_exec): Likewise. (debug_events): Likewise. (debug_memory): Likewise. (debug_exceptions): Likewise. (useshell): Likewise. * windows-tdep.c (maint_display_all_tib): Likewise. * xml-support.c (debug_xml): Likewise.
2019-09-14 21:36:58 +02:00
static bool debug_xml;
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
/* The contents of this file are only useful if XML support is
available. */
#ifdef HAVE_LIBEXPAT
#include "gdb_expat.h"
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* The maximum depth of <xi:include> nesting. No need to be miserly,
we just want to avoid running out of stack on loops. */
#define MAX_XINCLUDE_DEPTH 30
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
/* Simplified XML parser infrastructure. */
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* A parsing level -- used to keep track of the current element
nesting. */
struct scope_level
{
explicit scope_level (const gdb_xml_element *elements_ = NULL)
: elements (elements_),
element (NULL),
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
seen (0)
{}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Elements we allow at this level. */
const struct gdb_xml_element *elements;
/* The element which we are within. */
const struct gdb_xml_element *element;
/* Mask of which elements we've seen at this level (used for
optional and repeatable checking). */
unsigned int seen;
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
/* Body text accumulation. */
std::string body;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
};
/* The parser itself, and our additional state. */
struct gdb_xml_parser
{
gdb_xml_parser (const char *name,
const gdb_xml_element *elements,
void *user_data);
~gdb_xml_parser();
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
/* Associate DTD_NAME, which must be the name of a compiled-in DTD,
with the parser. */
void use_dtd (const char *dtd_name);
/* Return the name of the expected / default DTD, if specified. */
const char *dtd_name ()
{ return m_dtd_name; }
/* Invoke the parser on BUFFER. BUFFER is the data to parse, which
should be NUL-terminated.
The return value is 0 for success or -1 for error. It may throw,
but only if something unexpected goes wrong during parsing; parse
errors will be caught, warned about, and reported as failure. */
int parse (const char *buffer);
/* Issue a debugging message. */
void vdebug (const char *format, va_list ap)
ATTRIBUTE_PRINTF (2, 0);
/* Issue an error message, and stop parsing. */
void verror (const char *format, va_list ap)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 0);
void body_text (const XML_Char *text, int length);
void start_element (const XML_Char *name, const XML_Char **attrs);
void end_element (const XML_Char *name);
/* Return the name of this parser. */
const char *name ()
{ return m_name; }
/* Return the user's callback data, for handlers. */
void *user_data ()
{ return m_user_data; };
/* Are we the special <xi:include> parser? */
void set_is_xinclude (bool is_xinclude)
{ m_is_xinclude = is_xinclude; }
/* A thrown error, if any. */
Make exception handling more efficient This makes exception handling more efficient in a few spots, through the use of const- and rvalue-references. I wrote this patch by commenting out the gdb_exception copy constructor and then examining the resulting error messages one by one, introducing the use of std::move where appropriate. gdb/ChangeLog 2019-04-25 Tom Tromey <tromey@adacore.com> * xml-support.c (struct gdb_xml_parser) <set_error>: Take an rvalue reference. (gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper) (gdb_xml_parser::parse): Use std::move. * python/python-internal.h (gdbpy_convert_exception): Take a const reference. * python/py-value.c (valpy_getitem, valpy_nonzero): Use std::move. * python/py-utils.c (gdbpy_convert_exception): Take a const reference. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Use std::move. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Use std::move. * mi/mi-main.c (mi_print_exception): Take a const reference. * main.c (handle_command_errors): Take a const reference. * linespec.c (parse_linespec): Use std::move. * infcall.c (run_inferior_call): Use std::move. (call_function_by_hand_dummy): Use std::move. * exec.c (try_open_exec_file): Use std::move. * exceptions.h (exception_print, exception_fprintf) (exception_print_same): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Change parameters to const reference. * event-top.c (gdb_rl_callback_read_char_wrapper): Update. * common/new-op.c: Use std::move. * common/common-exceptions.h (struct gdb_exception): Add move constructor. (struct gdb_exception_error, struct gdb_exception_quit, struct gdb_quit_bad_alloc): Change constructor to move constructor. (throw_exception): Change parameter to rvalue reference. * common/common-exceptions.c (throw_exception): Take rvalue reference. * cli/cli-interp.c (safe_execute_command): Use std::move. * breakpoint.c (insert_bp_location, location_to_sals): Use std::move.
2019-04-24 14:50:06 +02:00
void set_error (gdb_exception &&error)
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
{
Make exception handling more efficient This makes exception handling more efficient in a few spots, through the use of const- and rvalue-references. I wrote this patch by commenting out the gdb_exception copy constructor and then examining the resulting error messages one by one, introducing the use of std::move where appropriate. gdb/ChangeLog 2019-04-25 Tom Tromey <tromey@adacore.com> * xml-support.c (struct gdb_xml_parser) <set_error>: Take an rvalue reference. (gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper) (gdb_xml_parser::parse): Use std::move. * python/python-internal.h (gdbpy_convert_exception): Take a const reference. * python/py-value.c (valpy_getitem, valpy_nonzero): Use std::move. * python/py-utils.c (gdbpy_convert_exception): Take a const reference. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Use std::move. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Use std::move. * mi/mi-main.c (mi_print_exception): Take a const reference. * main.c (handle_command_errors): Take a const reference. * linespec.c (parse_linespec): Use std::move. * infcall.c (run_inferior_call): Use std::move. (call_function_by_hand_dummy): Use std::move. * exec.c (try_open_exec_file): Use std::move. * exceptions.h (exception_print, exception_fprintf) (exception_print_same): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Change parameters to const reference. * event-top.c (gdb_rl_callback_read_char_wrapper): Update. * common/new-op.c: Use std::move. * common/common-exceptions.h (struct gdb_exception): Add move constructor. (struct gdb_exception_error, struct gdb_exception_quit, struct gdb_quit_bad_alloc): Change constructor to move constructor. (throw_exception): Change parameter to rvalue reference. * common/common-exceptions.c (throw_exception): Take rvalue reference. * cli/cli-interp.c (safe_execute_command): Use std::move. * breakpoint.c (insert_bp_location, location_to_sals): Use std::move.
2019-04-24 14:50:06 +02:00
m_error = std::move (error);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
#ifdef HAVE_XML_STOPPARSER
XML_StopParser (m_expat_parser, XML_FALSE);
#endif
}
/* Return the underlying expat parser. */
XML_Parser expat_parser ()
{ return m_expat_parser; }
private:
/* The underlying expat parser. */
XML_Parser m_expat_parser;
/* Name of this parser. */
const char *m_name;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
/* The user's callback data, for handlers. */
void *m_user_data;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Scoping stack. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
std::vector<scope_level> m_scopes;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
/* A thrown error, if any. */
struct gdb_exception m_error;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
/* The line of the thrown error, or 0. */
int m_last_line;
/* The name of the expected / default DTD, if specified. */
const char *m_dtd_name;
/* Are we the special <xi:include> parser? */
bool m_is_xinclude;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
};
/* Process some body text. We accumulate the text for later use; it's
wrong to do anything with it immediately, because a single block of
text might be broken up into multiple calls to this function. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
void
gdb_xml_parser::body_text (const XML_Char *text, int length)
{
if (m_error.reason < 0)
return;
scope_level &scope = m_scopes.back ();
scope.body.append (text, length);
}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
static void
gdb_xml_body_text (void *data, const XML_Char *text, int length)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct gdb_xml_parser *parser = (struct gdb_xml_parser *) data;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser->body_text (text, length);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Issue a debugging message from one of PARSER's handlers. */
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
void
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_parser::vdebug (const char *format, va_list ap)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
int line = XML_GetCurrentLineNumber (m_expat_parser);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
std::string message = string_vprintf (format, ap);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
if (line)
fprintf_unfiltered (gdb_stderr, "%s (line %d): %s\n",
m_name, line, message.c_str ());
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
else
fprintf_unfiltered (gdb_stderr, "%s: %s\n",
m_name, message.c_str ());
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
void
gdb_xml_debug (struct gdb_xml_parser *parser, const char *format, ...)
{
if (!debug_xml)
return;
va_list ap;
va_start (ap, format);
parser->vdebug (format, ap);
va_end (ap);
}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Issue an error message from one of PARSER's handlers, and stop
parsing. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
void
gdb_xml_parser::verror (const char *format, va_list ap)
{
int line = XML_GetCurrentLineNumber (m_expat_parser);
m_last_line = line;
throw_verror (XML_PARSE_ERROR, format, ap);
}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
void
gdb_xml_error (struct gdb_xml_parser *parser, const char *format, ...)
{
va_list ap;
va_start (ap, format);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser->verror (format, ap);
va_end (ap);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
/* Find the attribute named NAME in the set of parsed attributes
ATTRIBUTES. Returns NULL if not found. */
struct gdb_xml_value *
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
xml_find_attribute (std::vector<gdb_xml_value> &attributes,
const char *name)
{
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
for (gdb_xml_value &value : attributes)
if (strcmp (value.name, name) == 0)
return &value;
return NULL;
}
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
/* Handle the start of an element. NAME is the element, and ATTRS are
the names and values of this element's attributes. */
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
void
gdb_xml_parser::start_element (const XML_Char *name,
const XML_Char **attrs)
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (m_error.reason < 0)
return;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
const struct gdb_xml_element *element;
const struct gdb_xml_attribute *attribute;
unsigned int seen;
/* Push an error scope. If we return or throw an exception before
filling this in, it will tell us to ignore children of this
element. Note we don't take a reference to the element yet
because further below we'll process the element which may recurse
back here and push more elements to the vector. When the
recursion unrolls all such elements will have been popped back
already, but if one of those pushes reallocates the vector,
previous element references will be invalidated. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
m_scopes.emplace_back ();
/* Get a reference to the current scope. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
scope_level &scope = m_scopes[m_scopes.size () - 2];
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_debug (this, _("Entering element <%s>"), name);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Find this element in the list of the current scope's allowed
children. Record that we've seen it. */
seen = 1;
for (element = scope.elements; element && element->name;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
element++, seen <<= 1)
if (strcmp (element->name, name) == 0)
break;
if (element == NULL || element->name == NULL)
{
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* If we're working on XInclude, <xi:include> can be the child
of absolutely anything. Copy the previous scope's element
list into the new scope even if there was no match. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (m_is_xinclude)
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_DefaultCurrent (m_expat_parser);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
scope_level &unknown_scope = m_scopes.back ();
unknown_scope.elements = scope.elements;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
return;
}
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_debug (this, _("Element <%s> unknown"), name);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
return;
}
if (!(element->flags & GDB_XML_EF_REPEATABLE) && (seen & scope.seen))
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_error (this, _("Element <%s> only expected once"), name);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
scope.seen |= seen;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
std::vector<gdb_xml_value> attributes;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
for (attribute = element->attributes;
attribute != NULL && attribute->name != NULL;
attribute++)
{
const char *val = NULL;
const XML_Char **p;
void *parsed_value;
for (p = attrs; *p != NULL; p += 2)
if (!strcmp (attribute->name, p[0]))
{
val = p[1];
break;
}
if (*p != NULL && val == NULL)
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_debug (this, _("Attribute \"%s\" missing a value"),
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
attribute->name);
continue;
}
if (*p == NULL && !(attribute->flags & GDB_XML_AF_OPTIONAL))
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_error (this, _("Required attribute \"%s\" of "
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
"<%s> not specified"),
attribute->name, element->name);
continue;
}
if (*p == NULL)
continue;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_debug (this, _("Parsing attribute %s=\"%s\""),
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
attribute->name, val);
if (attribute->handler)
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parsed_value = attribute->handler (this, attribute, val);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
else
parsed_value = xstrdup (val);
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
attributes.emplace_back (attribute->name, parsed_value);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
/* Check for unrecognized attributes. */
if (debug_xml)
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
{
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
const XML_Char **p;
for (p = attrs; *p != NULL; p += 2)
{
for (attribute = element->attributes;
attribute != NULL && attribute->name != NULL;
attribute++)
if (strcmp (attribute->name, *p) == 0)
break;
if (attribute == NULL || attribute->name == NULL)
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_debug (this, _("Ignoring unknown attribute %s"), *p);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
}
/* Call the element handler if there is one. */
if (element->start_handler)
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
element->start_handler (this, element, m_user_data, attributes);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Fill in a new scope level. Note that we must delay getting a
back reference till here because above we might have recursed,
which may have reallocated the vector which invalidates
iterators/pointers/references. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
scope_level &new_scope = m_scopes.back ();
new_scope.element = element;
new_scope.elements = element->children;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
/* Wrapper for gdb_xml_start_element, to prevent throwing exceptions
through expat. */
static void
gdb_xml_start_element_wrapper (void *data, const XML_Char *name,
const XML_Char **attrs)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct gdb_xml_parser *parser = (struct gdb_xml_parser *) data;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
Rewrite TRY/CATCH This rewrites gdb's TRY/CATCH to plain C++ try/catch. The patch was largely written by script, though one change (to a comment in common-exceptions.h) was reverted by hand. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * xml-support.c: Use C++ exception handling. * x86-linux-nat.c: Use C++ exception handling. * windows-nat.c: Use C++ exception handling. * varobj.c: Use C++ exception handling. * value.c: Use C++ exception handling. * valprint.c: Use C++ exception handling. * valops.c: Use C++ exception handling. * unittests/parse-connection-spec-selftests.c: Use C++ exception handling. * unittests/cli-utils-selftests.c: Use C++ exception handling. * typeprint.c: Use C++ exception handling. * tui/tui.c: Use C++ exception handling. * tracefile-tfile.c: Use C++ exception handling. * top.c: Use C++ exception handling. * thread.c: Use C++ exception handling. * target.c: Use C++ exception handling. * symmisc.c: Use C++ exception handling. * symfile-mem.c: Use C++ exception handling. * stack.c: Use C++ exception handling. * sparc64-linux-tdep.c: Use C++ exception handling. * solib.c: Use C++ exception handling. * solib-svr4.c: Use C++ exception handling. * solib-spu.c: Use C++ exception handling. * solib-frv.c: Use C++ exception handling. * solib-dsbt.c: Use C++ exception handling. * selftest-arch.c: Use C++ exception handling. * s390-tdep.c: Use C++ exception handling. * rust-lang.c: Use C++ exception handling. * rust-exp.y: Use C++ exception handling. * rs6000-tdep.c: Use C++ exception handling. * rs6000-aix-tdep.c: Use C++ exception handling. * riscv-tdep.c: Use C++ exception handling. * remote.c: Use C++ exception handling. * remote-fileio.c: Use C++ exception handling. * record-full.c: Use C++ exception handling. * record-btrace.c: Use C++ exception handling. * python/python.c: Use C++ exception handling. * python/py-value.c: Use C++ exception handling. * python/py-utils.c: Use C++ exception handling. * python/py-unwind.c: Use C++ exception handling. * python/py-type.c: Use C++ exception handling. * python/py-symbol.c: Use C++ exception handling. * python/py-record.c: Use C++ exception handling. * python/py-record-btrace.c: Use C++ exception handling. * python/py-progspace.c: Use C++ exception handling. * python/py-prettyprint.c: Use C++ exception handling. * python/py-param.c: Use C++ exception handling. * python/py-objfile.c: Use C++ exception handling. * python/py-linetable.c: Use C++ exception handling. * python/py-lazy-string.c: Use C++ exception handling. * python/py-infthread.c: Use C++ exception handling. * python/py-inferior.c: Use C++ exception handling. * python/py-gdb-readline.c: Use C++ exception handling. * python/py-framefilter.c: Use C++ exception handling. * python/py-frame.c: Use C++ exception handling. * python/py-finishbreakpoint.c: Use C++ exception handling. * python/py-cmd.c: Use C++ exception handling. * python/py-breakpoint.c: Use C++ exception handling. * python/py-arch.c: Use C++ exception handling. * printcmd.c: Use C++ exception handling. * ppc-linux-tdep.c: Use C++ exception handling. * parse.c: Use C++ exception handling. * p-valprint.c: Use C++ exception handling. * objc-lang.c: Use C++ exception handling. * mi/mi-main.c: Use C++ exception handling. * mi/mi-interp.c: Use C++ exception handling. * mi/mi-cmd-stack.c: Use C++ exception handling. * mi/mi-cmd-break.c: Use C++ exception handling. * main.c: Use C++ exception handling. * linux-thread-db.c: Use C++ exception handling. * linux-tdep.c: Use C++ exception handling. * linux-nat.c: Use C++ exception handling. * linux-fork.c: Use C++ exception handling. * linespec.c: Use C++ exception handling. * language.c: Use C++ exception handling. * jit.c: Use C++ exception handling. * infrun.c: Use C++ exception handling. * infcmd.c: Use C++ exception handling. * infcall.c: Use C++ exception handling. * inf-loop.c: Use C++ exception handling. * i386-tdep.c: Use C++ exception handling. * i386-linux-tdep.c: Use C++ exception handling. * guile/scm-value.c: Use C++ exception handling. * guile/scm-type.c: Use C++ exception handling. * guile/scm-symtab.c: Use C++ exception handling. * guile/scm-symbol.c: Use C++ exception handling. * guile/scm-pretty-print.c: Use C++ exception handling. * guile/scm-ports.c: Use C++ exception handling. * guile/scm-param.c: Use C++ exception handling. * guile/scm-math.c: Use C++ exception handling. * guile/scm-lazy-string.c: Use C++ exception handling. * guile/scm-frame.c: Use C++ exception handling. * guile/scm-disasm.c: Use C++ exception handling. * guile/scm-cmd.c: Use C++ exception handling. * guile/scm-breakpoint.c: Use C++ exception handling. * guile/scm-block.c: Use C++ exception handling. * guile/guile-internal.h: Use C++ exception handling. * gnu-v3-abi.c: Use C++ exception handling. * gdbtypes.c: Use C++ exception handling. * frame.c: Use C++ exception handling. * frame-unwind.c: Use C++ exception handling. * fbsd-tdep.c: Use C++ exception handling. * f-valprint.c: Use C++ exception handling. * exec.c: Use C++ exception handling. * event-top.c: Use C++ exception handling. * event-loop.c: Use C++ exception handling. * eval.c: Use C++ exception handling. * dwarf2read.c: Use C++ exception handling. * dwarf2loc.c: Use C++ exception handling. * dwarf2-frame.c: Use C++ exception handling. * dwarf2-frame-tailcall.c: Use C++ exception handling. * dwarf-index-write.c: Use C++ exception handling. * dwarf-index-cache.c: Use C++ exception handling. * dtrace-probe.c: Use C++ exception handling. * disasm-selftests.c: Use C++ exception handling. * darwin-nat.c: Use C++ exception handling. * cp-valprint.c: Use C++ exception handling. * cp-support.c: Use C++ exception handling. * cp-abi.c: Use C++ exception handling. * corelow.c: Use C++ exception handling. * completer.c: Use C++ exception handling. * compile/compile-object-run.c: Use C++ exception handling. * compile/compile-object-load.c: Use C++ exception handling. * compile/compile-cplus-symbols.c: Use C++ exception handling. * compile/compile-c-symbols.c: Use C++ exception handling. * common/selftest.c: Use C++ exception handling. * common/new-op.c: Use C++ exception handling. * cli/cli-script.c: Use C++ exception handling. * cli/cli-interp.c: Use C++ exception handling. * cli/cli-cmds.c: Use C++ exception handling. * c-varobj.c: Use C++ exception handling. * btrace.c: Use C++ exception handling. * breakpoint.c: Use C++ exception handling. * break-catch-throw.c: Use C++ exception handling. * arch-utils.c: Use C++ exception handling. * amd64-tdep.c: Use C++ exception handling. * ada-valprint.c: Use C++ exception handling. * ada-typeprint.c: Use C++ exception handling. * ada-lang.c: Use C++ exception handling. * aarch64-tdep.c: Use C++ exception handling. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * server.c: Use C++ exception handling. * linux-low.c: Use C++ exception handling. * gdbreplay.c: Use C++ exception handling.
2019-04-04 00:02:42 +02:00
try
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser->start_element (name, attrs);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
Make exception handling more efficient This makes exception handling more efficient in a few spots, through the use of const- and rvalue-references. I wrote this patch by commenting out the gdb_exception copy constructor and then examining the resulting error messages one by one, introducing the use of std::move where appropriate. gdb/ChangeLog 2019-04-25 Tom Tromey <tromey@adacore.com> * xml-support.c (struct gdb_xml_parser) <set_error>: Take an rvalue reference. (gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper) (gdb_xml_parser::parse): Use std::move. * python/python-internal.h (gdbpy_convert_exception): Take a const reference. * python/py-value.c (valpy_getitem, valpy_nonzero): Use std::move. * python/py-utils.c (gdbpy_convert_exception): Take a const reference. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Use std::move. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Use std::move. * mi/mi-main.c (mi_print_exception): Take a const reference. * main.c (handle_command_errors): Take a const reference. * linespec.c (parse_linespec): Use std::move. * infcall.c (run_inferior_call): Use std::move. (call_function_by_hand_dummy): Use std::move. * exec.c (try_open_exec_file): Use std::move. * exceptions.h (exception_print, exception_fprintf) (exception_print_same): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Change parameters to const reference. * event-top.c (gdb_rl_callback_read_char_wrapper): Update. * common/new-op.c: Use std::move. * common/common-exceptions.h (struct gdb_exception): Add move constructor. (struct gdb_exception_error, struct gdb_exception_quit, struct gdb_quit_bad_alloc): Change constructor to move constructor. (throw_exception): Change parameter to rvalue reference. * common/common-exceptions.c (throw_exception): Take rvalue reference. * cli/cli-interp.c (safe_execute_command): Use std::move. * breakpoint.c (insert_bp_location, location_to_sals): Use std::move.
2019-04-24 14:50:06 +02:00
catch (gdb_exception &ex)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
Make exception handling more efficient This makes exception handling more efficient in a few spots, through the use of const- and rvalue-references. I wrote this patch by commenting out the gdb_exception copy constructor and then examining the resulting error messages one by one, introducing the use of std::move where appropriate. gdb/ChangeLog 2019-04-25 Tom Tromey <tromey@adacore.com> * xml-support.c (struct gdb_xml_parser) <set_error>: Take an rvalue reference. (gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper) (gdb_xml_parser::parse): Use std::move. * python/python-internal.h (gdbpy_convert_exception): Take a const reference. * python/py-value.c (valpy_getitem, valpy_nonzero): Use std::move. * python/py-utils.c (gdbpy_convert_exception): Take a const reference. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Use std::move. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Use std::move. * mi/mi-main.c (mi_print_exception): Take a const reference. * main.c (handle_command_errors): Take a const reference. * linespec.c (parse_linespec): Use std::move. * infcall.c (run_inferior_call): Use std::move. (call_function_by_hand_dummy): Use std::move. * exec.c (try_open_exec_file): Use std::move. * exceptions.h (exception_print, exception_fprintf) (exception_print_same): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Change parameters to const reference. * event-top.c (gdb_rl_callback_read_char_wrapper): Update. * common/new-op.c: Use std::move. * common/common-exceptions.h (struct gdb_exception): Add move constructor. (struct gdb_exception_error, struct gdb_exception_quit, struct gdb_quit_bad_alloc): Change constructor to move constructor. (throw_exception): Change parameter to rvalue reference. * common/common-exceptions.c (throw_exception): Take rvalue reference. * cli/cli-interp.c (safe_execute_command): Use std::move. * breakpoint.c (insert_bp_location, location_to_sals): Use std::move.
2019-04-24 14:50:06 +02:00
parser->set_error (std::move (ex));
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
/* Handle the end of an element. NAME is the current element. */
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
void
gdb_xml_parser::end_element (const XML_Char *name)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (m_error.reason < 0)
return;
struct scope_level *scope = &m_scopes.back ();
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
const struct gdb_xml_element *element;
unsigned int seen;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_debug (this, _("Leaving element <%s>"), name);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
for (element = scope->elements, seen = 1;
element != NULL && element->name != NULL;
element++, seen <<= 1)
if ((scope->seen & seen) == 0
&& (element->flags & GDB_XML_EF_OPTIONAL) == 0)
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_error (this, _("Required element <%s> is missing"),
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
element->name);
/* Call the element processor. */
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
if (scope->element != NULL && scope->element->end_handler)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
const char *body;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
if (scope->body.empty ())
body = "";
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
else
{
int length;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
length = scope->body.size ();
body = scope->body.c_str ();
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* Strip leading and trailing whitespace. */
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
while (length > 0 && ISSPACE (body[length - 1]))
length--;
scope->body.erase (length);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
while (*body && ISSPACE (*body))
body++;
}
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
scope->element->end_handler (this, scope->element,
m_user_data, body);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
}
else if (scope->element == NULL)
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_DefaultCurrent (m_expat_parser);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Pop the scope level. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
m_scopes.pop_back ();
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
/* Wrapper for gdb_xml_end_element, to prevent throwing exceptions
through expat. */
static void
gdb_xml_end_element_wrapper (void *data, const XML_Char *name)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct gdb_xml_parser *parser = (struct gdb_xml_parser *) data;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
Rewrite TRY/CATCH This rewrites gdb's TRY/CATCH to plain C++ try/catch. The patch was largely written by script, though one change (to a comment in common-exceptions.h) was reverted by hand. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * xml-support.c: Use C++ exception handling. * x86-linux-nat.c: Use C++ exception handling. * windows-nat.c: Use C++ exception handling. * varobj.c: Use C++ exception handling. * value.c: Use C++ exception handling. * valprint.c: Use C++ exception handling. * valops.c: Use C++ exception handling. * unittests/parse-connection-spec-selftests.c: Use C++ exception handling. * unittests/cli-utils-selftests.c: Use C++ exception handling. * typeprint.c: Use C++ exception handling. * tui/tui.c: Use C++ exception handling. * tracefile-tfile.c: Use C++ exception handling. * top.c: Use C++ exception handling. * thread.c: Use C++ exception handling. * target.c: Use C++ exception handling. * symmisc.c: Use C++ exception handling. * symfile-mem.c: Use C++ exception handling. * stack.c: Use C++ exception handling. * sparc64-linux-tdep.c: Use C++ exception handling. * solib.c: Use C++ exception handling. * solib-svr4.c: Use C++ exception handling. * solib-spu.c: Use C++ exception handling. * solib-frv.c: Use C++ exception handling. * solib-dsbt.c: Use C++ exception handling. * selftest-arch.c: Use C++ exception handling. * s390-tdep.c: Use C++ exception handling. * rust-lang.c: Use C++ exception handling. * rust-exp.y: Use C++ exception handling. * rs6000-tdep.c: Use C++ exception handling. * rs6000-aix-tdep.c: Use C++ exception handling. * riscv-tdep.c: Use C++ exception handling. * remote.c: Use C++ exception handling. * remote-fileio.c: Use C++ exception handling. * record-full.c: Use C++ exception handling. * record-btrace.c: Use C++ exception handling. * python/python.c: Use C++ exception handling. * python/py-value.c: Use C++ exception handling. * python/py-utils.c: Use C++ exception handling. * python/py-unwind.c: Use C++ exception handling. * python/py-type.c: Use C++ exception handling. * python/py-symbol.c: Use C++ exception handling. * python/py-record.c: Use C++ exception handling. * python/py-record-btrace.c: Use C++ exception handling. * python/py-progspace.c: Use C++ exception handling. * python/py-prettyprint.c: Use C++ exception handling. * python/py-param.c: Use C++ exception handling. * python/py-objfile.c: Use C++ exception handling. * python/py-linetable.c: Use C++ exception handling. * python/py-lazy-string.c: Use C++ exception handling. * python/py-infthread.c: Use C++ exception handling. * python/py-inferior.c: Use C++ exception handling. * python/py-gdb-readline.c: Use C++ exception handling. * python/py-framefilter.c: Use C++ exception handling. * python/py-frame.c: Use C++ exception handling. * python/py-finishbreakpoint.c: Use C++ exception handling. * python/py-cmd.c: Use C++ exception handling. * python/py-breakpoint.c: Use C++ exception handling. * python/py-arch.c: Use C++ exception handling. * printcmd.c: Use C++ exception handling. * ppc-linux-tdep.c: Use C++ exception handling. * parse.c: Use C++ exception handling. * p-valprint.c: Use C++ exception handling. * objc-lang.c: Use C++ exception handling. * mi/mi-main.c: Use C++ exception handling. * mi/mi-interp.c: Use C++ exception handling. * mi/mi-cmd-stack.c: Use C++ exception handling. * mi/mi-cmd-break.c: Use C++ exception handling. * main.c: Use C++ exception handling. * linux-thread-db.c: Use C++ exception handling. * linux-tdep.c: Use C++ exception handling. * linux-nat.c: Use C++ exception handling. * linux-fork.c: Use C++ exception handling. * linespec.c: Use C++ exception handling. * language.c: Use C++ exception handling. * jit.c: Use C++ exception handling. * infrun.c: Use C++ exception handling. * infcmd.c: Use C++ exception handling. * infcall.c: Use C++ exception handling. * inf-loop.c: Use C++ exception handling. * i386-tdep.c: Use C++ exception handling. * i386-linux-tdep.c: Use C++ exception handling. * guile/scm-value.c: Use C++ exception handling. * guile/scm-type.c: Use C++ exception handling. * guile/scm-symtab.c: Use C++ exception handling. * guile/scm-symbol.c: Use C++ exception handling. * guile/scm-pretty-print.c: Use C++ exception handling. * guile/scm-ports.c: Use C++ exception handling. * guile/scm-param.c: Use C++ exception handling. * guile/scm-math.c: Use C++ exception handling. * guile/scm-lazy-string.c: Use C++ exception handling. * guile/scm-frame.c: Use C++ exception handling. * guile/scm-disasm.c: Use C++ exception handling. * guile/scm-cmd.c: Use C++ exception handling. * guile/scm-breakpoint.c: Use C++ exception handling. * guile/scm-block.c: Use C++ exception handling. * guile/guile-internal.h: Use C++ exception handling. * gnu-v3-abi.c: Use C++ exception handling. * gdbtypes.c: Use C++ exception handling. * frame.c: Use C++ exception handling. * frame-unwind.c: Use C++ exception handling. * fbsd-tdep.c: Use C++ exception handling. * f-valprint.c: Use C++ exception handling. * exec.c: Use C++ exception handling. * event-top.c: Use C++ exception handling. * event-loop.c: Use C++ exception handling. * eval.c: Use C++ exception handling. * dwarf2read.c: Use C++ exception handling. * dwarf2loc.c: Use C++ exception handling. * dwarf2-frame.c: Use C++ exception handling. * dwarf2-frame-tailcall.c: Use C++ exception handling. * dwarf-index-write.c: Use C++ exception handling. * dwarf-index-cache.c: Use C++ exception handling. * dtrace-probe.c: Use C++ exception handling. * disasm-selftests.c: Use C++ exception handling. * darwin-nat.c: Use C++ exception handling. * cp-valprint.c: Use C++ exception handling. * cp-support.c: Use C++ exception handling. * cp-abi.c: Use C++ exception handling. * corelow.c: Use C++ exception handling. * completer.c: Use C++ exception handling. * compile/compile-object-run.c: Use C++ exception handling. * compile/compile-object-load.c: Use C++ exception handling. * compile/compile-cplus-symbols.c: Use C++ exception handling. * compile/compile-c-symbols.c: Use C++ exception handling. * common/selftest.c: Use C++ exception handling. * common/new-op.c: Use C++ exception handling. * cli/cli-script.c: Use C++ exception handling. * cli/cli-interp.c: Use C++ exception handling. * cli/cli-cmds.c: Use C++ exception handling. * c-varobj.c: Use C++ exception handling. * btrace.c: Use C++ exception handling. * breakpoint.c: Use C++ exception handling. * break-catch-throw.c: Use C++ exception handling. * arch-utils.c: Use C++ exception handling. * amd64-tdep.c: Use C++ exception handling. * ada-valprint.c: Use C++ exception handling. * ada-typeprint.c: Use C++ exception handling. * ada-lang.c: Use C++ exception handling. * aarch64-tdep.c: Use C++ exception handling. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * server.c: Use C++ exception handling. * linux-low.c: Use C++ exception handling. * gdbreplay.c: Use C++ exception handling.
2019-04-04 00:02:42 +02:00
try
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser->end_element (name);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
Make exception handling more efficient This makes exception handling more efficient in a few spots, through the use of const- and rvalue-references. I wrote this patch by commenting out the gdb_exception copy constructor and then examining the resulting error messages one by one, introducing the use of std::move where appropriate. gdb/ChangeLog 2019-04-25 Tom Tromey <tromey@adacore.com> * xml-support.c (struct gdb_xml_parser) <set_error>: Take an rvalue reference. (gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper) (gdb_xml_parser::parse): Use std::move. * python/python-internal.h (gdbpy_convert_exception): Take a const reference. * python/py-value.c (valpy_getitem, valpy_nonzero): Use std::move. * python/py-utils.c (gdbpy_convert_exception): Take a const reference. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Use std::move. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Use std::move. * mi/mi-main.c (mi_print_exception): Take a const reference. * main.c (handle_command_errors): Take a const reference. * linespec.c (parse_linespec): Use std::move. * infcall.c (run_inferior_call): Use std::move. (call_function_by_hand_dummy): Use std::move. * exec.c (try_open_exec_file): Use std::move. * exceptions.h (exception_print, exception_fprintf) (exception_print_same): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Change parameters to const reference. * event-top.c (gdb_rl_callback_read_char_wrapper): Update. * common/new-op.c: Use std::move. * common/common-exceptions.h (struct gdb_exception): Add move constructor. (struct gdb_exception_error, struct gdb_exception_quit, struct gdb_quit_bad_alloc): Change constructor to move constructor. (throw_exception): Change parameter to rvalue reference. * common/common-exceptions.c (throw_exception): Take rvalue reference. * cli/cli-interp.c (safe_execute_command): Use std::move. * breakpoint.c (insert_bp_location, location_to_sals): Use std::move.
2019-04-24 14:50:06 +02:00
catch (gdb_exception &ex)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
Make exception handling more efficient This makes exception handling more efficient in a few spots, through the use of const- and rvalue-references. I wrote this patch by commenting out the gdb_exception copy constructor and then examining the resulting error messages one by one, introducing the use of std::move where appropriate. gdb/ChangeLog 2019-04-25 Tom Tromey <tromey@adacore.com> * xml-support.c (struct gdb_xml_parser) <set_error>: Take an rvalue reference. (gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper) (gdb_xml_parser::parse): Use std::move. * python/python-internal.h (gdbpy_convert_exception): Take a const reference. * python/py-value.c (valpy_getitem, valpy_nonzero): Use std::move. * python/py-utils.c (gdbpy_convert_exception): Take a const reference. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Use std::move. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Use std::move. * mi/mi-main.c (mi_print_exception): Take a const reference. * main.c (handle_command_errors): Take a const reference. * linespec.c (parse_linespec): Use std::move. * infcall.c (run_inferior_call): Use std::move. (call_function_by_hand_dummy): Use std::move. * exec.c (try_open_exec_file): Use std::move. * exceptions.h (exception_print, exception_fprintf) (exception_print_same): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Change parameters to const reference. * event-top.c (gdb_rl_callback_read_char_wrapper): Update. * common/new-op.c: Use std::move. * common/common-exceptions.h (struct gdb_exception): Add move constructor. (struct gdb_exception_error, struct gdb_exception_quit, struct gdb_quit_bad_alloc): Change constructor to move constructor. (throw_exception): Change parameter to rvalue reference. * common/common-exceptions.c (throw_exception): Take rvalue reference. * cli/cli-interp.c (safe_execute_command): Use std::move. * breakpoint.c (insert_bp_location, location_to_sals): Use std::move.
2019-04-24 14:50:06 +02:00
parser->set_error (std::move (ex));
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
}
/* Free a parser and all its associated state. */
gdb_xml_parser::~gdb_xml_parser ()
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_ParserFree (m_expat_parser);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
/* Initialize a parser. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_parser::gdb_xml_parser (const char *name,
const gdb_xml_element *elements,
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
void *user_data)
: m_name (name),
m_user_data (user_data),
m_last_line (0),
m_dtd_name (NULL),
m_is_xinclude (false)
{
m_expat_parser = XML_ParserCreateNS (NULL, '!');
if (m_expat_parser == NULL)
malloc_failure (0);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetUserData (m_expat_parser, this);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Set the callbacks. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetElementHandler (m_expat_parser, gdb_xml_start_element_wrapper,
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_end_element_wrapper);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetCharacterDataHandler (m_expat_parser, gdb_xml_body_text);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Initialize the outer scope. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
m_scopes.emplace_back (elements);
}
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* External entity handler. The only external entities we support
are those compiled into GDB (we do not fetch entities from the
target). */
static int XMLCALL
gdb_xml_fetch_external_entity (XML_Parser expat_parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId)
{
XML_Parser entity_parser;
const char *text;
enum XML_Status status;
if (systemId == NULL)
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_parser *parser
= (gdb_xml_parser *) XML_GetUserData (expat_parser);
text = fetch_xml_builtin (parser->dtd_name ());
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
if (text == NULL)
internal_error (__FILE__, __LINE__,
_("could not locate built-in DTD %s"),
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser->dtd_name ());
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
}
else
{
text = fetch_xml_builtin (systemId);
if (text == NULL)
return XML_STATUS_ERROR;
}
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
entity_parser = XML_ExternalEntityParserCreate (expat_parser,
context, NULL);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* Don't use our handlers for the contents of the DTD. Just let expat
process it. */
XML_SetElementHandler (entity_parser, NULL, NULL);
XML_SetDoctypeDeclHandler (entity_parser, NULL, NULL);
XML_SetXmlDeclHandler (entity_parser, NULL);
XML_SetDefaultHandler (entity_parser, NULL);
XML_SetUserData (entity_parser, NULL);
status = XML_Parse (entity_parser, text, strlen (text), 1);
XML_ParserFree (entity_parser);
return status;
}
void
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_parser::use_dtd (const char *dtd_name)
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
{
enum XML_Error err;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
m_dtd_name = dtd_name;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetParamEntityParsing (m_expat_parser,
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetExternalEntityRefHandler (m_expat_parser,
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_fetch_external_entity);
/* Even if no DTD is provided, use the built-in DTD anyway. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
err = XML_UseForeignDTD (m_expat_parser, XML_TRUE);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
if (err != XML_ERROR_NONE)
internal_error (__FILE__, __LINE__,
_("XML_UseForeignDTD failed: %s"),
XML_ErrorString (err));
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Invoke PARSER on BUFFER. BUFFER is the data to parse, which
should be NUL-terminated.
The return value is 0 for success or -1 for error. It may throw,
but only if something unexpected goes wrong during parsing; parse
errors will be caught, warned about, and reported as failure. */
int
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_parser::parse (const char *buffer)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
enum XML_Status status;
const char *error_string;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_xml_debug (this, _("Starting:\n%s"), buffer);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
status = XML_Parse (m_expat_parser, buffer, strlen (buffer), 1);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (status == XML_STATUS_OK && m_error.reason == 0)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
return 0;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (m_error.reason == RETURN_ERROR
&& m_error.error == XML_PARSE_ERROR)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_assert (m_error.message != NULL);
Make exceptions use std::string and be self-managing This changes the exception's "message" member to be a shared_ptr wrapping a std::string. This allows removing the stack of exception messages, because now exceptions will self-destruct when needed. This also adds a noexcept copy constructor and operator= to gdb_exception, plus a "what" method. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * xml-support.c (gdb_xml_parser::parse): Update. * x86-linux-nat.c (x86_linux_nat_target::enable_btrace): Update. * value.c (show_convenience): Update. * unittests/cli-utils-selftests.c (test_number_or_range_parser) (test_parse_flags_qcs): Update. * thread.c (thr_try_catch_cmd): Update. * target.c (target_translate_tls_address): Update. * stack.c (print_frame_arg, read_frame_local, read_frame_arg) (info_frame_command_core, frame_apply_command_count): Update. * rust-exp.y (rust_lex_exception_test): Update. * riscv-tdep.c (riscv_print_one_register_info): Update. * remote.c (remote_target::enable_btrace): Update. * record-btrace.c (record_btrace_enable_warn): Update. * python/py-utils.c (gdbpy_convert_exception): Update. * printcmd.c (do_one_display, print_variable_and_value): Update. * mi/mi-main.c (mi_print_exception): Update. * mi/mi-interp.c (mi_cmd_interpreter_exec): Use SCOPE_EXIT. * mi/mi-cmd-stack.c (list_arg_or_local): Update. * linux-nat.c (linux_nat_target::attach): Update. * linux-fork.c (class scoped_switch_fork_info): Update. * infrun.c (displaced_step_prepare): Update. * infcall.c (call_function_by_hand_dummy): Update. * guile/scm-exception.c (gdbscm_scm_from_gdb_exception): Update. * gnu-v3-abi.c (print_one_vtable): Update. * frame.c (get_prev_frame_always): Update. * f-valprint.c (info_common_command_for_block): Update. * exec.c (try_open_exec_file): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Update. * dwarf2-frame.c (dwarf2_build_frame_info): Update. * dwarf-index-cache.c (index_cache::store) (index_cache::lookup_gdb_index): Update. * darwin-nat.c (maybe_cache_shell): Update. * cp-valprint.c (cp_print_value_fields): Update. * compile/compile-cplus-symbols.c (gcc_cplus_convert_symbol) (gcc_cplus_symbol_address): Update. * compile/compile-c-symbols.c (gcc_convert_symbol) (gcc_symbol_address, generate_c_for_for_one_variable): Update. * common/selftest.c: Update. * common/common-exceptions.h (struct gdb_exception) <message>: Now a std::string. (exception_try_scope_entry, exception_try_scope_exit): Don't declare. (struct exception_try_scope): Remove. (TRY): Don't use exception_try_scope. (struct gdb_exception): Add constructor, operator=. <what>: New method. (struct gdb_exception_RETURN_MASK_ALL) (struct gdb_exception_RETURN_MASK_ERROR) (struct gdb_exception_RETURN_MASK_QUIT): Add constructor. (struct gdb_quit_bad_alloc): Update. * common/common-exceptions.c (exception_none): Change initializer. (struct catcher) <state, exception>: Initialize inline. <prev>: Remove member. (current_catcher): Remove. (catchers): New global. (exceptions_state_mc_init): Simplify. (catcher_pop): Remove. (exceptions_state_mc, exceptions_state_mc_catch): Update. (try_scope_depth, exception_try_scope_entry) (exception_try_scope_exit): Remove. (throw_exception_sjlj): Update. (exception_messages, exception_messages_size): Remove. (throw_it): Simplify. (gdb_exception_sliced_copy): Remove. (throw_exception_cxx): Update. * cli/cli-script.c (script_from_file): Update. * breakpoint.c (insert_bp_location, update_breakpoint_locations): Update. * ada-valprint.c (ada_val_print): Update. * ada-lang.c (ada_to_fixed_type_1, ada_exception_name_addr) (create_excep_cond_exprs): Update. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * server.c (handle_btrace_general_set, handle_qxfer_btrace) (handle_qxfer_btrace_conf, detach_or_kill_for_exit_cleanup) (captured_main, main): Update. * gdbreplay.c (main): Update.
2019-01-28 18:11:10 +01:00
error_string = m_error.what ();
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
else if (status == XML_STATUS_ERROR)
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
enum XML_Error err = XML_GetErrorCode (m_expat_parser);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
error_string = XML_ErrorString (err);
}
else
{
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
gdb_assert (m_error.reason < 0);
Make exception handling more efficient This makes exception handling more efficient in a few spots, through the use of const- and rvalue-references. I wrote this patch by commenting out the gdb_exception copy constructor and then examining the resulting error messages one by one, introducing the use of std::move where appropriate. gdb/ChangeLog 2019-04-25 Tom Tromey <tromey@adacore.com> * xml-support.c (struct gdb_xml_parser) <set_error>: Take an rvalue reference. (gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper) (gdb_xml_parser::parse): Use std::move. * python/python-internal.h (gdbpy_convert_exception): Take a const reference. * python/py-value.c (valpy_getitem, valpy_nonzero): Use std::move. * python/py-utils.c (gdbpy_convert_exception): Take a const reference. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Use std::move. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Use std::move. * mi/mi-main.c (mi_print_exception): Take a const reference. * main.c (handle_command_errors): Take a const reference. * linespec.c (parse_linespec): Use std::move. * infcall.c (run_inferior_call): Use std::move. (call_function_by_hand_dummy): Use std::move. * exec.c (try_open_exec_file): Use std::move. * exceptions.h (exception_print, exception_fprintf) (exception_print_same): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Change parameters to const reference. * event-top.c (gdb_rl_callback_read_char_wrapper): Update. * common/new-op.c: Use std::move. * common/common-exceptions.h (struct gdb_exception): Add move constructor. (struct gdb_exception_error, struct gdb_exception_quit, struct gdb_quit_bad_alloc): Change constructor to move constructor. (throw_exception): Change parameter to rvalue reference. * common/common-exceptions.c (throw_exception): Take rvalue reference. * cli/cli-interp.c (safe_execute_command): Use std::move. * breakpoint.c (insert_bp_location, location_to_sals): Use std::move.
2019-04-24 14:50:06 +02:00
throw_exception (std::move (m_error));
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
}
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (m_last_line != 0)
warning (_("while parsing %s (at line %d): %s"), m_name,
m_last_line, error_string);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
else
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
warning (_("while parsing %s: %s"), m_name, error_string);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
return -1;
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
}
int
gdb_xml_parse_quick (const char *name, const char *dtd_name,
const struct gdb_xml_element *elements,
const char *document, void *user_data)
{
gdb_xml_parser parser (name, elements, user_data);
if (dtd_name != NULL)
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser.use_dtd (dtd_name);
return parser.parse (document);
}
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
/* Parse a field VALSTR that we expect to contain an integer value.
The integer is returned in *VALP. The string is parsed with an
equivalent to strtoul.
Returns 0 for success, -1 for error. */
static int
xml_parse_unsigned_integer (const char *valstr, ULONGEST *valp)
{
const char *endptr;
ULONGEST result;
if (*valstr == '\0')
return -1;
result = strtoulst (valstr, &endptr, 0);
if (*endptr != '\0')
return -1;
*valp = result;
return 0;
}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Parse an integer string into a ULONGEST and return it, or call
gdb_xml_error if it could not be parsed. */
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
ULONGEST
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_parse_ulongest (struct gdb_xml_parser *parser, const char *value)
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
{
ULONGEST result;
if (xml_parse_unsigned_integer (value, &result) != 0)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
gdb_xml_error (parser, _("Can't convert \"%s\" to an integer"), value);
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
return result;
}
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Parse an integer attribute into a ULONGEST. */
void *
gdb_xml_parse_attr_ulongest (struct gdb_xml_parser *parser,
const struct gdb_xml_attribute *attribute,
const char *value)
{
ULONGEST result;
void *ret;
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
if (xml_parse_unsigned_integer (value, &result) != 0)
gdb_xml_error (parser, _("Can't convert %s=\"%s\" to an integer"),
attribute->name, value);
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
Replace some xmalloc-family functions with XNEW-family ones This patch is part of the make-gdb-buildable-in-C++ effort. The idea is to change some calls to the xmalloc family of functions to calls to the equivalents in the XNEW family. This avoids adding an explicit cast, so it keeps the code a bit more readable. Some of them also map relatively well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be possible to do scripted replacements if needed. I only changed calls that were obviously allocating memory for one or multiple "objects". Allocation of variable sizes (such as strings or buffer handling) will be for later (and won't use XNEW). - xmalloc (sizeof (struct foo)) -> XNEW (struct foo) - xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num) - xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo) - xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num) - xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num) - obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo) - obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num) - alloca (sizeof (struct foo)) -> XALLOCA (struct foo) - alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num) Some instances of xmalloc followed by memset to zero the buffer were replaced by XCNEW or XCNEWVEC. I regtested on x86-64, Ubuntu 14.04, but the patch touches many architecture-specific files. For those I'll have to rely on the buildbot or people complaining that I broke their gdb. gdb/ChangeLog: * aarch64-linux-nat.c (aarch64_add_process): Likewise. * aarch64-tdep.c (aarch64_gdbarch_init): Likewise. * ada-exp.y (write_ambiguous_var): Likewise. * ada-lang.c (resolve_subexp): Likewise. (user_select_syms): Likewise. (assign_aggregate): Likewise. (ada_evaluate_subexp): Likewise. (cache_symbol): Likewise. * addrmap.c (allocate_key): Likewise. (addrmap_create_mutable): Likewise. * aix-thread.c (sync_threadlists): Likewise. * alpha-tdep.c (alpha_push_dummy_call): Likewise. (alpha_gdbarch_init): Likewise. * amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise. * arm-linux-nat.c (arm_linux_add_process): Likewise. * arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise. * arm-tdep.c (push_stack_item): Likewise. (arm_displaced_step_copy_insn): Likewise. (arm_gdbarch_init): Likewise. (_initialize_arm_tdep): Likewise. * avr-tdep.c (push_stack_item): Likewise. * ax-general.c (new_agent_expr): Likewise. * block.c (block_initialize_namespace): Likewise. * breakpoint.c (alloc_counted_command_line): Likewise. (update_dprintf_command_list): Likewise. (parse_breakpoint_sals): Likewise. (decode_static_tracepoint_spec): Likewise. (until_break_command): Likewise. (clear_command): Likewise. (update_global_location_list): Likewise. (get_breakpoint_objfile_data) Likewise. * btrace.c (ftrace_new_function): Likewise. (btrace_set_insn_history): Likewise. (btrace_set_call_history): Likewise. * buildsym.c (add_symbol_to_list): Likewise. (record_pending_block): Likewise. (start_subfile): Likewise. (start_buildsym_compunit): Likewise. (push_subfile): Likewise. (end_symtab_get_static_block): Likewise. (buildsym_init): Likewise. * cli/cli-cmds.c (source_command): Likewise. * cli/cli-decode.c (add_cmd): Likewise. * cli/cli-script.c (build_command_line): Likewise. (setup_user_args): Likewise. (realloc_body_list): Likewise. (process_next_line): Likewise. (copy_command_lines): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (read_pe_exported_syms): Likewise. * coffread.c (coff_locate_sections): Likewise. (coff_symtab_read): Likewise. (coff_read_struct_type): Likewise. * common/cleanups.c (make_my_cleanup2): Likewise. * common/common-exceptions.c (throw_it): Likewise. * common/filestuff.c (make_cleanup_close): Likewise. * common/format.c (parse_format_string): Likewise. * common/queue.h (DEFINE_QUEUE_P): Likewise. * compile/compile-object-load.c (munmap_list_add): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * compile/compile.c (append_args): Likewise. * corefile.c (specify_exec_file_hook): Likewise. * cp-support.c (make_symbol_overload_list): Likewise. * cris-tdep.c (push_stack_item): Likewise. (cris_gdbarch_init): Likewise. * ctf.c (ctf_trace_file_writer_new): Likewise. * dbxread.c (init_header_files): Likewise. (add_new_header_file): Likewise. (init_bincl_list): Likewise. (dbx_end_psymtab): Likewise. (start_psymtab): Likewise. (dbx_end_psymtab): Likewise. * dcache.c (dcache_init): Likewise. * dictionary.c (dict_create_hashed): Likewise. (dict_create_hashed_expandable): Likewise. (dict_create_linear): Likewise. (dict_create_linear_expandable): Likewise. * dtrace-probe.c (dtrace_process_dof_probe): Likewise. * dummy-frame.c (register_dummy_frame_dtor): Likewise. * dwarf2-frame-tailcall.c (cache_new_ref1): Likewise. * dwarf2-frame.c (dwarf2_build_frame_info): Likewise. (decode_frame_entry_1): Likewise. * dwarf2expr.c (new_dwarf_expr_context): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. * dwarf2read.c (dwarf2_has_info): Likewise. (create_signatured_type_table_from_index): Likewise. (dwarf2_read_index): Likewise. (dw2_get_file_names_reader): Likewise. (create_all_type_units): Likewise. (read_cutu_die_from_dwo): Likewise. (init_tu_and_read_dwo_dies): Likewise. (init_cutu_and_read_dies): Likewise. (create_all_comp_units): Likewise. (queue_comp_unit): Likewise. (inherit_abstract_dies): Likewise. (read_call_site_scope): Likewise. (dwarf2_add_field): Likewise. (dwarf2_add_typedef): Likewise. (dwarf2_add_member_fn): Likewise. (attr_to_dynamic_prop): Likewise. (abbrev_table_alloc_abbrev): Likewise. (abbrev_table_read_table): Likewise. (add_include_dir): Likewise. (add_file_name): Likewise. (dwarf_decode_line_header): Likewise. (dwarf2_const_value_attr): Likewise. (dwarf_alloc_block): Likewise. (parse_macro_definition): Likewise. (set_die_type): Likewise. (write_psymtabs_to_index): Likewise. (create_cus_from_index): Likewise. (dwarf2_create_include_psymtab): Likewise. (process_psymtab_comp_unit_reader): Likewise. (build_type_psymtab_dependencies): Likewise. (read_comp_units_from_section): Likewise. (compute_compunit_symtab_includes): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (load_partial_dies): Likewise. (dwarf2_symbol_mark_computed): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_read_minimal_symbols): Likewise. * environ.c (make_environ): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * event-loop.c (create_file_handler): Likewise. (create_async_signal_handler): Likewise. (create_async_event_handler): Likewise. (create_timer): Likewise. * exec.c (build_section_table): Likewise. * fbsd-nat.c (fbsd_remember_child): Likewise. * fork-child.c (fork_inferior): Likewise. * frv-tdep.c (new_variant): Likewise. * gdbarch.sh (gdbarch_alloc): Likewise. (append_name): Likewise. * gdbtypes.c (rank_function): Likewise. (copy_type_recursive): Likewise. (add_dyn_prop): Likewise. * gnu-nat.c (make_proc): Likewise. (make_inf): Likewise. (gnu_write_inferior): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise. (build_std_type_info_type): Likewise. * guile/scm-param.c (compute_enum_list): Likewise. * guile/scm-utils.c (gdbscm_parse_function_args): Likewise. * guile/scm-value.c (gdbscm_value_call): Likewise. * h8300-tdep.c (h8300_gdbarch_init): Likewise. * hppa-tdep.c (hppa_init_objfile_priv_data): Likewise. (read_unwind_info): Likewise. * ia64-tdep.c (ia64_gdbarch_init): Likewise. * infcall.c (dummy_frame_context_saver_setup): Likewise. (call_function_by_hand_dummy): Likewise. * infcmd.c (step_once): Likewise. (finish_forward): Likewise. (attach_command): Likewise. (notice_new_inferior): Likewise. * inferior.c (add_inferior_silent): Likewise. * infrun.c (add_displaced_stepping_state): Likewise. (save_infcall_control_state): Likewise. (save_inferior_ptid): Likewise. (_initialize_infrun): Likewise. * jit.c (bfd_open_from_target_memory): Likewise. (jit_gdbarch_data_init): Likewise. * language.c (add_language): Likewise. * linespec.c (decode_line_2): Likewise. * linux-nat.c (add_to_pid_list): Likewise. (add_initial_lwp): Likewise. * linux-thread-db.c (add_thread_db_info): Likewise. (record_thread): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_gdbarch_init): Likewise. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * m68k-tdep.c (m68k_gdbarch_init): Likewise. * m88k-tdep.c (m88k_analyze_prologue): Likewise. * macrocmd.c (macro_define_command): Likewise. * macroexp.c (gather_arguments): Likewise. * macroscope.c (sal_macro_scope): Likewise. * macrotab.c (new_macro_table): Likewise. * mdebugread.c (push_parse_stack): Likewise. (parse_partial_symbols): Likewise. (parse_symbol): Likewise. (psymtab_to_symtab_1): Likewise. (new_block): Likewise. (new_psymtab): Likewise. (mdebug_build_psymtabs): Likewise. (add_pending): Likewise. (elfmdebug_build_psymtabs): Likewise. * mep-tdep.c (mep_gdbarch_init): Likewise. * mi/mi-main.c (mi_execute_command): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. * minidebug.c (lzma_open): Likewise. * minsyms.c (terminate_minimal_symbol_table): Likewise. * mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * mt-tdep.c (mt_registers_info): Likewise. * nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise. * nat/linux-btrace.c (linux_enable_bts): Likewise. (linux_enable_pt): Likewise. * nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise. (linux_xfer_osdata_processgroups): Likewise. * nios2-tdep.c (nios2_gdbarch_init): Likewise. * nto-procfs.c (procfs_meminfo): Likewise. * objc-lang.c (start_msglist): Likewise. (selectors_info): Likewise. (classes_info): Likewise. (find_methods): Likewise. * objfiles.c (allocate_objfile): Likewise. (update_section_map): Likewise. * osabi.c (gdbarch_register_osabi): Likewise. (gdbarch_register_osabi_sniffer): Likewise. * parse.c (start_arglist): Likewise. * ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise. (hwdebug_insert_point): Likewise. * printcmd.c (display_command): Likewise. (ui_printf): Likewise. * procfs.c (create_procinfo): Likewise. (load_syscalls): Likewise. (proc_get_LDT_entry): Likewise. (proc_update_threads): Likewise. * prologue-value.c (make_pv_area): Likewise. (pv_area_store): Likewise. * psymtab.c (extend_psymbol_list): Likewise. (init_psymbol_list): Likewise. (allocate_psymtab): Likewise. * python/py-inferior.c (add_thread_object): Likewise. * python/py-param.c (compute_enum_values): Likewise. * python/py-value.c (valpy_call): Likewise. * python/py-varobj.c (py_varobj_iter_next): Likewise. * python/python.c (ensure_python_env): Likewise. * record-btrace.c (record_btrace_start_replaying): Likewise. * record-full.c (record_full_reg_alloc): Likewise. (record_full_mem_alloc): Likewise. (record_full_end_alloc): Likewise. (record_full_core_xfer_partial): Likewise. * regcache.c (get_thread_arch_aspace_regcache): Likewise. * remote-fileio.c (remote_fileio_init_fd_map): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (demand_private_info): Likewise. (remote_notif_stop_alloc_reply): Likewise. (remote_enable_btrace): Likewise. * reverse.c (save_bookmark_command): Likewise. * rl78-tdep.c (rl78_gdbarch_init): Likewise. * rx-tdep.c (rx_gdbarch_init): Likewise. * s390-linux-nat.c (s390_insert_watchpoint): Likewise. * ser-go32.c (dos_get_tty_state): Likewise. (dos_copy_tty_state): Likewise. * ser-mingw.c (ser_windows_open): Likewise. (ser_console_wait_handle): Likewise. (ser_console_get_tty_state): Likewise. (make_pipe_state): Likewise. (net_windows_open): Likewise. * ser-unix.c (hardwire_get_tty_state): Likewise. (hardwire_copy_tty_state): Likewise. * solib-aix.c (solib_aix_new_lm_info): Likewise. * solib-dsbt.c (dsbt_current_sos): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (frv_current_sos): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_bfd_fopen): Likewise. * solib-svr4.c (lm_info_read): Likewise. (svr4_copy_library_list): Likewise. (svr4_default_sos): Likewise. * source.c (find_source_lines): Likewise. (line_info): Likewise. (add_substitute_path_rule): Likewise. * spu-linux-nat.c (spu_bfd_open): Likewise. * spu-tdep.c (info_spu_dma_cmdlist): Likewise. * stabsread.c (dbx_lookup_type): Likewise. (read_type): Likewise. (read_member_functions): Likewise. (read_struct_fields): Likewise. (read_baseclasses): Likewise. (read_args): Likewise. (_initialize_stabsread): Likewise. * stack.c (func_command): Likewise. * stap-probe.c (handle_stap_probe): Likewise. * symfile.c (addrs_section_sort): Likewise. (addr_info_make_relative): Likewise. (load_section_callback): Likewise. (add_symbol_file_command): Likewise. (init_filename_language_table): Likewise. * symtab.c (create_filename_seen_cache): Likewise. (sort_search_symbols_remove_dups): Likewise. (search_symbols): Likewise. * target.c (make_cleanup_restore_target_terminal): Likewise. * thread.c (new_thread): Likewise. (enable_thread_stack_temporaries): Likewise. (make_cleanup_restore_current_thread): Likewise. (thread_apply_all_command): Likewise. * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. * top.c (gdb_readline_wrapper): Likewise. * tracefile-tfile.c (tfile_trace_file_writer_new): Likewise. * tracepoint.c (trace_find_line_command): Likewise. (all_tracepoint_actions_and_cleanup): Likewise. (make_cleanup_restore_current_traceframe): Likewise. (get_uploaded_tp): Likewise. (get_uploaded_tsv): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_alloc_content): Likewise. (tui_add_content_elements): Likewise. * tui/tui-disasm.c (tui_find_disassembly_address): Likewise. (tui_set_disassem_content): Likewise. * ui-file.c (ui_file_new): Likewise. (stdio_file_new): Likewise. (tee_file_new): Likewise. * utils.c (make_cleanup_restore_integer): Likewise. (add_internal_problem_command): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise. * valops.c (find_oload_champ): Likewise. * value.c (allocate_value_lazy): Likewise. (record_latest_value): Likewise. (create_internalvar): Likewise. * varobj.c (install_variable): Likewise. (new_variable): Likewise. (new_root_variable): Likewise. (cppush): Likewise. (_initialize_varobj): Likewise. * windows-nat.c (windows_make_so): Likewise. * x86-nat.c (x86_add_process): Likewise. * xcoffread.c (arrange_linetable): Likewise. (allocate_include_entry): Likewise. (process_linenos): Likewise. (SYMBOL_DUP): Likewise. (xcoff_start_psymtab): Likewise. (xcoff_end_psymtab): Likewise. * xml-support.c (gdb_xml_parse_attr_ulongest): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Likewise. (compile_bytecodes): Likewise. * dll.c (loaded_dll): Likewise. * event-loop.c (append_callback_event): Likewise. (create_file_handler): Likewise. (create_file_event): Likewise. * hostio.c (handle_open): Likewise. * inferiors.c (add_thread): Likewise. (add_process): Likewise. * linux-aarch64-low.c (aarch64_linux_new_process): Likewise. * linux-arm-low.c (arm_new_process): Likewise. (arm_new_thread): Likewise. * linux-low.c (add_to_pid_list): Likewise. (linux_add_process): Likewise. (handle_extended_wait): Likewise. (add_lwp): Likewise. (enqueue_one_deferred_signal): Likewise. (enqueue_pending_signal): Likewise. (linux_resume_one_lwp_throw): Likewise. (linux_resume_one_thread): Likewise. (linux_read_memory): Likewise. (linux_write_memory): Likewise. * linux-mips-low.c (mips_linux_new_process): Likewise. (mips_linux_new_thread): Likewise. (mips_add_watchpoint): Likewise. * linux-x86-low.c (initialize_low_arch): Likewise. * lynx-low.c (lynx_add_process): Likewise. * mem-break.c (set_raw_breakpoint_at): Likewise. (set_breakpoint): Likewise. (add_condition_to_breakpoint): Likewise. (add_commands_to_breakpoint): Likewise. (clone_agent_expr): Likewise. (clone_one_breakpoint): Likewise. * regcache.c (new_register_cache): Likewise. * remote-utils.c (look_up_one_symbol): Likewise. * server.c (queue_stop_reply): Likewise. (start_inferior): Likewise. (queue_stop_reply_callback): Likewise. (handle_target_event): Likewise. * spu-low.c (fetch_ppc_memory): Likewise. (store_ppc_memory): Likewise. * target.c (set_target_ops): Likewise. * thread-db.c (thread_db_load_search): Likewise. (try_thread_db_load_1): Likewise. * tracepoint.c (add_tracepoint): Likewise. (add_tracepoint_action): Likewise. (create_trace_state_variable): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtro): Likewise. (add_while_stepping_state): Likewise. * win32-low.c (child_add_thread): Likewise. (get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
ret = XNEW (ULONGEST);
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
memcpy (ret, &result, sizeof (result));
return ret;
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
/* A handler_data for yes/no boolean values. */
const struct gdb_xml_enum gdb_xml_enums_boolean[] = {
{ "yes", 1 },
{ "no", 0 },
{ NULL, 0 }
};
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
/* Map NAME to VALUE. A struct gdb_xml_enum * should be saved as the
value of handler_data when using gdb_xml_parse_attr_enum to parse a
fixed list of possible strings. The list is terminated by an entry
with NAME == NULL. */
void *
gdb_xml_parse_attr_enum (struct gdb_xml_parser *parser,
const struct gdb_xml_attribute *attribute,
const char *value)
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
const struct gdb_xml_enum *enums
= (const struct gdb_xml_enum *) attribute->handler_data;
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
void *ret;
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
for (enums = (const struct gdb_xml_enum *) attribute->handler_data;
enums->name != NULL; enums++)
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
if (strcasecmp (enums->name, value) == 0)
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
break;
if (enums->name == NULL)
gdb_xml_error (parser, _("Unknown attribute value %s=\"%s\""),
attribute->name, value);
ret = xmalloc (sizeof (enums->value));
memcpy (ret, &enums->value, sizeof (enums->value));
return ret;
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
}
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* XInclude processing. This is done as a separate step from actually
parsing the document, so that we can produce a single combined XML
document - e.g. to hand to a front end or to simplify comparing two
documents. We make extensive use of XML_DefaultCurrent, to pass
input text directly into the output without reformatting or
requoting it.
We output the DOCTYPE declaration for the first document unchanged,
if present, and discard DOCTYPEs from included documents. Only the
one we pass through here is used when we feed the result back to
expat. The XInclude standard explicitly does not discuss
validation of the result; we choose to apply the same DTD applied
to the outermost document.
We can not simply include the external DTD subset in the document
as an internal subset, because <!IGNORE> and <!INCLUDE> are valid
only in external subsets. But if we do not pass the DTD into the
output at all, default values will not be filled in.
We don't pass through any <?xml> declaration because we generate
UTF-8, not whatever the input encoding was. */
struct xinclude_parsing_data
{
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
xinclude_parsing_data (std::string &output_,
xml_fetch_another fetcher_, void *fetcher_baton_,
int include_depth_)
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
: output (output_),
skip_depth (0),
include_depth (include_depth_),
fetcher (fetcher_),
fetcher_baton (fetcher_baton_)
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
{}
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
/* Where the output goes. */
std::string &output;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* A count indicating whether we are in an element whose
children should not be copied to the output, and if so,
how deep we are nested. This is used for anything inside
an xi:include, and for the DTD. */
int skip_depth;
/* The number of <xi:include> elements currently being processed,
to detect loops. */
int include_depth;
/* A function to call to obtain additional features, and its
baton. */
xml_fetch_another fetcher;
void *fetcher_baton;
};
static void
xinclude_start_include (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
void *user_data,
std::vector<gdb_xml_value> &attributes)
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct xinclude_parsing_data *data
= (struct xinclude_parsing_data *) user_data;
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
char *href = (char *) xml_find_attribute (attributes, "href")->value.get ();
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_debug (parser, _("Processing XInclude of \"%s\""), href);
if (data->include_depth > MAX_XINCLUDE_DEPTH)
gdb_xml_error (parser, _("Maximum XInclude depth (%d) exceeded"),
MAX_XINCLUDE_DEPTH);
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
gdb::optional<gdb::char_vector> text
= data->fetcher (href, data->fetcher_baton);
if (!text)
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_error (parser, _("Could not load XML document \"%s\""), href);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (!xml_process_xincludes (data->output, parser->name (),
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
text->data (), data->fetcher,
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
data->fetcher_baton,
data->include_depth + 1))
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_error (parser, _("Parsing \"%s\" failed"), href);
data->skip_depth++;
}
static void
xinclude_end_include (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, const char *body_text)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct xinclude_parsing_data *data
= (struct xinclude_parsing_data *) user_data;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
data->skip_depth--;
}
static void XMLCALL
xml_xinclude_default (void *data_, const XML_Char *s, int len)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct gdb_xml_parser *parser = (struct gdb_xml_parser *) data_;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
xinclude_parsing_data *data = (xinclude_parsing_data *) parser->user_data ();
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* If we are inside of e.g. xi:include or the DTD, don't save this
string. */
if (data->skip_depth)
return;
/* Otherwise just add it to the end of the document we're building
up. */
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
data->output.append (s, len);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
}
static void XMLCALL
xml_xinclude_start_doctype (void *data_, const XML_Char *doctypeName,
const XML_Char *sysid, const XML_Char *pubid,
int has_internal_subset)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct gdb_xml_parser *parser = (struct gdb_xml_parser *) data_;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
xinclude_parsing_data *data = (xinclude_parsing_data *) parser->user_data ();
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* Don't print out the doctype, or the contents of the DTD internal
subset, if any. */
data->skip_depth++;
}
static void XMLCALL
xml_xinclude_end_doctype (void *data_)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
struct gdb_xml_parser *parser = (struct gdb_xml_parser *) data_;
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
xinclude_parsing_data *data = (xinclude_parsing_data *) parser->user_data ();
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
data->skip_depth--;
}
static void XMLCALL
xml_xinclude_xml_decl (void *data_, const XML_Char *version,
const XML_Char *encoding, int standalone)
{
/* Do nothing - this function prevents the default handler from
being called, thus suppressing the XML declaration from the
output. */
}
const struct gdb_xml_attribute xinclude_attributes[] = {
{ "href", GDB_XML_AF_NONE, NULL, NULL },
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
};
const struct gdb_xml_element xinclude_elements[] = {
{ "http://www.w3.org/2001/XInclude!include", xinclude_attributes, NULL,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
xinclude_start_include, xinclude_end_include },
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
};
/* The main entry point for <xi:include> processing. */
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
bool
xml_process_xincludes (std::string &result,
const char *name, const char *text,
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
xml_fetch_another fetcher, void *fetcher_baton,
int depth)
{
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
xinclude_parsing_data data (result, fetcher, fetcher_baton, depth);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_parser parser (name, xinclude_elements, &data);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser.set_is_xinclude (true);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetCharacterDataHandler (parser.expat_parser (), NULL);
XML_SetDefaultHandler (parser.expat_parser (), xml_xinclude_default);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* Always discard the XML version declarations; the only important
thing this provides is encoding, and our result will have been
converted to UTF-8. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetXmlDeclHandler (parser.expat_parser (), xml_xinclude_xml_decl);
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
if (depth > 0)
/* Discard the doctype for included documents. */
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
XML_SetDoctypeDeclHandler (parser.expat_parser (),
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
xml_xinclude_start_doctype,
xml_xinclude_end_doctype);
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
parser.use_dtd ("xinclude.dtd");
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
gdb_xml_parser: make data fields private and make more functions methods This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
2017-04-18 22:39:25 +02:00
if (parser.parse (text) == 0)
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
{
if (depth == 0)
gdb_xml_debug (&parser, _("XInclude processing succeeded."));
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
return true;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
}
xml-support.c: Use std::string for growing string buffer This main idea behind this patch is this change to xml-support.c:scope_level - /* Body text accumulation. This is an owning pointer. */ - struct obstack *body; + /* Body text accumulation. */ + std::string body; ... which allows simplifying other parts of the code. In target_fetch_description_xml, we want to distinguish between returning "success + empty std::string" and "no success", and gdb::optional is a natural fit for that. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_write_tdesc): Adjust to use gdb::optional<std::string>. * xml-support.c: Include <string>. (scope_level::scope_level(scope_level &&)) (scope_level::~scope_level): Delete. (scope_level::body): Now a std::string. (gdb_xml_body_text, gdb_xml_end_element): Adjust. (xinclude_parsing_data::xinclude_parsing_data): Add 'output' parameter. (xinclude_parsing_data::~xinclude_parsing_data): Delete. (xinclude_parsing_data::output): Now a std::string reference. (xinclude_start_include): Adjust. (xml_xinclude_default): Adjust. (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-support.h (xml_process_xincludes): Add 'output' parameter, and return bool. * xml-tdesc.c: Include <unordered_map> and <string>. (tdesc_xml_cache): Delete. (tdesc_xml_cache_s): Delete. (xml_cache): Now an std::unordered_map. (tdesc_parse_xml): Adjust to use std::string and unordered_map. (target_fetch_description_xml): Change return type to gdb::optional<std::string>, and adjust. * xml-tdesc.h: Include "common/gdb_optional.h" and <string>. (target_fetch_description_xml): Change return type to gdb::optional<std::string>.
2017-04-18 22:39:25 +02:00
return false;
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
}
#endif /* HAVE_LIBEXPAT */
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
/* Return an XML document which was compiled into GDB, from
the given FILENAME, or NULL if the file was not compiled in. */
const char *
fetch_xml_builtin (const char *filename)
{
const char *const (*p)[2];
* Makefile.in (XMLFILES): New. (COMMON_OBS): Add xml-builtin.o. (xml-builtin.c, stamp-xml): New rules. (xml-tdesc.o): Update. * features/feature_to_c.sh: New file. * xml-support.c (MAX_XINCLUDE_DEPTH): Define. (struct gdb_xml_parser): Add dtd_name and is_xinclude. (gdb_xml_start_element): Initialize scope after possibly reallocating scopes. Move cleanup later. Handle the XInclude description specially. (gdb_xml_end_element): Only parse the body if there is a current element. Call XML_DefaultCurrent if there is no element. (gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New. (struct xinclude_parsing_data, xinclude_start_include) (xinclude_end_include, xml_xinclude_default) (xml_xinclude_start_doctype, xml_xinclude_end_doctype) (xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes) (xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New. * xml-support.h (xml_fetch_another, xml_process_xincludes) (fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations. * xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument. Expand XInclude directives. Use the compiled in DTD. (fetch_xml_from_file): Add baton argument. Treat it as a containing directory name. Do not warn here. (file_read_description_xml): Update call. Warn here instead. Pass a dirname as baton. (fetch_available_features_from_target): New. (target_read_description_xml): Use it. * features/gdb-target.dtd: Add copyright notice. Use xinclude.dtd to handle XInclude. * features/xinclude.dtd: New file. * gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml, gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files. * gdb.texinfo (Target Description Format): Add section on XInclude.
2007-02-07 23:48:06 +01:00
for (p = xml_builtin; (*p)[0]; p++)
if (strcmp ((*p)[0], filename) == 0)
return (*p)[1];
return NULL;
}
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
/* 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;
}
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
static void
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
show_debug_xml (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
{
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
fprintf_filtered (file, _("XML debugging is %s.\n"), value);
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
}
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
gdb::optional<gdb::char_vector>
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
xml_fetch_content_from_file (const char *filename, void *baton)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
const char *dirname = (const char *) baton;
gdb_file_up file;
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
if (dirname && *dirname)
{
char *fullname = concat (dirname, "/", filename, (char *) NULL);
file = gdb_fopen_cloexec (fullname, FOPEN_RB);
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
xfree (fullname);
}
else
file = gdb_fopen_cloexec (filename, FOPEN_RB);
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
if (file == NULL)
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
return {};
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
/* Read in the whole file. */
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
size_t len;
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
if (fseek (file.get (), 0, SEEK_END) == -1)
perror_with_name (_("seek to end of file"));
len = ftell (file.get ());
rewind (file.get ());
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
gdb::char_vector text (len + 1);
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
if (fread (text.data (), 1, len, file.get ()) != len
|| ferror (file.get ()))
{
warning (_("Read error from \"%s\""), filename);
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
return {};
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
}
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
text.back () = '\0';
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
return text;
}
gdb: add back declarations for _initialize functions I'd like to enable the -Wmissing-declarations warning. However, it warns for every _initialize function, for example: CXX dcache.o /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’: /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations] _initialize_dcache (void) ^~~~~~~~~~~~~~~~~~ The only practical way forward I found is to add back the declarations, which were removed by this commit: commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9 Author: John Baldwin <jhb@FreeBSD.org> Date: Sat Sep 9 11:02:37 2017 -0700 Remove unnecessary function prototypes. I don't think it's a big problem to have the declarations for these functions, but if anybody has a better solution for this, I'll be happy to use it. gdb/ChangeLog: * aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration. * aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration. * aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration. * aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration. * aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration. * aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration. * ada-exp.y (_initialize_ada_exp): Add declaration. * ada-lang.c (_initialize_ada_language): Add declaration. * ada-tasks.c (_initialize_tasks): Add declaration. * agent.c (_initialize_agent): Add declaration. * aix-thread.c (_initialize_aix_thread): Add declaration. * alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration. * alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. * amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration. * amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration. * amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration. * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration. * amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration. * amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration. * amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration. * amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration. * amd64-tdep.c (_initialize_amd64_tdep): Add declaration. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration. * amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration. * annotate.c (_initialize_annotate): Add declaration. * arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration. * arc-tdep.c (_initialize_arc_tdep): Add declaration. * arch-utils.c (_initialize_gdbarch_utils): Add declaration. * arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration. * arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration. * arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration. * arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration. * arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration. * arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration. * arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration. * arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration. * auto-load.c (_initialize_auto_load): Add declaration. * auxv.c (_initialize_auxv): Add declaration. * avr-tdep.c (_initialize_avr_tdep): Add declaration. * ax-gdb.c (_initialize_ax_gdb): Add declaration. * bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration. * bfin-tdep.c (_initialize_bfin_tdep): Add declaration. * break-catch-sig.c (_initialize_break_catch_sig): Add declaration. * break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration. * break-catch-throw.c (_initialize_break_catch_throw): Add declaration. * breakpoint.c (_initialize_breakpoint): Add declaration. * bsd-uthread.c (_initialize_bsd_uthread): Add declaration. * btrace.c (_initialize_btrace): Add declaration. * charset.c (_initialize_charset): Add declaration. * cli/cli-cmds.c (_initialize_cli_cmds): Add declaration. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-logging.c (_initialize_cli_logging): Add declaration. * cli/cli-script.c (_initialize_cli_script): Add declaration. * cli/cli-style.c (_initialize_cli_style): Add declaration. * coff-pe-read.c (_initialize_coff_pe_read): Add declaration. * coffread.c (_initialize_coffread): Add declaration. * compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration. * compile/compile.c (_initialize_compile): Add declaration. * complaints.c (_initialize_complaints): Add declaration. * completer.c (_initialize_completer): Add declaration. * copying.c (_initialize_copying): Add declaration. * corefile.c (_initialize_core): Add declaration. * corelow.c (_initialize_corelow): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * cp-namespace.c (_initialize_cp_namespace): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-valprint.c (_initialize_cp_valprint): Add declaration. * cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration. * cris-tdep.c (_initialize_cris_tdep): Add declaration. * csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration. * csky-tdep.c (_initialize_csky_tdep): Add declaration. * ctfread.c (_initialize_ctfread): Add declaration. * d-lang.c (_initialize_d_language): Add declaration. * darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration. * darwin-nat.c (_initialize_darwin_nat): Add declaration. * dbxread.c (_initialize_dbxread): Add declaration. * dcache.c (_initialize_dcache): Add declaration. * disasm-selftests.c (_initialize_disasm_selftests): Add declaration. * disasm.c (_initialize_disasm): Add declaration. * dtrace-probe.c (_initialize_dtrace_probe): Add declaration. * dummy-frame.c (_initialize_dummy_frame): Add declaration. * dwarf-index-cache.c (_initialize_index_cache): Add declaration. * dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration. * dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration. * dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration. * dwarf2expr.c (_initialize_dwarf2expr): Add declaration. * dwarf2loc.c (_initialize_dwarf2loc): Add declaration. * dwarf2read.c (_initialize_dwarf2_read): Add declaration. * elfread.c (_initialize_elfread): Add declaration. * exec.c (_initialize_exec): Add declaration. * extension.c (_initialize_extension): Add declaration. * f-lang.c (_initialize_f_language): Add declaration. * f-valprint.c (_initialize_f_valprint): Add declaration. * fbsd-nat.c (_initialize_fbsd_nat): Add declaration. * fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration. * filesystem.c (_initialize_filesystem): Add declaration. * findcmd.c (_initialize_mem_search): Add declaration. * findvar.c (_initialize_findvar): Add declaration. * fork-child.c (_initialize_fork_child): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (_initialize_frame): Add declaration. * frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration. * frv-tdep.c (_initialize_frv_tdep): Add declaration. * ft32-tdep.c (_initialize_ft32_tdep): Add declaration. * gcore.c (_initialize_gcore): Add declaration. * gdb-demangle.c (_initialize_gdb_demangle): Add declaration. * gdb_bfd.c (_initialize_gdb_bfd): Add declaration. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration. * gdbarch.c (_initialize_gdbarch): Add declaration. * gdbtypes.c (_initialize_gdbtypes): Add declaration. * gnu-nat.c (_initialize_gnu_nat): Add declaration. * gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration. * gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration. * go-lang.c (_initialize_go_language): Add declaration. * go32-nat.c (_initialize_go32_nat): Add declaration. * guile/guile.c (_initialize_guile): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration. * hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration. * hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration. * hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration. * hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration. * hppa-tdep.c (_initialize_hppa_tdep): Add declaration. * i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration. * i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration. * i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration. * i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration. * i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration. * i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration. * i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration. * i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration. * i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration. * i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration. * i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration. * i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration. * i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration. * i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration. * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration. * i386-tdep.c (_initialize_i386_tdep): Add declaration. * i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration. * ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration. * ia64-tdep.c (_initialize_ia64_tdep): Add declaration. * ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration. * infcall.c (_initialize_infcall): Add declaration. * infcmd.c (_initialize_infcmd): Add declaration. * inflow.c (_initialize_inflow): Add declaration. * infrun.c (_initialize_infrun): Add declaration. * interps.c (_initialize_interpreter): Add declaration. * iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration. * jit.c (_initialize_jit): Add declaration. * language.c (_initialize_language): Add declaration. * linux-fork.c (_initialize_linux_fork): Add declaration. * linux-nat.c (_initialize_linux_nat): Add declaration. * linux-tdep.c (_initialize_linux_tdep): Add declaration. * linux-thread-db.c (_initialize_thread_db): Add declaration. * lm32-tdep.c (_initialize_lm32_tdep): Add declaration. * m2-lang.c (_initialize_m2_language): Add declaration. * m32c-tdep.c (_initialize_m32c_tdep): Add declaration. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration. * m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration. * m32r-tdep.c (_initialize_m32r_tdep): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. * m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration. * m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration. * m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration. * m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * machoread.c (_initialize_machoread): Add declaration. * macrocmd.c (_initialize_macrocmd): Add declaration. * macroscope.c (_initialize_macroscope): Add declaration. * maint-test-options.c (_initialize_maint_test_options): Add declaration. * maint-test-settings.c (_initialize_maint_test_settings): Add declaration. * maint.c (_initialize_maint_cmds): Add declaration. * mdebugread.c (_initialize_mdebugread): Add declaration. * memattr.c (_initialize_mem): Add declaration. * mep-tdep.c (_initialize_mep_tdep): Add declaration. * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration. * mi/mi-cmds.c (_initialize_mi_cmds): Add declaration. * mi/mi-interp.c (_initialize_mi_interp): Add declaration. * mi/mi-main.c (_initialize_mi_main): Add declaration. * microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration. * microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration. * mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration. * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration. * mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration. * mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration. * mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration. * mipsread.c (_initialize_mipsread): Add declaration. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration. * mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration. * moxie-tdep.c (_initialize_moxie_tdep): Add declaration. * msp430-tdep.c (_initialize_msp430_tdep): Add declaration. * nds32-tdep.c (_initialize_nds32_tdep): Add declaration. * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration. * nios2-tdep.c (_initialize_nios2_tdep): Add declaration. * nto-procfs.c (_initialize_procfs): Add declaration. * objc-lang.c (_initialize_objc_language): Add declaration. * observable.c (_initialize_observer): Add declaration. * opencl-lang.c (_initialize_opencl_language): Add declaration. * or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration. * or1k-tdep.c (_initialize_or1k_tdep): Add declaration. * osabi.c (_initialize_gdb_osabi): Add declaration. * osdata.c (_initialize_osdata): Add declaration. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * parse.c (_initialize_parse): Add declaration. * ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration. * ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration. * ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration. * ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration. * printcmd.c (_initialize_printcmd): Add declaration. * probe.c (_initialize_probe): Add declaration. * proc-api.c (_initialize_proc_api): Add declaration. * proc-events.c (_initialize_proc_events): Add declaration. * proc-service.c (_initialize_proc_service): Add declaration. * procfs.c (_initialize_procfs): Add declaration. * producer.c (_initialize_producer): Add declaration. * psymtab.c (_initialize_psymtab): Add declaration. * python/python.c (_initialize_python): Add declaration. * ravenscar-thread.c (_initialize_ravenscar): Add declaration. * record-btrace.c (_initialize_record_btrace): Add declaration. * record-full.c (_initialize_record_full): Add declaration. * record.c (_initialize_record): Add declaration. * regcache-dump.c (_initialize_regcache_dump): Add declaration. * regcache.c (_initialize_regcache): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * remote-notif.c (_initialize_notif): Add declaration. * remote-sim.c (_initialize_remote_sim): Add declaration. * remote.c (_initialize_remote): Add declaration. * reverse.c (_initialize_reverse): Add declaration. * riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration. * riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration. * riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration. * riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration. * riscv-tdep.c (_initialize_riscv_tdep): Add declaration. * rl78-tdep.c (_initialize_rl78_tdep): Add declaration. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration. * rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep): Add declaration. * rs6000-nat.c (_initialize_rs6000_nat): Add declaration. * rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration. * run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration. * rust-exp.y (_initialize_rust_exp): Add declaration. * rx-tdep.c (_initialize_rx_tdep): Add declaration. * s12z-tdep.c (_initialize_s12z_tdep): Add declaration. * s390-linux-nat.c (_initialize_s390_nat): Add declaration. * s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration. * s390-tdep.c (_initialize_s390_tdep): Add declaration. * score-tdep.c (_initialize_score_tdep): Add declaration. * ser-go32.c (_initialize_ser_dos): Add declaration. * ser-mingw.c (_initialize_ser_windows): Add declaration. * ser-pipe.c (_initialize_ser_pipe): Add declaration. * ser-tcp.c (_initialize_ser_tcp): Add declaration. * ser-uds.c (_initialize_ser_socket): Add declaration. * ser-unix.c (_initialize_ser_hardwire): Add declaration. * serial.c (_initialize_serial): Add declaration. * sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration. * sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration. * sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration. * sh-tdep.c (_initialize_sh_tdep): Add declaration. * skip.c (_initialize_step_skip): Add declaration. * sol-thread.c (_initialize_sol_thread): Add declaration. * solib-aix.c (_initialize_solib_aix): Add declaration. * solib-darwin.c (_initialize_darwin_solib): Add declaration. * solib-dsbt.c (_initialize_dsbt_solib): Add declaration. * solib-frv.c (_initialize_frv_solib): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib-target.c (_initialize_solib_target): Add declaration. * solib.c (_initialize_solib): Add declaration. * source-cache.c (_initialize_source_cache): Add declaration. * source.c (_initialize_source): Add declaration. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration. * sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration. * sparc-nat.c (_initialize_sparc_nat): Add declaration. * sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration. * sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration. * sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration. * sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration. * sparc-tdep.c (_initialize_sparc_tdep): Add declaration. * sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration. * sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration. * sparc64-nat.c (_initialize_sparc64_nat): Add declaration. * sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration. * sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration. * sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration. * sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration. * stabsread.c (_initialize_stabsread): Add declaration. * stack.c (_initialize_stack): Add declaration. * stap-probe.c (_initialize_stap_probe): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * symfile-debug.c (_initialize_symfile_debug): Add declaration. * symfile-mem.c (_initialize_symfile_mem): Add declaration. * symfile.c (_initialize_symfile): Add declaration. * symmisc.c (_initialize_symmisc): Add declaration. * symtab.c (_initialize_symtab): Add declaration. * target.c (_initialize_target): Add declaration. * target-connection.c (_initialize_target_connection): Add declaration. * target-dcache.c (_initialize_target_dcache): Add declaration. * target-descriptions.c (_initialize_target_descriptions): Add declaration. * thread.c (_initialize_thread): Add declaration. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration. * tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration. * tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration. * tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration. * tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration. * tracectf.c (_initialize_ctf): Add declaration. * tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration. * tracefile.c (_initialize_tracefile): Add declaration. * tracepoint.c (_initialize_tracepoint): Add declaration. * tui/tui-hooks.c (_initialize_tui_hooks): Add declaration. * tui/tui-interp.c (_initialize_tui_interp): Add declaration. * tui/tui-layout.c (_initialize_tui_layout): Add declaration. * tui/tui-regs.c (_initialize_tui_regs): Add declaration. * tui/tui-stack.c (_initialize_tui_stack): Add declaration. * tui/tui-win.c (_initialize_tui_win): Add declaration. * tui/tui.c (_initialize_tui): Add declaration. * typeprint.c (_initialize_typeprint): Add declaration. * ui-style.c (_initialize_ui_style): Add declaration. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration. * unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration. * unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration. * unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration. * unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration. * unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration. * unittests/filtered_iterator-selftests.c (_initialize_filtered_iterator_selftests): Add declaration. * unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration. * unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration. * unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration. * unittests/main-thread-selftests.c (_initialize_main_thread_selftests): Add declaration. * unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration. * unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration. * unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration. * unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration. * unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration. * unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration. * unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration. * unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration. * unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration. * unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration. * unittests/style-selftests.c (_initialize_style_selftest): Add declaration. * unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration. * unittests/tui-selftests.c (_initialize_tui_selftest): Add declaration. * unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration. * unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration. * unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration. * unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration. * user-regs.c (_initialize_user_regs): Add declaration. * utils.c (_initialize_utils): Add declaration. * v850-tdep.c (_initialize_v850_tdep): Add declaration. * valops.c (_initialize_valops): Add declaration. * valprint.c (_initialize_valprint): Add declaration. * value.c (_initialize_values): Add declaration. * varobj.c (_initialize_varobj): Add declaration. * vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * windows-nat.c (_initialize_windows_nat): Add declaration. (_initialize_check_for_gdb_ini): Add declaration. (_initialize_loadable): Add declaration. * windows-tdep.c (_initialize_windows_tdep): Add declaration. * x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration. * x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration. * xcoffread.c (_initialize_xcoffread): Add declaration. * xml-support.c (_initialize_xml_support): Add declaration. * xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration. * xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration. * xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration. Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 20:01:38 +01:00
void _initialize_xml_support ();
void _initialize_xml_support ();
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
void
gdb: add back declarations for _initialize functions I'd like to enable the -Wmissing-declarations warning. However, it warns for every _initialize function, for example: CXX dcache.o /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’: /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations] _initialize_dcache (void) ^~~~~~~~~~~~~~~~~~ The only practical way forward I found is to add back the declarations, which were removed by this commit: commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9 Author: John Baldwin <jhb@FreeBSD.org> Date: Sat Sep 9 11:02:37 2017 -0700 Remove unnecessary function prototypes. I don't think it's a big problem to have the declarations for these functions, but if anybody has a better solution for this, I'll be happy to use it. gdb/ChangeLog: * aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration. * aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration. * aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration. * aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration. * aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration. * aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration. * ada-exp.y (_initialize_ada_exp): Add declaration. * ada-lang.c (_initialize_ada_language): Add declaration. * ada-tasks.c (_initialize_tasks): Add declaration. * agent.c (_initialize_agent): Add declaration. * aix-thread.c (_initialize_aix_thread): Add declaration. * alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration. * alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. * amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration. * amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration. * amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration. * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration. * amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration. * amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration. * amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration. * amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration. * amd64-tdep.c (_initialize_amd64_tdep): Add declaration. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration. * amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration. * annotate.c (_initialize_annotate): Add declaration. * arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration. * arc-tdep.c (_initialize_arc_tdep): Add declaration. * arch-utils.c (_initialize_gdbarch_utils): Add declaration. * arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration. * arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration. * arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration. * arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration. * arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration. * arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration. * arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration. * arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration. * auto-load.c (_initialize_auto_load): Add declaration. * auxv.c (_initialize_auxv): Add declaration. * avr-tdep.c (_initialize_avr_tdep): Add declaration. * ax-gdb.c (_initialize_ax_gdb): Add declaration. * bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration. * bfin-tdep.c (_initialize_bfin_tdep): Add declaration. * break-catch-sig.c (_initialize_break_catch_sig): Add declaration. * break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration. * break-catch-throw.c (_initialize_break_catch_throw): Add declaration. * breakpoint.c (_initialize_breakpoint): Add declaration. * bsd-uthread.c (_initialize_bsd_uthread): Add declaration. * btrace.c (_initialize_btrace): Add declaration. * charset.c (_initialize_charset): Add declaration. * cli/cli-cmds.c (_initialize_cli_cmds): Add declaration. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-logging.c (_initialize_cli_logging): Add declaration. * cli/cli-script.c (_initialize_cli_script): Add declaration. * cli/cli-style.c (_initialize_cli_style): Add declaration. * coff-pe-read.c (_initialize_coff_pe_read): Add declaration. * coffread.c (_initialize_coffread): Add declaration. * compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration. * compile/compile.c (_initialize_compile): Add declaration. * complaints.c (_initialize_complaints): Add declaration. * completer.c (_initialize_completer): Add declaration. * copying.c (_initialize_copying): Add declaration. * corefile.c (_initialize_core): Add declaration. * corelow.c (_initialize_corelow): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * cp-namespace.c (_initialize_cp_namespace): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-valprint.c (_initialize_cp_valprint): Add declaration. * cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration. * cris-tdep.c (_initialize_cris_tdep): Add declaration. * csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration. * csky-tdep.c (_initialize_csky_tdep): Add declaration. * ctfread.c (_initialize_ctfread): Add declaration. * d-lang.c (_initialize_d_language): Add declaration. * darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration. * darwin-nat.c (_initialize_darwin_nat): Add declaration. * dbxread.c (_initialize_dbxread): Add declaration. * dcache.c (_initialize_dcache): Add declaration. * disasm-selftests.c (_initialize_disasm_selftests): Add declaration. * disasm.c (_initialize_disasm): Add declaration. * dtrace-probe.c (_initialize_dtrace_probe): Add declaration. * dummy-frame.c (_initialize_dummy_frame): Add declaration. * dwarf-index-cache.c (_initialize_index_cache): Add declaration. * dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration. * dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration. * dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration. * dwarf2expr.c (_initialize_dwarf2expr): Add declaration. * dwarf2loc.c (_initialize_dwarf2loc): Add declaration. * dwarf2read.c (_initialize_dwarf2_read): Add declaration. * elfread.c (_initialize_elfread): Add declaration. * exec.c (_initialize_exec): Add declaration. * extension.c (_initialize_extension): Add declaration. * f-lang.c (_initialize_f_language): Add declaration. * f-valprint.c (_initialize_f_valprint): Add declaration. * fbsd-nat.c (_initialize_fbsd_nat): Add declaration. * fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration. * filesystem.c (_initialize_filesystem): Add declaration. * findcmd.c (_initialize_mem_search): Add declaration. * findvar.c (_initialize_findvar): Add declaration. * fork-child.c (_initialize_fork_child): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (_initialize_frame): Add declaration. * frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration. * frv-tdep.c (_initialize_frv_tdep): Add declaration. * ft32-tdep.c (_initialize_ft32_tdep): Add declaration. * gcore.c (_initialize_gcore): Add declaration. * gdb-demangle.c (_initialize_gdb_demangle): Add declaration. * gdb_bfd.c (_initialize_gdb_bfd): Add declaration. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration. * gdbarch.c (_initialize_gdbarch): Add declaration. * gdbtypes.c (_initialize_gdbtypes): Add declaration. * gnu-nat.c (_initialize_gnu_nat): Add declaration. * gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration. * gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration. * go-lang.c (_initialize_go_language): Add declaration. * go32-nat.c (_initialize_go32_nat): Add declaration. * guile/guile.c (_initialize_guile): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration. * hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration. * hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration. * hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration. * hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration. * hppa-tdep.c (_initialize_hppa_tdep): Add declaration. * i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration. * i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration. * i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration. * i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration. * i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration. * i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration. * i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration. * i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration. * i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration. * i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration. * i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration. * i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration. * i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration. * i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration. * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration. * i386-tdep.c (_initialize_i386_tdep): Add declaration. * i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration. * ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration. * ia64-tdep.c (_initialize_ia64_tdep): Add declaration. * ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration. * infcall.c (_initialize_infcall): Add declaration. * infcmd.c (_initialize_infcmd): Add declaration. * inflow.c (_initialize_inflow): Add declaration. * infrun.c (_initialize_infrun): Add declaration. * interps.c (_initialize_interpreter): Add declaration. * iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration. * jit.c (_initialize_jit): Add declaration. * language.c (_initialize_language): Add declaration. * linux-fork.c (_initialize_linux_fork): Add declaration. * linux-nat.c (_initialize_linux_nat): Add declaration. * linux-tdep.c (_initialize_linux_tdep): Add declaration. * linux-thread-db.c (_initialize_thread_db): Add declaration. * lm32-tdep.c (_initialize_lm32_tdep): Add declaration. * m2-lang.c (_initialize_m2_language): Add declaration. * m32c-tdep.c (_initialize_m32c_tdep): Add declaration. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration. * m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration. * m32r-tdep.c (_initialize_m32r_tdep): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. * m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration. * m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration. * m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration. * m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * machoread.c (_initialize_machoread): Add declaration. * macrocmd.c (_initialize_macrocmd): Add declaration. * macroscope.c (_initialize_macroscope): Add declaration. * maint-test-options.c (_initialize_maint_test_options): Add declaration. * maint-test-settings.c (_initialize_maint_test_settings): Add declaration. * maint.c (_initialize_maint_cmds): Add declaration. * mdebugread.c (_initialize_mdebugread): Add declaration. * memattr.c (_initialize_mem): Add declaration. * mep-tdep.c (_initialize_mep_tdep): Add declaration. * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration. * mi/mi-cmds.c (_initialize_mi_cmds): Add declaration. * mi/mi-interp.c (_initialize_mi_interp): Add declaration. * mi/mi-main.c (_initialize_mi_main): Add declaration. * microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration. * microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration. * mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration. * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration. * mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration. * mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration. * mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration. * mipsread.c (_initialize_mipsread): Add declaration. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration. * mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration. * moxie-tdep.c (_initialize_moxie_tdep): Add declaration. * msp430-tdep.c (_initialize_msp430_tdep): Add declaration. * nds32-tdep.c (_initialize_nds32_tdep): Add declaration. * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration. * nios2-tdep.c (_initialize_nios2_tdep): Add declaration. * nto-procfs.c (_initialize_procfs): Add declaration. * objc-lang.c (_initialize_objc_language): Add declaration. * observable.c (_initialize_observer): Add declaration. * opencl-lang.c (_initialize_opencl_language): Add declaration. * or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration. * or1k-tdep.c (_initialize_or1k_tdep): Add declaration. * osabi.c (_initialize_gdb_osabi): Add declaration. * osdata.c (_initialize_osdata): Add declaration. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * parse.c (_initialize_parse): Add declaration. * ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration. * ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration. * ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration. * ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration. * printcmd.c (_initialize_printcmd): Add declaration. * probe.c (_initialize_probe): Add declaration. * proc-api.c (_initialize_proc_api): Add declaration. * proc-events.c (_initialize_proc_events): Add declaration. * proc-service.c (_initialize_proc_service): Add declaration. * procfs.c (_initialize_procfs): Add declaration. * producer.c (_initialize_producer): Add declaration. * psymtab.c (_initialize_psymtab): Add declaration. * python/python.c (_initialize_python): Add declaration. * ravenscar-thread.c (_initialize_ravenscar): Add declaration. * record-btrace.c (_initialize_record_btrace): Add declaration. * record-full.c (_initialize_record_full): Add declaration. * record.c (_initialize_record): Add declaration. * regcache-dump.c (_initialize_regcache_dump): Add declaration. * regcache.c (_initialize_regcache): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * remote-notif.c (_initialize_notif): Add declaration. * remote-sim.c (_initialize_remote_sim): Add declaration. * remote.c (_initialize_remote): Add declaration. * reverse.c (_initialize_reverse): Add declaration. * riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration. * riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration. * riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration. * riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration. * riscv-tdep.c (_initialize_riscv_tdep): Add declaration. * rl78-tdep.c (_initialize_rl78_tdep): Add declaration. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration. * rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep): Add declaration. * rs6000-nat.c (_initialize_rs6000_nat): Add declaration. * rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration. * run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration. * rust-exp.y (_initialize_rust_exp): Add declaration. * rx-tdep.c (_initialize_rx_tdep): Add declaration. * s12z-tdep.c (_initialize_s12z_tdep): Add declaration. * s390-linux-nat.c (_initialize_s390_nat): Add declaration. * s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration. * s390-tdep.c (_initialize_s390_tdep): Add declaration. * score-tdep.c (_initialize_score_tdep): Add declaration. * ser-go32.c (_initialize_ser_dos): Add declaration. * ser-mingw.c (_initialize_ser_windows): Add declaration. * ser-pipe.c (_initialize_ser_pipe): Add declaration. * ser-tcp.c (_initialize_ser_tcp): Add declaration. * ser-uds.c (_initialize_ser_socket): Add declaration. * ser-unix.c (_initialize_ser_hardwire): Add declaration. * serial.c (_initialize_serial): Add declaration. * sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration. * sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration. * sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration. * sh-tdep.c (_initialize_sh_tdep): Add declaration. * skip.c (_initialize_step_skip): Add declaration. * sol-thread.c (_initialize_sol_thread): Add declaration. * solib-aix.c (_initialize_solib_aix): Add declaration. * solib-darwin.c (_initialize_darwin_solib): Add declaration. * solib-dsbt.c (_initialize_dsbt_solib): Add declaration. * solib-frv.c (_initialize_frv_solib): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib-target.c (_initialize_solib_target): Add declaration. * solib.c (_initialize_solib): Add declaration. * source-cache.c (_initialize_source_cache): Add declaration. * source.c (_initialize_source): Add declaration. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration. * sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration. * sparc-nat.c (_initialize_sparc_nat): Add declaration. * sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration. * sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration. * sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration. * sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration. * sparc-tdep.c (_initialize_sparc_tdep): Add declaration. * sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration. * sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration. * sparc64-nat.c (_initialize_sparc64_nat): Add declaration. * sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration. * sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration. * sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration. * sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration. * stabsread.c (_initialize_stabsread): Add declaration. * stack.c (_initialize_stack): Add declaration. * stap-probe.c (_initialize_stap_probe): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * symfile-debug.c (_initialize_symfile_debug): Add declaration. * symfile-mem.c (_initialize_symfile_mem): Add declaration. * symfile.c (_initialize_symfile): Add declaration. * symmisc.c (_initialize_symmisc): Add declaration. * symtab.c (_initialize_symtab): Add declaration. * target.c (_initialize_target): Add declaration. * target-connection.c (_initialize_target_connection): Add declaration. * target-dcache.c (_initialize_target_dcache): Add declaration. * target-descriptions.c (_initialize_target_descriptions): Add declaration. * thread.c (_initialize_thread): Add declaration. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration. * tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration. * tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration. * tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration. * tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration. * tracectf.c (_initialize_ctf): Add declaration. * tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration. * tracefile.c (_initialize_tracefile): Add declaration. * tracepoint.c (_initialize_tracepoint): Add declaration. * tui/tui-hooks.c (_initialize_tui_hooks): Add declaration. * tui/tui-interp.c (_initialize_tui_interp): Add declaration. * tui/tui-layout.c (_initialize_tui_layout): Add declaration. * tui/tui-regs.c (_initialize_tui_regs): Add declaration. * tui/tui-stack.c (_initialize_tui_stack): Add declaration. * tui/tui-win.c (_initialize_tui_win): Add declaration. * tui/tui.c (_initialize_tui): Add declaration. * typeprint.c (_initialize_typeprint): Add declaration. * ui-style.c (_initialize_ui_style): Add declaration. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration. * unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration. * unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration. * unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration. * unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration. * unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration. * unittests/filtered_iterator-selftests.c (_initialize_filtered_iterator_selftests): Add declaration. * unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration. * unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration. * unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration. * unittests/main-thread-selftests.c (_initialize_main_thread_selftests): Add declaration. * unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration. * unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration. * unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration. * unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration. * unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration. * unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration. * unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration. * unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration. * unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration. * unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration. * unittests/style-selftests.c (_initialize_style_selftest): Add declaration. * unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration. * unittests/tui-selftests.c (_initialize_tui_selftest): Add declaration. * unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration. * unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration. * unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration. * unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration. * user-regs.c (_initialize_user_regs): Add declaration. * utils.c (_initialize_utils): Add declaration. * v850-tdep.c (_initialize_v850_tdep): Add declaration. * valops.c (_initialize_valops): Add declaration. * valprint.c (_initialize_valprint): Add declaration. * value.c (_initialize_values): Add declaration. * varobj.c (_initialize_varobj): Add declaration. * vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * windows-nat.c (_initialize_windows_nat): Add declaration. (_initialize_check_for_gdb_ini): Add declaration. (_initialize_loadable): Add declaration. * windows-tdep.c (_initialize_windows_tdep): Add declaration. * x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration. * x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration. * xcoffread.c (_initialize_xcoffread): Add declaration. * xml-support.c (_initialize_xml_support): Add declaration. * xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration. * xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration. * xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration. Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 20:01:38 +01:00
_initialize_xml_support ()
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
{
* memory-map.c (struct_memory_map_parsing_data): Remove most members. Make property_name an array. (free_memory_map_parsing_data, memory_map_start_element) (memory_map_end_element, memory_map_character_data): Delete. (memory_map_start_memory, memory_map_end_memory) (memory_map_start_property, memory_map_end_property): New functions. (property_attributes, memory_children, memory_type_enum) (memory_attributes, memory_map_children, memory_map_elements): New. (parse_memory_map): Rewrite. * xml-support.c (debug_xml): New. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, free_xml_parser, make_cleanup_free_xml_parser): Delete. (struct scope_level, struct gdb_xml_parser, gdb_xml_body_text) (gdb_xml_debug, gdb_xml_error, gdb_xml_values_cleanup) (gdb_xml_start_element, gdb_xml_start_element_wrapper) (gdb_xml_end_element, gdb_xml_end_element_wrapper, gdb_xml_cleanup) (gdb_xml_create_parser_and_cleanup, gdb_xml_parse) (gdb_xml_parse_ulongest, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, show_debug_xml, _initialize_xml_support): New. * xml-support.h (struct gdb_xml_value, gdb_xml_attribute_handler) (enum gdb_xml_attribute_flag, struct gdb_xml_attribute) (enum gdb_xml_element_flag, struct gdb_xml_element) (gdb_xml_element_start_handler, gdb_xml_element_end_handler) (struct gdb_xml_enum): New. (gdb_xml_create_parser_and_cleanup, gdb_xml_parse, gdb_xml_debug) (gdb_xml_error, gdb_xml_parse_attr_ulongest) (gdb_xml_parse_attr_enum, gdb_xml_parse_ulongest): New prototypes. (xml_get_required_attribute, xml_get_integer_attribute) (xml_get_enum_value, make_cleanup_free_xml_parser): Delete prototypes. * Makefile.in (xml_support_h, xml-support.o): Update. * gdb.texinfo (Debugging Output): Document "set debug xml" and "show debug xml".
2007-01-04 23:11:44 +01:00
add_setshow_boolean_cmd ("xml", class_maintenance, &debug_xml,
_("Set XML parser debugging."),
_("Show XML parser debugging."),
_("When set, debugging messages for XML parsers "
"are displayed."),
NULL, show_debug_xml,
&setdebuglist, &showdebuglist);
gdb/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * Makefile.in (SFILES): Add memory-map.c and xml-support.c. (memory_map_h, xml_support_h): New. (target_h): Add vec_h dependency. (COMMON_OBS): Add memory-map.o and xml-support.o. (memory-map.o, xml-support.o): New rules. (remote.o): Update. * exceptions.h (enum errors): Add XML_PARSE_ERROR. * infcmd.c (run_command_1, attach_command): Call target_pre_inferior. * memattr.c (default_mem_attrib): Initialize blocksize. (target_mem_region_list, mem_use_target) (target_mem_regions_valid, mem_region_cmp, mem_region_init) (require_user_regions, require_target_regions) (invalidate_target_mem_regions): New. (create_mem_region): Use mem_region_init. (mem_clear): Move higher. (lookup_mem_region): Use require_target_regions. (mem_command): Implement "mem auto". (mem_info_command): Handle target-supplied regions and flash attributes. (mem_enable_command, mem_disable_command, mem_delete_command): Use require_user_regions. (_initialize_mem): Mention "mem auto" in help. * memattr.h (enum mem_access_mode): Add MEM_FLASH. (struct mem_attrib): Add blocksize. (invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New prototypes. * remote.c: Include "memory-map.h". (PACKET_qXfer_memory_map): New enum value. (remote_protocol_features): Add qXfer:memory-map:read. (remote_xfer_partial): Handle memory maps. (remote_memory_map): New. (init_remote_ops, init_remote_async_ops): Set to_memory_map. (_initialize_remote): Register qXfer:memory-map:read. * target.c (update_current_target): Mention to_memory_map. (target_memory_map, target_pre_inferior): New. (target_preopen): Call target_pre_inferior. * target.h: Include "vec.h". (enum target_object): Add TARGET_OBJECT_MEMORY_MAP. (struct target_ops): Add to_memory_map. (target_memory_map, target_pre_inferior): New prototypes. * memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files. gdb/doc/ 2006-09-21 Vladimir Prus <vladimir@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto".
2006-09-21 15:54:03 +02:00
}