This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[8/10] update .gdb_index


This patch updates the .gdb_index creation code to account for PUs.

I chose an approach that would not require an index version bump.  Now,
PUs are listed in the list of CUs, but symbols in the index only refer
to their ultimately containing CU.  The idea here is that a lookup will
expand a particular CU, but this will cause PU expansion as a side
effect, so the symbol will be correctly instantiated and then found.

Tom

>From 5fe8ae27cbc1e407b3e8e56c78364683e290b674 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Tue, 24 Apr 2012 10:03:54 -0600
Subject: [PATCH 08/10] update .gdb_index generation for partial symtabs

	* dwarf2read.c (recursively_write_psymbols): New function.
	(write_psymtabs_to_index): Use it.
---
 gdb/dwarf2read.c |   41 +++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index bf8eae2..0794e10 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17323,6 +17323,35 @@ write_one_signatured_type (void **slot, void *d)
   return 1;
 }
 
+/* Recurse into all "included" dependencies and write their symbols as
+   if they appeared in this psymtab.  */
+
+static void
+recursively_write_psymbols (struct objfile *objfile,
+			    struct partial_symtab *psymtab,
+			    struct mapped_symtab *symtab,
+			    htab_t psyms_seen,
+			    offset_type cu_index)
+{
+  int i;
+
+  for (i = 0; i < psymtab->number_of_dependencies; ++i)
+    if (psymtab->dependencies[i]->users != NULL)
+      recursively_write_psymbols (objfile, psymtab->dependencies[i],
+				  symtab, psyms_seen, cu_index);
+
+  write_psymbols (symtab,
+		  psyms_seen,
+		  objfile->global_psymbols.list + psymtab->globals_offset,
+		  psymtab->n_global_syms, cu_index,
+		  0);
+  write_psymbols (symtab,
+		  psyms_seen,
+		  objfile->static_psymbols.list + psymtab->statics_offset,
+		  psymtab->n_static_syms, cu_index,
+		  1);
+}
+
 /* Create an index file for OBJFILE in the directory DIR.  */
 
 static void
@@ -17407,16 +17436,8 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
       struct psymtab_cu_index_map *map;
       void **slot;
 
-      write_psymbols (symtab,
-		      psyms_seen,
-		      objfile->global_psymbols.list + psymtab->globals_offset,
-		      psymtab->n_global_syms, i,
-		      0);
-      write_psymbols (symtab,
-		      psyms_seen,
-		      objfile->static_psymbols.list + psymtab->statics_offset,
-		      psymtab->n_static_syms, i,
-		      1);
+      if (psymtab->users == NULL)
+	recursively_write_psymbols (objfile, psymtab, symtab, psyms_seen, i);
 
       map = &psymtab_cu_index_map[i];
       map->psymtab = psymtab;
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]