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]

RFA: make it simpler to try debug_pubnames


I wanted to try the debug_pubnames support today, but when I enabled
this I found that it did not compile, and when I made it compile, it
caused an internal error.

This patch fixes the compilation error and the crash, and makes it
simple to try this code by introducing a new symbol, which is used
rather than "#if 0".

The reason I would like this in the repository is to make it simpler
for other folks to try this out.

Please check the comment before WANT_PUBNAMES.  I am not sure this is
actually an accurate assessment; my searches didn't turn up anything
relevant.

Built on x86 F8.  I did not regression-test this, because it does not
actually change any behavior.

Ok?

Tom

b/gdb/ChangeLog:
2008-07-31  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (WANT_PUBNAMES): New define.
	(dwarf2_build_psymtabs): Use WANT_PUBNAMES.  Check
	dwarf_aranges_section and dwarf_pubnames_section.
	(dwarf2_build_psymtabs_easy): Use WANT_PUBNAMES.  Initialize
	cu_header.initial_length_size.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8f1062d..ac97cd7 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -69,6 +69,13 @@
    can be used for any other data associated to the objfile (symbol
    names, type names, location expressions to name a few).  */
 
+/* Define this to 1 if you want to try out the debug_pubnames
+   support.  This is disabled for the time being because it leads to a
+   change of behavior -- 'static' file-scoped variables are not
+   mentioned in debug_pubnames, but historically these do appear in
+   gdb's psymtab.  */
+#define WANT_PUBNAMES 0
+
 #if 0
 /* .debug_info header for a compilation unit
    Because of alignment constraints, this structure has padding and cannot
@@ -734,7 +741,7 @@ dwarf2_invalid_attrib_class_complaint (const char *arg1, const char *arg2)
 
 static void dwarf2_locate_sections (bfd *, asection *, void *);
 
-#if 0
+#if WANT_PUBNAMES
 static void dwarf2_build_psymtabs_easy (struct objfile *, int);
 #endif
 
@@ -1258,8 +1265,8 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline)
       init_psymbol_list (objfile, 1024);
     }
 
-#if 0
-  if (dwarf_aranges_offset && dwarf_pubnames_offset)
+#if WANT_PUBNAMES
+  if (dwarf_aranges_section && dwarf_pubnames_section)
     {
       /* Things are significantly easier if we have .debug_aranges and
          .debug_pubnames sections */
@@ -1275,7 +1282,7 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline)
     }
 }
 
-#if 0
+#if WANT_PUBNAMES
 /* Build the partial symbol table from the information in the
    .debug_pubnames and .debug_aranges sections.  */
 
@@ -1295,6 +1302,7 @@ dwarf2_build_psymtabs_easy (struct objfile *objfile, int mainline)
       struct comp_unit_head cu_header;
       unsigned int bytes_read;
 
+      cu_header.initial_length_size = 0;
       entry_length = read_initial_length (abfd, pubnames_ptr, &cu_header,
                                           &bytes_read);
       pubnames_ptr += bytes_read;


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