From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16690 invoked by alias); 27 May 2005 14:38:33 -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 16617 invoked by uid 22791); 27 May 2005 14:38:23 -0000 Received: from miranda.se.axis.com (HELO miranda.se.axis.com) (193.13.178.8) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 27 May 2005 14:38:23 +0000 Received: from [10.92.19.1] (ironmaiden.se.axis.com [10.92.19.1]) by miranda.se.axis.com (8.12.9/8.12.9/Debian-5local0.1) with ESMTP id j4REbnNc012089; Fri, 27 May 2005 16:37:49 +0200 Message-ID: <429730C0.7010600@axis.com> Date: Sat, 28 May 2005 08:58:00 -0000 From: Orjan Friberg User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com CC: Daniel Jacobowitz Subject: Re: Dwarf-2 unwinding vs. manual prologue analysis References: <4295E439.7070104@axis.com> <20050526150841.GA9804@nevyn.them.org> <4296F9B6.10500@axis.com> In-Reply-To: <4296F9B6.10500@axis.com> Content-Type: multipart/mixed; boundary="------------060500050809090004080100" X-SW-Source: 2005-05/txt/msg00576.txt.bz2 This is a multi-part message in MIME format. --------------060500050809090004080100 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 764 (Back to gdb-patches@ for patch submission.) Orjan Friberg wrote: > > Ah, now I see. The things that broke without any prologue scanning were > indeed things like 'next' over library calls (PLT stubs) and things > related to call dummys (callfuncs.exp). Add signal trampolines to that list too. The change below (committed) doesn't make anything better or worse; it just clarifies the situation in which it's assumed that the new CRISv32-specific prologue scanner will be used and what conditions are assumed to hold true. 2005-05-27 Orjan Friberg * cris-tdep.c (crisv32_scan_prologue): Add. (cris_frame_unwind_cache, cris_skip_prologue): Call crisv32_scan_prologue when debugging CRISv32. -- Orjan Friberg Axis Communications --------------060500050809090004080100 Content-Type: text/plain; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" Content-length: 2818 Index: cris-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/cris-tdep.c,v retrieving revision 1.131 diff -u -p -r1.131 cris-tdep.c --- cris-tdep.c 27 May 2005 13:47:59 -0000 1.131 +++ cris-tdep.c 27 May 2005 14:14:24 -0000 @@ -724,6 +724,10 @@ static CORE_ADDR cris_scan_prologue (COR struct frame_info *next_frame, struct cris_unwind_cache *info); +static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc, + struct frame_info *next_frame, + struct cris_unwind_cache *info); + static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame); @@ -795,7 +799,10 @@ cris_frame_unwind_cache (struct frame_in info->leaf_function = 0; /* Prologue analysis does the rest... */ - cris_scan_prologue (frame_func_unwind (next_frame), next_frame, info); + if (cris_version () == 32) + crisv32_scan_prologue (frame_func_unwind (next_frame), next_frame, info); + else + cris_scan_prologue (frame_func_unwind (next_frame), next_frame, info); return info; } @@ -1375,6 +1382,42 @@ cris_scan_prologue (CORE_ADDR pc, struct return pc; } +static CORE_ADDR +crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, + struct cris_unwind_cache *info) +{ + ULONGEST this_base; + + /* Unlike the CRISv10 prologue scanner (cris_scan_prologue), this is not + meant to be a full-fledged prologue scanner. It is only needed for + the cases where we end up in code always lacking DWARF-2 CFI, notably: + + * PLT stubs (library calls) + * call dummys + * signal trampolines + + For those cases, it is assumed that there is no actual prologue; that + the stack pointer is not adjusted, and (as a consequence) the return + address is not pushed onto the stack. */ + + /* We only want to know the end of the prologue when next_frame and info + are NULL (called from cris_skip_prologue i.e.). */ + if (next_frame == NULL && info == NULL) + { + return pc; + } + + /* The SP is assumed to be unaltered. */ + frame_unwind_unsigned_register (next_frame, SP_REGNUM, &this_base); + info->base = this_base; + info->prev_sp = this_base; + + /* The PC is assumed to be found in SRP. */ + info->saved_regs[PC_REGNUM] = info->saved_regs[SRP_REGNUM]; + + return pc; +} + /* Advance pc beyond any function entry prologue instructions at pc to reach some "real" code. */ @@ -1397,7 +1440,11 @@ cris_skip_prologue (CORE_ADDR pc) return sal.end; } - pc_after_prologue = cris_scan_prologue (pc, NULL, NULL); + if (cris_version () == 32) + pc_after_prologue = crisv32_scan_prologue (pc, NULL, NULL); + else + pc_after_prologue = cris_scan_prologue (pc, NULL, NULL); + return pc_after_prologue; } --------------060500050809090004080100--