From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13235 invoked by alias); 31 Jul 2008 19:22:59 -0000 Received: (qmail 13215 invoked by uid 22791); 31 Jul 2008 19:22:59 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 31 Jul 2008 19:22:33 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m6VJMVam025176 for ; Thu, 31 Jul 2008 15:22:31 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m6VJMUe0026624; Thu, 31 Jul 2008 15:22:30 -0400 Received: from opsy.redhat.com (vpn-10-108.bos.redhat.com [10.16.10.108]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m6VJMUQn017619; Thu, 31 Jul 2008 15:22:30 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 5BC1E8880A6; Thu, 31 Jul 2008 13:22:29 -0600 (MDT) To: gdb-patches@sourceware.org Subject: RFA: make it simpler to try debug_pubnames From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom Date: Thu, 31 Jul 2008 19:22:00 -0000 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00587.txt.bz2 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 * 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;