+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>
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
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)
{
: _("[%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")
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));
{
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
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
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)
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)
{
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
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))
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
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
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
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. */
#include <ctype.h>
#include "gdb_bfd.h"
#include "f-lang.h"
+#include "source.h"
#include <fcntl.h>
#include "gdb_string.h"
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);
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);
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;
}
/* 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
{
#include "linux-fork.h"
#include "linux-nat.h"
#include "gdbthread.h"
+#include "source.h"
#include <sys/ptrace.h>
#include "gdb_wait.h"
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)
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;
#include "gdb_stat.h"
#include "gdb_string.h"
#include "psympriv.h"
+#include "source.h"
#include "bfd.h"
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);
/* 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));
{
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);
#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. */
if (sal.symtab)
{
- *filename = xstrdup (sal.symtab->filename);
+ *filename = xstrdup (symtab_to_filename_for_display (sal.symtab));
*line = sal.line;
}
}
&& 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)
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);
}
}
STPY_REQUIRE_VALID (self, symtab);
- result = PyString_FromString (symtab->filename);
+ result = PyString_FromString (symtab_to_filename_for_display (symtab));
return result;
}
{
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;
}
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;
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);
#include "objfiles.h"
#include "exceptions.h"
#include "breakpoint.h" /* for get_sal_arch () */
+#include "source.h"
+#include "filenames.h"
struct skiplist_entry
{
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
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
{
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;
}
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)
&& 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;
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;
/* 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;
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);
{
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);
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++);
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);
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);
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);
}
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)
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);
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)
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);
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);
}
}
}
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);
#include "dictionary.h"
#include "typeprint.h"
#include "gdbcmd.h"
+#include "source.h"
#include "gdb_string.h"
#include "readline/readline.h"
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)
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);
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);
QUIT;
if (! regexp
- || re_exec (symtab->filename))
+ || re_exec (symtab_to_filename_for_display (symtab)))
{
if (! printed_objfile_start)
{
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));
&& 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. */
%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);
}
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);
{
if (objfile->sf)
objfile->sf->qf->expand_symtabs_with_fullname (objfile,
- symtab->filename);
+ symtab_to_fullname (symtab));
}
ALL_SYMTABS (objfile, s)
{
for (i = 0; i < nfiles; i++)
{
- if (filename_cmp (files[i], lbasename (file)) == 0)
+ if (compare_filenames_for_search (file, files[i]))
return 1;
}
}
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);
}
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);
p->symbol,
p->block,
last_filename);
- last_filename = p->symtab->filename;
+ last_filename = symtab_to_filename_for_display (p->symtab);
}
}
{
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);
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, "'");
p->symtab,
p->symbol,
p->block,
- p->symtab->filename);
+ symtab_to_filename_for_display (p->symtab));
}
else
{
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. */
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);
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)
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))
{
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;
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
{
= 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));