aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-09-24 13:57:38 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-09-24 13:57:38 +0000
commit4262abfb982e7afb257203a2dbdb921b57f5e39b (patch)
tree65d47de75e58957074300462f32e77ee4ba20e02 /gdb/symfile.c
parent4721dc182386f8071324ed3106493cf2797344c1 (diff)
downloadgdb-4262abfb982e7afb257203a2dbdb921b57f5e39b.zip
gdb-4262abfb982e7afb257203a2dbdb921b57f5e39b.tar.gz
gdb-4262abfb982e7afb257203a2dbdb921b57f5e39b.tar.bz2
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.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b32a550..287c8fe 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);