+2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * 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 Simon Marchi <simon.marchi@polymtl.ca>
* extension.h (struct xmethod_worker) <clone>: Remove.
static void
check_xml_btrace_version (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)
{
const char *version
- = (const char *) xml_find_attribute (attributes, "version")->value;
+ = (const char *) xml_find_attribute (attributes, "version")->value.get ();
if (strcmp (version, "1.0") != 0)
gdb_xml_error (parser, _("Unsupported btrace version: \"%s\""), version);
static void
parse_xml_btrace_block (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 btrace_data *btrace;
struct btrace_block *block;
gdb_xml_error (parser, _("Btrace format error."));
}
- begin = (ULONGEST *) xml_find_attribute (attributes, "begin")->value;
- end = (ULONGEST *) xml_find_attribute (attributes, "end")->value;
+ begin = (ULONGEST *) xml_find_attribute (attributes, "begin")->value.get ();
+ end = (ULONGEST *) xml_find_attribute (attributes, "end")->value.get ();
block = VEC_safe_push (btrace_block_s, btrace->variant.bts.blocks, NULL);
block->begin = *begin;
parse_xml_btrace_pt_config_cpu (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data,
- VEC (gdb_xml_value_s) *attributes)
+ std::vector<gdb_xml_value> &attributes)
{
struct btrace_data *btrace;
const char *vendor;
ULONGEST *family, *model, *stepping;
- vendor = (const char *) xml_find_attribute (attributes, "vendor")->value;
- family = (ULONGEST *) xml_find_attribute (attributes, "family")->value;
- model = (ULONGEST *) xml_find_attribute (attributes, "model")->value;
- stepping = (ULONGEST *) xml_find_attribute (attributes, "stepping")->value;
+ vendor =
+ (const char *) xml_find_attribute (attributes, "vendor")->value.get ();
+ family
+ = (ULONGEST *) xml_find_attribute (attributes, "family")->value.get ();
+ model
+ = (ULONGEST *) xml_find_attribute (attributes, "model")->value.get ();
+ stepping
+ = (ULONGEST *) xml_find_attribute (attributes, "stepping")->value.get ();
btrace = (struct btrace_data *) user_data;
static void
parse_xml_btrace_pt (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 btrace_data *btrace;
static void
parse_xml_btrace_conf_bts (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 btrace_config *conf;
struct gdb_xml_value *size;
size = xml_find_attribute (attributes, "size");
if (size != NULL)
- conf->bts.size = (unsigned int) *(ULONGEST *) size->value;
+ conf->bts.size = (unsigned int) *(ULONGEST *) size->value.get ();
}
/* Parse a btrace-conf "pt" xml record. */
static void
parse_xml_btrace_conf_pt (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 btrace_config *conf;
struct gdb_xml_value *size;
size = xml_find_attribute (attributes, "size");
if (size != NULL)
- conf->pt.size = (unsigned int) *(ULONGEST *) size->value;
+ conf->pt.size = (unsigned int) *(ULONGEST *) size->value.get ();
}
static const struct gdb_xml_attribute btrace_conf_pt_attributes[] = {
static void
memory_map_start_memory (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 memory_map_parsing_data *data
= (struct memory_map_parsing_data *) user_data;
ULONGEST *start_p, *length_p, *type_p;
start_p
- = (ULONGEST *) xml_find_attribute (attributes, "start")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "start")->value.get ();
length_p
- = (ULONGEST *) xml_find_attribute (attributes, "length")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "length")->value.get ();
type_p
- = (ULONGEST *) xml_find_attribute (attributes, "type")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "type")->value.get ();
data->memory_map->emplace_back (*start_p, *start_p + *length_p,
(enum mem_access_mode) *type_p);
static void
memory_map_start_property (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 memory_map_parsing_data *data
= (struct memory_map_parsing_data *) user_data;
char *name;
- name = (char *) xml_find_attribute (attributes, "name")->value;
+ name = (char *) xml_find_attribute (attributes, "name")->value.get ();
data->property_name.assign (name);
}
static void
osdata_start_osdata (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 osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
if (data->osdata != NULL)
gdb_xml_error (parser, _("Seen more than on osdata element"));
- char *type = (char *) xml_find_attribute (attributes, "type")->value;
+ char *type = (char *) xml_find_attribute (attributes, "type")->value.get ();
data->osdata.reset (new struct osdata (std::string (type)));
}
static void
osdata_start_item (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 osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
data->osdata->items.emplace_back ();
static void
osdata_start_column (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 osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
const char *name
- = (const char *) xml_find_attribute (attributes, "name")->value;
+ = (const char *) xml_find_attribute (attributes, "name")->value.get ();
data->property_name.assign (name);
}
static void
start_thread (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 threads_listing_context *data
= (struct threads_listing_context *) user_data;
struct gdb_xml_value *attr;
- char *id = (char *) xml_find_attribute (attributes, "id")->value;
+ char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
ptid_t ptid = read_ptid (id, NULL);
data->items.emplace_back (ptid);
attr = xml_find_attribute (attributes, "core");
if (attr != NULL)
- item.core = *(ULONGEST *) attr->value;
+ item.core = *(ULONGEST *) attr->value.get ();
attr = xml_find_attribute (attributes, "name");
if (attr != NULL)
- item.name = (const char *) attr->value;
+ item.name = (const char *) attr->value.get ();
attr = xml_find_attribute (attributes, "handle");
if (attr != NULL)
- item.thread_handle = hex2bin ((const char *) attr->value);
+ item.thread_handle = hex2bin ((const char *) attr->value.get ());
}
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)
+ std::vector<gdb_xml_value> &attributes)
{
VEC (lm_info_aix_p) **list = (VEC (lm_info_aix_p) **) user_data;
lm_info_aix *item = new lm_info_aix;
struct gdb_xml_value *attr;
attr = xml_find_attribute (attributes, "name");
- item->filename = xstrdup ((const char *) attr->value);
+ item->filename = xstrdup ((const char *) attr->value.get ());
attr = xml_find_attribute (attributes, "member");
if (attr != NULL)
- item->member_name = xstrdup ((const char *) attr->value);
+ item->member_name = xstrdup ((const char *) attr->value.get ());
attr = xml_find_attribute (attributes, "text_addr");
- item->text_addr = * (ULONGEST *) attr->value;
+ item->text_addr = * (ULONGEST *) attr->value.get ();
attr = xml_find_attribute (attributes, "text_size");
- item->text_size = * (ULONGEST *) attr->value;
+ item->text_size = * (ULONGEST *) attr->value.get ();
attr = xml_find_attribute (attributes, "data_addr");
- item->data_addr = * (ULONGEST *) attr->value;
+ item->data_addr = * (ULONGEST *) attr->value.get ();
attr = xml_find_attribute (attributes, "data_size");
- item->data_size = * (ULONGEST *) attr->value;
+ item->data_size = * (ULONGEST *) attr->value.get ();
VEC_safe_push (lm_info_aix_p, *list, item);
}
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)
{
- char *version = (char *) xml_find_attribute (attributes, "version")->value;
+ char *version
+ = (char *) xml_find_attribute (attributes, "version")->value.get ();
if (strcmp (version, "1.0") != 0)
gdb_xml_error (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)
{
struct svr4_library_list *list = (struct svr4_library_list *) user_data;
const char *name
- = (const char *) xml_find_attribute (attributes, "name")->value;
+ = (const char *) xml_find_attribute (attributes, "name")->value.get ();
ULONGEST *lmp
- = (ULONGEST *) xml_find_attribute (attributes, "lm")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "lm")->value.get ();
ULONGEST *l_addrp
- = (ULONGEST *) xml_find_attribute (attributes, "l_addr")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "l_addr")->value.get ();
ULONGEST *l_ldp
- = (ULONGEST *) xml_find_attribute (attributes, "l_ld")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "l_ld")->value.get ();
struct so_list *new_elem;
new_elem = XCNEW (struct so_list);
static void
svr4_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 svr4_library_list *list = (struct svr4_library_list *) user_data;
const char *version
- = (const char *) xml_find_attribute (attributes, "version")->value;
+ = (const char *) xml_find_attribute (attributes, "version")->value.get ();
struct gdb_xml_value *main_lm = xml_find_attribute (attributes, "main-lm");
if (strcmp (version, "1.0") != 0)
version);
if (main_lm)
- list->main_lm = *(ULONGEST *) main_lm->value;
+ list->main_lm = *(ULONGEST *) main_lm->value.get ();
}
/* The allowed elements and attributes for an XML library list.
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 ())
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 ())
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);
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,
static void
traceframe_info_start_memory (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 traceframe_info *info = (struct traceframe_info *) user_data;
ULONGEST *start_p, *length_p;
start_p
- = (ULONGEST *) xml_find_attribute (attributes, "start")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "start")->value.get ();
length_p
- = (ULONGEST *) xml_find_attribute (attributes, "length")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "length")->value.get ();
info->memory.emplace_back (*start_p, *length_p);
}
traceframe_info_start_tvar (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data,
- VEC(gdb_xml_value_s) *attributes)
+ std::vector<gdb_xml_value> &attributes)
{
struct traceframe_info *info = (struct traceframe_info *) user_data;
const char *id_attrib
- = (const char *) xml_find_attribute (attributes, "id")->value;
+ = (const char *) xml_find_attribute (attributes, "id")->value.get ();
int id = gdb_xml_parse_ulongest (parser, id_attrib);
info->tvars.push_back (id);
ATTRIBUTES. Returns NULL if not found. */
struct gdb_xml_value *
-xml_find_attribute (VEC(gdb_xml_value_s) *attributes, const char *name)
+xml_find_attribute (std::vector<gdb_xml_value> &attributes,
+ const char *name)
{
- struct gdb_xml_value *value;
- int ix;
-
- for (ix = 0; VEC_iterate (gdb_xml_value_s, attributes, ix, value); ix++)
- if (strcmp (value->name, name) == 0)
- return value;
+ for (gdb_xml_value &value : attributes)
+ if (strcmp (value.name, name) == 0)
+ return &value;
return NULL;
}
-/* Clean up a vector of parsed attribute values. */
-
-static void
-gdb_xml_values_cleanup (void *data)
-{
- VEC(gdb_xml_value_s) **values = (VEC(gdb_xml_value_s) **) data;
- struct gdb_xml_value *value;
- int ix;
-
- for (ix = 0; VEC_iterate (gdb_xml_value_s, *values, ix, value); ix++)
- xfree (value->value);
- VEC_free (gdb_xml_value_s, *values);
-}
-
/* Handle the start of an element. NAME is the element, and ATTRS are
the names and values of this element's attributes. */
const struct gdb_xml_element *element;
const struct gdb_xml_attribute *attribute;
- VEC(gdb_xml_value_s) *attributes = NULL;
unsigned int seen;
- struct cleanup *back_to;
/* Push an error scope. If we return or throw an exception before
filling this in, it will tell us to ignore children of this
scope.seen |= seen;
- back_to = make_cleanup (gdb_xml_values_cleanup, &attributes);
+ std::vector<gdb_xml_value> attributes;
for (attribute = element->attributes;
attribute != NULL && attribute->name != NULL;
const char *val = NULL;
const XML_Char **p;
void *parsed_value;
- struct gdb_xml_value new_value;
for (p = attrs; *p != NULL; p += 2)
if (!strcmp (attribute->name, p[0]))
else
parsed_value = xstrdup (val);
- new_value.name = attribute->name;
- new_value.value = parsed_value;
- VEC_safe_push (gdb_xml_value_s, attributes, &new_value);
+ attributes.emplace_back (attribute->name, parsed_value);
}
/* Check for unrecognized attributes. */
scope_level &new_scope = m_scopes.back ();
new_scope.element = element;
new_scope.elements = element->children;
-
- do_cleanups (back_to);
}
/* Wrapper for gdb_xml_start_element, to prevent throwing exceptions
static void
xinclude_start_include (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 xinclude_parsing_data *data
= (struct xinclude_parsing_data *) user_data;
- char *href = (char *) xml_find_attribute (attributes, "href")->value;
+ char *href = (char *) xml_find_attribute (attributes, "href")->value.get ();
gdb_xml_debug (parser, _("Processing XInclude of \"%s\""), href);
struct gdb_xml_value
{
+ gdb_xml_value (const char *name_, void *value_)
+ : name (name_), value (value_)
+ {}
+
const char *name;
- void *value;
+ gdb::unique_xmalloc_ptr<void> value;
};
-typedef struct gdb_xml_value gdb_xml_value_s;
-DEF_VEC_O(gdb_xml_value_s);
/* The type of an attribute handler.
typedef void (gdb_xml_element_start_handler)
(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);
/* A handler called at the end of an element.
/* Find the attribute named NAME in the set of parsed attributes
ATTRIBUTES. Returns NULL if not found. */
-struct gdb_xml_value *xml_find_attribute (VEC(gdb_xml_value_s) *attributes,
- const char *name);
+struct gdb_xml_value *xml_find_attribute
+ (std::vector<gdb_xml_value> &attributes, const char *name);
/* Parse an integer attribute into a ULONGEST. */
static void
syscall_start_syscall (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 syscall_parsing_data *data = (struct syscall_parsing_data *) user_data;
- struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
- int len, i;
/* syscall info. */
char *name = NULL;
int number = 0;
char *groups = NULL;
- len = VEC_length (gdb_xml_value_s, attributes);
-
- for (i = 0; i < len; i++)
+ for (const gdb_xml_value &attr : attributes)
{
- if (strcmp (attrs[i].name, "name") == 0)
- name = (char *) attrs[i].value;
- else if (strcmp (attrs[i].name, "number") == 0)
- number = * (ULONGEST *) attrs[i].value;
- else if (strcmp (attrs[i].name, "groups") == 0)
- groups = (char *) attrs[i].value;
+ if (strcmp (attr.name, "name") == 0)
+ name = (char *) attr.value.get ();
+ else if (strcmp (attr.name, "number") == 0)
+ number = * (ULONGEST *) attr.value.get ();
+ else if (strcmp (attr.name, "groups") == 0)
+ groups = (char *) attr.value.get ();
else
internal_error (__FILE__, __LINE__,
- _("Unknown attribute name '%s'."), attrs[i].name);
+ _("Unknown attribute name '%s'."), attr.name);
}
gdb_assert (name);
static void
tdesc_start_target (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)
{
- char *version = (char *) xml_find_attribute (attributes, "version")->value;
+ char *version
+ = (char *) xml_find_attribute (attributes, "version")->value.get ();
if (strcmp (version, "1.0") != 0)
gdb_xml_error (parser,
static void
tdesc_start_feature (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
- char *name = (char *) xml_find_attribute (attributes, "name")->value;
+ char *name = (char *) xml_find_attribute (attributes, "name")->value.get ();
data->current_feature = tdesc_create_feature (data->tdesc, name);
}
static void
tdesc_start_reg (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
- struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
- int ix = 0, length;
+ int ix = 0;
char *name, *group;
const char *type;
int bitsize, regnum, save_restore;
- length = VEC_length (gdb_xml_value_s, attributes);
+ int length = attributes.size ();
- name = (char *) attrs[ix++].value;
- bitsize = * (ULONGEST *) attrs[ix++].value;
+ name = (char *) attributes[ix++].value.get ();
+ bitsize = * (ULONGEST *) attributes[ix++].value.get ();
- if (ix < length && strcmp (attrs[ix].name, "regnum") == 0)
- regnum = * (ULONGEST *) attrs[ix++].value;
+ if (ix < length && strcmp (attributes[ix].name, "regnum") == 0)
+ regnum = * (ULONGEST *) attributes[ix++].value.get ();
else
regnum = data->next_regnum;
- if (ix < length && strcmp (attrs[ix].name, "type") == 0)
- type = (char *) attrs[ix++].value;
+ if (ix < length && strcmp (attributes[ix].name, "type") == 0)
+ type = (char *) attributes[ix++].value.get ();
else
type = "int";
- if (ix < length && strcmp (attrs[ix].name, "group") == 0)
- group = (char *) attrs[ix++].value;
+ if (ix < length && strcmp (attributes[ix].name, "group") == 0)
+ group = (char *) attributes[ix++].value.get ();
else
group = NULL;
- if (ix < length && strcmp (attrs[ix].name, "save-restore") == 0)
- save_restore = * (ULONGEST *) attrs[ix++].value;
+ if (ix < length && strcmp (attributes[ix].name, "save-restore") == 0)
+ save_restore = * (ULONGEST *) attributes[ix++].value.get ();
else
save_restore = 1;
static void
tdesc_start_union (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
- char *id = (char *) xml_find_attribute (attributes, "id")->value;
+ char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
data->current_type = tdesc_create_union (data->current_feature, id);
data->current_type_size = 0;
static void
tdesc_start_struct (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
- char *id = (char *) xml_find_attribute (attributes, "id")->value;
+ char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
struct gdb_xml_value *attr;
tdesc_type_with_fields *type_with_fields
attr = xml_find_attribute (attributes, "size");
if (attr != NULL)
{
- ULONGEST size = * (ULONGEST *) attr->value;
+ ULONGEST size = * (ULONGEST *) attr->value.get ();
if (size > MAX_FIELD_SIZE)
{
static void
tdesc_start_flags (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
- char *id = (char *) xml_find_attribute (attributes, "id")->value;
+ char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
ULONGEST size = * (ULONGEST *)
- xml_find_attribute (attributes, "size")->value;
+ xml_find_attribute (attributes, "size")->value.get ();
if (size > MAX_FIELD_SIZE)
{
static void
tdesc_start_enum (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
- char *id = (char *) xml_find_attribute (attributes, "id")->value;
+ char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
int size = * (ULONGEST *)
- xml_find_attribute (attributes, "size")->value;
+ xml_find_attribute (attributes, "size")->value.get ();
if (size > MAX_FIELD_SIZE)
{
static void
tdesc_start_field (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
struct gdb_xml_value *attr;
char *field_name, *field_type_id;
int start, end;
- field_name = (char *) xml_find_attribute (attributes, "name")->value;
+ field_name = (char *) xml_find_attribute (attributes, "name")->value.get ();
attr = xml_find_attribute (attributes, "type");
if (attr != NULL)
{
- field_type_id = (char *) attr->value;
+ field_type_id = (char *) attr->value.get ();
field_type = tdesc_named_type (data->current_feature, field_type_id);
}
else
attr = xml_find_attribute (attributes, "start");
if (attr != NULL)
{
- ULONGEST ul_start = * (ULONGEST *) attr->value;
+ ULONGEST ul_start = * (ULONGEST *) attr->value.get ();
if (ul_start > MAX_FIELD_BITSIZE)
{
attr = xml_find_attribute (attributes, "end");
if (attr != NULL)
{
- ULONGEST ul_end = * (ULONGEST *) attr->value;
+ ULONGEST ul_end = * (ULONGEST *) attr->value.get ();
if (ul_end > MAX_FIELD_BITSIZE)
{
static void
tdesc_start_enum_value (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
struct gdb_xml_value *attr;
ULONGEST ul_value;
int value;
- field_name = (char *) xml_find_attribute (attributes, "name")->value;
+ field_name = (char *) xml_find_attribute (attributes, "name")->value.get ();
attr = xml_find_attribute (attributes, "value");
- ul_value = * (ULONGEST *) attr->value;
+ ul_value = * (ULONGEST *) attr->value.get ();
if (ul_value > INT_MAX)
{
gdb_xml_error (parser,
static void
tdesc_start_vector (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 tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
- struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
struct tdesc_type *field_type;
char *id, *field_type_id;
ULONGEST count;
- id = (char *) attrs[0].value;
- field_type_id = (char *) attrs[1].value;
- count = * (ULONGEST *) attrs[2].value;
+ id = (char *) attributes[0].value.get ();
+ field_type_id = (char *) attributes[1].value.get ();
+ count = * (ULONGEST *) attributes[2].value.get ();
if (count > MAX_VECTOR_SIZE)
{