From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25753 invoked by alias); 9 Mar 2004 02:54:19 -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 25631 invoked from network); 9 Mar 2004 02:54:18 -0000 Received: from unknown (HELO localhost.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 9 Mar 2004 02:54:18 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 125EB2B92; Mon, 8 Mar 2004 21:54:18 -0500 (EST) Message-ID: <404D31D9.6050203@gnu.org> Date: Tue, 09 Mar 2004 02:54:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb@sources.redhat.com Subject: Re: get_frame_func() VS get_frame_id().code References: <4048A562.5020106@gnu.org> <20040307000139.GA10524@nevyn.them.org> In-Reply-To: <20040307000139.GA10524@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00061.txt.bz2 > On Fri, Mar 05, 2004 at 11:05:54AM -0500, Andrew Cagney wrote: > >>> Hello, >>> >>> The current get_frame_func() is implemented as roughly: >>> >>> fi->prev_func.addr = get_pc_function_start (addr_in_block); >>> >>> Unfortunatly this isn't valid for a signal trampoline (or at least the >>> evil ones that consist of random bytes in a random memory location). >>> For such trampolines, get_pc_function_start [rightly] fails and "func" >>> ends up as zero -- not good -- a properly constructed frame ID requires >>> non-zero code and stack addresses. >>> >>> Fortunatly, with a bit of extra instruction pattern matching, it is >>> possible to identify the first instruction of a signal trampoline and >>> hence correctly compute the trampolines "func" address. Similarly, more >>> normal frames can determine the function start using the symbol table's >>> get_pc_function_start. >>> >>> Consequently, I think there should be mechanism for obtaining both the >>> symbol table and frame's idea of a function's start address. This would >>> mean introducing: >>> >>> - get_frame_func_by_symtab >>> Returns the function start according to the symbol table. Much of the >>> existing code (especially unwinders) would need to be updated to use this. > > > How about just leaving this as frame_func_unwind? Because the func, based on the frame ID, is more likely to be correct. The current get_frame_func and frame_func_unwind can return 0 or the wrong function :-( BTW, there is get_frame_function() which returns the symbol for the function. > The only current use > of frame_func_unwind that I see outside of unwinders is the > implementation of get_frame_func. ... get_frame_func is hardly called ... > So we could define frame_func_unwind > to attempt to find the beginning of the function at the unwound PC > using the symtab. ... so it may even be possible to simply pull get_frame_func from the frame interface. > It is already the unwinder's duty to propogate the function address > into the ID. Andrew