diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-01-07 09:29:52 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-01-07 09:38:16 -0500 |
commit | 4d0fdd9b357aff1fea3ef3def55d12464a41bf5b (patch) | |
tree | 3d31052e1794ddbe5942daabe65d3fc1d900cf76 /gdb/solib-target.c | |
parent | Remove xmethod_worker::clone (diff) | |
download | binutils-gdb-4d0fdd9b357aff1fea3ef3def55d12464a41bf5b.tar.gz binutils-gdb-4d0fdd9b357aff1fea3ef3def55d12464a41bf5b.tar.bz2 binutils-gdb-4d0fdd9b357aff1fea3ef3def55d12464a41bf5b.zip |
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.
Diffstat (limited to 'gdb/solib-target.c')
-rw-r--r-- | gdb/solib-target.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 70f864e428f..0968e49eb2d 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -79,12 +79,13 @@ solib_target_parse_libraries (const char *library) static void library_list_start_segment (struct gdb_xml_parser *parser, const struct gdb_xml_element *element, - void *user_data, VEC(gdb_xml_value_s) *attributes) + void *user_data, + std::vector<gdb_xml_value> &attributes) { VEC(lm_info_target_p) **list = (VEC(lm_info_target_p) **) user_data; lm_info_target *last = VEC_last (lm_info_target_p, *list); ULONGEST *address_p - = (ULONGEST *) xml_find_attribute (attributes, "address")->value; + = (ULONGEST *) xml_find_attribute (attributes, "address")->value.get (); CORE_ADDR address = (CORE_ADDR) *address_p; if (!last->section_bases.empty ()) @@ -97,12 +98,13 @@ library_list_start_segment (struct gdb_xml_parser *parser, static void library_list_start_section (struct gdb_xml_parser *parser, const struct gdb_xml_element *element, - void *user_data, VEC(gdb_xml_value_s) *attributes) + void *user_data, + std::vector<gdb_xml_value> &attributes) { VEC(lm_info_target_p) **list = (VEC(lm_info_target_p) **) user_data; lm_info_target *last = VEC_last (lm_info_target_p, *list); ULONGEST *address_p - = (ULONGEST *) xml_find_attribute (attributes, "address")->value; + = (ULONGEST *) xml_find_attribute (attributes, "address")->value.get (); CORE_ADDR address = (CORE_ADDR) *address_p; if (!last->segment_bases.empty ()) @@ -117,12 +119,13 @@ library_list_start_section (struct gdb_xml_parser *parser, static void library_list_start_library (struct gdb_xml_parser *parser, const struct gdb_xml_element *element, - void *user_data, VEC(gdb_xml_value_s) *attributes) + void *user_data, + std::vector<gdb_xml_value> &attributes) { VEC(lm_info_target_p) **list = (VEC(lm_info_target_p) **) user_data; lm_info_target *item = new lm_info_target; const char *name - = (const char *) xml_find_attribute (attributes, "name")->value; + = (const char *) xml_find_attribute (attributes, "name")->value.get (); item->name = xstrdup (name); VEC_safe_push (lm_info_target_p, *list, item); @@ -146,14 +149,15 @@ library_list_end_library (struct gdb_xml_parser *parser, static void library_list_start_list (struct gdb_xml_parser *parser, const struct gdb_xml_element *element, - void *user_data, VEC(gdb_xml_value_s) *attributes) + void *user_data, + std::vector<gdb_xml_value> &attributes) { struct gdb_xml_value *version = xml_find_attribute (attributes, "version"); /* #FIXED attribute may be omitted, Expat returns NULL in such case. */ if (version != NULL) { - const char *string = (const char *) version->value; + const char *string = (const char *) version->value.get (); if (strcmp (string, "1.0") != 0) gdb_xml_error (parser, |