diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-09-24 13:57:36 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-09-24 13:57:36 +0000 |
commit | 51c92d04868bda27020a3dca7c0e6fb69a81203c (patch) | |
tree | f85ee053705d7354c811ba47d8238ec0244550bd | |
parent | ed16cce345679080b1fc077c650c2e85ccb92dba (diff) | |
download | gdb-51c92d04868bda27020a3dca7c0e6fb69a81203c.tar.gz |
Code cleanup: Add objfile_name accessor
gdb/
2013-09-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup: Add objfile_name accessor function.
* ada-lang.c (is_known_support_routine): Use objfile_name.
* auto-load.c (source_gdb_script_for_objfile)
(auto_load_objfile_script): Likewise.
* coffread.c (coff_symtab_read, read_one_sym): Likewise.
* dbxread.c (dbx_symfile_read): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
* dwarf2loc.c (locexpr_describe_location_piece): Likewise.
* dwarf2read.c (dwarf2_get_dwz_file, dwarf2_read_index)
(dw2_symtab_iter_next, dw2_expand_symtabs_matching)
(lookup_dwp_signatured_type, lookup_dwo_unit)
(dwarf2_build_psymtabs_hard, scan_partial_symbols, process_queue)
(fixup_go_packaging, process_imported_unit_die, dwarf2_physname)
(read_import_statement, create_dwo_cu, open_and_init_dwp_file)
(lookup_dwo_cutu, read_call_site_scope, dwarf2_ranges_read)
(dwarf2_record_block_ranges, read_common_block, read_typedef)
(read_subrange_type, load_partial_dies, read_partial_die)
(read_addr_index_1, read_str_index, dwarf_decode_lines_1)
(die_containing_type, build_error_marker_type, lookup_die_type)
(follow_die_ref_or_sig, follow_die_ref, dwarf2_fetch_die_loc_sect_off)
(dwarf2_fetch_constant_bytes, follow_die_sig, get_signatured_type)
(get_DW_AT_signature_type, write_psymtabs_to_index)
(save_gdb_index_command): Likewise.
* elfread.c (find_separate_debug_file_by_buildid, elf_symfile_read):
Likewise.
* expprint.c (dump_subexp_body_standard): Likewise.
* gdbtypes.c (type_name_no_tag_or_error): Likewise.
* jit.c (jit_object_close_impl): Use the objfile field name renamed to
original_name.
* linux-thread-db.c (try_thread_db_load_from_pdir_1): New variable
obj_name, use objfile_name for it, use the variable.
(try_thread_db_load_from_pdir, has_libpthread, thread_db_new_objfile):
Use objfile_name.
* machoread.c (macho_symtab_read, macho_check_dsym)
(macho_symfile_relocate): Likewise.
* maint.c (maintenance_translate_address): Likewise.
* minidebug.c (find_separate_debug_file_in_section): Likewise.
* minsyms.c (install_minimal_symbols): Likewise.
* objfiles.c (allocate_objfile): Use the objfile field name renamed to
original_name.
(filter_overlapping_sections): Use objfile_name.
(objfile_name): New function.
* objfiles.h (struct objfile): Rename field name to original_name.
(objfile_name): New prototype.
* printcmd.c (sym_info, address_info): Use objfile_name.
* probe.c (parse_probes, collect_probes, compare_probes)
(info_probes_for_ops): Likewise.
* progspace.c (clone_program_space): Likewise.
* psymtab.c (require_partial_symbols, dump_psymtab, allocate_psymtab)
(maintenance_info_psymtabs): Likewise.
* python/py-auto-load.c (gdbpy_load_auto_script_for_objfile)
(source_section_scripts): Likewise.
* python/py-objfile.c (objfpy_get_filename): Likewise.
* python/py-progspace.c (pspy_get_filename): Likewise.
* solib-aix.c (solib_aix_get_toc_value): Likewise.
* solib-som.c (match_main, som_solib_section_offsets): Likewise.
* solib.c (solib_read_symbols): Likewise.
* stabsread.c (scan_file_globals): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (symbol_file_clear, separate_debug_file_exists)
(find_separate_debug_file_by_debuglink): Likewise.
(reread_symbols): Likewise. Use the objfile field name renamed to
original_name.
(allocate_symtab): Use objfile_name.
* symmisc.c (print_symbol_bcache_statistics, print_objfile_statistics)
(dump_objfile, dump_msymbols, dump_symtab_1)
(maintenance_print_msymbols, maintenance_print_objfiles)
(maintenance_info_symtabs, maintenance_check_symtabs): Likewise.
* target.c (target_translate_tls_address, target_info): Likewise.
* xcoffread.c (xcoff_initial_scan): Make variable name const. Use
objfile_name.
-rw-r--r-- | gdb/ChangeLog | 74 | ||||
-rw-r--r-- | gdb/ada-lang.c | 2 | ||||
-rw-r--r-- | gdb/auto-load.c | 4 | ||||
-rw-r--r-- | gdb/coffread.c | 9 | ||||
-rw-r--r-- | gdb/dbxread.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2-frame.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 130 | ||||
-rw-r--r-- | gdb/elfread.c | 4 | ||||
-rw-r--r-- | gdb/expprint.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 3 | ||||
-rw-r--r-- | gdb/jit.c | 2 | ||||
-rw-r--r-- | gdb/linux-thread-db.c | 15 | ||||
-rw-r--r-- | gdb/machoread.c | 15 | ||||
-rw-r--r-- | gdb/maint.c | 4 | ||||
-rw-r--r-- | gdb/minidebug.c | 4 | ||||
-rw-r--r-- | gdb/minsyms.c | 2 | ||||
-rw-r--r-- | gdb/objfiles.c | 16 | ||||
-rw-r--r-- | gdb/objfiles.h | 4 | ||||
-rw-r--r-- | gdb/printcmd.c | 6 | ||||
-rw-r--r-- | gdb/probe.c | 14 | ||||
-rw-r--r-- | gdb/progspace.c | 2 | ||||
-rw-r--r-- | gdb/psymtab.c | 10 | ||||
-rw-r--r-- | gdb/python/py-auto-load.c | 6 | ||||
-rw-r--r-- | gdb/python/py-objfile.c | 3 | ||||
-rw-r--r-- | gdb/python/py-progspace.c | 3 | ||||
-rw-r--r-- | gdb/solib-aix.c | 2 | ||||
-rw-r--r-- | gdb/solib-som.c | 4 | ||||
-rw-r--r-- | gdb/solib.c | 2 | ||||
-rw-r--r-- | gdb/stabsread.c | 2 | ||||
-rw-r--r-- | gdb/stap-probe.c | 6 | ||||
-rw-r--r-- | gdb/symfile.c | 27 | ||||
-rw-r--r-- | gdb/symmisc.c | 20 | ||||
-rw-r--r-- | gdb/target.c | 15 | ||||
-rw-r--r-- | gdb/xcoffread.c | 4 |
35 files changed, 265 insertions, 161 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6dbb51d707a..6b9ff05e020 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,79 @@ 2013-09-24 Jan Kratochvil <jan.kratochvil@redhat.com> + Code cleanup: Add objfile_name accessor function. + * ada-lang.c (is_known_support_routine): Use objfile_name. + * auto-load.c (source_gdb_script_for_objfile) + (auto_load_objfile_script): Likewise. + * coffread.c (coff_symtab_read, read_one_sym): Likewise. + * dbxread.c (dbx_symfile_read): Likewise. + * dwarf2-frame.c (dwarf2_build_frame_info): Likewise. + * dwarf2loc.c (locexpr_describe_location_piece): Likewise. + * dwarf2read.c (dwarf2_get_dwz_file, dwarf2_read_index) + (dw2_symtab_iter_next, dw2_expand_symtabs_matching) + (lookup_dwp_signatured_type, lookup_dwo_unit) + (dwarf2_build_psymtabs_hard, scan_partial_symbols, process_queue) + (fixup_go_packaging, process_imported_unit_die, dwarf2_physname) + (read_import_statement, create_dwo_cu, open_and_init_dwp_file) + (lookup_dwo_cutu, read_call_site_scope, dwarf2_ranges_read) + (dwarf2_record_block_ranges, read_common_block, read_typedef) + (read_subrange_type, load_partial_dies, read_partial_die) + (read_addr_index_1, read_str_index, dwarf_decode_lines_1) + (die_containing_type, build_error_marker_type, lookup_die_type) + (follow_die_ref_or_sig, follow_die_ref, dwarf2_fetch_die_loc_sect_off) + (dwarf2_fetch_constant_bytes, follow_die_sig, get_signatured_type) + (get_DW_AT_signature_type, write_psymtabs_to_index) + (save_gdb_index_command): Likewise. + * elfread.c (find_separate_debug_file_by_buildid, elf_symfile_read): + Likewise. + * expprint.c (dump_subexp_body_standard): Likewise. + * gdbtypes.c (type_name_no_tag_or_error): Likewise. + * jit.c (jit_object_close_impl): Use the objfile field name renamed to + original_name. + * linux-thread-db.c (try_thread_db_load_from_pdir_1): New variable + obj_name, use objfile_name for it, use the variable. + (try_thread_db_load_from_pdir, has_libpthread, thread_db_new_objfile): + Use objfile_name. + * machoread.c (macho_symtab_read, macho_check_dsym) + (macho_symfile_relocate): Likewise. + * maint.c (maintenance_translate_address): Likewise. + * minidebug.c (find_separate_debug_file_in_section): Likewise. + * minsyms.c (install_minimal_symbols): Likewise. + * objfiles.c (allocate_objfile): Use the objfile field name renamed to + original_name. + (filter_overlapping_sections): Use objfile_name. + (objfile_name): New function. + * objfiles.h (struct objfile): Rename field name to original_name. + (objfile_name): New prototype. + * printcmd.c (sym_info, address_info): Use objfile_name. + * probe.c (parse_probes, collect_probes, compare_probes) + (info_probes_for_ops): Likewise. + * progspace.c (clone_program_space): Likewise. + * psymtab.c (require_partial_symbols, dump_psymtab, allocate_psymtab) + (maintenance_info_psymtabs): Likewise. + * python/py-auto-load.c (gdbpy_load_auto_script_for_objfile) + (source_section_scripts): Likewise. + * python/py-objfile.c (objfpy_get_filename): Likewise. + * python/py-progspace.c (pspy_get_filename): Likewise. + * solib-aix.c (solib_aix_get_toc_value): Likewise. + * solib-som.c (match_main, som_solib_section_offsets): Likewise. + * solib.c (solib_read_symbols): Likewise. + * stabsread.c (scan_file_globals): Likewise. + * stap-probe.c (handle_stap_probe): Likewise. + * symfile.c (symbol_file_clear, separate_debug_file_exists) + (find_separate_debug_file_by_debuglink): Likewise. + (reread_symbols): Likewise. Use the objfile field name renamed to + original_name. + (allocate_symtab): Use objfile_name. + * symmisc.c (print_symbol_bcache_statistics, print_objfile_statistics) + (dump_objfile, dump_msymbols, dump_symtab_1) + (maintenance_print_msymbols, maintenance_print_objfiles) + (maintenance_info_symtabs, maintenance_check_symtabs): Likewise. + * target.c (target_translate_tls_address, target_info): Likewise. + * xcoffread.c (xcoff_initial_scan): Make variable name const. Use + objfile_name. + +2013-09-24 Jan Kratochvil <jan.kratochvil@redhat.com> + Code cleanup. * probe.c (parse_probes): Rename variable objfile_name to objfile_namestr. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index ba59913b38e..f29c3516f3b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11154,7 +11154,7 @@ is_known_support_routine (struct frame_info *frame) if (re_exec (lbasename (sal.symtab->filename))) return 1; if (sal.symtab->objfile != NULL - && re_exec (sal.symtab->objfile->name)) + && re_exec (objfile_name (sal.symtab->objfile))) return 1; } diff --git a/gdb/auto-load.c b/gdb/auto-load.c index d461f2b95b6..6d0d6d98c2e 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -516,7 +516,7 @@ source_gdb_script_for_objfile (struct objfile *objfile, FILE *file, is_safe = file_is_auto_load_safe (filename, _("auto-load: Loading canned " "sequences of commands script " "\"%s\" for objfile \"%s\".\n"), - filename, objfile->name); + filename, objfile_name (objfile)); /* Add this script to the hash table too so "info auto-load gdb-scripts" can print it. */ @@ -809,7 +809,7 @@ void auto_load_objfile_script (struct objfile *objfile, const struct script_language *language) { - char *realname = gdb_realpath (objfile->name); + char *realname = gdb_realpath (objfile_name (objfile)); struct cleanup *cleanups = make_cleanup (xfree, realname); if (!auto_load_objfile_script_1 (objfile, realname, language)) diff --git a/gdb/coffread.c b/gdb/coffread.c index 7ade38c92eb..1008f6d777e 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -819,7 +819,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, /* Position to read the symbol table. */ val = bfd_seek (objfile->obfd, (long) symtab_offset, 0); if (val < 0) - perror_with_name (objfile->name); + perror_with_name (objfile_name (objfile)); coffread_objfile = objfile; nlist_bfd_global = objfile->obfd; @@ -1229,14 +1229,14 @@ read_one_sym (struct coff_symbol *cs, cs->c_symnum = symnum; bytes = bfd_bread (temp_sym, local_symesz, nlist_bfd_global); if (bytes != local_symesz) - error (_("%s: error reading symbols"), coffread_objfile->name); + error (_("%s: error reading symbols"), objfile_name (coffread_objfile)); bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym); cs->c_naux = sym->n_numaux & 0xff; if (cs->c_naux >= 1) { bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global); if (bytes != local_auxesz) - error (_("%s: error reading symbols"), coffread_objfile->name); + error (_("%s: error reading symbols"), objfile_name (coffread_objfile)); bfd_coff_swap_aux_in (symfile_bfd, temp_aux, sym->n_type, sym->n_sclass, 0, cs->c_naux, (char *) aux); @@ -1246,7 +1246,8 @@ read_one_sym (struct coff_symbol *cs, { bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global); if (bytes != local_auxesz) - error (_("%s: error reading symbols"), coffread_objfile->name); + error (_("%s: error reading symbols"), + objfile_name (coffread_objfile)); } } cs->c_name = getsymname (sym); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 283b87feca7..8188718130a 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -553,7 +553,7 @@ dbx_symfile_read (struct objfile *objfile, int symfile_flags) val = bfd_seek (sym_bfd, DBX_SYMTAB_OFFSET (objfile), SEEK_SET); if (val < 0) - perror_with_name (objfile->name); + perror_with_name (objfile_name (objfile)); /* Size the symbol table. */ if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0) diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 5c88b039ae0..e05236f0055 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -2306,7 +2306,7 @@ dwarf2_build_frame_info (struct objfile *objfile) if (e.reason < 0) { warning (_("skipping .eh_frame info of %s: %s"), - objfile->name, e.message); + objfile_name (objfile), e.message); if (fde_table.num_entries != 0) { @@ -2346,7 +2346,7 @@ dwarf2_build_frame_info (struct objfile *objfile) if (e.reason < 0) { warning (_("skipping .debug_frame info of %s: %s"), - objfile->name, e.message); + objfile_name (objfile), e.message); if (fde_table.num_entries != 0) { diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 55d43f1d0c0..c875d3a4afa 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -3487,7 +3487,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, fprintf_filtered (stream, _("a thread-local variable at offset 0x%s " "in the thread-local storage for `%s'"), - phex_nz (offset, addr_size), objfile->name); + phex_nz (offset, addr_size), objfile_name (objfile)); data += 1 + addr_size + 1; } @@ -3510,7 +3510,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, fprintf_filtered (stream, _("a thread-local variable at offset 0x%s " "in the thread-local storage for `%s'"), - phex_nz (offset, addr_size), objfile->name); + phex_nz (offset, addr_size), objfile_name (objfile)); ++data; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index a9c4d781bbe..fc57db16ddc 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2139,7 +2139,7 @@ dwarf2_get_dwz_file (void) filename = (const char *) data; if (!IS_ABSOLUTE_PATH (filename)) { - char *abs = gdb_realpath (dwarf2_per_objfile->objfile->name); + char *abs = gdb_realpath (objfile_name (dwarf2_per_objfile->objfile)); char *rel; make_cleanup (xfree, abs); @@ -2831,7 +2831,7 @@ dwarf2_read_index (struct objfile *objfile) offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0; struct dwz_file *dwz; - if (!read_index_from_section (objfile, objfile->name, + if (!read_index_from_section (objfile, objfile_name (objfile), use_deprecated_index_sections, &dwarf2_per_objfile->gdb_index, &local_map, &cu_list, &cu_list_elements, @@ -3250,7 +3250,8 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter) { complaint (&symfile_complaints, _(".gdb_index entry has bad CU index" - " [in module %s]"), dwarf2_per_objfile->objfile->name); + " [in module %s]"), + objfile_name (dwarf2_per_objfile->objfile)); continue; } @@ -3647,7 +3648,7 @@ dw2_expand_symtabs_matching { complaint (&symfile_complaints, _(".gdb_index entry has bad CU index" - " [in module %s]"), objfile->name); + " [in module %s]"), objfile_name (objfile)); continue; } @@ -4565,7 +4566,7 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) hex_string (sig), cu->per_cu->is_debug_types ? "TU" : "CU", cu->per_cu->offset.sect_off, - objfile->name); + objfile_name (objfile)); return sig_entry; } @@ -4877,7 +4878,7 @@ lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu, if (! attr) error (_("Dwarf Error: missing dwo_id for dwo_name %s" " [in module %s]"), - dwo_name, this_cu->objfile->name); + dwo_name, objfile_name (this_cu->objfile)); signature = DW_UNSND (attr); dwo_unit = lookup_dwo_comp_unit (this_cu, dwo_name, comp_dir, signature); @@ -5980,7 +5981,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) if (dwarf2_read_debug) { fprintf_unfiltered (gdb_stdlog, "Building psymtabs of objfile %s ...\n", - objfile->name); + objfile_name (objfile)); } dwarf2_per_objfile->reading_partial_symbols = 1; @@ -6019,7 +6020,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) if (dwarf2_read_debug) fprintf_unfiltered (gdb_stdlog, "Done building psymtabs of %s\n", - objfile->name); + objfile_name (objfile)); } /* die_reader_func for load_partial_comp_unit. */ @@ -6219,7 +6220,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc, { error (_("Dwarf Error: DW_TAG_imported_unit is not" " supported in type units [in module %s]"), - cu->objfile->name); + objfile_name (cu->objfile)); } per_cu = dwarf2_find_containing_comp_unit (pdi->d.offset, @@ -7011,7 +7012,7 @@ process_queue (void) { fprintf_unfiltered (gdb_stdlog, "Expanding one or more symtabs of objfile %s ...\n", - dwarf2_per_objfile->objfile->name); + objfile_name (dwarf2_per_objfile->objfile)); } /* The queue starts out with one item, but following a DIE reference @@ -7058,7 +7059,7 @@ process_queue (void) if (dwarf2_read_debug) { fprintf_unfiltered (gdb_stdlog, "Done expanding symtabs of %s.\n", - dwarf2_per_objfile->objfile->name); + objfile_name (dwarf2_per_objfile->objfile)); } } @@ -7298,7 +7299,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) _("Symtab %s has objects from two different Go packages: %s and %s"), (SYMBOL_SYMTAB (sym) ? symtab_to_filename_for_display (SYMBOL_SYMTAB (sym)) - : cu->objfile->name), + : objfile_name (cu->objfile)), this_package_name, package_name); xfree (this_package_name); } @@ -7666,7 +7667,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) { error (_("Dwarf Error: DW_TAG_imported_unit is not" " supported in type units [in module %s]"), - cu->objfile->name); + objfile_name (cu->objfile)); } attr = dwarf2_attr (die, DW_AT_import, cu); @@ -8197,7 +8198,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Computed physname <%s> does not match demangled <%s> " "(from linkage <%s>) - DIE at 0x%x [in module %s]"), - physname, canon, mangled, die->offset.sect_off, objfile->name); + physname, canon, mangled, die->offset.sect_off, + objfile_name (objfile)); /* Prefer DW_AT_linkage_name (in the CANON form) - when it is available here - over computed PHYSNAME. It is safer @@ -8326,7 +8328,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("child DW_TAG_imported_declaration expected " "- DIE at 0x%x [in module %s]"), - child_die->offset.sect_off, objfile->name); + child_die->offset.sect_off, objfile_name (objfile)); continue; } @@ -8347,7 +8349,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("child DW_TAG_imported_declaration has unknown " "imported name - DIE at 0x%x [in module %s]"), - child_die->offset.sect_off, objfile->name); + child_die->offset.sect_off, objfile_name (objfile)); continue; } @@ -8905,7 +8907,7 @@ create_dwo_cu (struct dwo_file *dwo_file) { complaint (&symfile_complaints, _("Multiple CUs in DWO file %s [in module %s]"), - dwo_file->dwo_name, objfile->name); + dwo_file->dwo_name, objfile_name (objfile)); break; } @@ -9646,7 +9648,7 @@ open_and_init_dwp_file (void) bfd *dbfd; struct cleanup *cleanups; - dwp_name = xstrprintf ("%s.dwp", dwarf2_per_objfile->objfile->name); + dwp_name = xstrprintf ("%s.dwp", objfile_name (dwarf2_per_objfile->objfile)); cleanups = make_cleanup (xfree, dwp_name); dbfd = open_dwp_file (dwp_name); @@ -9818,7 +9820,7 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit, " [in module %s]"), kind, dwo_name, hex_string (signature), this_unit->is_debug_types ? "TU" : "CU", - this_unit->offset.sect_off, objfile->name); + this_unit->offset.sect_off, objfile_name (objfile)); return NULL; } @@ -10333,7 +10335,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("missing DW_AT_low_pc for DW_TAG_GNU_call_site " "DIE 0x%x [in module %s]"), - die->offset.sect_off, objfile->name); + die->offset.sect_off, objfile_name (objfile)); return; } pc = DW_ADDR (attr) + baseaddr; @@ -10349,7 +10351,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Duplicate PC %s for DW_TAG_GNU_call_site " "DIE 0x%x [in module %s]"), - paddress (gdbarch, pc), die->offset.sect_off, objfile->name); + paddress (gdbarch, pc), die->offset.sect_off, + objfile_name (objfile)); return; } @@ -10364,7 +10367,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Tag %d is not DW_TAG_GNU_call_site_parameter in " "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"), - child_die->tag, child_die->offset.sect_off, objfile->name); + child_die->tag, child_die->offset.sect_off, + objfile_name (objfile)); continue; } @@ -10422,7 +10426,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Cannot find function owning DW_TAG_GNU_call_site " "DIE 0x%x [in module %s]"), - die->offset.sect_off, objfile->name); + die->offset.sect_off, objfile_name (objfile)); } } @@ -10468,7 +10472,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("DW_AT_GNU_call_site_target target DIE has invalid " "physname, for referencing DIE 0x%x [in module %s]"), - die->offset.sect_off, objfile->name); + die->offset.sect_off, objfile_name (objfile)); else SET_FIELD_PHYSNAME (call_site->target, target_physname); } @@ -10481,7 +10485,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("DW_AT_GNU_call_site_target target DIE has invalid " "low pc, for referencing DIE 0x%x [in module %s]"), - die->offset.sect_off, objfile->name); + die->offset.sect_off, objfile_name (objfile)); else SET_FIELD_PHYSADDR (call_site->target, lowpc + baseaddr); } @@ -10490,7 +10494,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("DW_TAG_GNU_call_site DW_AT_GNU_call_site_target is neither " "block nor reference, for DIE 0x%x [in module %s]"), - die->offset.sect_off, objfile->name); + die->offset.sect_off, objfile_name (objfile)); call_site->per_cu = cu->per_cu; @@ -10531,7 +10535,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) _("DW_AT_abstract_origin offset is not in CU for " "DW_TAG_GNU_call_site child DIE 0x%x " "[in module %s]"), - child_die->offset.sect_off, objfile->name); + child_die->offset.sect_off, objfile_name (objfile)); continue; } parameter->u.param_offset.cu_off = (offset.sect_off @@ -10542,7 +10546,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("No DW_FORM_block* DW_AT_location for " "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"), - child_die->offset.sect_off, objfile->name); + child_die->offset.sect_off, objfile_name (objfile)); continue; } else @@ -10562,7 +10566,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) "for DW_FORM_block* DW_AT_location is supported for " "DW_TAG_GNU_call_site child DIE 0x%x " "[in module %s]"), - child_die->offset.sect_off, objfile->name); + child_die->offset.sect_off, objfile_name (objfile)); continue; } } @@ -10573,7 +10577,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("No DW_FORM_block* DW_AT_GNU_call_site_value for " "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"), - child_die->offset.sect_off, objfile->name); + child_die->offset.sect_off, objfile_name (objfile)); continue; } parameter->value = DW_BLOCK (attr)->data; @@ -10591,7 +10595,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("No DW_FORM_block* DW_AT_GNU_call_site_data_value for " "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"), - child_die->offset.sect_off, objfile->name); + child_die->offset.sect_off, objfile_name (objfile)); else { parameter->data_value = DW_BLOCK (attr)->data; @@ -10713,7 +10717,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return, { complaint (&symfile_complaints, _(".debug_ranges entry has start address of zero" - " [in module %s]"), objfile->name); + " [in module %s]"), objfile_name (objfile)); continue; } @@ -11054,7 +11058,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, { complaint (&symfile_complaints, _(".debug_ranges entry has start address of zero" - " [in module %s]"), objfile->name); + " [in module %s]"), objfile_name (objfile)); continue; } @@ -12661,7 +12665,8 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) _("Variable in common block has " "DW_AT_data_member_location " "- DIE at 0x%x [in module %s]"), - child_die->offset.sect_off, cu->objfile->name); + child_die->offset.sect_off, + objfile_name (cu->objfile)); if (attr_form_is_section_offset (member_loc)) dwarf2_complex_location_expr_complaint (); @@ -13285,7 +13290,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Self-referential DW_TAG_typedef " "- DIE at 0x%x [in module %s]"), - die->offset.sect_off, objfile->name); + die->offset.sect_off, objfile_name (objfile)); TYPE_TARGET_TYPE (this_type) = NULL; } return this_type; @@ -13453,7 +13458,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) else if (!low_default_is_valid) complaint (&symfile_complaints, _("Missing DW_AT_lower_bound " "- DIE at 0x%x [in module %s]"), - die->offset.sect_off, cu->objfile->name); + die->offset.sect_off, objfile_name (cu->objfile)); attr = dwarf2_attr (die, DW_AT_upper_bound, cu); if (attr) @@ -14145,7 +14150,7 @@ load_partial_dies (const struct die_reader_specs *reader, complaint (&symfile_complaints, _("DW_TAG_typedef has childen - GCC PR debug/47510 bug " "- DIE at 0x%x [in module %s]"), - part_die->offset.sect_off, objfile->name); + part_die->offset.sect_off, objfile_name (objfile)); /* If we're at the second level, and we're an enumerator, and our parent has no specification (meaning possibly lives in a @@ -14461,7 +14466,7 @@ read_partial_die (const struct die_reader_specs *reader, _("DW_AT_low_pc %s is zero " "for DIE at 0x%x [in module %s]"), paddress (gdbarch, part_die->lowpc), - part_die->offset.sect_off, objfile->name); + part_die->offset.sect_off, objfile_name (objfile)); } /* dwarf2_get_pc_bounds has also the strict low < high requirement. */ else if (part_die->lowpc >= part_die->highpc) @@ -14473,7 +14478,7 @@ read_partial_die (const struct die_reader_specs *reader, "for DIE at 0x%x [in module %s]"), paddress (gdbarch, part_die->lowpc), paddress (gdbarch, part_die->highpc), - part_die->offset.sect_off, objfile->name); + part_die->offset.sect_off, objfile_name (objfile)); } else part_die->has_pc_info = 1; @@ -15307,11 +15312,11 @@ read_addr_index_1 (unsigned int addr_index, ULONGEST addr_base, int addr_size) dwarf2_read_section (objfile, &dwarf2_per_objfile->addr); if (dwarf2_per_objfile->addr.buffer == NULL) error (_("DW_FORM_addr_index used without .debug_addr section [in module %s]"), - objfile->name); + objfile_name (objfile)); if (addr_base + addr_index * addr_size >= dwarf2_per_objfile->addr.size) error (_("DW_FORM_addr_index pointing outside of " ".debug_addr section [in module %s]"), - objfile->name); + objfile_name (objfile)); info_ptr = (dwarf2_per_objfile->addr.buffer + addr_base + addr_index * addr_size); if (addr_size == 4) @@ -15426,7 +15431,7 @@ read_str_index (const struct die_reader_specs *reader, struct dwarf2_cu *cu, ULONGEST str_index) { struct objfile *objfile = dwarf2_per_objfile->objfile; - const char *dwo_name = objfile->name; + const char *dwo_name = objfile_name (objfile); bfd *abfd = objfile->obfd; struct dwo_sections *sections = &reader->dwo_file->sections; const gdb_byte *info_ptr; @@ -16081,7 +16086,7 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir, complaint (&symfile_complaints, _(".debug_line address at offset 0x%lx is 0 " "[in module %s]"), - line_offset, objfile->name); + line_offset, objfile_name (objfile)); p_record_line = noop_record_line; } @@ -17108,7 +17113,7 @@ die_containing_type (struct die_info *die, struct dwarf2_cu *cu) type_attr = dwarf2_attr (die, DW_AT_containing_type, cu); if (!type_attr) error (_("Dwarf Error: Problem turning containing type into gdb type " - "[in module %s]"), cu->objfile->name); + "[in module %s]"), objfile_name (cu->objfile)); return lookup_die_type (die, type_attr, cu); } @@ -17122,7 +17127,7 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die) char *message, *saved; message = xstrprintf (_("<unknown type in %s, CU 0x%x, DIE 0x%x>"), - objfile->name, + objfile_name (objfile), cu->header.offset.sect_off, die->offset.sect_off); saved = obstack_copy0 (&objfile->objfile_obstack, @@ -17176,7 +17181,7 @@ lookup_die_type (struct die_info *die, const struct attribute *attr, _("Dwarf Error: Bad type attribute %s in DIE" " at 0x%x [in module %s]"), dwarf_attr_name (attr->name), die->offset.sect_off, - objfile->name); + objfile_name (objfile)); return build_error_marker_type (cu, die); } @@ -18089,7 +18094,7 @@ follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr, { dump_die_for_error (src_die); error (_("Dwarf Error: Expected reference attribute [in module %s]"), - (*ref_cu)->objfile->name); + objfile_name ((*ref_cu)->objfile)); } return die; @@ -18164,7 +18169,8 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr, if (!die) error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE " "at 0x%x [in module %s]"), - offset.sect_off, src_die->offset.sect_off, cu->objfile->name); + offset.sect_off, src_die->offset.sect_off, + objfile_name (cu->objfile)); return die; } @@ -18193,7 +18199,7 @@ dwarf2_fetch_die_loc_sect_off (sect_offset offset, die = follow_die_offset (offset, per_cu->is_dwz, &cu); if (!die) error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), - offset.sect_off, per_cu->objfile->name); + offset.sect_off, objfile_name (per_cu->objfile)); attr = dwarf2_attr (die, DW_AT_location, cu); if (!attr) @@ -18221,7 +18227,7 @@ dwarf2_fetch_die_loc_sect_off (sect_offset offset, if (!attr_form_is_block (attr)) error (_("Dwarf Error: DIE at 0x%x referenced in module %s " "is neither DW_FORM_block* nor DW_FORM_exprloc"), - offset.sect_off, per_cu->objfile->name); + offset.sect_off, objfile_name (per_cu->objfile)); retval.data = DW_BLOCK (attr)->data; retval.size = DW_BLOCK (attr)->size; @@ -18294,7 +18300,7 @@ dwarf2_fetch_constant_bytes (sect_offset offset, die = follow_die_offset (offset, per_cu->is_dwz, &cu); if (!die) error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), - offset.sect_off, per_cu->objfile->name); + offset.sect_off, objfile_name (per_cu->objfile)); attr = dwarf2_attr (die, DW_AT_const_value, cu); @@ -18478,7 +18484,7 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr, error (_("Dwarf Error: Cannot find signatured DIE %s referenced" " from DIE at 0x%x [in module %s]"), hex_string (signature), src_die->offset.sect_off, - (*ref_cu)->objfile->name); + objfile_name ((*ref_cu)->objfile)); } die = follow_die_sig_1 (src_die, sig_type, ref_cu); @@ -18488,7 +18494,7 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr, error (_("Dwarf Error: Problem reading signatured DIE %s referenced" " from DIE at 0x%x [in module %s]"), hex_string (signature), src_die->offset.sect_off, - (*ref_cu)->objfile->name); + objfile_name ((*ref_cu)->objfile)); } return die; @@ -18515,7 +18521,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature, _("Dwarf Error: Cannot find signatured DIE %s referenced" " from DIE at 0x%x [in module %s]"), hex_string (signature), die->offset.sect_off, - dwarf2_per_objfile->objfile->name); + objfile_name (dwarf2_per_objfile->objfile)); return build_error_marker_type (cu, die); } @@ -18537,7 +18543,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature, _("Dwarf Error: Cannot build signatured type %s" " referenced from DIE at 0x%x [in module %s]"), hex_string (signature), die->offset.sect_off, - dwarf2_per_objfile->objfile->name); + objfile_name (dwarf2_per_objfile->objfile)); type = build_error_marker_type (cu, die); } } @@ -18547,7 +18553,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature, _("Dwarf Error: Problem reading signatured DIE %s referenced" " from DIE at 0x%x [in module %s]"), hex_string (signature), die->offset.sect_off, - dwarf2_per_objfile->objfile->name); + objfile_name (dwarf2_per_objfile->objfile)); type = build_error_marker_type (cu, die); } sig_type->type = type; @@ -18580,7 +18586,7 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr, _("Dwarf Error: DW_AT_signature has bad form %s in DIE" " at 0x%x [in module %s]"), dwarf_form_name (attr->form), die->offset.sect_off, - dwarf2_per_objfile->objfile->name); + objfile_name (dwarf2_per_objfile->objfile)); return build_error_marker_type (cu, die); } } @@ -21350,10 +21356,10 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir) if (!objfile->psymtabs || !objfile->psymtabs_addrmap) return; - if (stat (objfile->name, &st) < 0) - perror_with_name (objfile->name); + if (stat (objfile_name (objfile), &st) < 0) + perror_with_name (objfile_name (objfile)); - filename = concat (dir, SLASH_STRING, lbasename (objfile->name), + filename = concat (dir, SLASH_STRING, lbasename (objfile_name (objfile)), INDEX_SUFFIX, (char *) NULL); cleanup = make_cleanup (xfree, filename); @@ -21527,7 +21533,7 @@ save_gdb_index_command (char *arg, int from_tty) struct stat st; /* If the objfile does not correspond to an actual file, skip it. */ - if (stat (objfile->name, &st) < 0) + if (stat (objfile_name (objfile), &st) < 0) continue; dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); @@ -21542,7 +21548,7 @@ save_gdb_index_command (char *arg, int from_tty) if (except.reason < 0) exception_fprintf (gdb_stderr, except, _("Error while writing index for `%s': "), - objfile->name); + objfile_name (objfile)); } } } diff --git a/gdb/elfread.c b/gdb/elfread.c index b5c10464000..cbb55b1ecd0 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1200,7 +1200,7 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) build_id_name = build_id_to_debug_filename (build_id); /* Prevent looping on a stripped .debug file. */ if (build_id_name != NULL - && filename_cmp (build_id_name, objfile->name) == 0) + && filename_cmp (build_id_name, objfile_name (objfile)) == 0) { warning (_("\"%s\": separate debug info file has no debug info"), build_id_name); @@ -1255,7 +1255,7 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) { fprintf_unfiltered (gdb_stdlog, "Reading minimal symbols of objfile %s ...\n", - objfile->name); + objfile_name (objfile)); } init_minimal_symbol_collection (); diff --git a/gdb/expprint.c b/gdb/expprint.c index 648e66aaf38..6eb6f13385a 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -934,7 +934,7 @@ dump_subexp_body_standard (struct expression *exp, gdb_print_host_address (exp->elts[elt + 1].type, stream); fprintf_filtered (stream, " (__thread /* \"%s\" */ ", (exp->elts[elt].objfile == NULL ? "(null)" - : exp->elts[elt].objfile->name)); + : objfile_name (exp->elts[elt].objfile))); type_print (exp->elts[elt + 1].type, NULL, stream, 0); fprintf_filtered (stream, ")"); elt = dump_subexp (exp, stream, elt + 3); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d4375ae3ddc..ea5ca2171dd 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1187,7 +1187,8 @@ type_name_no_tag_or_error (struct type *type) name = type_name_no_tag (saved_type); objfile = TYPE_OBJFILE (saved_type); error (_("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"), - name ? name : "<anonymous>", objfile ? objfile->name : "<arch>"); + name ? name : "<anonymous>", + objfile ? objfile_name (objfile) : "<arch>"); } /* Lookup a typedef or primitive type named NAME, visible in lexical diff --git a/gdb/jit.c b/gdb/jit.c index c565b6b7aa9..ce66c9fabf5 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -790,7 +790,7 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb, terminate_minimal_symbol_table (objfile); - objfile->name = "<< JIT compiled code >>"; + objfile->original_name = "<< JIT compiled code >>"; j = NULL; for (i = obj->symtabs; i; i = j) diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 36968272c07..3813f6386c3 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -892,19 +892,20 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir) struct cleanup *cleanup; char *path, *cp; int result; + const char *obj_name = objfile_name (obj); - if (obj->name[0] != '/') + if (obj_name[0] != '/') { warning (_("Expected absolute pathname for libpthread in the" - " inferior, but got %s."), obj->name); + " inferior, but got %s."), obj_name); return 0; } - path = xmalloc (strlen (obj->name) + (subdir ? strlen (subdir) + 1 : 0) + path = xmalloc (strlen (obj_name) + (subdir ? strlen (subdir) + 1 : 0) + 1 + strlen (LIBTHREAD_DB_SO) + 1); cleanup = make_cleanup (xfree, path); - strcpy (path, obj->name); + strcpy (path, obj_name); cp = strrchr (path, '/'); /* This should at minimum hit the first character. */ gdb_assert (cp != NULL); @@ -941,7 +942,7 @@ try_thread_db_load_from_pdir (const char *subdir) return 0; ALL_OBJFILES (obj) - if (libpthread_name_p (obj->name)) + if (libpthread_name_p (objfile_name (obj))) { if (try_thread_db_load_from_pdir_1 (obj, subdir)) return 1; @@ -1075,7 +1076,7 @@ has_libpthread (void) struct objfile *obj; ALL_OBJFILES (obj) - if (libpthread_name_p (obj->name)) + if (libpthread_name_p (objfile_name (obj))) return 1; return 0; @@ -1200,7 +1201,7 @@ thread_db_new_objfile (struct objfile *objfile) of the list of shared libraries to load, and in an app of several thousand shared libraries, this can otherwise be painful. */ && ((objfile->flags & OBJF_MAINLINE) != 0 - || libpthread_name_p (objfile->name))) + || libpthread_name_p (objfile_name (objfile)))) check_for_thread_db (); } diff --git a/gdb/machoread.c b/gdb/machoread.c index b56e21c5418..91cc69334d4 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -239,7 +239,7 @@ macho_symtab_read (struct objfile *objfile, /* Debugging symbols are not expected here. */ complaint (&symfile_complaints, _("%s: Unexpected debug stab outside SO markers"), - objfile->name); + objfile_name (objfile)); } else { @@ -791,16 +791,16 @@ macho_symfile_read_all_oso (VEC (oso_el) **oso_vector_ptr, static bfd * macho_check_dsym (struct objfile *objfile) { - size_t name_len = strlen (objfile->name); + size_t name_len = strlen (objfile_name (objfile)); size_t dsym_len = strlen (DSYM_SUFFIX); - const char *base_name = lbasename (objfile->name); + const char *base_name = lbasename (objfile_name (objfile)); size_t base_len = strlen (base_name); char *dsym_filename = alloca (name_len + dsym_len + base_len + 1); bfd *dsym_bfd; bfd_mach_o_load_command *main_uuid; bfd_mach_o_load_command *dsym_uuid; - strcpy (dsym_filename, objfile->name); + strcpy (dsym_filename, objfile_name (objfile)); strcpy (dsym_filename + name_len, DSYM_SUFFIX); strcpy (dsym_filename + name_len + dsym_len, base_name); @@ -810,7 +810,7 @@ macho_check_dsym (struct objfile *objfile) if (bfd_mach_o_lookup_command (objfile->obfd, BFD_MACH_O_LC_UUID, &main_uuid) == 0) { - warning (_("can't find UUID in %s"), objfile->name); + warning (_("can't find UUID in %s"), objfile_name (objfile)); return NULL; } dsym_bfd = gdb_bfd_openr (dsym_filename, gnutarget); @@ -837,7 +837,8 @@ macho_check_dsym (struct objfile *objfile) if (memcmp (dsym_uuid->command.uuid.uuid, main_uuid->command.uuid.uuid, sizeof (main_uuid->command.uuid.uuid))) { - warning (_("dsym file UUID doesn't match the one in %s"), objfile->name); + warning (_("dsym file UUID doesn't match the one in %s"), + objfile_name (objfile)); gdb_bfd_unref (dsym_bfd); return NULL; } @@ -953,7 +954,7 @@ macho_symfile_relocate (struct objfile *objfile, asection *sectp, if (mach_o_debug_level > 0) printf_unfiltered (_("Relocate section '%s' of %s\n"), - sectp->name, objfile->name); + sectp->name, objfile_name (objfile)); return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL); } diff --git a/gdb/maint.c b/gdb/maint.c index 18a804a955a..71c4b85c7e2 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -503,8 +503,8 @@ maintenance_translate_address (char *arg, int from_tty) gdb_assert (sect->the_bfd_section && sect->the_bfd_section->name); section_name = sect->the_bfd_section->name; - gdb_assert (sect->objfile && sect->objfile->name); - obj_name = sect->objfile->name; + gdb_assert (sect->objfile && objfile_name (sect->objfile)); + obj_name = objfile_name (sect->objfile); if (MULTI_OBJFILE_P ()) printf_filtered (_("%s + %s in section %s of %s\n"), diff --git a/gdb/minidebug.c b/gdb/minidebug.c index a33628a18b6..385566aeca1 100644 --- a/gdb/minidebug.c +++ b/gdb/minidebug.c @@ -269,8 +269,8 @@ find_separate_debug_file_in_section (struct objfile *objfile) return NULL; #ifdef HAVE_LIBLZMA - abfd = gdb_bfd_openr_iovec (objfile->name, gnutarget, lzma_open, section, - lzma_pread, lzma_close, lzma_stat); + abfd = gdb_bfd_openr_iovec (objfile_name (objfile), gnutarget, lzma_open, + section, lzma_pread, lzma_close, lzma_stat); if (abfd == NULL) return NULL; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index e2079301fad..95dd6cf8317 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1187,7 +1187,7 @@ install_minimal_symbols (struct objfile *objfile) { fprintf_unfiltered (gdb_stdlog, "Installing %d minimal symbols of objfile %s.\n", - msym_count, objfile->name); + msym_count, objfile_name (objfile)); } /* Allocate enough space in the obstack, into which we will gather the diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 16815472fb6..aae992fd30d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -283,7 +283,7 @@ allocate_objfile (bfd *abfd, int flags) gdb_bfd_ref (abfd); if (abfd != NULL) { - objfile->name = bfd_get_filename (abfd); + objfile->original_name = bfd_get_filename (abfd); objfile->mtime = bfd_get_mtime (abfd); /* Build section table. */ @@ -291,7 +291,7 @@ allocate_objfile (bfd *abfd, int flags) } else { - objfile->name = "<<anonymous objfile>>"; + objfile->original_name = "<<anonymous objfile>>"; } objfile->per_bfd = get_objfile_bfd_data (objfile, abfd); @@ -1267,10 +1267,10 @@ filter_overlapping_sections (struct obj_section **map, int map_size) " (A) section `%s' from `%s' [%s, %s)\n" " (B) section `%s' from `%s' [%s, %s).\n" "Will ignore section B"), - bfd_section_name (abfd1, bfds1), objf1->name, + bfd_section_name (abfd1, bfds1), objfile_name (objf1), paddress (gdbarch, sect1_addr), paddress (gdbarch, sect1_endaddr), - bfd_section_name (abfd2, bfds2), objf2->name, + bfd_section_name (abfd2, bfds2), objfile_name (objf2), paddress (gdbarch, sect2_addr), paddress (gdbarch, sect2_endaddr)); } @@ -1481,6 +1481,14 @@ default_iterate_over_objfiles_in_search_order } } +/* Return canonical name for OBJFILE. */ + +const char * +objfile_name (const struct objfile *objfile) +{ + return objfile->original_name; +} + /* Provide a prototype to silence -Wmissing-prototypes. */ extern initialize_file_ftype _initialize_objfiles; diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 51ec8a3fd94..8467aa4143b 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -209,7 +209,7 @@ struct objfile pointer is never NULL. This does not have to be freed; it is guaranteed to have a lifetime at least as long as the objfile. */ - char *name; + char *original_name; CORE_ADDR addr_low; @@ -673,4 +673,6 @@ extern void default_iterate_over_objfiles_in_search_order void set_objfile_per_bfd (struct objfile *obj); +const char *objfile_name (const struct objfile *objfile); + #endif /* !defined (OBJFILES_H) */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 68921b05dfd..751cd2b797f 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1151,8 +1151,8 @@ sym_info (char *arg, int from_tty) a pagination request inside printf_filtered. */ old_chain = make_cleanup (xfree, loc_string); - gdb_assert (osect->objfile && osect->objfile->name); - obj_name = osect->objfile->name; + gdb_assert (osect->objfile && objfile_name (osect->objfile)); + obj_name = objfile_name (osect->objfile); if (MULTI_OBJFILE_P ()) if (pc_in_unmapped_range (addr, osect)) @@ -1383,7 +1383,7 @@ address_info (char *exp, int from_tty) printf_filtered (_("a thread-local variable at offset %s " "in the thread-local storage for `%s'"), paddress (gdbarch, load_addr), - section->objfile->name); + objfile_name (section->objfile)); else { printf_filtered (_("static storage at address ")); diff --git a/gdb/probe.c b/gdb/probe.c index 4d8b92b541b..4046701447f 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -116,8 +116,9 @@ parse_probes (char **argptr, struct linespec_result *canonical) continue; if (objfile_namestr - && FILENAME_CMP (objfile->name, objfile_namestr) != 0 - && FILENAME_CMP (lbasename (objfile->name), objfile_namestr) != 0) + && FILENAME_CMP (objfile_name (objfile), objfile_namestr) != 0 + && FILENAME_CMP (lbasename (objfile_name (objfile)), + objfile_namestr) != 0) continue; probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); @@ -263,7 +264,7 @@ collect_probes (char *objname, char *provider, char *probe_name, if (objname) { - if (regexec (&obj_pat, objfile->name, 0, NULL, 0) != 0) + if (regexec (&obj_pat, objfile_name (objfile), 0, NULL, 0) != 0) continue; } @@ -313,7 +314,7 @@ compare_probes (const void *a, const void *b) if (pa->address > pb->address) return 1; - return strcmp (pa->objfile->name, pb->objfile->name); + return strcmp (objfile_name (pa->objfile), objfile_name (pb->objfile)); } /* Helper function that generate entries in the ui_out table being @@ -538,7 +539,7 @@ info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops) { size_name = max (strlen (probe->name), size_name); size_provider = max (strlen (probe->provider), size_provider); - size_objname = max (strlen (probe->objfile->name), size_objname); + size_objname = max (strlen (objfile_name (probe->objfile)), size_objname); } ui_out_table_header (current_uiout, size_provider, ui_left, "provider", @@ -588,7 +589,8 @@ info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops) else print_ui_out_info (probe); - ui_out_field_string (current_uiout, "object", probe->objfile->name); + ui_out_field_string (current_uiout, "object", + objfile_name (probe->objfile)); ui_out_text (current_uiout, "\n"); do_cleanups (inner); diff --git a/gdb/progspace.c b/gdb/progspace.c index 2a031ed4f9e..6e7221122e5 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -200,7 +200,7 @@ clone_program_space (struct program_space *dest, struct program_space *src) exec_file_attach (src->pspace_exec_filename, 0); if (src->symfile_object_file != NULL) - symbol_file_add_main (src->symfile_object_file->name, 0); + symbol_file_add_main (objfile_name (src->symfile_object_file), 0); do_cleanups (old_chain); return dest; diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 3bab7471bc4..feea823c67a 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -86,7 +86,7 @@ require_partial_symbols (struct objfile *objfile, int verbose) if (verbose) { printf_unfiltered (_("Reading symbols from %s..."), - objfile->name); + objfile_name (objfile)); gdb_flush (gdb_stdout); } (*objfile->sf->sym_read_psymbols) (objfile); @@ -974,7 +974,7 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, gdb_print_host_address (psymtab, outfile); fprintf_filtered (outfile, ")\n\n"); fprintf_unfiltered (outfile, " Read from object file %s (", - objfile->name); + objfile_name (objfile)); gdb_print_host_address (objfile, outfile); fprintf_unfiltered (outfile, ")\n"); @@ -1759,10 +1759,10 @@ allocate_psymtab (const char *filename, struct objfile *objfile) static char *last_objfile_name = NULL; if (last_objfile_name == NULL - || strcmp (last_objfile_name, objfile->name) != 0) + || strcmp (last_objfile_name, objfile_name (objfile)) != 0) { xfree (last_objfile_name); - last_objfile_name = xstrdup (objfile->name); + last_objfile_name = xstrdup (objfile_name (objfile)); fprintf_unfiltered (gdb_stdlog, "Creating one or more psymtabs for objfile %s ...\n", last_objfile_name); @@ -1917,7 +1917,7 @@ maintenance_info_psymtabs (char *regexp, int from_tty) { if (! printed_objfile_start) { - printf_filtered ("{ objfile %s ", objfile->name); + printf_filtered ("{ objfile %s ", objfile_name (objfile)); wrap_here (" "); printf_filtered ("((struct objfile *) %s)\n", host_address_to_string (objfile)); diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c index fa0743236f2..2802acf34cf 100644 --- a/gdb/python/py-auto-load.c +++ b/gdb/python/py-auto-load.c @@ -74,7 +74,7 @@ gdbpy_load_auto_script_for_objfile (struct objfile *objfile, FILE *file, is_safe = file_is_auto_load_safe (filename, _("auto-load: Loading Python script \"%s\" " "by extension for objfile \"%s\".\n"), - filename, objfile->name); + filename, objfile_name (objfile)); /* Add this script to the hash table too so "info auto-load python-scripts" can print it. */ @@ -157,7 +157,7 @@ source_section_scripts (struct objfile *objfile, const char *source_name, "\"%s\" from section \"%s\" of " "objfile \"%s\".\n"), full_path, GDBPY_AUTO_SECTION_NAME, - objfile->name)) + objfile_name (objfile))) opened = 0; } else @@ -169,7 +169,7 @@ source_section_scripts (struct objfile *objfile, const char *source_name, warning (_("Missing auto-load scripts referenced in section %s\n\ of file %s\n\ Use `info auto-load python [REGEXP]' to list them."), - GDBPY_AUTO_SECTION_NAME, objfile->name); + GDBPY_AUTO_SECTION_NAME, objfile_name (objfile)); } /* If one script isn't found it's not uncommon for more to not be diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index a954c9d2923..9bbd4c22183 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -53,7 +53,8 @@ objfpy_get_filename (PyObject *self, void *closure) objfile_object *obj = (objfile_object *) self; if (obj->objfile) - return PyString_Decode (obj->objfile->name, strlen (obj->objfile->name), + return PyString_Decode (objfile_name (obj->objfile), + strlen (objfile_name (obj->objfile)), host_charset (), NULL); Py_RETURN_NONE; } diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c index 98eeecc240f..910c6a3fcb3 100644 --- a/gdb/python/py-progspace.c +++ b/gdb/python/py-progspace.c @@ -60,7 +60,8 @@ pspy_get_filename (PyObject *self, void *closure) struct objfile *objfile = obj->pspace->symfile_object_file; if (objfile) - return PyString_Decode (objfile->name, strlen (objfile->name), + return PyString_Decode (objfile_name (objfile), + strlen (objfile_name (objfile)), host_charset (), NULL); } Py_RETURN_NONE; diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 29574f273d4..8fc516ab4d7 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -765,7 +765,7 @@ solib_aix_get_toc_value (CORE_ADDR pc) if (data_osect == NULL) error (_("unable to find TOC entry for pc %s " "(%s has no data section)"), - core_addr_to_string (pc), pc_osect->objfile->name); + core_addr_to_string (pc), objfile_name (pc_osect->objfile)); result = (obj_section_addr (data_osect) + xcoff_get_toc_offset (pc_osect->objfile)); diff --git a/gdb/solib-som.c b/gdb/solib-som.c index 457e464d72c..98b32db40f1 100644 --- a/gdb/solib-som.c +++ b/gdb/solib-som.c @@ -569,7 +569,7 @@ link_map_start (void) static int match_main (const char *name) { - return strcmp (name, symfile_objfile->name) == 0; + return strcmp (name, objfile_name (symfile_objfile)) == 0; } static struct so_list * @@ -839,7 +839,7 @@ som_solib_section_offsets (struct objfile *objfile, { /* Oh what a pain! We need the offsets before so_list->objfile is valid. The BFDs will never match. Make a best guess. */ - if (strstr (objfile->name, so_list->so_name)) + if (strstr (objfile_name (objfile), so_list->so_name)) { asection *private_section; struct obj_section *sect; diff --git a/gdb/solib.c b/gdb/solib.c index 5456d6f390e..98833a509ee 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -601,7 +601,7 @@ solib_read_symbols (struct so_list *so, int flags) /* Have we already loaded this shared object? */ ALL_OBJFILES (so->objfile) { - if (filename_cmp (so->objfile->name, so->so_name) == 0 + if (filename_cmp (objfile_name (so->objfile), so->so_name) == 0 && so->objfile->addr_low == so->addr_low) break; } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index f16e54743f6..da95a7e7331 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -4732,7 +4732,7 @@ scan_file_globals (struct objfile *objfile) complaint (&symfile_complaints, _("%s: common block `%s' from " "global_sym_chain unresolved"), - objfile->name, SYMBOL_PRINT_NAME (prev)); + objfile_name (objfile), SYMBOL_PRINT_NAME (prev)); } } memset (global_sym_chain, 0, sizeof (global_sym_chain)); diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index 200111c5ee6..a7347937372 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -1355,7 +1355,8 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el, if (!ret->p.name) { complaint (&symfile_complaints, _("corrupt probe name when " - "reading `%s'"), objfile->name); + "reading `%s'"), + objfile_name (objfile)); /* There is no way to use a probe without a name or a provider, so returning zero here makes sense. */ @@ -1394,7 +1395,8 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el, != el->data + el->size - 1)) { complaint (&symfile_complaints, _("corrupt probe argument when " - "reading `%s'"), objfile->name); + "reading `%s'"), + objfile_name (objfile)); /* If the argument string is NULL, it means some problem happened with it. So we return 0. */ return; diff --git a/gdb/symfile.c b/gdb/symfile.c index b32a550121f..287c8feb630 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1249,7 +1249,7 @@ symbol_file_clear (int from_tty) && from_tty && (symfile_objfile ? !query (_("Discard symbol table from `%s'? "), - symfile_objfile->name) + objfile_name (symfile_objfile)) : !query (_("Discard symbol table? ")))) error (_("Not confirmed.")); @@ -1280,7 +1280,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, ".debug" suffix as "/usr/lib/debug/path/to/file" is a separate tree where the separate debug infos with the same basename can exist. */ - if (filename_cmp (name, parent_objfile->name) == 0) + if (filename_cmp (name, objfile_name (parent_objfile)) == 0) return 0; abfd = gdb_bfd_open_maybe_remote (name); @@ -1337,7 +1337,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, if (verified_as_different || parent_crc != file_crc) warning (_("the debug information found in \"%s\"" " does not match \"%s\" (CRC mismatch).\n"), - name, parent_objfile->name); + name, objfile_name (parent_objfile)); return 0; } @@ -1495,7 +1495,7 @@ find_separate_debug_file_by_debuglink (struct objfile *objfile) } cleanups = make_cleanup (xfree, debuglink); - dir = xstrdup (objfile->name); + dir = xstrdup (objfile_name (objfile)); make_cleanup (xfree, dir); terminate_after_last_dir_separator (dir); canon_dir = lrealpath (dir); @@ -1512,11 +1512,12 @@ find_separate_debug_file_by_debuglink (struct objfile *objfile) struct stat st_buf; - if (lstat (objfile->name, &st_buf) == 0 && S_ISLNK(st_buf.st_mode)) + if (lstat (objfile_name (objfile), &st_buf) == 0 + && S_ISLNK (st_buf.st_mode)) { char *symlink_dir; - symlink_dir = lrealpath (objfile->name); + symlink_dir = lrealpath (objfile_name (objfile)); if (symlink_dir != NULL) { make_cleanup (xfree, symlink_dir); @@ -2357,12 +2358,12 @@ reread_symbols (void) if (objfile->obfd->my_archive) res = stat (objfile->obfd->my_archive->filename, &new_statbuf); else - res = stat (objfile->name, &new_statbuf); + res = stat (objfile_name (objfile), &new_statbuf); if (res != 0) { /* FIXME, should use print_sys_errmsg but it's not filtered. */ printf_unfiltered (_("`%s' has disappeared; keeping its symbols.\n"), - objfile->name); + objfile_name (objfile)); continue; } new_modtime = new_statbuf.st_mtime; @@ -2373,7 +2374,7 @@ reread_symbols (void) int num_offsets; printf_unfiltered (_("`%s' has changed; re-reading symbols.\n"), - objfile->name); + objfile_name (objfile)); /* There are various functions like symbol_file_add, symfile_bfd_open, syms_from_objfile, etc., which might @@ -2441,10 +2442,10 @@ reread_symbols (void) gdb_bfd_unref (obfd); } - objfile->name = bfd_get_filename (objfile->obfd); + objfile->original_name = bfd_get_filename (objfile->obfd); /* bfd_openr sets cacheable to true, which is what we want. */ if (!bfd_check_format (objfile->obfd, bfd_object)) - error (_("Can't read symbols from %s: %s."), objfile->name, + error (_("Can't read symbols from %s: %s."), objfile_name (objfile), bfd_errmsg (bfd_get_error ())); /* Save the offsets, we will nuke them with the rest of the @@ -2791,10 +2792,10 @@ allocate_symtab (const char *filename, struct objfile *objfile) static char *last_objfile_name = NULL; if (last_objfile_name == NULL - || strcmp (last_objfile_name, objfile->name) != 0) + || strcmp (last_objfile_name, objfile_name (objfile)) != 0) { xfree (last_objfile_name); - last_objfile_name = xstrdup (objfile->name); + last_objfile_name = xstrdup (objfile_name (objfile)); fprintf_unfiltered (gdb_stdlog, "Creating one or more symtabs for objfile %s ...\n", last_objfile_name); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 842c16f76ca..b192184089f 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -84,7 +84,8 @@ print_symbol_bcache_statistics (void) ALL_PSPACE_OBJFILES (pspace, objfile) { QUIT; - printf_filtered (_("Byte cache statistics for '%s':\n"), objfile->name); + printf_filtered (_("Byte cache statistics for '%s':\n"), + objfile_name (objfile)); print_bcache_statistics (psymbol_bcache_get_bcache (objfile->psymbol_cache), "partial symbol cache"); print_bcache_statistics (objfile->per_bfd->macro_cache, @@ -106,7 +107,7 @@ print_objfile_statistics (void) ALL_PSPACE_OBJFILES (pspace, objfile) { QUIT; - printf_filtered (_("Statistics for '%s':\n"), objfile->name); + printf_filtered (_("Statistics for '%s':\n"), objfile_name (objfile)); if (OBJSTAT (objfile, n_stabs) > 0) printf_filtered (_(" Number of \"stab\" symbols read: %d\n"), OBJSTAT (objfile, n_stabs)); @@ -161,7 +162,7 @@ dump_objfile (struct objfile *objfile) { struct symtab *symtab; - printf_filtered ("\nObject file %s: ", objfile->name); + printf_filtered ("\nObject file %s: ", objfile_name (objfile)); printf_filtered ("Objfile at "); gdb_print_host_address (objfile, gdb_stdout); printf_filtered (", bfd at "); @@ -202,7 +203,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) int index; char ms_type; - fprintf_filtered (outfile, "\nObject file %s:\n\n", objfile->name); + fprintf_filtered (outfile, "\nObject file %s:\n\n", objfile_name (objfile)); if (objfile->minimal_symbol_count == 0) { fprintf_filtered (outfile, "No minimal symbols found.\n"); @@ -299,7 +300,8 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab, if (symtab->dirname) fprintf_filtered (outfile, "Compilation directory is %s\n", symtab->dirname); - fprintf_filtered (outfile, "Read from object file %s (", objfile->name); + fprintf_filtered (outfile, "Read from object file %s (", + objfile_name (objfile)); gdb_print_host_address (objfile, outfile); fprintf_filtered (outfile, ")\n"); fprintf_filtered (outfile, "Language: %s\n", @@ -677,7 +679,7 @@ maintenance_print_msymbols (char *args, int from_tty) ALL_PSPACE_OBJFILES (pspace, objfile) { QUIT; - if (symname == NULL || (!stat (objfile->name, &obj_st) + if (symname == NULL || (!stat (objfile_name (objfile), &obj_st) && sym_st.st_dev == obj_st.st_dev && sym_st.st_ino == obj_st.st_ino)) dump_msymbols (objfile, outfile); @@ -702,7 +704,7 @@ maintenance_print_objfiles (char *regexp, int from_tty) { QUIT; if (! regexp - || re_exec (objfile->name)) + || re_exec (objfile_name (objfile))) dump_objfile (objfile); } } @@ -738,7 +740,7 @@ maintenance_info_symtabs (char *regexp, int from_tty) { if (! printed_objfile_start) { - printf_filtered ("{ objfile %s ", objfile->name); + printf_filtered ("{ objfile %s ", objfile_name (objfile)); wrap_here (" "); printf_filtered ("((struct objfile *) %s)\n", host_address_to_string (objfile)); @@ -809,7 +811,7 @@ maintenance_check_symtabs (char *ignore, int from_tty) { if (! printed_objfile_start) { - printf_filtered ("{ objfile %s ", objfile->name); + printf_filtered ("{ objfile %s ", objfile_name (objfile)); wrap_here (" "); printf_filtered ("((struct objfile *) %s)\n", host_address_to_string (objfile)); diff --git a/gdb/target.c b/gdb/target.c index d55712d4c1c..5ab328c192b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1187,10 +1187,10 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) case TLS_LOAD_MODULE_NOT_FOUND_ERROR: if (objfile_is_library) error (_("Cannot find shared library `%s' in dynamic" - " linker's load module list"), objfile->name); + " linker's load module list"), objfile_name (objfile)); else error (_("Cannot find executable file `%s' in dynamic" - " linker's load module list"), objfile->name); + " linker's load module list"), objfile_name (objfile)); break; case TLS_NOT_ALLOCATED_YET_ERROR: if (objfile_is_library) @@ -1198,25 +1198,25 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) " thread-local variables in\n" "the shared library `%s'\n" "for %s"), - objfile->name, target_pid_to_str (ptid)); + objfile_name (objfile), target_pid_to_str (ptid)); else error (_("The inferior has not yet allocated storage for" " thread-local variables in\n" "the executable `%s'\n" "for %s"), - objfile->name, target_pid_to_str (ptid)); + objfile_name (objfile), target_pid_to_str (ptid)); break; case TLS_GENERIC_ERROR: if (objfile_is_library) error (_("Cannot find thread-local storage for %s, " "shared library %s:\n%s"), target_pid_to_str (ptid), - objfile->name, ex.message); + objfile_name (objfile), ex.message); else error (_("Cannot find thread-local storage for %s, " "executable file %s:\n%s"), target_pid_to_str (ptid), - objfile->name, ex.message); + objfile_name (objfile), ex.message); break; default: throw_exception (ex); @@ -2491,7 +2491,8 @@ target_info (char *args, int from_tty) int has_all_mem = 0; if (symfile_objfile != NULL) - printf_unfiltered (_("Symbols from \"%s\".\n"), symfile_objfile->name); + printf_unfiltered (_("Symbols from \"%s\".\n"), + objfile_name (symfile_objfile)); for (t = target_stack; t != NULL; t = t->beneath) { diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index ee2a0fd1aa9..75ac0f59ff3 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2958,12 +2958,12 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags) file_ptr symtab_offset; /* symbol table and */ file_ptr stringtab_offset; /* string table file offsets */ struct coff_symfile_info *info; - char *name; + const char *name; unsigned int size; info = XCOFF_DATA (objfile); symfile_bfd = abfd = objfile->obfd; - name = objfile->name; + name = objfile_name (objfile); num_symbols = bfd_get_symcount (abfd); /* # of symbols */ symtab_offset = obj_sym_filepos (abfd); /* symbol table file offset */ |