From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18374 invoked by alias); 7 Mar 2002 18:13:04 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 18222 invoked from network); 7 Mar 2002 18:13:01 -0000 Received: from unknown (HELO deimos.hpl.hp.com) (192.6.19.190) by sources.redhat.com with SMTP; 7 Mar 2002 18:13:01 -0000 Received: from hplms2.hpl.hp.com (hplms2.hpl.hp.com [15.0.152.33]) by deimos.hpl.hp.com (8.9.3 (PHNE_24419)/HPL-PA Relay) with ESMTP id KAA25931; Thu, 7 Mar 2002 10:13:00 -0800 (PST) Received: from napali.hpl.hp.com (napali.hpl.hp.com [15.4.89.123]) by hplms2.hpl.hp.com (8.10.2/8.10.2 HPL-PA Hub) with ESMTP id g27ICx407463; Thu, 7 Mar 2002 10:12:59 -0800 (PST) Received: from napali.hpl.hp.com (localhost [127.0.0.1]) by napali.hpl.hp.com (8.12.1/8.12.1/Debian -5) with ESMTP id g27ICxf7015745; Thu, 7 Mar 2002 10:12:59 -0800 Received: (from davidm@localhost) by napali.hpl.hp.com (8.12.1/8.12.1/Debian -5) id g27ICwOD015739; Thu, 7 Mar 2002 10:12:58 -0800 From: David Mosberger MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15495.44458.890110.519531@napali.hpl.hp.com> Date: Thu, 07 Mar 2002 10:13:00 -0000 To: Kevin Buettner Cc: davidm@hpl.hp.com, gdb@sources.redhat.com Subject: Re: question on gdbarch_skip_prologue() In-Reply-To: <1020307081116.ZM26473@localhost.localdomain> References: <1020307081116.ZM26473@localhost.localdomain> X-Mailer: VM 7.01 under Emacs 21.1.1 Reply-To: davidm@hpl.hp.com X-URL: http://www.hpl.hp.com/personal/David_Mosberger/ X-SW-Source: 2002-03/txt/msg00051.txt.bz2 >>>>> On Thu, 7 Mar 2002 01:11:17 -0700, Kevin Buettner said: Kevin> GDB currently expects that the skip_prologue() function will Kevin> return a PC that's after the last prologue instruction that Kevin> saved an argument to its "home" location (if any) in memory Kevin> (or whereever the debug info says that a parameter's location Kevin> is). The difficulty with this, of course, is that with Kevin> optimized code, it can be very difficult to discern where Kevin> this is. So, if I may paraphrase, skip_prologue() returns the PC of the first instruction for which the debug info will be valid, right? If so, I'd argue this has much more to do with debug info than with unwind info. For example, hand-written assembly routines often have sizable prologues, but a programmer would almost certainly want a breakpoint to be placed right at the beginning of the function, not at the end of the prologue. Now, I wonder whether it wouldn't be possible and indeed better to implement skip_prologue() based on debug info. Unfortunately, I'm not very familiar with, say, DWARF2. However, I did notice that applying the "info line" command to the first line of source code in a C program does indeed return a starting address that corresponds to the value that ought to be returned by skip_prologue(). Perhaps skip_prologue() could look for the first PC that is covered by line info and return that value (or the original PC if there is no such PC)? To be on the safe side, skip_prologue() probably ought to give up the search as soon as it sees a branch instruction. Would this be a safe algorithm? --david