This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 2/4] Improve DWARF Type Unit performance
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Tue, 10 Jul 2012 01:09:13 -0700 (PDT)
- Subject: [RFA 2/4] Improve DWARF Type Unit performance
This patch in the series adds the notion of anonymous partial symtabs.
TU partial symtabs currently don't have a name, and this patch series
doesn't change that. They could if we looked at DW_AT_decl_file, but
I haven't found a compelling need for it (you can't, for example,
set a breakpoint on a type unit).
2012-07-09 Doug Evans <dje@google.com>
* psympriv.h (struct partial_symtab): New member "anonymous".
* psymtab.c (partial_map_symtabs_matching_filename): Ignore
anonymous psymtabs.
(map_symbol_filenames_psymtab): Ditto.
(expand_symtabs_matching_via_partial): Ditto.
(dump_psymtab): Update.
Index: psympriv.h
===================================================================
RCS file: /cvs/src/src/gdb/psympriv.h,v
retrieving revision 1.13
diff -u -p -r1.13 psympriv.h
--- psympriv.h 10 May 2012 19:54:45 -0000 1.13
+++ psympriv.h 10 Jul 2012 01:15:46 -0000
@@ -182,6 +182,10 @@ struct partial_symtab
unsigned char psymtabs_addrmap_supported;
+ /* True if the name of this partial symtab is not a source file name. */
+
+ unsigned char anonymous;
+
/* A flag that is temporarily used when searching psymtabs. */
ENUM_BITFIELD (psymtab_search_status) searched_flag : 2;
Index: psymtab.c
===================================================================
RCS file: /cvs/src/src/gdb/psymtab.c,v
retrieving revision 1.48
diff -u -p -r1.48 psymtab.c
--- psymtab.c 26 Jun 2012 20:14:02 -0000 1.48
+++ psymtab.c 10 Jul 2012 01:15:46 -0000
@@ -174,6 +174,10 @@ partial_map_symtabs_matching_filename (s
if (pst->user != NULL)
continue;
+ /* Anonymous psymtabs don't have a file name. */
+ if (pst->anonymous)
+ continue;
+
if (FILENAME_CMP (name, pst->filename) == 0
|| (!is_abs && compare_filenames_for_search (pst->filename,
name, name_len)))
@@ -973,8 +977,13 @@ dump_psymtab (struct objfile *objfile, s
struct gdbarch *gdbarch = get_objfile_arch (objfile);
int i;
- fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
- psymtab->filename);
+ if (psymtab->anonymous)
+ fprintf_filtered (outfile, "\nAnonymous partial symtab ");
+ else
+ {
+ fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
+ psymtab->filename);
+ }
fprintf_filtered (outfile, "(object ");
gdb_print_host_address (psymtab, outfile);
fprintf_filtered (outfile, ")\n\n");
@@ -1143,6 +1152,10 @@ map_symbol_filenames_psymtab (struct obj
if (ps->readin)
continue;
+ /* Anonymous psymtabs don't have a file name. */
+ if (ps->anonymous)
+ continue;
+
QUIT;
if (need_fullname)
fullname = psymtab_to_fullname (ps);
@@ -1377,8 +1390,13 @@ expand_symtabs_matching_via_partial
if (ps->user != NULL)
continue;
- if (file_matcher && ! (*file_matcher) (ps->filename, data))
- continue;
+ if (file_matcher)
+ {
+ if (ps->anonymous)
+ continue;
+ if (! (*file_matcher) (ps->filename, data))
+ continue;
+ }
if (recursively_search_psymtabs (ps, objfile, kind, name_matcher, data))
psymtab_to_symtab (ps);