From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5752 invoked by alias); 23 Apr 2003 14:37:14 -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 5657 invoked from network); 23 Apr 2003 14:37:00 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 23 Apr 2003 14:37:00 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id B63D32B2F; Wed, 23 Apr 2003 10:36:55 -0400 (EDT) Message-ID: <3EA6A507.5060706@redhat.com> Date: Wed, 23 Apr 2003 18:48: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: Eli Zaretskii Cc: gdb-patches@sources.redhat.com, kettenis@chello.nl Subject: Re: [patch rfc] push_dummy_call return a frame ID; eliminate need for read_fp References: <3EA5C113.7080906@redhat.com> <2927-Wed23Apr2003123434+0300-eliz@elta.co.il> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-04/txt/msg00438.txt.bz2 Hmm, Patch withdrawn. I've just figured out a more straight forward way of doing this. The `else' comment: > + re-identify the dummy breakpoint. Code using > + push_dummy_call() will have previously computed the dummy > + frame's ID (and hence set "code_addr" to something > + non-zero. */ > + id = frame_id_build (read_fp (), sal.pc); > + /* else ... is the sal.pc the frame ID's code_addr? */ > + gives the hint. The frame ID's code_addr is always be the address of the breakpoint, so instead of having push_dummy_call() return the frame ID, it can return the ID's stack_addr, and then the hand function call code can explicitly construct the frame ID from that and the sap.pc. I'll just need to check the Arm. Andrew > Now that the inferior function call code is all in a single function, more, and significant, cleanups become possible. > > This patch modifies the architecture method push_dummy_call() so that it returns a frame ID, and not just a stack pointer. That frame ID is then used: > > - to create the breakpoint (the ID identifies the breakpoint's frame) > > - to identify the dummy (somewhat indirectly at present as it still goes via SAVE_DUMMY_FRAME_TOS() and generic_save_call_dummy_addr()) > > This means that: > > - push_dummy_call(regcache, ...) creates the dummy frame's ID > > - unwind_dummy_id(frame, ...) is then expected to return that same value > > so the need for one to match the other is hopefully both clear and easy ... > > Future changes will involve: > > - deprecating read_fp / TARGET_READ_FP, as core GDB no longer contains any legitimate calls > > - merging SAVE_DUMMY_FRAME_TOS and generic_save_call_dummy_addr() into a single method that receives the full frame ID, and can not be overridden by the architecture. > > Someone studying this carefully will probably realise that instead of having push_dummy_call() return the ID, the code could simply use: > > flush cached frames; > id = get_frame_id (get_current_frame ()); > > but that would incure additional overhead. > > Mark, > I think this patch resolves the i386's FP/SP frame ID problem. It makes push_dummy_call responsible for computing the ID, and then just passes it through. > > Richard, > For the ARM, I've pulled a quick hack. I'm not sure what would happen if the ARM started returning a full frame ID. > > I'll leave this one sit for a week. > > Andrew > > > > 2003-04-22 Andrew Cagney > > * d10v-tdep.c (d10v_push_dummy_call): Return a frame ID. > (d10v_gdbarch_init): Do not set read_fp. > (d10v_read_fp): Delete function. > * arm-tdep.c (arm_push_dummy_call): Return the SP in a frame ID. > * infcall.c (call_function_by_hand): New variable "id". > Initialize using gdbarch_push_dummy_call when possible. For > legacy code, use the the frame ID's "stack_addr" instead of "sp" > to track the stack's inner most address. > * gdbarch.sh (PUSH_DUMMY_CALL): Return the frame ID instead of the > stack's inner most address. > * gdbarch.h, gdbarch.c: Re-generate. > > Index: doc/ChangeLog > 2003-04-22 Andrew Cagney > > * gdbint.texinfo (Target Architecture Definition): Update > "push_dummy_call", returns a frame ID. Cross reference > "push_dummy_call" and "unwind_dummy_id". Drop reference to > SAVE_DUMMY_FRAME_TOS. >