diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/arm-tdep.c | 2 | ||||
-rw-r--r-- | gdb/block.c | 2 | ||||
-rw-r--r-- | gdb/buildsym.c | 20 | ||||
-rw-r--r-- | gdb/coffread.c | 12 | ||||
-rw-r--r-- | gdb/compile/compile-object-load.c | 2 | ||||
-rw-r--r-- | gdb/cp-namespace.c | 2 | ||||
-rw-r--r-- | gdb/ctfread.c | 16 | ||||
-rw-r--r-- | gdb/dbxread.c | 18 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 86 | ||||
-rw-r--r-- | gdb/dwarf2/section.c | 2 | ||||
-rw-r--r-- | gdb/elfread.c | 6 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 20 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 2 | ||||
-rw-r--r-- | gdb/hppa-tdep.c | 4 | ||||
-rw-r--r-- | gdb/jit.c | 18 | ||||
-rw-r--r-- | gdb/mdebugread.c | 36 | ||||
-rw-r--r-- | gdb/objfiles.c | 10 | ||||
-rw-r--r-- | gdb/objfiles.h | 6 | ||||
-rw-r--r-- | gdb/stabsread.c | 56 | ||||
-rw-r--r-- | gdb/symfile.c | 12 | ||||
-rw-r--r-- | gdb/symmisc.c | 4 | ||||
-rw-r--r-- | gdb/xcoffread.c | 18 |
22 files changed, 179 insertions, 175 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 3a1b52c..8e84ab2 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2607,7 +2607,7 @@ arm_exidx_new_objfile (struct objfile *objfile) if (n_bytes || n_words) { gdb_byte *p = entry - = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, + = (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), n_bytes + n_words * 4 + 1); while (n_bytes--) diff --git a/gdb/block.c b/gdb/block.c index 26126f5..8ae6f32 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -881,7 +881,7 @@ make_blockranges (struct objfile *objfile, size_t n = rangevec.size(); blr = (struct blockranges *) - obstack_alloc (&objfile->objfile_obstack, + obstack_alloc (objfile->objfile_obstack (), sizeof (struct blockranges) + (n - 1) * sizeof (struct blockrange)); diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 65c2ac5..16d5a36 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -211,13 +211,13 @@ buildsym_compunit::finish_block_internal struct pending_block *opblock; block = (is_global - ? allocate_global_block (&m_objfile->objfile_obstack) - : allocate_block (&m_objfile->objfile_obstack)); + ? allocate_global_block (m_objfile->objfile_obstack ()) + : allocate_block (m_objfile->objfile_obstack ())); if (symbol) { block->set_multidict - (mdict_create_linear (&m_objfile->objfile_obstack, *listhead)); + (mdict_create_linear (m_objfile->objfile_obstack (), *listhead)); } else { @@ -230,7 +230,7 @@ buildsym_compunit::finish_block_internal else { block->set_multidict - (mdict_create_hashed (&m_objfile->objfile_obstack, *listhead)); + (mdict_create_hashed (m_objfile->objfile_obstack (), *listhead)); } } @@ -374,7 +374,7 @@ buildsym_compunit::finish_block_internal (is_global ? m_global_using_directives : m_local_using_directives), - &m_objfile->objfile_obstack); + m_objfile->objfile_obstack ()); if (is_global) m_global_using_directives = NULL; else @@ -434,7 +434,7 @@ buildsym_compunit::make_blockvector () } blockvector = (struct blockvector *) - obstack_alloc (&m_objfile->objfile_obstack, + obstack_alloc (m_objfile->objfile_obstack (), (sizeof (struct blockvector) + (i - 1) * sizeof (struct block *))); @@ -454,8 +454,8 @@ buildsym_compunit::make_blockvector () blockvector. */ if (m_pending_addrmap_interesting) blockvector->set_map - (new (&m_objfile->objfile_obstack) addrmap_fixed - (&m_objfile->objfile_obstack, &m_pending_addrmap)); + (new (m_objfile->objfile_obstack ()) addrmap_fixed + (m_objfile->objfile_obstack (), &m_pending_addrmap)); else blockvector->set_map (nullptr); @@ -939,7 +939,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector int linetablesize = sizeof (struct linetable) + entry_array_size; symtab->set_linetable - (XOBNEWVAR (&m_objfile->objfile_obstack, struct linetable, + (XOBNEWVAR (m_objfile->objfile_obstack (), struct linetable, linetablesize)); symtab->linetable ()->nitems = n_entries; @@ -966,7 +966,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector if (!m_comp_dir.empty ()) { /* Reallocate the dirname on the symbol obstack. */ - cu->set_dirname (obstack_strdup (&m_objfile->objfile_obstack, + cu->set_dirname (obstack_strdup (m_objfile->objfile_obstack (), m_comp_dir.c_str ())); } diff --git a/gdb/coffread.c b/gdb/coffread.c index 474a1aa..cac1216 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1561,13 +1561,13 @@ process_coff_symbol (struct coff_symbol *cs, union internal_auxent *aux, struct objfile *objfile) { - struct symbol *sym = new (&objfile->objfile_obstack) symbol; + struct symbol *sym = new (objfile->objfile_obstack ()) symbol; char *name; name = cs->c_name; name = EXTERNAL_NAME (name, objfile->obfd); sym->set_language (get_current_subfile ()->language, - &objfile->objfile_obstack); + objfile->objfile_obstack ()); sym->compute_and_set_names (name, true, objfile->per_bfd); /* default assumptions */ @@ -2014,7 +2014,7 @@ coff_read_struct_type (int index, int length, int lastsym, list = newobj; /* Save the data. */ - list->field.set_name (obstack_strdup (&objfile->objfile_obstack, + list->field.set_name (obstack_strdup (objfile->objfile_obstack (), name)); list->field.set_type (decode_type (ms, ms->c_type, &sub_aux, objfile)); @@ -2031,7 +2031,7 @@ coff_read_struct_type (int index, int length, int lastsym, list = newobj; /* Save the data. */ - list->field.set_name (obstack_strdup (&objfile->objfile_obstack, + list->field.set_name (obstack_strdup (objfile->objfile_obstack (), name)); list->field.set_type (decode_type (ms, ms->c_type, &sub_aux, objfile)); @@ -2100,9 +2100,9 @@ coff_read_enum_type (int index, int length, int lastsym, switch (ms->c_sclass) { case C_MOE: - sym = new (&objfile->objfile_obstack) symbol; + sym = new (objfile->objfile_obstack ()) symbol; - name = obstack_strdup (&objfile->objfile_obstack, name); + name = obstack_strdup (objfile->objfile_obstack (), name); sym->set_linkage_name (name); sym->set_aclass_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index d393091..66f0440 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -693,7 +693,7 @@ compile_object_load (const compile_file_names &file_names, /* The memory may be later needed by bfd_generic_get_relocated_section_contents called from default_symfile_relocate. */ - symbol_table = (asymbol **) obstack_alloc (&objfile->objfile_obstack, + symbol_table = (asymbol **) obstack_alloc (objfile->objfile_obstack (), storage_needed); number_of_symbols = bfd_canonicalize_symtab (abfd.get (), symbol_table); if (number_of_symbols < 0) diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index e734eff..0a59073 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -97,7 +97,7 @@ cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit, std::vector<const char *> excludes; add_using_directive (compunit->get_local_using_directives (), dest, src, NULL, NULL, excludes, - 1, &objfile->objfile_obstack); + 1, objfile->objfile_obstack ()); } /* The "+ 2" is for the "::". */ previous_component = next_component + 2; diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 828f300..c079987 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -257,7 +257,7 @@ set_tid_type (struct objfile *of, ctf_id_t tid, struct type *typ) ids.type = typ; slot = (struct ctf_tid_and_type **) htab_find_slot (htab, &ids, INSERT); if (*slot == nullptr) - *slot = XOBNEW (&of->objfile_obstack, struct ctf_tid_and_type); + *slot = XOBNEW (of->objfile_obstack (), struct ctf_tid_and_type); **slot = ids; return typ; } @@ -445,10 +445,10 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg) if (name != nullptr) { - struct symbol *sym = new (&ccp->of->objfile_obstack) symbol; + struct symbol *sym = new (ccp->of->objfile_obstack ()) symbol; OBJSTAT (ccp->of, n_syms++); - sym->set_language (language_c, &ccp->of->objfile_obstack); + sym->set_language (language_c, ccp->of->objfile_obstack ()); sym->compute_and_set_names (name, false, ccp->of->per_bfd); sym->set_aclass_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); @@ -474,10 +474,10 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) const char *name = ctf_type_name_raw (fp, tid); if (name != nullptr) { - sym = new (&objfile->objfile_obstack) symbol; + sym = new (objfile->objfile_obstack ()) symbol; OBJSTAT (objfile, n_syms++); - sym->set_language (language_c, &objfile->objfile_obstack); + sym->set_language (language_c, objfile->objfile_obstack ()); sym->compute_and_set_names (name, false, objfile->per_bfd); sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_OPTIMIZED_OUT); @@ -928,7 +928,7 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid, struct objfile *objfile = ccp->of; struct type *this_type, *target_type; - char *aname = obstack_strdup (&objfile->objfile_obstack, name); + char *aname = obstack_strdup (objfile->objfile_obstack (), name); this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, aname); set_tid_type (objfile, tid, this_type); target_type = fetch_tid_type (ccp, btid); @@ -1167,7 +1167,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg) complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id); type = objfile_type (ccp->of)->builtin_error; } - sym = new (&ccp->of->objfile_obstack) symbol; + sym = new (ccp->of->objfile_obstack ()) symbol; OBJSTAT (ccp->of, n_syms++); sym->set_type (type); sym->set_domain (VAR_DOMAIN); @@ -1203,7 +1203,7 @@ add_stt_entries (struct ctf_context *ccp, int functions) type = get_tid_type (ccp->of, tid); if (type == nullptr) continue; - sym = new (&ccp->of->objfile_obstack) symbol; + sym = new (ccp->of->objfile_obstack ()) symbol; OBJSTAT (ccp->of, n_syms++); sym->set_type (type); sym->set_domain (VAR_DOMAIN); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index bcf5190..00a2a38 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -669,7 +669,7 @@ dbx_symfile_init (struct objfile *objfile) DBX_STRINGTAB_SIZE (objfile)); DBX_STRINGTAB (objfile) = - (char *) obstack_alloc (&objfile->objfile_obstack, + (char *) obstack_alloc (objfile->objfile_obstack (), DBX_STRINGTAB_SIZE (objfile)); OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile)); @@ -1440,7 +1440,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, if (new_name != nullptr) { sym_len = strlen (new_name.get ()); - sym_name = obstack_strdup (&objfile->objfile_obstack, + sym_name = obstack_strdup (objfile->objfile_obstack (), new_name.get ()); } } @@ -1945,7 +1945,7 @@ start_psymtab (psymtab_storage *partial_symtabs, struct objfile *objfile, objfile->per_bfd, textlow); result->read_symtab_private = - XOBNEW (&objfile->objfile_obstack, struct symloc); + XOBNEW (objfile->objfile_obstack (), struct symloc); LDSYMOFF (result) = ldsymoff; result->legacy_read_symtab = dbx_read_symtab; result->legacy_expand_psymtab = dbx_expand_psymtab; @@ -2068,7 +2068,7 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs, new legacy_psymtab (include_list[i], partial_symtabs, objfile->per_bfd); subpst->read_symtab_private = - XOBNEW (&objfile->objfile_obstack, struct symloc); + XOBNEW (objfile->objfile_obstack (), struct symloc); LDSYMOFF (subpst) = LDSYMLEN (subpst) = 0; @@ -2452,7 +2452,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, /* For C++, set the block's scope. */ if (cstk.name->language () == language_cplus) - cp_set_block_scope (cstk.name, block, &objfile->objfile_obstack); + cp_set_block_scope (cstk.name, block, objfile->objfile_obstack ()); /* May be switching to an assembler file which may not be using block relative stabs, so reset the offset. */ @@ -2819,7 +2819,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, /* For C++, set the block's scope. */ if (cstk.name->language () == language_cplus) cp_set_block_scope (cstk.name, block, - &objfile->objfile_obstack); + objfile->objfile_obstack ()); } newobj = push_context (0, valu); @@ -2949,7 +2949,7 @@ coffstab_build_psymtabs (struct objfile *objfile, if (stabstrsize > bfd_get_size (sym_bfd)) error (_("ridiculous string table size: %d bytes"), stabstrsize); DBX_STRINGTAB (objfile) = (char *) - obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1); + obstack_alloc (objfile->objfile_obstack (), stabstrsize + 1); OBJSTAT (objfile, sz_strtab += stabstrsize + 1); /* Now read in the string table in one big gulp. */ @@ -3042,7 +3042,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect, if (stabstrsize > bfd_get_size (sym_bfd)) error (_("ridiculous string table size: %d bytes"), stabstrsize); DBX_STRINGTAB (objfile) = (char *) - obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1); + obstack_alloc (objfile->objfile_obstack (), stabstrsize + 1); OBJSTAT (objfile, sz_strtab += stabstrsize + 1); /* Now read in the string table in one big gulp. */ @@ -3137,7 +3137,7 @@ stabsect_build_psymtabs (struct objfile *objfile, char *stab_name, error (_("ridiculous string table size: %d bytes"), DBX_STRINGTAB_SIZE (objfile)); DBX_STRINGTAB (objfile) = (char *) - obstack_alloc (&objfile->objfile_obstack, + obstack_alloc (objfile->objfile_obstack (), DBX_STRINGTAB_SIZE (objfile) + 1); OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ea0d984..cf44996 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7850,8 +7850,8 @@ fixup_go_packaging (struct dwarf2_cu *cu) saved_package_name); struct symbol *sym; - sym = new (&objfile->objfile_obstack) symbol; - sym->set_language (language_go, &objfile->objfile_obstack); + sym = new (objfile->objfile_obstack ()) symbol; + sym->set_language (language_go, objfile->objfile_obstack ()); sym->compute_and_set_names (saved_package_name, false, objfile->per_bfd); /* This is not VAR_DOMAIN because we want a way to ensure a lookup of, e.g., "main" finds the "main" module and not C's main(). */ @@ -8028,11 +8028,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) type->field (1).set_name (rust_last_path_segment (type->field (1).type ()->name ())); type->field (1).type ()->set_name - (rust_fully_qualify (&objfile->objfile_obstack, type->name (), + (rust_fully_qualify (objfile->objfile_obstack (), type->name (), type->field (1).name ())); const char *dataless_name - = rust_fully_qualify (&objfile->objfile_obstack, type->name (), + = rust_fully_qualify (objfile->objfile_obstack (), type->name (), name); struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0, dataless_name); @@ -8044,7 +8044,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) /* Indicate that this is a variant type. */ static discriminant_range ranges[1] = { { 0, 0 } }; - alloc_rust_variant (&objfile->objfile_obstack, type, 0, 1, ranges); + alloc_rust_variant (objfile->objfile_obstack (), type, 0, 1, ranges); } /* A union with a single anonymous field is probably an old-style univariant enum. */ @@ -8059,10 +8059,10 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) = rust_last_path_segment (field_type->name ()); type->field (0).set_name (variant_name); field_type->set_name - (rust_fully_qualify (&objfile->objfile_obstack, + (rust_fully_qualify (objfile->objfile_obstack (), type->name (), variant_name)); - alloc_rust_variant (&objfile->objfile_obstack, type, -1, 0, {}); + alloc_rust_variant (objfile->objfile_obstack (), type, -1, 0, {}); } else { @@ -8136,7 +8136,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) /* We don't need a range entry for the discriminant, but we do need one for every other field, as there is no default variant. */ - discriminant_range *ranges = XOBNEWVEC (&objfile->objfile_obstack, + discriminant_range *ranges = XOBNEWVEC (objfile->objfile_obstack (), discriminant_range, n_fields - 1); /* Skip the discriminant here. */ @@ -8168,12 +8168,12 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) } type->field (i).set_name (variant_name); sub_type->set_name - (rust_fully_qualify (&objfile->objfile_obstack, + (rust_fully_qualify (objfile->objfile_obstack (), type->name (), variant_name)); } /* Indicate that this is a variant type. */ - alloc_rust_variant (&objfile->objfile_obstack, type, 0, -1, + alloc_rust_variant (objfile->objfile_obstack (), type, 0, -1, gdb::array_view<discriminant_range> (ranges, n_fields - 1)); } @@ -8314,7 +8314,7 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu, /* Now we have a transitive closure of all the included symtabs. */ len = result_symtabs.size (); cust->includes - = XOBNEWVEC (&per_objfile->objfile->objfile_obstack, + = XOBNEWVEC (per_objfile->objfile->objfile_obstack (), struct compunit_symtab *, len + 1); memcpy (cust->includes, result_symtabs.data (), len * sizeof (compunit_symtab *)); @@ -9330,7 +9330,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) canonical_name = imported_name_prefix; } else if (strlen (imported_name_prefix) > 0) - canonical_name = obconcat (&objfile->objfile_obstack, + canonical_name = obconcat (objfile->objfile_obstack (), imported_name_prefix, (cu->lang () == language_d ? "." @@ -9391,7 +9391,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) imported_declaration, excludes, 0, - &objfile->objfile_obstack); + objfile->objfile_obstack ()); } /* ICC<14 does not output the required DW_AT_declaration on incomplete @@ -9702,7 +9702,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die) time. */ tug_unshare->symtabs - = XOBNEWVEC (&cust->objfile ()->objfile_obstack, + = XOBNEWVEC (cust->objfile ()->objfile_obstack (), struct symtab *, line_header->file_names_size ()); auto &file_names = line_header->file_names (); @@ -12005,7 +12005,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) if (child_die->tag == DW_TAG_template_type_param || child_die->tag == DW_TAG_template_value_param) { - templ_func = new (&objfile->objfile_obstack) template_symbol; + templ_func = new (objfile->objfile_obstack ()) template_symbol; templ_func->subclass = SYMBOL_TEMPLATE; break; } @@ -12032,7 +12032,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) if (attr != nullptr) { newobj->static_link - = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop); + = XOBNEW (objfile->objfile_obstack (), struct dynamic_prop); attr_to_dynamic_prop (attr, die, cu, newobj->static_link, cu->addr_type ()); } @@ -12097,7 +12097,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) || cu->lang () == language_rust) && cu->processing_has_namespace_info) block_set_scope (block, determine_prefix (die, cu), - &objfile->objfile_obstack); + objfile->objfile_obstack ()); /* If we have address ranges, record them. */ dwarf2_record_block_ranges (die, block, baseaddr, cu); @@ -12111,7 +12111,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) templ_func->n_template_arguments = template_args.size (); templ_func->template_arguments - = XOBNEWVEC (&objfile->objfile_obstack, struct symbol *, + = XOBNEWVEC (objfile->objfile_obstack (), struct symbol *, templ_func->n_template_arguments); memcpy (templ_func->template_arguments, template_args.data (), @@ -12261,7 +12261,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) if (cu->call_site_htab == NULL) cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash, call_site::eq, NULL, - &objfile->objfile_obstack, + objfile->objfile_obstack (), hashtab_obstack_allocate, NULL); struct call_site call_site_local (pc, nullptr, nullptr); slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); @@ -12294,7 +12294,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) } struct call_site *call_site - = new (XOBNEWVAR (&objfile->objfile_obstack, + = new (XOBNEWVAR (objfile->objfile_obstack (), struct call_site, sizeof (*call_site) + sizeof (call_site->parameter[0]) * nparams)) struct call_site (pc, cu->per_cu, per_objfile); @@ -12372,7 +12372,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) struct dwarf2_locexpr_baton *dlbaton; struct dwarf_block *block = attr->as_block (); - dlbaton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton); + dlbaton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_locexpr_baton); dlbaton->data = block->data; dlbaton->size = block->size; dlbaton->per_objfile = per_objfile; @@ -12413,7 +12413,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) std::vector<CORE_ADDR> addresses; dwarf2_ranges_read_low_addrs (ranges_offset, target_cu, target_die->tag, addresses); - CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR, + CORE_ADDR *saved = XOBNEWVAR (objfile->objfile_obstack (), CORE_ADDR, addresses.size ()); std::copy (addresses.begin (), addresses.end (), saved); call_site->target.set_loc_array (addresses.size (), saved); @@ -12602,7 +12602,7 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu) { struct objfile *objfile = cu->per_objfile->objfile; - storage = new (&objfile->objfile_obstack) rust_vtable_symbol; + storage = new (objfile->objfile_obstack ()) rust_vtable_symbol; storage->concrete_type = containing_type; storage->subclass = SYMBOL_RUST_VTABLE; } @@ -13439,7 +13439,7 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu, dwarf2_per_objfile *per_objfile = cu->per_objfile; struct objfile *objfile = per_objfile->objfile; struct dwarf2_locexpr_baton *dlbaton - = XOBNEW (&objfile->objfile_obstack, + = XOBNEW (objfile->objfile_obstack (), struct dwarf2_locexpr_baton); dlbaton->data = attr->as_block ()->data; dlbaton->size = attr->as_block ()->size; @@ -13888,12 +13888,12 @@ add_variant_property (struct field_info *fip, struct type *type, struct objfile *objfile = cu->per_objfile->objfile; gdb::array_view<const variant_part> parts - = create_variant_parts (&objfile->objfile_obstack, offset_map, fip, + = create_variant_parts (objfile->objfile_obstack (), offset_map, fip, fip->variant_parts); struct dynamic_prop prop; prop.set_variant_parts ((gdb::array_view<variant_part> *) - obstack_copy (&objfile->objfile_obstack, &parts, + obstack_copy (objfile->objfile_obstack (), &parts, sizeof (parts))); type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop); @@ -14861,7 +14861,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) ALLOCATE_CPLUS_STRUCT_TYPE (type); TYPE_N_TEMPLATE_ARGUMENTS (type) = template_args.size (); TYPE_TEMPLATE_ARGUMENTS (type) - = XOBNEWVEC (&objfile->objfile_obstack, + = XOBNEWVEC (objfile->objfile_obstack (), struct symbol *, TYPE_N_TEMPLATE_ARGUMENTS (type)); memcpy (TYPE_TEMPLATE_ARGUMENTS (type), @@ -15790,7 +15790,7 @@ mark_common_block_symbol_computed (struct symbol *sym, gdb_assert (member_loc->form_is_block () || member_loc->form_is_constant ()); - baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton); + baton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_locexpr_baton); baton->per_objfile = per_objfile; baton->per_cu = cu->per_cu; gdb_assert (baton->per_cu); @@ -15805,7 +15805,7 @@ mark_common_block_symbol_computed (struct symbol *sym, else baton->size += member_loc->as_block ()->size; - ptr = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, baton->size); + ptr = (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), baton->size); baton->data = ptr; *ptr++ = DW_OP_call4; @@ -15883,7 +15883,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) size = (sizeof (struct common_block) + (n_entries - 1) * sizeof (struct symbol *)); common_block - = (struct common_block *) obstack_alloc (&objfile->objfile_obstack, + = (struct common_block *) obstack_alloc (objfile->objfile_obstack (), size); memset (common_block->contents, 0, n_entries * sizeof (struct symbol *)); common_block->n_entries = 0; @@ -15965,7 +15965,7 @@ read_namespace_type (struct die_info *die, struct dwarf2_cu *cu) previous_prefix = determine_prefix (die, cu); if (previous_prefix[0] != '\0') - name = typename_concat (&objfile->objfile_obstack, + name = typename_concat (objfile->objfile_obstack (), previous_prefix, name, 0, cu); /* Create the type. */ @@ -16001,7 +16001,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) std::vector<const char *> excludes; add_using_directive (using_directives (cu), previous_prefix, type->name (), NULL, - NULL, excludes, 0, &objfile->objfile_obstack); + NULL, excludes, 0, objfile->objfile_obstack ()); } } @@ -17140,7 +17140,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) { gdb_assert (startswith (gnat_encoding_suffix, GNAT_FIXED_POINT_SUFFIX)); - name = obstack_strndup (&cu->per_objfile->objfile->objfile_obstack, + name = obstack_strndup (cu->per_objfile->objfile->objfile_obstack (), name, gnat_encoding_suffix - name); /* Use -1 here so that SUFFIX points at the "_" after the "XF". */ @@ -17170,7 +17170,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) if (name == nullptr) { struct obstack *obstack - = &cu->per_objfile->objfile->objfile_obstack; + = cu->per_objfile->objfile->objfile_obstack (); name = obconcat (obstack, "_Complex ", type->name (), nullptr); } @@ -17301,7 +17301,7 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, struct dwarf2_property_baton *baton; dwarf2_per_objfile *per_objfile = cu->per_objfile; struct objfile *objfile = per_objfile->objfile; - struct obstack *obstack = &objfile->objfile_obstack; + struct obstack *obstack = objfile->objfile_obstack (); gdb_assert (default_type != NULL); @@ -20694,11 +20694,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, if (space) sym = space; else - sym = new (&objfile->objfile_obstack) symbol; + sym = new (objfile->objfile_obstack ()) symbol; OBJSTAT (objfile, n_syms++); /* Cache this symbol's name and the name's demangled form (if any). */ - sym->set_language (cu->lang (), &objfile->objfile_obstack); + sym->set_language (cu->lang (), objfile->objfile_obstack ()); /* Fortran does not have mangling standard and the mangling does differ between gfortran, iFort etc. */ const char *physname @@ -20711,7 +20711,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, sym->set_linkage_name (physname); else { - sym->set_demangled_name (physname, &objfile->objfile_obstack); + sym->set_demangled_name (physname, objfile->objfile_obstack ()); sym->set_linkage_name (linkagename); } @@ -21246,7 +21246,7 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym, dwarf2_const_value_attr (attr, sym->type (), sym->print_name (), - &objfile->objfile_obstack, cu, + objfile->objfile_obstack (), cu, &value, &bytes, &baton); if (baton != NULL) @@ -21359,7 +21359,7 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die) objfile_name (objfile), sect_offset_str (cu->header.sect_off), sect_offset_str (die->sect_off)); - saved = obstack_strdup (&objfile->objfile_obstack, message); + saved = obstack_strdup (objfile->objfile_obstack (), message); return init_type (objfile, TYPE_CODE_ERROR, 0, saved); } @@ -23346,7 +23346,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, { struct dwarf2_loclist_baton *baton; - baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_loclist_baton); + baton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_loclist_baton); fill_in_loclist_baton (cu, baton, attr); @@ -23363,7 +23363,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, { struct dwarf2_locexpr_baton *baton; - baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton); + baton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_locexpr_baton); baton->per_objfile = per_objfile; baton->per_cu = cu->per_cu; gdb_assert (baton->per_cu); @@ -23846,7 +23846,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu, if (*slot) complaint (_("A problem internal to GDB: DIE %s has type already set"), sect_offset_str (die->sect_off)); - *slot = XOBNEW (&objfile->objfile_obstack, + *slot = XOBNEW (objfile->objfile_obstack (), struct dwarf2_per_cu_offset_and_type); **slot = ofs; return type; diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c index 32c86cc..fad87ee 100644 --- a/gdb/dwarf2/section.c +++ b/gdb/dwarf2/section.c @@ -164,7 +164,7 @@ dwarf2_section_info::read (struct objfile *objfile) return; } - buf = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, size); + buf = (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), size); buffer = buf; /* When debugging .o files, we may need to apply relocations; see diff --git a/gdb/elfread.c b/gdb/elfread.c index 8ff62a1..7fa7c23 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -728,11 +728,11 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr) } entry_local.addr = addr; - obstack_grow (&objfile->objfile_obstack, &entry_local, + obstack_grow (objfile->objfile_obstack (), &entry_local, offsetof (struct elf_gnu_ifunc_cache, name)); - obstack_grow_str0 (&objfile->objfile_obstack, name); + obstack_grow_str0 (objfile->objfile_obstack (), name); entry_p - = (struct elf_gnu_ifunc_cache *) obstack_finish (&objfile->objfile_obstack); + = (struct elf_gnu_ifunc_cache *) obstack_finish (objfile->objfile_obstack ()); slot = htab_find_slot (htab, entry_p, INSERT); if (*slot != NULL) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c8f9855..557c0e7 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -185,8 +185,8 @@ alloc_type (struct objfile *objfile) gdb_assert (objfile != NULL); /* Alloc the structure and start off with all fields zeroed. */ - type = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct type); - TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (&objfile->objfile_obstack, + type = OBSTACK_ZALLOC (objfile->objfile_obstack (), struct type); + TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (objfile->objfile_obstack (), struct main_type); OBJSTAT (objfile, n_types++); @@ -298,7 +298,7 @@ alloc_type_instance (struct type *oldtype) if (!oldtype->is_objfile_owned ()) type = GDBARCH_OBSTACK_ZALLOC (oldtype->arch_owner (), struct type); else - type = OBSTACK_ZALLOC (&oldtype->objfile_owner ()->objfile_obstack, + type = OBSTACK_ZALLOC (oldtype->objfile_owner ()->objfile_obstack (), struct type); TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype); @@ -2411,7 +2411,7 @@ resolve_dynamic_array_or_string (struct type *type, if (prop_list != nullptr) { struct obstack *obstack - = &type->objfile_owner ()->objfile_obstack; + = type->objfile_owner ()->objfile_obstack (); TYPE_MAIN_TYPE (type)->dyn_prop_list = copy_dynamic_prop_list (obstack, prop_list); } @@ -2933,7 +2933,7 @@ type::add_dyn_prop (dynamic_prop_node_kind prop_kind, dynamic_prop prop) gdb_assert (this->is_objfile_owned ()); - temp = XOBNEW (&this->objfile_owner ()->objfile_obstack, + temp = XOBNEW (this->objfile_owner ()->objfile_obstack (), struct dynamic_prop_list); temp->prop_kind = prop_kind; temp->prop = prop; @@ -5596,7 +5596,7 @@ htab_up create_copied_types_hash (struct objfile *objfile) { return htab_up (htab_create_alloc_ex (1, type_pair_hash, type_pair_eq, - NULL, &objfile->objfile_obstack, + NULL, objfile->objfile_obstack (), hashtab_obstack_allocate, dummy_obstack_deallocate)); } @@ -5657,7 +5657,7 @@ copy_type_recursive (struct objfile *objfile, /* We must add the new type to the hash table immediately, in case we encounter this type again during a recursive call below. */ struct type_pair *stored - = new (&objfile->objfile_obstack) struct type_pair (type, new_type); + = new (objfile->objfile_obstack ()) struct type_pair (type, new_type); *slot = stored; @@ -5736,7 +5736,7 @@ copy_type_recursive (struct objfile *objfile, if (type->main_type->dyn_prop_list != NULL) new_type->main_type->dyn_prop_list - = copy_dynamic_prop_list (&objfile->objfile_obstack, + = copy_dynamic_prop_list (objfile->objfile_obstack (), type->main_type->dyn_prop_list); @@ -5809,7 +5809,7 @@ copy_type (const struct type *type) if (type->main_type->dyn_prop_list != NULL) { struct obstack *storage = (type->is_objfile_owned () - ? &type->objfile_owner ()->objfile_obstack + ? type->objfile_owner ()->objfile_obstack () : gdbarch_obstack (type->arch_owner ())); new_type->main_type->dyn_prop_list = copy_dynamic_prop_list (storage, type->main_type->dyn_prop_list); @@ -6330,7 +6330,7 @@ objfile_type (struct objfile *objfile) if (objfile_type) return objfile_type; - objfile_type = OBSTACK_CALLOC (&objfile->objfile_obstack, + objfile_type = OBSTACK_CALLOC (objfile->objfile_obstack (), 1, struct objfile_type); /* Use the objfile architecture to determine basic type properties. */ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 7437e1d..3a4d644 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2473,7 +2473,7 @@ extern const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN]; #define TYPE_ALLOC(t,size) \ (obstack_alloc (((t)->is_objfile_owned () \ - ? &((t)->objfile_owner ()->objfile_obstack) \ + ? ((t)->objfile_owner ()->objfile_obstack ()) \ : gdbarch_obstack ((t)->arch_owner ())), \ size)) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index f9ececb..0f5577b 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -347,7 +347,7 @@ read_unwind_info (struct objfile *objfile) struct hppa_objfile_private *obj_private; text_offset = objfile->text_section_offset (); - ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack, + ui = (struct hppa_unwind_info *) obstack_alloc (objfile->objfile_obstack (), sizeof (struct hppa_unwind_info)); ui->table = NULL; @@ -397,7 +397,7 @@ read_unwind_info (struct objfile *objfile) /* Allocate memory for the unwind table. */ ui->table = (struct unwind_table_entry *) - obstack_alloc (&objfile->objfile_obstack, total_size); + obstack_alloc (objfile->objfile_obstack (), total_size); ui->last = total_entries - 1; /* Now read in each unwind section and internalize the standard unwind @@ -550,13 +550,13 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) * sizeof (struct linetable_entry) + sizeof (struct linetable)); filetab->set_linetable ((struct linetable *) - obstack_alloc (&objfile->objfile_obstack, size)); + obstack_alloc (objfile->objfile_obstack (), size)); memcpy (filetab->linetable (), stab->linetable.get (), size); } blockvector_size = (sizeof (struct blockvector) + (actual_nblocks - 1) * sizeof (struct block *)); - bv = (struct blockvector *) obstack_alloc (&objfile->objfile_obstack, + bv = (struct blockvector *) obstack_alloc (objfile->objfile_obstack (), blockvector_size); cust->set_blockvector (bv); @@ -573,15 +573,15 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) int block_idx = FIRST_LOCAL_BLOCK; for (gdb_block &gdb_block_iter : stab->blocks) { - struct block *new_block = allocate_block (&objfile->objfile_obstack); - struct symbol *block_name = new (&objfile->objfile_obstack) symbol; + struct block *new_block = allocate_block (objfile->objfile_obstack ()); + struct symbol *block_name = new (objfile->objfile_obstack ()) symbol; struct type *block_type = arch_type (objfile->arch (), TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); new_block->set_multidict - (mdict_create_linear (&objfile->objfile_obstack, NULL)); + (mdict_create_linear (objfile->objfile_obstack (), NULL)); /* The address range. */ new_block->set_start (gdb_block_iter.begin); new_block->set_end (gdb_block_iter.end); @@ -593,7 +593,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) block_name->set_type (lookup_function_type (block_type)); block_name->set_value_block (new_block); - block_name->m_name = obstack_strdup (&objfile->objfile_obstack, + block_name->m_name = obstack_strdup (objfile->objfile_obstack (), gdb_block_iter.name.get ()); new_block->set_function (block_name); @@ -616,10 +616,10 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) struct block *new_block; new_block = (i == GLOBAL_BLOCK - ? allocate_global_block (&objfile->objfile_obstack) - : allocate_block (&objfile->objfile_obstack)); + ? allocate_global_block (objfile->objfile_obstack ()) + : allocate_block (objfile->objfile_obstack ())); new_block->set_multidict - (mdict_create_linear (&objfile->objfile_obstack, NULL)); + (mdict_create_linear (objfile->objfile_obstack (), NULL)); new_block->set_superblock (block_iter); block_iter = new_block; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index a2280c3..17e4476 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -350,7 +350,7 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader, char *fdr_end; FDR *fdr_ptr; - info->fdr = (FDR *) XOBNEWVEC (&objfile->objfile_obstack, FDR, + info->fdr = (FDR *) XOBNEWVEC (objfile->objfile_obstack (), FDR, info->symbolic_header.ifdMax); fdr_src = (char *) info->external_fdr; fdr_end = (fdr_src @@ -503,7 +503,7 @@ add_pending (FDR *fh, char *sh, struct type *t) /* Make sure we do not make duplicates. */ if (!p) { - p = XOBNEW (&mdebugread_objfile->objfile_obstack, mdebug_pending); + p = XOBNEW (mdebugread_objfile->objfile_obstack (), mdebug_pending); p->s = sh; p->t = t; p->next = pending_list[f_idx]; @@ -1018,7 +1018,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (sh->iss == 0 || name[0] == '.' || name[0] == '\0') t->set_name (NULL); else - t->set_name (obconcat (&mdebugread_objfile->objfile_obstack, + t->set_name (obconcat (mdebugread_objfile->objfile_obstack (), name, (char *) NULL)); t->set_code (type_code); @@ -1061,9 +1061,9 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, f->set_name (debug_info->ss + cur_fdr->issBase + tsym.iss); FIELD_BITSIZE (*f) = 0; - enum_sym = new (&mdebugread_objfile->objfile_obstack) symbol; + enum_sym = new (mdebugread_objfile->objfile_obstack ()) symbol; enum_sym->set_linkage_name - (obstack_strdup (&mdebugread_objfile->objfile_obstack, + (obstack_strdup (mdebugread_objfile->objfile_obstack (), f->name ())); enum_sym->set_aclass_index (LOC_CONST); enum_sym->set_type (t); @@ -1157,7 +1157,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s->set_domain (LABEL_DOMAIN); s->set_aclass_index (LOC_CONST); s->set_type (objfile_type (mdebugread_objfile)->builtin_void); - e = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack, + e = OBSTACK_ZALLOC (mdebugread_objfile->objfile_obstack (), mdebug_extra_func_info); s->set_value_bytes ((gdb_byte *) e); e->numargs = top_stack->numargs; @@ -1370,7 +1370,7 @@ basic_type (int bt, struct objfile *objfile) if (!map_bt) { - map_bt = OBSTACK_CALLOC (&objfile->objfile_obstack, + map_bt = OBSTACK_CALLOC (objfile->objfile_obstack (), btMax, struct type *); basic_type_data.set (objfile, map_bt); } @@ -1681,7 +1681,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, tp->set_name (NULL); else if (tp->name () == NULL || strcmp (tp->name (), name) != 0) - tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack, + tp->set_name (obstack_strdup (mdebugread_objfile->objfile_obstack (), name)); } } @@ -1717,7 +1717,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, } if (tp->name () == NULL || strcmp (tp->name (), name) != 0) - tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack, + tp->set_name (obstack_strdup (mdebugread_objfile->objfile_obstack (), name)); } } @@ -2331,7 +2331,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, && (bfd_section_flags (text_sect) & SEC_RELOC)) relocatable = 1; - extern_tab = XOBNEWVEC (&objfile->objfile_obstack, EXTR, hdr->iextMax); + extern_tab = XOBNEWVEC (objfile->objfile_obstack (), EXTR, hdr->iextMax); includes_allocated = 30; includes_used = 0; @@ -2373,7 +2373,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, } /* Allocate the global pending list. */ - pending_list = XOBNEWVEC (&objfile->objfile_obstack, mdebug_pending *, + pending_list = XOBNEWVEC (objfile->objfile_obstack (), mdebug_pending *, hdr->ifdMax); memset (pending_list, 0, hdr->ifdMax * sizeof (struct mdebug_pending *)); @@ -2604,7 +2604,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, textlow = 0; pst = new legacy_psymtab (fdr_name (fh), partial_symtabs, objfile->per_bfd, textlow); - pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, md_symloc); + pst->read_symtab_private = XOBNEW (objfile->objfile_obstack (), md_symloc); memset (pst->read_symtab_private, 0, sizeof (struct md_symloc)); save_pst = pst; @@ -3980,7 +3980,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) /* Make up special symbol to contain procedure specific info. */ mdebug_extra_func_info *e - = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack, + = OBSTACK_ZALLOC (mdebugread_objfile->objfile_obstack (), mdebug_extra_func_info); struct symbol *s = new_symbol (MDEBUG_EFI_SYMBOL_NAME); @@ -4173,7 +4173,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) --size; cust->primary_filetab ()->set_linetable ((struct linetable *) - obstack_copy (&mdebugread_objfile->objfile_obstack, + obstack_copy (mdebugread_objfile->objfile_obstack (), lines, (sizeof (struct linetable) + size * sizeof (lines->item)))); xfree (lines); @@ -4649,7 +4649,7 @@ new_psymtab (const char *name, psymtab_storage *partial_symtabs, /* Keep a backpointer to the file's symbols. */ psymtab->read_symtab_private - = OBSTACK_ZALLOC (&objfile->objfile_obstack, md_symloc); + = OBSTACK_ZALLOC (objfile->objfile_obstack (), md_symloc); CUR_BFD (psymtab) = cur_bfd; DEBUG_SWAP (psymtab) = debug_swap; DEBUG_INFO (psymtab) = debug_info; @@ -4735,9 +4735,9 @@ new_block (enum block_type type, enum language language) static struct symbol * new_symbol (const char *name) { - struct symbol *s = new (&mdebugread_objfile->objfile_obstack) symbol; + struct symbol *s = new (mdebugread_objfile->objfile_obstack ()) symbol; - s->set_language (psymtab_language, &mdebugread_objfile->objfile_obstack); + s->set_language (psymtab_language, mdebugread_objfile->objfile_obstack ()); s->compute_and_set_names (name, true, mdebugread_objfile->per_bfd); return s; } @@ -4773,7 +4773,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile, minimal_symbol_reader reader (objfile); - info = XOBNEW (&objfile->objfile_obstack, ecoff_debug_info); + info = XOBNEW (objfile->objfile_obstack (), ecoff_debug_info); if (!(*swap->read_debug_info) (abfd, sec, info)) error (_("Error reading ECOFF debugging information: %s"), diff --git a/gdb/objfiles.c b/gdb/objfiles.c index f462557..5149a24 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -225,7 +225,7 @@ objfile_register_static_link (struct objfile *objfile, slot = htab_find_slot (objfile->static_links.get (), &lookup_entry, INSERT); gdb_assert (*slot == NULL); - entry = XOBNEW (&objfile->objfile_obstack, static_link_htab_entry); + entry = XOBNEW (objfile->objfile_obstack (), static_link_htab_entry); entry->block = block; entry->static_link = static_link; *slot = (void *) entry; @@ -291,7 +291,7 @@ build_objfile_section_table (struct objfile *objfile) { int count = gdb_bfd_count_sections (objfile->obfd); - objfile->sections = OBSTACK_CALLOC (&objfile->objfile_obstack, + objfile->sections = OBSTACK_CALLOC (objfile->objfile_obstack (), count, struct obj_section); objfile->sections_end = (objfile->sections + count); @@ -327,7 +327,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_) /* We could use obstack_specify_allocation here instead, but gdb_obstack.h specifies the alloc/dealloc functions. */ - obstack_init (&objfile_obstack); + obstack_init (objfile_obstack ()); objfile_alloc_data (this); @@ -346,7 +346,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_) name_holder = gdb_abspath (name); expanded_name = name_holder.c_str (); } - original_name = obstack_strdup (&objfile_obstack, expanded_name); + original_name = obstack_strdup (objfile_obstack (), expanded_name); /* Update the per-objfile information that comes from the bfd, ensuring that any data that is reference is saved in the per-objfile data @@ -594,7 +594,7 @@ objfile::~objfile () } /* Free the obstacks for non-reusable objfiles. */ - obstack_free (&objfile_obstack, 0); + obstack_free (objfile_obstack (), 0); /* Rebuild section map next time we need it. */ get_objfile_pspace_data (pspace)->section_map_dirty = 1; diff --git a/gdb/objfiles.h b/gdb/objfiles.h index a7098b4..76d063c 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -666,7 +666,11 @@ public: /* Obstack to hold objects that should be freed when we load a new symbol table from this object file. */ - struct obstack objfile_obstack {}; + struct obstack m_objfile_obstack {}; + struct obstack *objfile_obstack () + { + return &m_objfile_obstack; + } /* Structure which keeps track of functions that manipulate objfile's of the same type as this objfile. I.e. the function to read partial diff --git a/gdb/stabsread.c b/gdb/stabsread.c index ab74cee..98ea59d 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -423,11 +423,11 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, /* On xcoff, if a global is defined and never referenced, ld will remove it from the executable. There is then a N_GSYM stab for it, but no regular (C_EXT) symbol. */ - sym = new (&objfile->objfile_obstack) symbol; + sym = new (objfile->objfile_obstack ()) symbol; sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_OPTIMIZED_OUT); sym->set_linkage_name - (obstack_strndup (&objfile->objfile_obstack, name, pp - name)); + (obstack_strndup (objfile->objfile_obstack (), name, pp - name)); pp += 2; if (*(pp - 1) == 'F' || *(pp - 1) == 'f') { @@ -687,7 +687,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, e.g. ":t10=*2" or a nameless enum like " :T16=ered:0,green:1,blue:2,;" */ nameless = (p == string || ((string[0] == ' ') && (string[1] == ':'))); - current_symbol = sym = new (&objfile->objfile_obstack) symbol; + current_symbol = sym = new (objfile->objfile_obstack ()) symbol; if (processing_gcc_compilation) { @@ -701,7 +701,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, } sym->set_language (get_current_subfile ()->language, - &objfile->objfile_obstack); + objfile->objfile_obstack ()); if (is_cplus_marker (string[0])) { @@ -799,7 +799,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, dbl_type = objfile_type (objfile)->builtin_double; dbl_valu - = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, + = (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), TYPE_LENGTH (dbl_type)); target_float_from_string (dbl_valu, dbl_type, std::string (p)); @@ -884,7 +884,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, (create_array_type (NULL, objfile_type (objfile)->builtin_char, range_type)); string_value - = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1); + = (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), ind + 1); memcpy (string_value, string_local, ind + 1); p++; @@ -1283,7 +1283,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (synonym) { /* Create the STRUCT_DOMAIN clone. */ - struct symbol *struct_sym = new (&objfile->objfile_obstack) symbol; + struct symbol *struct_sym = new (objfile->objfile_obstack ()) symbol; *struct_sym = *sym; struct_sym->set_aclass_index (LOC_TYPEDEF); @@ -1291,7 +1291,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, struct_sym->set_domain (STRUCT_DOMAIN); if (sym->type ()->name () == 0) sym->type ()->set_name - (obconcat (&objfile->objfile_obstack, sym->linkage_name (), + (obconcat (objfile->objfile_obstack (), sym->linkage_name (), (char *) NULL)); add_symbol_to_list (struct_sym, get_file_symbols ()); } @@ -1318,14 +1318,14 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_domain (STRUCT_DOMAIN); if (sym->type ()->name () == 0) sym->type ()->set_name - (obconcat (&objfile->objfile_obstack, sym->linkage_name (), + (obconcat (objfile->objfile_obstack (), sym->linkage_name (), (char *) NULL)); add_symbol_to_list (sym, get_file_symbols ()); if (synonym) { /* Clone the sym and then modify it. */ - struct symbol *typedef_sym = new (&objfile->objfile_obstack) symbol; + struct symbol *typedef_sym = new (objfile->objfile_obstack ()) symbol; *typedef_sym = *sym; typedef_sym->set_aclass_index (LOC_TYPEDEF); @@ -1333,7 +1333,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, typedef_sym->set_domain (VAR_DOMAIN); if (sym->type ()->name () == 0) sym->type ()->set_name - (obconcat (&objfile->objfile_obstack, sym->linkage_name (), + (obconcat (objfile->objfile_obstack (), sym->linkage_name (), (char *) NULL)); add_symbol_to_list (typedef_sym, get_file_symbols ()); } @@ -1599,13 +1599,13 @@ again: gdb::unique_xmalloc_ptr<char> new_name = cp_canonicalize_string (name); if (new_name != nullptr) - type_name = obstack_strdup (&objfile->objfile_obstack, + type_name = obstack_strdup (objfile->objfile_obstack (), new_name.get ()); } if (type_name == NULL) { char *to = type_name = (char *) - obstack_alloc (&objfile->objfile_obstack, p - *pp + 1); + obstack_alloc (objfile->objfile_obstack (), p - *pp + 1); /* Copy the name. */ from = *pp + 1; @@ -1633,7 +1633,7 @@ again: && (sym->type ()->code () == code) && strcmp (sym->linkage_name (), type_name) == 0) { - obstack_free (&objfile->objfile_obstack, type_name); + obstack_free (objfile->objfile_obstack (), type_name); type = sym->type (); if (typenums[0] != -1) *dbx_lookup_type (typenums, objfile) = type; @@ -2038,7 +2038,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile) if (!negative_types) { /* This includes an empty slot for type number -0. */ - negative_types = OBSTACK_CALLOC (&objfile->objfile_obstack, + negative_types = OBSTACK_CALLOC (objfile->objfile_obstack (), NUMBER_RECOGNIZED + 1, struct type *); rs6000_builtin_type_data.set (objfile, negative_types); } @@ -2584,11 +2584,11 @@ read_member_functions (struct stab_field_info *fip, const char **pp, struct next_fnfieldlist); destr_fnlist->fn_fieldlist.name - = obconcat (&objfile->objfile_obstack, "~", + = obconcat (objfile->objfile_obstack (), "~", new_fnlist->fn_fieldlist.name, (char *) NULL); destr_fnlist->fn_fieldlist.fn_fields = - XOBNEWVEC (&objfile->objfile_obstack, + XOBNEWVEC (objfile->objfile_obstack (), struct fn_field, has_destructor); memset (destr_fnlist->fn_fieldlist.fn_fields, 0, sizeof (struct fn_field) * has_destructor); @@ -2643,13 +2643,13 @@ read_member_functions (struct stab_field_info *fip, const char **pp, else if (has_destructor && new_fnlist->fn_fieldlist.name[0] != '~') { new_fnlist->fn_fieldlist.name = - obconcat (&objfile->objfile_obstack, + obconcat (objfile->objfile_obstack (), "~", main_fn_name, (char *)NULL); xfree (main_fn_name); } new_fnlist->fn_fieldlist.fn_fields - = OBSTACK_CALLOC (&objfile->objfile_obstack, length, fn_field); + = OBSTACK_CALLOC (objfile->objfile_obstack (), length, fn_field); for (i = length; (i--, sublist); sublist = sublist->next) { new_fnlist->fn_fieldlist.fn_fields[i] = sublist->fn_field; @@ -2712,7 +2712,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp, { name = ""; } - fip->list->field.set_name (obconcat (&objfile->objfile_obstack, + fip->list->field.set_name (obconcat (objfile->objfile_obstack (), vptr_name, name, (char *) NULL)); break; @@ -2725,13 +2725,13 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp, symnum); name = "FOO"; } - fip->list->field.set_name (obconcat (&objfile->objfile_obstack, + fip->list->field.set_name (obconcat (objfile->objfile_obstack (), vb_name, name, (char *) NULL)); break; default: invalid_cpp_abbrev_complaint (*pp); - fip->list->field.set_name (obconcat (&objfile->objfile_obstack, + fip->list->field.set_name (obconcat (objfile->objfile_obstack (), "INVALID_CPLUSPLUS_ABBREV", (char *) NULL)); break; @@ -2782,7 +2782,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp, struct gdbarch *gdbarch = objfile->arch (); fip->list->field.set_name - (obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp)); + (obstack_strndup (objfile->objfile_obstack (), *pp, p - *pp)); *pp = p + 1; /* This means we have a visibility for a field coming. */ @@ -3582,16 +3582,16 @@ read_enum_type (const char **pp, struct type *type, p = *pp; while (*p != ':') p++; - name = obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp); + name = obstack_strndup (objfile->objfile_obstack (), *pp, p - *pp); *pp = p + 1; n = read_huge_number (pp, ',', &nbits, 0); if (nbits != 0) return error_type (pp, objfile); - sym = new (&objfile->objfile_obstack) symbol; + sym = new (objfile->objfile_obstack ()) symbol; sym->set_linkage_name (name); sym->set_language (get_current_subfile ()->language, - &objfile->objfile_obstack); + objfile->objfile_obstack ()); sym->set_aclass_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); sym->set_value_longest (n); @@ -4232,7 +4232,7 @@ common_block_start (const char *name, struct objfile *objfile) } common_block = *get_local_symbols (); common_block_i = common_block ? common_block->nsyms : 0; - common_block_name = obstack_strdup (&objfile->objfile_obstack, name); + common_block_name = obstack_strdup (objfile->objfile_obstack (), name); } /* Process a N_ECOMM symbol. */ @@ -4257,7 +4257,7 @@ common_block_end (struct objfile *objfile) return; } - sym = new (&objfile->objfile_obstack) symbol; + sym = new (objfile->objfile_obstack ()) symbol; /* Note: common_block_name already saved on objfile_obstack. */ sym->set_linkage_name (common_block_name); sym->set_aclass_index (LOC_BLOCK); diff --git a/gdb/symfile.c b/gdb/symfile.c index 6f546f5..d2fd08c 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2525,7 +2525,7 @@ reread_symbols (int from_tty) /* NB: after this call to obstack_free, objfiles_changed will need to be called (see discussion below). */ - obstack_free (&objfile->objfile_obstack, 0); + obstack_free (objfile->objfile_obstack (), 0); objfile->sections = NULL; objfile->section_offsets.clear (); objfile->sect_index_bss = -1; @@ -2539,7 +2539,7 @@ reread_symbols (int from_tty) /* obstack_init also initializes the obstack so it is empty. We could use obstack_specify_allocation but gdb_obstack.h specifies the alloc/dealloc functions. */ - obstack_init (&objfile->objfile_obstack); + obstack_init (objfile->objfile_obstack ()); /* set_objfile_per_bfd potentially allocates the per-bfd data on the objfile's obstack (if sharing data across @@ -2548,7 +2548,7 @@ reread_symbols (int from_tty) set_objfile_per_bfd (objfile); objfile->original_name - = obstack_strdup (&objfile->objfile_obstack, original_name); + = obstack_strdup (objfile->objfile_obstack (), original_name); /* Reset the sym_fns pointer. The ELF reader can change it based on whether .gdb_index is present, and we need it to @@ -2776,7 +2776,7 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename) { struct objfile *objfile = cust->objfile (); struct symtab *symtab - = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symtab); + = OBSTACK_ZALLOC (objfile->objfile_obstack (), struct symtab); symtab->filename = objfile->intern (filename); symtab->fullname = NULL; @@ -2819,7 +2819,7 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename) struct compunit_symtab * allocate_compunit_symtab (struct objfile *objfile, const char *name) { - struct compunit_symtab *cu = OBSTACK_ZALLOC (&objfile->objfile_obstack, + struct compunit_symtab *cu = OBSTACK_ZALLOC (objfile->objfile_obstack (), struct compunit_symtab); const char *saved_name; @@ -2829,7 +2829,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name) Just save the basename to avoid path issues (too long for display, relative vs absolute, etc.). */ saved_name = lbasename (name); - cu->name = obstack_strdup (&objfile->objfile_obstack, saved_name); + cu->name = obstack_strdup (objfile->objfile_obstack (), saved_name); cu->set_debugformat ("unknown"); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 68b76bf..e1d6b20 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -95,8 +95,8 @@ print_objfile_statistics (void) gdb_printf (_(" Space used by string tables: %d\n"), OBJSTAT (objfile, sz_strtab)); gdb_printf (_(" Total memory used for objfile obstack: %s\n"), - pulongest (obstack_memory_used (&objfile - ->objfile_obstack))); + pulongest (obstack_memory_used (objfile + ->objfile_obstack ()))); gdb_printf (_(" Total memory used for BFD obstack: %s\n"), pulongest (obstack_memory_used (&objfile->per_bfd ->storage_obstack))); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 9e571d0..8970a81 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1005,7 +1005,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst) { char *p; - p = (char *) obstack_alloc (&objfile->objfile_obstack, + p = (char *) obstack_alloc (objfile->objfile_obstack (), E_SYMNMLEN + 1); strncpy (p, cs->c_name, E_SYMNMLEN); p[E_SYMNMLEN] = '\0'; @@ -1450,7 +1450,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst) } #define SYMNAME_ALLOC(NAME, ALLOCED) \ - ((ALLOCED) ? (NAME) : obstack_strdup (&objfile->objfile_obstack, \ + ((ALLOCED) ? (NAME) : obstack_strdup (objfile->objfile_obstack (), \ (NAME))) @@ -1499,7 +1499,7 @@ process_xcoff_symbol (struct xcoff_symbol *cs, struct objfile *objfile) sym->set_type (objfile_type (objfile)->nodebug_text_symbol); sym->set_aclass_index (LOC_BLOCK); - sym2 = new (&objfile->objfile_obstack) symbol (*sym); + sym2 = new (objfile->objfile_obstack ()) symbol (*sym); if (cs->c_sclass == C_EXT || C_WEAKEXT) add_symbol_to_list (sym2, get_global_symbols ()); @@ -1850,7 +1850,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) /* Allocate string table from objfile_obstack. We will need this table as long as we have its symbol table around. */ - strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length); + strtbl = (char *) obstack_alloc (objfile->objfile_obstack (), length); xcoff->strtbl = strtbl; /* Copy length buffer, the first byte is usually zero and is @@ -1893,7 +1893,7 @@ xcoff_start_psymtab (psymtab_storage *partial_symtabs, objfile->per_bfd, 0); result->read_symtab_private = - XOBNEW (&objfile->objfile_obstack, struct xcoff_symloc); + XOBNEW (objfile->objfile_obstack (), struct xcoff_symloc); ((struct xcoff_symloc *) result->read_symtab_private)->first_symnum = first_symnum; result->legacy_read_symtab = xcoff_read_symtab; result->legacy_expand_psymtab = xcoff_expand_psymtab; @@ -1948,7 +1948,7 @@ xcoff_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs, legacy_psymtab *subpst = new legacy_psymtab (include_list[i], partial_symtabs, objfile->per_bfd); - subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, xcoff_symloc); + subpst->read_symtab_private = XOBNEW (objfile->objfile_obstack (), xcoff_symloc); ((struct xcoff_symloc *) subpst->read_symtab_private)->first_symnum = 0; ((struct xcoff_symloc *) subpst->read_symtab_private)->numsyms = 0; @@ -1999,7 +1999,7 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux, into the minimal symbols. */ char *p; - p = (char *) obstack_alloc (&objfile->objfile_obstack, + p = (char *) obstack_alloc (objfile->objfile_obstack (), E_SYMNMLEN + 1); strncpy (p, symbol->n_name, E_SYMNMLEN); p[E_SYMNMLEN] = '\0'; @@ -2826,7 +2826,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) if (length) { debugsec - = (bfd_byte *) obstack_alloc (&objfile->objfile_obstack, + = (bfd_byte *) obstack_alloc (objfile->objfile_obstack (), length); if (!bfd_get_full_section_contents (abfd, secp, &debugsec)) @@ -2847,7 +2847,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) error (_("Error reading symbols from %s: %s"), name, bfd_errmsg (bfd_get_error ())); size = coff_data (abfd)->local_symesz * num_symbols; - info->symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size); + info->symtbl = (char *) obstack_alloc (objfile->objfile_obstack (), size); info->symtbl_num_syms = num_symbols; val = bfd_bread (info->symtbl, size, abfd); |