From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17744 invoked by alias); 17 Apr 2012 23:52:00 -0000 Received: (qmail 17733 invoked by uid 22791); 17 Apr 2012 23:51:59 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Apr 2012 23:51:47 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 871821C6B81; Tue, 17 Apr 2012 19:51:46 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qCGC6lkX04uy; Tue, 17 Apr 2012 19:51:46 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 516BE1C6B41; Tue, 17 Apr 2012 19:51:46 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 6D451145616; Tue, 17 Apr 2012 16:51:38 -0700 (PDT) Date: Wed, 18 Apr 2012 00:24:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: RFC: bfd_section should not be NULL in call to prim_record_minimal_* Message-ID: <20120417235138.GT2852@adacore.com> References: <1334610821-10974-1-git-send-email-brobecker@adacore.com> <87zkaawp9g.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zkaawp9g.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2012-04/txt/msg00526.txt.bz2 > Did you audit the other symbol readers? Here is what I found - not exactly completely pretty, and definitely shows that it would have been a bad idea to add an assertion ;-). What it also tells me is that, if some of the code out there explicitly makes the assumption that the minsym's obj_section is set, it is wrong. I remember seeing this, but in fact, that was in elfread.c, where the assumption is true. | * coff-pe-read.c: | Says: Used as a last resort if no debugging symbols recognized | | - Calls prim_record_minimal_symbol from add_pe_exported_sym | => No bfd_section => No obj_section. | Fixing might not be completely straightforward, depends | (needs deeper investigation)... | | * dbxread.c: | - Calls prim_record_minimal_symbol from read_dbx_dynamic_symtab. | => No bfd_section. | Should be possible to fix? Need to re-learn about format first. | | * mdebugread.c: | - Calls prim_record_minimal_symbol_and_info, but sometimes with | NULL bfd_section. May not always be fixable: | | What does the following mean? When can this happen? | > default: | > /* This kind of symbol is not associated to a section. */ | > section = -1; | > bfd_section = NULL; | | - The other calls to prim_record_minimal_symbol_and_info (with a NULL | bfd_class) should be replaceable by a call to record_minimal_symbol, | which provides the bfd_section (apart from the exception above). | | * mips-read.c: Do we still support this format??? (bfd_arch_alpha) | - read_alphacoff_dynamic_symtab calls prim_record_minimal_symbol | => No bfd_section. | | * somread.c: (pa-hpux format - time to propose deprecation?) | - som_symtab_read calls prim_record_minimal_symbol => No bfd_section. | Don't remember SOM format anymore, but maybe fixable. | | * coffread.c, machoread.c: | OK: Calls prim_record_minimal_symbol_and_info with a bfd_section. | | * elfread.c: | OK: Calls prim_record_minimal_symbol_full with a bfd_section. -- Joel