From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24399 invoked by alias); 19 Nov 2008 22:37:17 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 24310 invoked by uid 9519); 19 Nov 2008 22:37:16 -0000 Date: Wed, 19 Nov 2008 22:37:00 -0000 Message-ID: <20081119223716.24286.qmail@sourceware.org> From: rmoseley@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-rmoseley-F9-patch-merge: Add final linking fix, have a couple compile erros to go after I comment them back in. X-Git-Refname: refs/heads/archer-rmoseley-F9-patch-merge X-Git-Reftype: branch X-Git-Oldrev: 507be30a312572fcbfb751d201aa112c2fabcf60 X-Git-Newrev: eecf8a1bffed2ed860ea995647afdc71982d508f X-SW-Source: 2008-q4/txt/msg00131.txt.bz2 List-Id: The branch, archer-rmoseley-F9-patch-merge has been updated via eecf8a1bffed2ed860ea995647afdc71982d508f (commit) from 507be30a312572fcbfb751d201aa112c2fabcf60 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit eecf8a1bffed2ed860ea995647afdc71982d508f Author: Rick Moseley Date: Wed Nov 19 16:36:23 2008 -0600 Add final linking fix, have a couple compile erros to go after I comment them back in. ----------------------------------------------------------------------- Summary of changes: gdb/frame.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 0 deletions(-) First 500 lines of diff: diff --git a/gdb/frame.c b/gdb/frame.c index 0215966..f48f1aa 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -573,6 +573,24 @@ frame_pc_unwind (struct frame_info *this_frame) } CORE_ADDR +frame_func_unwind (struct frame_info *fi, enum frame_type this_type) +{ + if (!fi->prev_func.p) + { + /* Make certain that this, and not the adjacent, function is + found. */ + CORE_ADDR addr_in_block = frame_unwind_address_in_block (fi, this_type); + fi->prev_func.p = 1; + fi->prev_func.addr = get_pc_function_start (addr_in_block); + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, + "{ frame_func_unwind (fi=%d) -> 0x%s }\n", + fi->level, paddr_nz (fi->prev_func.addr)); + } + return fi->prev_func.addr; +} + +CORE_ADDR get_frame_func (struct frame_info *this_frame) { struct frame_info *next_frame = this_frame->next; @@ -1686,6 +1704,48 @@ get_frame_pc (struct frame_info *frame) return frame_pc_unwind (frame->next); } +/* Return an address that falls within NEXT_FRAME's caller's code + block, assuming that the caller is a THIS_TYPE frame. */ + +CORE_ADDR +frame_unwind_address_in_block (struct frame_info *next_frame, + enum frame_type this_type) +{ + /* A draft address. */ + CORE_ADDR pc = frame_pc_unwind (next_frame); + + /* If NEXT_FRAME was called by a signal frame or dummy frame, then + we should not adjust the unwound PC. These frames may not call + their next frame in the normal way; the operating system or GDB + may have pushed their resume address manually onto the stack, so + it may be the very first instruction. Even if the resume address + was not manually pushed, they expect to be returned to. */ + if (this_type != NORMAL_FRAME && this_type != INLINE_FRAME) + return pc; + + /* If NEXT_FRAME was inlined into the current frame, we are really + interested in an even younger (newer) frame - the point where + execution left THIS function. */ + while (get_frame_type (next_frame) == INLINE_FRAME) + next_frame = next_frame->next; + + /* If THIS frame is not inner most (i.e., NEXT isn't the sentinel), + and NEXT is `normal' (i.e., not a sigtramp, dummy, ....) THIS + frame's PC ends up pointing at the instruction fallowing the + "call". Adjust that PC value so that it falls on the call + instruction (which, hopefully, falls within THIS frame's code + block). So far it's proved to be a very good approximation. See + get_frame_type() for why ->type can't be used. + + This is correct even if NEXT_FRAME describes an inlined function. + Inlined functions always live between two normal frames, and are + themselves normal. */ + if (next_frame->level >= 0 + && get_frame_type (next_frame) == NORMAL_FRAME) + --pc; + return pc; +} + /* Return an address that falls within THIS_FRAME's code block. */ CORE_ADDR hooks/post-receive -- Repository for Project Archer.