aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-02-03 16:13:31 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-02-03 16:13:31 +0000
commit05cba821addfe83535ad36f7487d1d2bbac48ba2 (patch)
tree01f05878995058932e67caa78def1d1df1e572d5
parent1b56eb55405f0222188073473e1ab563899424ca (diff)
downloadgdb-05cba821addfe83535ad36f7487d1d2bbac48ba2.zip
gdb-05cba821addfe83535ad36f7487d1d2bbac48ba2.tar.gz
gdb-05cba821addfe83535ad36f7487d1d2bbac48ba2.tar.bz2
gdb/
* ada-lang.c (user_select_syms): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise. (clear_command): New variable sal_fullname, initialize it. Replace compare_filenames_for_search by filename_cmp with sal_fullname. (say_where, update_static_tracepoint): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec): Likewise. * dwarf2read.c: Include source.h. (fixup_go_packaging): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * linespec.c (add_sal_to_sals): Rename variable filename to fullname. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (create_sals_line_offset, convert_linespec_to_sals): New variable fullname, initialize it, replace symtab->filename reference by the variable. * linux-fork.c: Include source.h. (info_checkpoints_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * macroscope.c (sal_macro_scope): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mdebugread.c: Include source.h. (psymtab_to_symtab_1): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files): Likewise. * printcmd.c: Include source.h. (build_address_symbolic): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * psymtab.c (partial_map_symtabs_matching_filename) (read_psymtabs_with_fullname): Call compare_filenames_for_search also with psymtab_to_fullname. * python/py-symtab.c (stpy_str): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (stpy_get_filename): New variable filename, initialize it, use instead of symtab->filename refererences. (salpy_str): Make variable filename const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. * skip.c: Include source.h and filenames.h. (skip_file_command): Remove const from the symtab variable. Replace symtab->filename refererences by symtab_to_fullname call. (function_name_is_marked_for_skip): New variables searched_for_fullname and fullname. Use them to search also with symtab's fullname. * source.c (find_source_lines): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (print_source_lines_base): New variable filename, use it instead of symtab->filename. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (line_info, forward_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (reverse_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. New variable filename for it. * stack.c (frame_info): Likewise. * symmisc.c: Include source.h. (dump_objfile, dump_symtab_1, maintenance_print_symbols) (maintenance_info_symtabs): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * symtab.c (iterate_over_some_symtabs): Call compare_filenames_for_search also with symtab_to_fullname. (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (find_line_symtab): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (file_matches): Replace filename_cmp by compare_filenames_for_search. (print_symbol_info): Make the last parameter const char *. New variable s_filename. Use it in the function. (symtab_symbol_info): Make the last_filename variable const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (rbreak_command): New variable fullname. Use it. Replace symtab->filename refererence by symtab_to_filename_for_display call. * tracepoint.c (set_traceframe_context, trace_find_line_command) (print_one_static_tracepoint_marker): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * tui/tui-source.c (tui_set_source_content): New variables filename and s_filename. Replace symtab->filename refererences by this variable. Replace other symtab->filename refererences by symtab_to_filename_for_display calls.
-rw-r--r--gdb/ChangeLog83
-rw-r--r--gdb/ada-lang.c8
-rw-r--r--gdb/breakpoint.c31
-rw-r--r--gdb/cli/cli-cmds.c13
-rw-r--r--gdb/dwarf2read.c3
-rw-r--r--gdb/linespec.c20
-rw-r--r--gdb/linux-fork.c4
-rw-r--r--gdb/macroscope.c2
-rw-r--r--gdb/mdebugread.c4
-rw-r--r--gdb/mi/mi-cmd-file.c5
-rw-r--r--gdb/printcmd.c3
-rw-r--r--gdb/psymtab.c9
-rw-r--r--gdb/python/py-symtab.c12
-rw-r--r--gdb/skip.c49
-rw-r--r--gdb/source.c39
-rw-r--r--gdb/stack.c3
-rw-r--r--gdb/symmisc.c14
-rw-r--r--gdb/symtab.c34
-rw-r--r--gdb/tracepoint.c10
-rw-r--r--gdb/tui/tui-source.c18
20 files changed, 269 insertions, 95 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 82eebfa..680529c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,86 @@
+2013-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * ada-lang.c (user_select_syms): Replace symtab->filename refererences
+ by symtab_to_filename_for_display calls.
+ * breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise.
+ (clear_command): New variable sal_fullname, initialize it. Replace
+ compare_filenames_for_search by filename_cmp with sal_fullname.
+ (say_where, update_static_tracepoint): Replace symtab->filename
+ refererences by symtab_to_filename_for_display calls.
+ * cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec):
+ Likewise.
+ * dwarf2read.c: Include source.h.
+ (fixup_go_packaging): Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+ * linespec.c (add_sal_to_sals): Rename variable filename to fullname.
+ Replace symtab->filename refererences by symtab_to_filename_for_display
+ calls.
+ (create_sals_line_offset, convert_linespec_to_sals): New variable
+ fullname, initialize it, replace symtab->filename reference by the
+ variable.
+ * linux-fork.c: Include source.h.
+ (info_checkpoints_command): Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+ * macroscope.c (sal_macro_scope): Replace symtab->filename refererences
+ by symtab_to_filename_for_display calls.
+ * mdebugread.c: Include source.h.
+ (psymtab_to_symtab_1): Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+ * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
+ (mi_cmd_file_list_exec_source_files): Likewise.
+ * printcmd.c: Include source.h.
+ (build_address_symbolic): Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+ * psymtab.c (partial_map_symtabs_matching_filename)
+ (read_psymtabs_with_fullname): Call compare_filenames_for_search also
+ with psymtab_to_fullname.
+ * python/py-symtab.c (stpy_str): Replace symtab->filename refererences
+ by symtab_to_filename_for_display calls.
+ (stpy_get_filename): New variable filename, initialize it, use instead
+ of symtab->filename refererences.
+ (salpy_str): Make variable filename const char *. Replace
+ symtab->filename refererences by symtab_to_filename_for_display calls.
+ * skip.c: Include source.h and filenames.h.
+ (skip_file_command): Remove const from the symtab variable. Replace
+ symtab->filename refererences by symtab_to_fullname call.
+ (function_name_is_marked_for_skip): New variables searched_for_fullname
+ and fullname. Use them to search also with symtab's fullname.
+ * source.c (find_source_lines): Replace symtab->filename refererences
+ by symtab_to_filename_for_display calls.
+ (print_source_lines_base): New variable filename, use it instead of
+ symtab->filename. Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+ (line_info, forward_search_command): Replace symtab->filename
+ refererences by symtab_to_filename_for_display calls.
+ (reverse_search_command): Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls. New variable filename for it.
+ * stack.c (frame_info): Likewise.
+ * symmisc.c: Include source.h.
+ (dump_objfile, dump_symtab_1, maintenance_print_symbols)
+ (maintenance_info_symtabs): Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+ * symtab.c (iterate_over_some_symtabs): Call
+ compare_filenames_for_search also with symtab_to_fullname.
+ (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace
+ symtab->filename refererences by symtab_to_filename_for_display calls.
+ (find_line_symtab): Replace symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+ (file_matches): Replace filename_cmp by compare_filenames_for_search.
+ (print_symbol_info): Make the last parameter const char *. New
+ variable s_filename. Use it in the function.
+ (symtab_symbol_info): Make the last_filename variable const char *.
+ Replace symtab->filename refererences by symtab_to_filename_for_display
+ calls.
+ (rbreak_command): New variable fullname. Use it. Replace
+ symtab->filename refererence by symtab_to_filename_for_display call.
+ * tracepoint.c (set_traceframe_context, trace_find_line_command)
+ (print_one_static_tracepoint_marker): Replace symtab->filename
+ refererences by symtab_to_filename_for_display calls.
+ * tui/tui-source.c (tui_set_source_content): New variables filename and
+ s_filename. Replace symtab->filename refererences by this variable.
+ Replace other symtab->filename refererences by
+ symtab_to_filename_for_display calls.
+
2013-02-03 Eldar Gaynetdinov <hal9000ed2k@gmail.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c202173..634e761 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3573,7 +3573,8 @@ See set/show multiple-symbol."));
else
printf_unfiltered (_("[%d] %s at %s:%d\n"), i + first_choice,
SYMBOL_PRINT_NAME (syms[i].sym),
- sal.symtab->filename, sal.line);
+ symtab_to_filename_for_display (sal.symtab),
+ sal.line);
continue;
}
else
@@ -3588,7 +3589,8 @@ See set/show multiple-symbol."));
printf_unfiltered (_("[%d] %s at %s:%d\n"),
i + first_choice,
SYMBOL_PRINT_NAME (syms[i].sym),
- symtab->filename, SYMBOL_LINE (syms[i].sym));
+ symtab_to_filename_for_display (symtab),
+ SYMBOL_LINE (syms[i].sym));
else if (is_enumeral
&& TYPE_NAME (SYMBOL_TYPE (syms[i].sym)) != NULL)
{
@@ -3604,7 +3606,7 @@ See set/show multiple-symbol."));
: _("[%d] %s at %s:?\n"),
i + first_choice,
SYMBOL_PRINT_NAME (syms[i].sym),
- symtab->filename);
+ symtab_to_filename_for_display (symtab));
else
printf_unfiltered (is_enumeral
? _("[%d] %s (enumeral)\n")
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 55274c8..026ce73 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5707,9 +5707,10 @@ print_breakpoint_location (struct breakpoint *b,
ui_out_wrap_hint (uiout, wrap_indent_at_field (uiout, "what"));
ui_out_text (uiout, "at ");
}
- ui_out_field_string (uiout, "file", loc->symtab->filename);
+ ui_out_field_string (uiout, "file",
+ symtab_to_filename_for_display (loc->symtab));
ui_out_text (uiout, ":");
-
+
if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "fullname",
symtab_to_fullname (loc->symtab));
@@ -9770,7 +9771,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
{
if (!find_line_pc (sal->symtab, sal->line, &pc))
error (_("No line %d in file \"%s\"."),
- sal->line, sal->symtab->filename);
+ sal->line, symtab_to_filename_for_display (sal->symtab));
sal->pc = pc;
/* If this SAL corresponds to a breakpoint inserted using a line
@@ -11941,6 +11942,8 @@ clear_command (char *arg, int from_tty)
make_cleanup (VEC_cleanup (breakpoint_p), &found);
for (i = 0; i < sals.nelts; i++)
{
+ const char *sal_fullname;
+
/* If exact pc given, clear bpts at that pc.
If line given (pc == 0), clear all bpts on specified line.
If defaulting, clear all bpts on default line
@@ -11954,6 +11957,8 @@ clear_command (char *arg, int from_tty)
1 0 <can't happen> */
sal = sals.sals[i];
+ sal_fullname = (sal.symtab == NULL
+ ? NULL : symtab_to_fullname (sal.symtab));
/* Find all matching breakpoints and add them to 'found'. */
ALL_BREAKPOINTS (b)
@@ -11977,14 +11982,12 @@ clear_command (char *arg, int from_tty)
if ((default_match || sal.explicit_line)
&& loc->symtab != NULL
- && sal.symtab != NULL
+ && sal_fullname != NULL
&& sal.pspace == loc->pspace
- && loc->line_number == sal.line)
- {
- if (compare_filenames_for_search (loc->symtab->filename,
- sal.symtab->filename))
- line_match = 1;
- }
+ && loc->line_number == sal.line
+ && filename_cmp (symtab_to_fullname (loc->symtab),
+ sal_fullname) == 0)
+ line_match = 1;
if (pc_match || line_match)
{
@@ -12726,7 +12729,8 @@ say_where (struct breakpoint *b)
more nicely. */
if (b->loc->next == NULL)
printf_filtered (": file %s, line %d.",
- b->loc->symtab->filename, b->loc->line_number);
+ symtab_to_filename_for_display (b->loc->symtab),
+ b->loc->line_number);
else
/* This is not ideal, but each location may have a
different file name, and this at least reflects the
@@ -13925,7 +13929,8 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
SYMBOL_PRINT_NAME (sym));
ui_out_text (uiout, " at ");
}
- ui_out_field_string (uiout, "file", sal2.symtab->filename);
+ ui_out_field_string (uiout, "file",
+ symtab_to_filename_for_display (sal2.symtab));
ui_out_text (uiout, ":");
if (ui_out_is_mi_like_p (uiout))
@@ -13943,7 +13948,7 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
xfree (b->addr_string);
b->addr_string = xstrprintf ("%s:%d",
- sal2.symtab->filename,
+ symtab_to_filename_for_display (sal2.symtab),
b->loc->line_number);
/* Might be nice to check if function changed, and warn if
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 8f78641..d9bf80f 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -818,11 +818,13 @@ edit_command (char *arg, int from_tty)
printf_filtered ("%s is in %s (%s:%d).\n",
paddress (gdbarch, sal.pc),
SYMBOL_PRINT_NAME (sym),
- sal.symtab->filename, sal.line);
+ symtab_to_filename_for_display (sal.symtab),
+ sal.line);
else
printf_filtered ("%s is at %s:%d.\n",
paddress (gdbarch, sal.pc),
- sal.symtab->filename, sal.line);
+ symtab_to_filename_for_display (sal.symtab),
+ sal.line);
}
/* If what was given does not imply a symtab, it must be an
@@ -981,11 +983,11 @@ list_command (char *arg, int from_tty)
printf_filtered ("%s is in %s (%s:%d).\n",
paddress (gdbarch, sal.pc),
SYMBOL_PRINT_NAME (sym),
- sal.symtab->filename, sal.line);
+ symtab_to_filename_for_display (sal.symtab), sal.line);
else
printf_filtered ("%s is at %s:%d.\n",
paddress (gdbarch, sal.pc),
- sal.symtab->filename, sal.line);
+ symtab_to_filename_for_display (sal.symtab), sal.line);
}
/* If line was not specified by just a line number, and it does not
@@ -1445,7 +1447,8 @@ ambiguous_line_spec (struct symtabs_and_lines *sals)
for (i = 0; i < sals->nelts; ++i)
printf_filtered (_("file: \"%s\", line number: %d\n"),
- sals->sals[i].symtab->filename, sals->sals[i].line);
+ symtab_to_filename_for_display (sals->sals[i].symtab),
+ sals->sals[i].line);
}
/* Sort function for filter_sals. */
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 924b6b8..0a3a977 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -67,6 +67,7 @@
#include <ctype.h>
#include "gdb_bfd.h"
#include "f-lang.h"
+#include "source.h"
#include <fcntl.h>
#include "gdb_string.h"
@@ -6790,7 +6791,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
complaint (&symfile_complaints,
_("Symtab %s has objects from two different Go packages: %s and %s"),
(SYMBOL_SYMTAB (sym)
- ? SYMBOL_SYMTAB (sym)->filename
+ ? symtab_to_filename_for_display (SYMBOL_SYMTAB (sym))
: cu->objfile->name),
this_package_name, package_name);
xfree (this_package_name);
diff --git a/gdb/linespec.c b/gdb/linespec.c
index bc2415c..2e98db7 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -854,19 +854,19 @@ add_sal_to_sals (struct linespec_state *self,
sals->nelts * sizeof (char *));
if (!literal_canonical && sal->symtab)
{
- char *filename = sal->symtab->filename;
+ const char *fullname = symtab_to_fullname (sal->symtab);
/* Note that the filter doesn't have to be a valid linespec
input. We only apply the ":LINE" treatment to Ada for
the time being. */
if (symname != NULL && sal->line != 0
&& self->language->la_language == language_ada)
- canonical_name = xstrprintf ("%s:%s:%d", filename, symname,
+ canonical_name = xstrprintf ("%s:%s:%d", fullname, symname,
sal->line);
else if (symname != NULL)
- canonical_name = xstrprintf ("%s:%s", filename, symname);
+ canonical_name = xstrprintf ("%s:%s", fullname, symname);
else
- canonical_name = xstrprintf ("%s:%d", filename, sal->line);
+ canonical_name = xstrprintf ("%s:%d", fullname, sal->line);
}
else if (symname != NULL)
canonical_name = xstrdup (symname);
@@ -1729,15 +1729,17 @@ create_sals_line_offset (struct linespec_state *self,
if (VEC_length (symtab_p, ls->file_symtabs) == 1
&& VEC_index (symtab_p, ls->file_symtabs, 0) == NULL)
{
+ const char *fullname;
+
set_current_program_space (self->program_space);
/* Make sure we have at least a default source line. */
set_default_source_symtab_and_line ();
initialize_defaults (&self->default_symtab, &self->default_line);
+ fullname = symtab_to_fullname (self->default_symtab);
VEC_pop (symtab_p, ls->file_symtabs);
VEC_free (symtab_p, ls->file_symtabs);
- ls->file_symtabs
- = collect_symtabs_from_filename (self->default_symtab->filename);
+ ls->file_symtabs = collect_symtabs_from_filename (fullname);
use_default = 1;
}
@@ -1939,7 +1941,11 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
/* Make sure we have a filename for canonicalization. */
if (ls->source_filename == NULL)
- ls->source_filename = xstrdup (state->default_symtab->filename);
+ {
+ const char *fullname = symtab_to_fullname (state->default_symtab);
+
+ ls->source_filename = xstrdup (fullname);
+ }
}
else
{
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 4c6b623..2151401 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -29,6 +29,7 @@
#include "linux-fork.h"
#include "linux-nat.h"
#include "gdbthread.h"
+#include "source.h"
#include <sys/ptrace.h>
#include "gdb_wait.h"
@@ -583,7 +584,8 @@ info_checkpoints_command (char *arg, int from_tty)
sal = find_pc_line (pc, 0);
if (sal.symtab)
- printf_filtered (_(", file %s"), lbasename (sal.symtab->filename));
+ printf_filtered (_(", file %s"),
+ symtab_to_filename_for_display (sal.symtab));
if (sal.line)
printf_filtered (_(", line %d"), sal.line);
if (!sal.symtab && !sal.line)
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
index 63e6ebe..c7a6c35 100644
--- a/gdb/macroscope.c
+++ b/gdb/macroscope.c
@@ -77,7 +77,7 @@ sal_macro_scope (struct symtab_and_line sal)
complaint (&symfile_complaints,
_("symtab found for `%s', but that file\n"
"is not covered in the compilation unit's macro information"),
- sal.symtab->filename);
+ symtab_to_filename_for_display (sal.symtab));
}
return ms;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 4f64342..2fed944 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -58,6 +58,7 @@
#include "gdb_stat.h"
#include "gdb_string.h"
#include "psympriv.h"
+#include "source.h"
#include "bfd.h"
@@ -4343,7 +4344,8 @@ psymtab_to_symtab_1 (struct objfile *objfile,
if (info_verbose && n_undef_symbols)
{
printf_filtered (_("File %s contains %d unresolved references:"),
- st->filename, n_undef_symbols);
+ symtab_to_filename_for_display (st),
+ n_undef_symbols);
printf_filtered ("\n\t%4d variables\n\t%4d "
"procedures\n\t%4d labels\n",
n_undef_vars, n_undef_procs, n_undef_labels);
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index d4261fb..07d9722 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -50,7 +50,8 @@ mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
/* Print to the user the line, filename and fullname. */
ui_out_field_int (uiout, "line", st.line);
- ui_out_field_string (uiout, "file", st.symtab->filename);
+ ui_out_field_string (uiout, "file",
+ symtab_to_filename_for_display (st.symtab));
ui_out_field_string (uiout, "fullname", symtab_to_fullname (st.symtab));
@@ -93,7 +94,7 @@ mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
{
ui_out_begin (uiout, ui_out_type_tuple, NULL);
- ui_out_field_string (uiout, "file", s->filename);
+ ui_out_field_string (uiout, "file", symtab_to_filename_for_display (s));
ui_out_field_string (uiout, "fullname", symtab_to_fullname (s));
ui_out_end (uiout, ui_out_type_tuple);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index a576d88..d94d28d 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -50,6 +50,7 @@
#include "arch-utils.h"
#include "cli/cli-utils.h"
#include "format.h"
+#include "source.h"
#ifdef TUI
#include "tui/tui.h" /* For tui_active et al. */
@@ -724,7 +725,7 @@ build_address_symbolic (struct gdbarch *gdbarch,
if (sal.symtab)
{
- *filename = xstrdup (sal.symtab->filename);
+ *filename = xstrdup (symtab_to_filename_for_display (sal.symtab));
*line = sal.line;
}
}
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c6f994e..7c48599 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -191,6 +191,13 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
&& FILENAME_CMP (name_basename, lbasename (pst->filename)) != 0)
continue;
+ if (compare_filenames_for_search (psymtab_to_fullname (pst), name))
+ {
+ if (partial_map_expand_apply (objfile, name, real_path,
+ pst, callback, data))
+ return 1;
+ }
+
/* If the user gave us an absolute path, try to find the file in
this symtab and use its absolute path. */
if (real_path != NULL)
@@ -1106,7 +1113,7 @@ read_psymtabs_with_fullname (struct objfile *objfile, const char *fullname)
if (p->anonymous)
continue;
- if (filename_cmp (fullname, p->filename) == 0)
+ if (filename_cmp (fullname, psymtab_to_fullname (p)) == 0)
psymtab_to_symtab (objfile, p);
}
}
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 49ed5c5..6fa8ecb 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -91,7 +91,7 @@ stpy_str (PyObject *self)
STPY_REQUIRE_VALID (self, symtab);
- result = PyString_FromString (symtab->filename);
+ result = PyString_FromString (symtab_to_filename_for_display (symtab));
return result;
}
@@ -101,11 +101,12 @@ stpy_get_filename (PyObject *self, void *closure)
{
PyObject *str_obj;
struct symtab *symtab = NULL;
+ const char *filename;
STPY_REQUIRE_VALID (self, symtab);
+ filename = symtab_to_filename_for_display (symtab);
- str_obj = PyString_Decode (symtab->filename,
- strlen (symtab->filename),
+ str_obj = PyString_Decode (filename, strlen (filename),
host_charset (), NULL);
return str_obj;
}
@@ -186,7 +187,8 @@ stpy_static_block (PyObject *self, PyObject *args)
static PyObject *
salpy_str (PyObject *self)
{
- char *s, *filename;
+ char *s;
+ const char *filename;
sal_object *sal_obj;
PyObject *result;
struct symtab_and_line *sal = NULL;
@@ -195,7 +197,7 @@ salpy_str (PyObject *self)
sal_obj = (sal_object *) self;
filename = (sal_obj->symtab == (symtab_object *) Py_None)
- ? "<unknown>" : sal_obj->symtab->symtab->filename;
+ ? "<unknown>" : symtab_to_filename_for_display (sal_obj->symtab->symtab);
s = xstrprintf ("symbol and line for %s, line %d", filename,
sal->line);
diff --git a/gdb/skip.c b/gdb/skip.c
index f8db6f8..0c002ff 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -32,6 +32,8 @@
#include "objfiles.h"
#include "exceptions.h"
#include "breakpoint.h" /* for get_sal_arch () */
+#include "source.h"
+#include "filenames.h"
struct skiplist_entry
{
@@ -69,7 +71,7 @@ static void
skip_file_command (char *arg, int from_tty)
{
struct skiplist_entry *e;
- const struct symtab *symtab;
+ struct symtab *symtab;
const char *filename = NULL;
/* If no argument was given, try to default to the last
@@ -79,8 +81,10 @@ skip_file_command (char *arg, int from_tty)
symtab = get_last_displayed_symtab ();
if (symtab == NULL)
error (_("No default file now."));
- else
- filename = symtab->filename;
+
+ /* It is not a typo, symtab_to_filename_for_display woule be needlessly
+ ambiguous. */
+ filename = symtab_to_fullname (symtab);
}
else
{
@@ -91,8 +95,9 @@ skip_file_command (char *arg, int from_tty)
if (!nquery (_("\
Ignore file pending future shared library load? ")))
return;
-
}
+ /* Do not use SYMTAB's filename, later loaded shared libraries may match
+ given ARG but not SYMTAB's filename. */
filename = arg;
}
@@ -330,6 +335,8 @@ int
function_name_is_marked_for_skip (const char *function_name,
const struct symtab_and_line *function_sal)
{
+ int searched_for_fullname = 0;
+ const char *fullname = NULL;
struct skiplist_entry *e;
if (function_name == NULL)
@@ -345,11 +352,35 @@ function_name_is_marked_for_skip (const char *function_name,
&& strcmp_iw (function_name, e->function_name) == 0)
return 1;
- if (e->filename != NULL && function_sal->symtab != NULL
- && function_sal->symtab->filename != NULL
- && compare_filenames_for_search (function_sal->symtab->filename,
- e->filename))
- return 1;
+ if (e->filename != NULL)
+ {
+ /* Check first sole SYMTAB->FILENAME. It does not need to be
+ a substring of symtab_to_fullname as it may contain "./" etc. */
+ if (function_sal->symtab != NULL
+ && compare_filenames_for_search (function_sal->symtab->filename,
+ e->filename))
+ return 1;
+
+ /* Before we invoke realpath, which can get expensive when many
+ files are involved, do a quick comparison of the basenames. */
+ if (!basenames_may_differ
+ && (function_sal->symtab == NULL
+ || filename_cmp (lbasename (function_sal->symtab->filename),
+ lbasename (e->filename)) != 0))
+ continue;
+
+ /* Get the filename corresponding to this FUNCTION_SAL, if we haven't
+ yet. */
+ if (!searched_for_fullname)
+ {
+ if (function_sal->symtab != NULL)
+ fullname = symtab_to_fullname (function_sal->symtab);
+ searched_for_fullname = 1;
+ }
+ if (fullname != NULL
+ && compare_filenames_for_search (fullname, e->filename))
+ return 1;
+ }
}
return 0;
diff --git a/gdb/source.c b/gdb/source.c
index 68fbcdf..45140fc 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1167,7 +1167,7 @@ find_source_lines (struct symtab *s, int desc)
gdb_assert (s);
line_charpos = (int *) xmalloc (lines_allocated * sizeof (int));
if (fstat (desc, &st) < 0)
- perror_with_name (s->filename);
+ perror_with_name (symtab_to_filename_for_display (s));
if (s->objfile && s->objfile->obfd)
mtime = s->objfile->mtime;
@@ -1192,7 +1192,7 @@ find_source_lines (struct symtab *s, int desc)
/* Reassign `size' to result of read for systems where \r\n -> \n. */
size = myread (desc, data, size);
if (size < 0)
- perror_with_name (s->filename);
+ perror_with_name (symtab_to_filename_for_display (s));
end = data + size;
p = data;
line_charpos[0] = 0;
@@ -1333,17 +1333,19 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
if (!(flags & PRINT_SOURCE_LINES_NOERROR))
{
- int len = strlen (s->filename) + 100;
+ const char *filename = symtab_to_filename_for_display (s);
+ int len = strlen (filename) + 100;
char *name = alloca (len);
- xsnprintf (name, len, "%d\t%s", line, s->filename);
+ xsnprintf (name, len, "%d\t%s", line, filename);
print_sys_errmsg (name, errno);
}
else
{
ui_out_field_int (uiout, "line", line);
ui_out_text (uiout, "\tin ");
- ui_out_field_string (uiout, "file", s->filename);
+ ui_out_field_string (uiout, "file",
+ symtab_to_filename_for_display (s));
if (ui_out_is_mi_like_p (uiout))
{
const char *fullname = symtab_to_fullname (s);
@@ -1365,13 +1367,13 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
{
close (desc);
error (_("Line number %d out of range; %s has %d lines."),
- line, s->filename, s->nlines);
+ line, symtab_to_filename_for_display (s), s->nlines);
}
if (lseek (desc, s->line_charpos[line - 1], 0) < 0)
{
close (desc);
- perror_with_name (s->filename);
+ perror_with_name (symtab_to_filename_for_display (s));
}
stream = fdopen (desc, FDOPEN_MODE);
@@ -1388,7 +1390,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
last_line_listed = current_source_line;
if (flags & PRINT_SOURCE_LINES_FILENAME)
{
- ui_out_text (uiout, s->filename);
+ ui_out_text (uiout, symtab_to_filename_for_display (s));
ui_out_text (uiout, ":");
}
xsnprintf (buf, sizeof (buf), "%d\t", current_source_line++);
@@ -1502,7 +1504,8 @@ line_info (char *arg, int from_tty)
if (start_pc == end_pc)
{
printf_filtered ("Line %d of \"%s\"",
- sal.line, sal.symtab->filename);
+ sal.line,
+ symtab_to_filename_for_display (sal.symtab));
wrap_here (" ");
printf_filtered (" is at address ");
print_address (gdbarch, start_pc, gdb_stdout);
@@ -1512,7 +1515,8 @@ line_info (char *arg, int from_tty)
else
{
printf_filtered ("Line %d of \"%s\"",
- sal.line, sal.symtab->filename);
+ sal.line,
+ symtab_to_filename_for_display (sal.symtab));
wrap_here (" ");
printf_filtered (" starts at address ");
print_address (gdbarch, start_pc, gdb_stdout);
@@ -1538,7 +1542,7 @@ line_info (char *arg, int from_tty)
which the user would want to see? If we have debugging symbols
and no line numbers? */
printf_filtered (_("Line number %d is out of range for \"%s\".\n"),
- sal.line, sal.symtab->filename);
+ sal.line, symtab_to_filename_for_display (sal.symtab));
}
do_cleanups (cleanups);
}
@@ -1566,7 +1570,7 @@ forward_search_command (char *regex, int from_tty)
desc = open_source_file (current_source_symtab);
if (desc < 0)
- perror_with_name (current_source_symtab->filename);
+ perror_with_name (symtab_to_filename_for_display (current_source_symtab));
cleanups = make_cleanup_close (desc);
if (current_source_symtab->line_charpos == 0)
@@ -1576,7 +1580,7 @@ forward_search_command (char *regex, int from_tty)
error (_("Expression not found"));
if (lseek (desc, current_source_symtab->line_charpos[line - 1], 0) < 0)
- perror_with_name (current_source_symtab->filename);
+ perror_with_name (symtab_to_filename_for_display (current_source_symtab));
discard_cleanups (cleanups);
stream = fdopen (desc, FDOPEN_MODE);
@@ -1655,7 +1659,7 @@ reverse_search_command (char *regex, int from_tty)
desc = open_source_file (current_source_symtab);
if (desc < 0)
- perror_with_name (current_source_symtab->filename);
+ perror_with_name (symtab_to_filename_for_display (current_source_symtab));
cleanups = make_cleanup_close (desc);
if (current_source_symtab->line_charpos == 0)
@@ -1665,7 +1669,7 @@ reverse_search_command (char *regex, int from_tty)
error (_("Expression not found"));
if (lseek (desc, current_source_symtab->line_charpos[line - 1], 0) < 0)
- perror_with_name (current_source_symtab->filename);
+ perror_with_name (symtab_to_filename_for_display (current_source_symtab));
discard_cleanups (cleanups);
stream = fdopen (desc, FDOPEN_MODE);
@@ -1708,8 +1712,11 @@ reverse_search_command (char *regex, int from_tty)
line--;
if (fseek (stream, current_source_symtab->line_charpos[line - 1], 0) < 0)
{
+ const char *filename;
+
do_cleanups (cleanups);
- perror_with_name (current_source_symtab->filename);
+ filename = symtab_to_filename_for_display (current_source_symtab);
+ perror_with_name (filename);
}
}
diff --git a/gdb/stack.c b/gdb/stack.c
index 662b351..bfec1b8 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1460,7 +1460,8 @@ frame_info (char *addr_exp, int from_tty)
}
wrap_here (" ");
if (sal.symtab)
- printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line);
+ printf_filtered (" (%s:%d)", symtab_to_filename_for_display (sal.symtab),
+ sal.line);
puts_filtered ("; ");
wrap_here (" ");
printf_filtered ("saved %s ", pc_regname);
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 2abaa5d..5fa4e4e 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -36,6 +36,7 @@
#include "dictionary.h"
#include "typeprint.h"
#include "gdbcmd.h"
+#include "source.h"
#include "gdb_string.h"
#include "readline/readline.h"
@@ -185,7 +186,7 @@ dump_objfile (struct objfile *objfile)
symtab != NULL;
symtab = symtab->next)
{
- printf_filtered ("%s at ", symtab->filename);
+ printf_filtered ("%s at ", symtab_to_filename_for_display (symtab));
gdb_print_host_address (symtab, gdb_stdout);
printf_filtered (", ");
if (symtab->objfile != objfile)
@@ -294,7 +295,8 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
struct block *b;
int depth;
- fprintf_filtered (outfile, "\nSymtab for file %s\n", symtab->filename);
+ fprintf_filtered (outfile, "\nSymtab for file %s\n",
+ symtab_to_filename_for_display (symtab));
if (symtab->dirname)
fprintf_filtered (outfile, "Compilation directory is %s\n",
symtab->dirname);
@@ -443,7 +445,8 @@ maintenance_print_symbols (char *args, int from_tty)
ALL_SYMTABS (objfile, s)
{
QUIT;
- if (symname == NULL || filename_cmp (symname, s->filename) == 0)
+ if (symname == NULL
+ || filename_cmp (symname, symtab_to_filename_for_display (s)) == 0)
dump_symtab (objfile, s, outfile);
}
do_cleanups (cleanups);
@@ -724,7 +727,7 @@ maintenance_info_symtabs (char *regexp, int from_tty)
QUIT;
if (! regexp
- || re_exec (symtab->filename))
+ || re_exec (symtab_to_filename_for_display (symtab)))
{
if (! printed_objfile_start)
{
@@ -735,7 +738,8 @@ maintenance_info_symtabs (char *regexp, int from_tty)
printed_objfile_start = 1;
}
- printf_filtered (" { symtab %s ", symtab->filename);
+ printf_filtered (" { symtab %s ",
+ symtab_to_filename_for_display (symtab));
wrap_here (" ");
printf_filtered ("((struct symtab *) %s)\n",
host_address_to_string (symtab));
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 690cda1..072b3da 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -219,6 +219,12 @@ iterate_over_some_symtabs (const char *name,
&& FILENAME_CMP (base_name, lbasename (s->filename)) != 0)
continue;
+ if (compare_filenames_for_search (symtab_to_fullname (s), name))
+ {
+ if (callback (s, data))
+ return 1;
+ }
+
/* If the user gave us an absolute path, try to find the file in
this symtab and use its absolute path. */
@@ -1650,7 +1656,7 @@ Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
%s may be an inlined function, or may be a template function\n\
(if a template, try specifying an instantiation: %s<type>)."),
kind == GLOBAL_BLOCK ? "global" : "static",
- name, symtab->filename, name, name);
+ name, symtab_to_filename_for_display (symtab), name, name);
}
return fixup_symbol_section (sym, objfile);
}
@@ -1855,7 +1861,7 @@ basic_lookup_transparent_type_quick (struct objfile *objfile, int kind,
Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
%s may be an inlined function, or may be a template function\n\
(if a template, try specifying an instantiation: %s<type>)."),
- name, symtab->filename, name, name);
+ name, symtab_to_filename_for_display (symtab), name, name);
}
if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
return SYMBOL_TYPE (sym);
@@ -2502,7 +2508,7 @@ find_line_symtab (struct symtab *symtab, int line,
{
if (objfile->sf)
objfile->sf->qf->expand_symtabs_with_fullname (objfile,
- symtab->filename);
+ symtab_to_fullname (symtab));
}
ALL_SYMTABS (objfile, s)
@@ -3268,7 +3274,7 @@ file_matches (const char *file, char *files[], int nfiles)
{
for (i = 0; i < nfiles; i++)
{
- if (filename_cmp (files[i], lbasename (file)) == 0)
+ if (compare_filenames_for_search (file, files[i]))
return 1;
}
}
@@ -3699,12 +3705,14 @@ search_symbols (char *regexp, enum search_domain kind,
static void
print_symbol_info (enum search_domain kind,
struct symtab *s, struct symbol *sym,
- int block, char *last)
+ int block, const char *last)
{
- if (last == NULL || filename_cmp (last, s->filename) != 0)
+ const char *s_filename = symtab_to_filename_for_display (s);
+
+ if (last == NULL || filename_cmp (last, s_filename) != 0)
{
fputs_filtered ("\nFile ", gdb_stdout);
- fputs_filtered (s->filename, gdb_stdout);
+ fputs_filtered (s_filename, gdb_stdout);
fputs_filtered (":\n", gdb_stdout);
}
@@ -3762,7 +3770,7 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
struct symbol_search *symbols;
struct symbol_search *p;
struct cleanup *old_chain;
- char *last_filename = NULL;
+ const char *last_filename = NULL;
int first = 1;
gdb_assert (kind <= TYPES_DOMAIN);
@@ -3797,7 +3805,7 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
p->symbol,
p->block,
last_filename);
- last_filename = p->symtab->filename;
+ last_filename = symtab_to_filename_for_display (p->symtab);
}
}
@@ -3881,7 +3889,9 @@ rbreak_command (char *regexp, int from_tty)
{
if (p->msymbol == NULL)
{
- int newlen = (strlen (p->symtab->filename)
+ const char *fullname = symtab_to_fullname (p->symtab);
+
+ int newlen = (strlen (fullname)
+ strlen (SYMBOL_LINKAGE_NAME (p->symbol))
+ 4);
@@ -3890,7 +3900,7 @@ rbreak_command (char *regexp, int from_tty)
string = xrealloc (string, newlen);
len = newlen;
}
- strcpy (string, p->symtab->filename);
+ strcpy (string, fullname);
strcat (string, ":'");
strcat (string, SYMBOL_LINKAGE_NAME (p->symbol));
strcat (string, "'");
@@ -3899,7 +3909,7 @@ rbreak_command (char *regexp, int from_tty)
p->symtab,
p->symbol,
p->block,
- p->symtab->filename);
+ symtab_to_filename_for_display (p->symtab));
}
else
{
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index be45cb4..bc30150 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -311,7 +311,7 @@ set_traceframe_context (struct frame_info *trace_frame)
clear_internalvar (lookup_internalvar ("trace_file"));
else
set_internalvar_string (lookup_internalvar ("trace_file"),
- traceframe_sal.symtab->filename);
+ symtab_to_filename_for_display (traceframe_sal.symtab));
}
/* Create a new trace state variable with the given name. */
@@ -2512,7 +2512,8 @@ trace_find_line_command (char *args, int from_tty)
if (start_pc == end_pc)
{
printf_filtered ("Line %d of \"%s\"",
- sal.line, sal.symtab->filename);
+ sal.line,
+ symtab_to_filename_for_display (sal.symtab));
wrap_here (" ");
printf_filtered (" is at address ");
print_address (get_current_arch (), start_pc, gdb_stdout);
@@ -2533,7 +2534,7 @@ trace_find_line_command (char *args, int from_tty)
which the user would want to see? If we have debugging
symbols and no line numbers? */
error (_("Line number %d is out of range for \"%s\"."),
- sal.line, sal.symtab->filename);
+ sal.line, symtab_to_filename_for_display (sal.symtab));
/* Find within range of stated line. */
if (args && *args)
@@ -4860,7 +4861,8 @@ print_one_static_tracepoint_marker (int count,
if (sal.symtab != NULL)
{
- ui_out_field_string (uiout, "file", sal.symtab->filename);
+ ui_out_field_string (uiout, "file",
+ symtab_to_filename_for_display (sal.symtab));
ui_out_text (uiout, ":");
if (ui_out_is_mi_like_p (uiout))
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 4368c04..52b6f41 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -63,9 +63,10 @@ tui_set_source_content (struct symtab *s,
{
if (!noerror)
{
- char *name = alloca (strlen (s->filename) + 100);
+ const char *filename = symtab_to_filename_for_display (s);
+ char *name = alloca (strlen (filename) + 100);
- sprintf (name, "%s:%d", s->filename, line_no);
+ sprintf (name, "%s:%d", filename, line_no);
print_sys_errmsg (name, errno);
}
ret = TUI_FAILURE;
@@ -78,14 +79,16 @@ tui_set_source_content (struct symtab *s,
if (line_no < 1 || line_no > s->nlines)
{
close (desc);
- printf_unfiltered (
- "Line number %d out of range; %s has %d lines.\n",
- line_no, s->filename, s->nlines);
+ printf_unfiltered ("Line number %d out of range; "
+ "%s has %d lines.\n",
+ line_no,
+ symtab_to_filename_for_display (s),
+ s->nlines);
}
else if (lseek (desc, s->line_charpos[line_no - 1], 0) < 0)
{
close (desc);
- perror_with_name (s->filename);
+ perror_with_name (symtab_to_filename_for_display (s));
}
else
{
@@ -94,10 +97,11 @@ tui_set_source_content (struct symtab *s,
= tui_locator_win_info_ptr ();
struct tui_source_info *src
= &TUI_SRC_WIN->detail.source_info;
+ const char *s_filename = symtab_to_filename_for_display (s);
if (TUI_SRC_WIN->generic.title)
xfree (TUI_SRC_WIN->generic.title);
- TUI_SRC_WIN->generic.title = xstrdup (s->filename);
+ TUI_SRC_WIN->generic.title = xstrdup (s_filename);
xfree (src->fullname);
src->fullname = xstrdup (symtab_to_fullname (s));