From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21248 invoked by alias); 7 Oct 2004 01:26:44 -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 21126 invoked from network); 7 Oct 2004 01:26:42 -0000 Received: from unknown (HELO mail03.idc.renesas.com) (202.234.163.13) by sourceware.org with SMTP; 7 Oct 2004 01:26:42 -0000 Received: (from root@localhost) by guardian03.idc.renesas.com with id i971QLhB023168; Thu, 7 Oct 2004 10:26:21 +0900 (JST) Received: from unknown [172.20.8.71] by guardian03.idc.renesas.com with SMTP id LAA23167 ; Thu, 7 Oct 2004 10:26:21 +0900 Received: from mrkaisv.hoku.renesas.com ([10.145.105.245]) by rnsmtp01.hoku_r.renesas.com (8.9.3/3.7W) with ESMTP id KAA02922; Thu, 7 Oct 2004 10:26:23 +0900 (JST) Received: from E5A02646 (unknown [10.145.105.81]) by mrkaisv.hoku.renesas.com (Postfix) with SMTP id B3A9B7981B7; Thu, 7 Oct 2004 10:26:22 +0900 (JST) Message-ID: <014801c4ac0c$a7de1130$5169910a@E5A02646> From: "Kei Sakamoto" To: "Andrew Cagney" Cc: References: <046601c4aac3$eda73740$5169910a@E5A02646> <41642A1C.2010603@gnu.org> Subject: Re: [RFA/m32r] Fix m32r frame analyzer Date: Thu, 07 Oct 2004 01:26:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0145_01C4AC58.177660B0" X-SW-Source: 2004-10/txt/msg00124.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0145_01C4AC58.177660B0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Content-length: 814 > The save_read_memory will need to be in decode_prologue and applied to > every memory read as a fetch of PC+/-4 could equally fail. That means > more interface changes to decode_prologue (return success/fail?). > > On fail, it should also return the old PC and not zero - look at > find_function_start_sal for why. > > If you make those changes, you can commit. > > Andrew I revised my patch and committed it. Thank you. Kei Sakamoto 2004-10-07 Kei Sakamoto * m32r-tdep.c (decode_prologue): Support functions written in assembler language. Recognize trap instructions as the end of prologue. (m32r_frame_unwind_cache): Ditto. (m32r_skip_prologue): Extend search limit. Quit analyzing prologue if pc's location is not readable. ------=_NextPart_000_0145_01C4AC58.177660B0 Content-Type: application/octet-stream; name="m32r-tdep.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="m32r-tdep.patch" Content-length: 4831 Index: m32r-tdep.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/m32r-tdep.c,v=0A= retrieving revision 1.32=0A= diff -r1.32 m32r-tdep.c=0A= 3c3=0A= < Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software=0A= ---=0A= > Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software= =0A= 259c259=0A= < static void=0A= ---=0A= > static int=0A= 261c261=0A= < CORE_ADDR *pl_endptr)=0A= ---=0A= > CORE_ADDR *pl_endptr, unsigned long *framelength)=0A= 266d265=0A= < int maybe_one_more =3D 0;=0A= 267a267=0A= > CORE_ADDR after_push =3D 0;=0A= 269a270=0A= > LONGEST return_value;=0A= 275a277,280=0A= > /* Check if current pc's location is readable. */=0A= > if (!safe_read_memory_integer (current_pc, 2, &return_value))=0A= > return -1;=0A= >=20=0A= 277a283,285=0A= > if (insn =3D=3D 0x0000)=0A= > break;=0A= >=20=0A= 282,293d289=0A= < /* Clear the parallel execution bit from 16 bit instruction */=0A= < if (maybe_one_more)=0A= < {=0A= < /* The last instruction was a branch, usually terminates=0A= < the series, but if this is a parallel instruction,=0A= < it may be a stack framing instruction */=0A= < if (!(insn & 0x8000))=0A= < {=0A= < /* nope, we are really done */=0A= < break;=0A= < }=0A= < }=0A= 299,300d294=0A= < if (maybe_one_more)=0A= < break; /* This isnt the one more */=0A= 304a299=0A= >=20=0A= 305a301,305=0A= >=20=0A= > /* Check if current pc's location is readable. */=0A= > if (!safe_read_memory_integer (current_pc, 2, &return_value))=0A= > return -1;=0A= >=20=0A= 314a315,316=0A= > && safe_read_memory_integer (current_pc + 2, 2,=0A= > &return_value)=0A= 327c329=0A= < after_prologue =3D current_pc;=0A= ---=0A= > after_push =3D current_pc + 2;=0A= 365a368=0A= >=20=0A= 371a375,380=0A= > /* End of prolog if any of these are trap instructions */=0A= > if ((insn & 0xfff0) =3D=3D 0x10f0)=0A= > {=0A= > after_prologue =3D current_pc;=0A= > break;=0A= > }=0A= 376d384=0A= < maybe_one_more =3D 1;=0A= 386d393=0A= < maybe_one_more =3D 1;=0A= 391a399,401=0A= > if (framelength)=0A= > *framelength =3D framesize;=0A= >=20=0A= 402a413,419=0A= > else if (after_push !=3D 0)=0A= > /* We did not find a "mv fp,sp", but we DID find=0A= > a push. Is it safe to use that as the=0A= > end of the prologue? I just don't know. */=0A= > {=0A= > *pl_endptr =3D after_push;=0A= > }=0A= 410c427=0A= < return;=0A= ---=0A= > return 0;=0A= 411a429=0A= >=20=0A= 416a435,436=0A= >=20=0A= > return 0;=0A= 422c442=0A= < #define DEFAULT_SEARCH_LIMIT 44=0A= ---=0A= > #define DEFAULT_SEARCH_LIMIT 128=0A= 428a449=0A= > LONGEST return_value;=0A= 450c471,479=0A= < decode_prologue (pc, func_end, &sal.end);=0A= ---=0A= >=20=0A= > /* If pc's location is not readable, just quit. */=0A= > if (!safe_read_memory_integer (pc, 4, &return_value))=0A= > return pc;=0A= >=20=0A= > /* Find the end of prologue. */=0A= > if (decode_prologue (pc, func_end, &sal.end, NULL) < 0)=0A= > return pc;=0A= >=20=0A= 454d482=0A= <=20=0A= 483c511=0A= < CORE_ADDR pc;=0A= ---=0A= > CORE_ADDR pc, scan_limit;=0A= 486c514=0A= < unsigned long op;=0A= ---=0A= > unsigned long op, op2;=0A= 489a518=0A= >=20=0A= 499d527=0A= <=20=0A= 500a529,530=0A= >=20=0A= > scan_limit =3D frame_pc_unwind (next_frame);=0A= 502c532=0A= < pc > 0 && pc < frame_pc_unwind (next_frame); pc +=3D 2)=0A= ---=0A= > pc > 0 && pc < scan_limit; pc +=3D 2)=0A= 516,517c546,547=0A= < else if (((op >> 8) =3D=3D 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */= =0A= < && get_frame_memory_unsigned (next_frame, pc + 4,=0A= ---=0A= > else if (((op >> 8) =3D=3D 0xe4)=0A= > && get_frame_memory_unsigned (next_frame, pc + 2,=0A= 519a550=0A= > /* ld24 r4, xxxxxx; sub sp, r4 */=0A= 522c553=0A= < pc +=3D 2;=0A= ---=0A= > pc +=3D 2; /* skip sub instruction */=0A= 524,525d554=0A= < else=0A= < break;=0A= 527c556,558=0A= < pc +=3D 2;=0A= ---=0A= > if (pc =3D=3D scan_limit)=0A= > scan_limit +=3D 2; /* extend the search */=0A= > pc +=3D 2; /* skip the immediate data */=0A= 551a583,588=0A= > break; /* end of stack adjustments */=0A= > }=0A= > else if ((op & 0xfff0) =3D=3D 0x10f0)=0A= > {=0A= > /* end of prologue if this is a trap instruction */=0A= > break; /* end of stack adjustments */=0A= 553,557d589=0A= < else if (op =3D=3D 0x7000)=0A= < /* nop */=0A= < continue;=0A= < else=0A= < break;=0A= ------=_NextPart_000_0145_01C4AC58.177660B0--