From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32165 invoked by alias); 29 Apr 2004 01:02:09 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32155 invoked from network); 29 Apr 2004 01:02:06 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (142.179.108.108) by sources.redhat.com with SMTP; 29 Apr 2004 01:02:06 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id A7DC447D63; Wed, 28 Apr 2004 18:02:05 -0700 (PDT) Date: Thu, 29 Apr 2004 01:02:00 -0000 From: Joel Brobecker To: Jason Molenda Cc: Andrew Cagney , gdb-patches@sources.redhat.com Subject: Re: Question about blockframe.c:inside_main_func() Message-ID: <20040429010205.GS867@gnat.com> References: <9B827536-9972-11D8-9EA7-000A9569836A@apple.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9B827536-9972-11D8-9EA7-000A9569836A@apple.com> User-Agent: Mutt/1.4i X-SW-Source: 2004-04/txt/msg00655.txt.bz2 > We're bringing up the currentish gdb sources here at Apple and I was > debugging a problem with inside_main_func () [*] when I noticed that > there seems to be a bit of extra computation that has snuck into the > function during the changes since July. Indeed, it seems that we could improve a bit this code: It really looks like we are trying to compute the low/high addresses for function main twice! Even when main is found within the debug info, we go through the through the trouble of finding the bounds of function "main" from the min syms anyway. A missing condition somewhere? At first glance, I would think something like this ought to work: if (lowpc == INVALID && highpc == INVALID) { msymbol = lookup_minimal_symbol (main_name () if (msymbol != NULL) { /* Try finding the bounds from the debug info. */ struct symbol *mainsym = find_pc_function (...); if (mainsym != NULL && ...) { lowpc = BLOCK_START (...); highpc = BLOCK_END (...); } else { /* Not found in the debug info, use the minsyms... */ CORE_ADDR maddr = SYMBOL_VALUE_ADDRESS (msymbol); [...] } } } return (lowpc <= pc && highpc > pc); Unless Andrew had a reason to believe that recomputing the low/high PCs was necessary? See http://sources.redhat.com/ml/gdb-patches/2003-07/msg00144.html, where the block computing the function bounds from minimal symbols was introduced. -- Joel