* dwarf2read.c (dw2_map_symbol_filenames): New parameter
authorDoug Evans <dje@google.com>
Fri, 11 Nov 2011 00:43:04 +0000 (00:43 +0000)
committerDoug Evans <dje@google.com>
Fri, 11 Nov 2011 00:43:04 +0000 (00:43 +0000)
`need_fullname'.
* psymtab.c (map_symbol_filenames_psymtab): Ditto.
(map_partial_symbol_filenames): Ditto.  All callers updated.
* psymtab.h (map_partial_symbol_filenames): Update prototype.
* symfile.h (struct quick_symbol_functions, map_symbol_filenames): New
parameter need_fullname.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/mi/mi-cmd-file.c
gdb/psymtab.c
gdb/psymtab.h
gdb/symfile.h
gdb/symtab.c

index 63deaf1db5efa38a768176c7281a193e659c393e..8aaf0ddf9b5ca73124db1bfc2fa6bb9edfc3131b 100644 (file)
 
 2011-11-10  Doug Evans  <dje@google.com>
 
+       * dwarf2read.c (dw2_map_symbol_filenames): New parameter
+       `need_fullname'.
+       * psymtab.c (map_symbol_filenames_psymtab): Ditto.
+       (map_partial_symbol_filenames): Ditto.  All callers updated.
+       * psymtab.h (map_partial_symbol_filenames): Update prototype.
+       * symfile.h (struct quick_symbol_functions, map_symbol_filenames): New
+       parameter need_fullname.
+
        * psymtab.c (psymtab_to_fullname): Use cached copy if it exists.
        * source.c (symtab_to_fullname): Ditto.
 
index 5a3e4692e86767b2b7c7af6a048ced0f38d74380..5e5ee7c9c29598955e5d3e8bf34e417bba55a118 100644 (file)
@@ -2811,7 +2811,7 @@ dw2_find_pc_sect_symtab (struct objfile *objfile,
 
 static void
 dw2_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun,
-                         void *data)
+                         void *data, int need_fullname)
 {
   int i;
 
@@ -2833,8 +2833,12 @@ dw2_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun,
 
       for (j = 0; j < file_data->num_file_names; ++j)
        {
-         const char *this_real_name = dw2_get_real_path (objfile, file_data,
-                                                         j);
+         const char *this_real_name;
+
+         if (need_fullname)
+           this_real_name = dw2_get_real_path (objfile, file_data, j);
+         else
+           this_real_name = NULL;
          (*fun) (file_data->file_names[j], this_real_name, data);
        }
     }
index 22cb99532a8c53291d5878b3ca1256c5b6c98ff1..ff8658889c8e1ae67d13014c2363c0acf249a561 100644 (file)
@@ -109,7 +109,8 @@ mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
     ui_out_end (uiout, ui_out_type_tuple);
   }
 
-  map_partial_symbol_filenames (print_partial_file_name, NULL);
+  map_partial_symbol_filenames (print_partial_file_name, NULL,
+                               1 /*need_fullname*/);
 
   ui_out_end (uiout, ui_out_type_list);
 }
index 38adca2e2274cb08e1ee2b7acfe0d10884fa65b4..6012118e341c5d3a1a5b6381a4a482bb89fa0ae0 100644 (file)
@@ -1082,7 +1082,8 @@ read_psymtabs_with_filename (struct objfile *objfile, const char *filename)
 
 static void
 map_symbol_filenames_psymtab (struct objfile *objfile,
-                             symbol_filename_ftype *fun, void *data)
+                             symbol_filename_ftype *fun, void *data,
+                             int need_fullname)
 {
   struct partial_symtab *ps;
 
@@ -1094,7 +1095,10 @@ map_symbol_filenames_psymtab (struct objfile *objfile,
        continue;
 
       QUIT;
-      fullname = psymtab_to_fullname (ps);
+      if (need_fullname)
+       fullname = psymtab_to_fullname (ps);
+      else
+       fullname = NULL;
       (*fun) (ps->filename, fullname, data);
     }
 }
@@ -1921,13 +1925,15 @@ expand_partial_symbol_names (int (*fun) (const char *, void *), void *data)
 }
 
 void
-map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data)
+map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data,
+                             int need_fullname)
 {
   struct objfile *objfile;
 
   ALL_OBJFILES (objfile)
   {
     if (objfile->sf)
-      objfile->sf->qf->map_symbol_filenames (objfile, fun, data);
+      objfile->sf->qf->map_symbol_filenames (objfile, fun, data,
+                                            need_fullname);
   }
 }
index 4d7f6d6d8f75db59da6a6dad67730e54ab4b1512..de292c5d87c9ba176b298b51ab9467d08e88f9c9 100644 (file)
@@ -33,7 +33,8 @@ extern struct bcache *psymbol_bcache_get_bcache (struct psymbol_bcache *);
 void expand_partial_symbol_names (int (*fun) (const char *, void *),
                                  void *data);
 
-void map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data);
+void map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data,
+                                  int need_fullname);
 
 extern const struct quick_symbol_functions psym_functions;
 
index 624df7682324f0adac2546a955f7cbba379f000a..accd20ee97946b21a66cd1bd68480cd756e4dc1d 100644 (file)
@@ -289,9 +289,11 @@ struct quick_symbol_functions
 
   /* Call a callback for every file defined in OBJFILE whose symtab is
      not already read in.  FUN is the callback.  It is passed the file's
-     FILENAME, the file's FULLNAME, and the DATA passed to this function.  */
+     FILENAME, the file's FULLNAME (if need_fullname is non-zero), and
+     the DATA passed to this function.  */
   void (*map_symbol_filenames) (struct objfile *objfile,
-                               symbol_filename_ftype *fun, void *data);
+                               symbol_filename_ftype *fun, void *data,
+                               int need_fullname);
 };
 
 /* Structure to keep track of symbol reading functions for various
index f8812267bb07fc94a177c466b597289105cdb482..1628f3159a23badeeda82205c52755bec8b20166 100644 (file)
@@ -2881,7 +2881,8 @@ sources_info (char *ignore, int from_tty)
                   "will be read in on demand:\n\n");
 
   first = 1;
-  map_partial_symbol_filenames (output_partial_symbol_filename, &first);
+  map_partial_symbol_filenames (output_partial_symbol_filename, &first,
+                               1 /*need_fullname*/);
   printf_filtered ("\n");
 }
 
@@ -4314,7 +4315,8 @@ make_source_files_completion_list (char *text, char *word)
   datum.list = &list;
   datum.list_used = &list_used;
   datum.list_alloced = &list_alloced;
-  map_partial_symbol_filenames (maybe_add_partial_symtab_filename, &datum);
+  map_partial_symbol_filenames (maybe_add_partial_symtab_filename, &datum,
+                               0 /*need_fullname*/);
   discard_cleanups (back_to);
 
   return list;