gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 3 Feb 2013 16:13:31 +0000 (16:13 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 3 Feb 2013 16:13:31 +0000 (16:13 +0000)
* 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.

20 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/breakpoint.c
gdb/cli/cli-cmds.c
gdb/dwarf2read.c
gdb/linespec.c
gdb/linux-fork.c
gdb/macroscope.c
gdb/mdebugread.c
gdb/mi/mi-cmd-file.c
gdb/printcmd.c
gdb/psymtab.c
gdb/python/py-symtab.c
gdb/skip.c
gdb/source.c
gdb/stack.c
gdb/symmisc.c
gdb/symtab.c
gdb/tracepoint.c
gdb/tui/tui-source.c

index 82eebfaa5a89d097f7d075654380d740002485a2..680529c91aa37c61bc2f7d540ea3ad814b0adc0f 100644 (file)
@@ -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>
 
index c202173c719b624c7fba34b54d838c33ea7a207d..634e7610a75005bae892ad3d5167c926d3034773 100644 (file)
@@ -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")
index 55274c88f679a93f50c7936301a006339da88477..026ce739a2fc7ce79fe2e8c1077223544e88738a 100644 (file)
@@ -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
index 8f78641fbddce4c8cccd203691d77e09112889e9..d9bf80f97aa9767fc69f35f5f413f73f1526f817 100644 (file)
@@ -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.  */
index 924b6b8dbea622968221edea4e52cede78ce3d71..0a3a9772f27d5d1b8efacae326c1df8b5ad970cc 100644 (file)
@@ -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);
index bc2415cf261ab9bc482d6ba7421a91117017b7a5..2e98db734d9d65fadc040e1f94995fb3a3a65471 100644 (file)
@@ -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
     {
index 4c6b623b8ddfd0c806a440c3c9b4d301a1b6d952..21514011cdfceb75f08e34ec1e17a9a09cf3ff0b 100644 (file)
@@ -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)
index 63e6ebe7d9d807439f10d922d29098841cfd5705..c7a6c35651934d7d94541776f037b41a3d7a38a6 100644 (file)
@@ -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;
index 4f64342bc315a4fb885397b6b07b676593bb6237..2fed944a79c324022a8a3aaa2544556edaa5058a 100644 (file)
@@ -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);
index d4261fb5c059d646b5e5a7941c80def27056fe93..07d972289c2f396f68d98e29fbf8ba9eb99897b9 100644 (file)
@@ -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);
index a576d8861216d8e39118fce3a499dd698837f9ad..d94d28d4074bfea75d1536a3706db22077ef88a8 100644 (file)
@@ -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;
        }
     }
index c6f994e5f7648717a58f3085997ca35550cc329e..7c4859922099749c397b5ef6a759441f475e7bec 100644 (file)
@@ -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);
     }
 }
index 49ed5c5951f5ac2f6bf22fbe43673b1d82358385..6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 100644 (file)
@@ -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);
index f8db6f855489d75385b57a5887df99153ffe2e0c..0c002ff5687a8caf769f7b51843182c7738d6c9e 100644 (file)
@@ -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;
index 68fbcdfa49d5d2c23ba78620e0d5be56126d80a2..45140fc7ce2cc78ca05977f8bc19f8bbfa8b17f0 100644 (file)
@@ -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);
        }
     }
 
index 662b351d209a395af05eacda33bb59a1eb64eca9..bfec1b853b3ebd6c49060d04dc9326e9a47622e9 100644 (file)
@@ -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);
index 2abaa5db48b0ea0897c6043249ad42b460354bd5..5fa4e4e0fbd03b86e5a505258f1c28f15ebf5291 100644 (file)
@@ -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));
index 690cda1ff55e4b027554644d665a48d3fd0ae173..072b3da43d44f2f23f1a693d9da7e2e9a6e600c3 100644 (file)
@@ -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
        {
index be45cb49d1f0ab97e19d75f3cf1dd1f0cce76e98..bc30150922ab2ad498f33ed09c2dd85e646f95e9 100644 (file)
@@ -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))
index 4368c04ff375f3903d757c0c0554d9b6d605e3ba..52b6f41f1f27ee94f058a709dcbdbd89d81b24d9 100644 (file)
@@ -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));