From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20906 invoked by alias); 14 Mar 2003 18:20:55 -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 20824 invoked from network); 14 Mar 2003 18:20:54 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 14 Mar 2003 18:20:54 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 1F4482B11; Fri, 14 Mar 2003 13:20:47 -0500 (EST) Message-ID: <3E721D7E.7040906@redhat.com> Date: Fri, 14 Mar 2003 18:20:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Cagney Cc: Mark Kettenis , mludvig@suse.cz, gdb-patches@sources.redhat.com Subject: Re: [offbyone RFC] Merge i386newframe References: <3E6FAF64.7070304@suse.cz> <3E70D673.1040504@redhat.com> <200303132246.h2DMk7pH013325@elgar.kettenis.dyndns.org> <3E71F9B4.5000504@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-03/txt/msg00329.txt.bz2 > Hmm. I was under the impression that we have this function because on > some targets (the i386 is one of them) the frame hasn't been setup yet > when we've stopped on the first instruction of a function. > > With CFI, frame or no frame, it is always possible to unwind the PC. A more complex prologue analysier could also manage to unwind the PC correctly in this case (but at the expense of doing prologue analysis). > > The function is called when doing a next and has just stepped into a function. To make the next faster (no prologue analysis), and the prologue analyzer easier (avoid most common frameless case). > > Thing is, it doesn't do anything for: > > (gdb) stepi > Stepped into function foo() > 0x10000 add 8 to sp > (gdb) stepi > 0x10000 store link-register in [sp + 4] > > which prologue analyzers should handle but don't `because it is to hard'. A simple minded suggestion is to limit the prologue analyser to the instruction range [func ... current-pc) so that, when still in the prologue, it only records what really happened. > > Perhaphs it should be superseeded by a method that takes a regcache instead of a frame (making the non-analysis of the prologue clearer)? > > I think that would be a good idea. > > Optional. It should fall back to using standard unwind_pc(). Hmm, why not get dogmatic? The prologue analyzer shall efficiently, and correctly, handle the case of a pc in the prologue. If that is a given, the pc == function edge case can be handled with: if (pc == function) // don't bother with prologue analysis // all registers (except PC/LR) come from next frame return; or for (iaddr = function; iaddr < pc; iaddr += insn length) ... examine instruction ... either way it will efficiently avoid doing prologue analysis when on the first instruction, and in the second case will result in a better analyzer. Andrew