From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27779 invoked by alias); 25 Oct 2004 09:02: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 27752 invoked from network); 25 Oct 2004 09:02:11 -0000 Received: from unknown (HELO mail03.idc.renesas.com) (202.234.163.13) by sourceware.org with SMTP; 25 Oct 2004 09:02:11 -0000 Received: (from root@localhost) by guardian05.idc.renesas.com with id i9P92AXW016178 for gdb-patches@sources.redhat.com; Mon, 25 Oct 2004 18:02:10 +0900 (JST) Received: from unknown [172.20.8.69] by guardian05.idc.renesas.com with SMTP id UAA16177 ; Mon, 25 Oct 2004 18:02:10 +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 SAA15186 for ; Mon, 25 Oct 2004 18:02:07 +0900 (JST) Received: from E5A02646 (unknown [10.145.105.81]) by mrkaisv.hoku.renesas.com (Postfix) with SMTP id A96957981B7 for ; Mon, 25 Oct 2004 18:02:07 +0900 (JST) Message-ID: <017b01c4ba71$7900e8b0$5169910a@E5A02646> From: "Kei Sakamoto" To: References: <01b101c4ac37$3adbf950$5169910a@E5A02646> <017701c4b4dd$cd025230$5169910a@E5A02646> Subject: [RFA/m32r] Unreviewed patch (breakpoint bug) Date: Mon, 25 Oct 2004 09:02:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0178_01C4BABC.E8A9DA00" X-SW-Source: 2004-10/txt/msg00401.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0178_01C4BABC.E8A9DA00 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit Content-length: 1083 This is the second ping. Please review the following patch. Kei Sakamoto From: "Kei Sakamoto" To: Sent: Monday, October 18, 2004 3:43 PM Subject: [RFA/m32r] Unreviewed patch (breakpoint bug) > Hello, > > Would anyone review this patch? > Thank you in advance. > > Kei Sakamoto > > From: "Kei Sakamoto" > To: > Sent: Thursday, October 07, 2004 3:31 PM > Subject: [RFA/m32r] Fix breakpoint bug > > > > Hello, > > > > m32r-tdep.c can't handle breakpoints on instructions executed > > in parallel. It does not remove unnecessary parallel execution > > bit from instructions and causes illegal instruction errors. > > > > The attached patch fixes this problem. > > > > OK to commit? > > > > 2004-10-07 Kei Sakamoto > > > > * m32r-tdep.c (m32r_memory_insert_breakpoint): Remove > > unnecessary parallel execution bit. > > (m32r_memory_remove_breakpoint): Ditto. > > (m32r_breakpoint_from_pc): Update. > > > ------=_NextPart_000_0178_01C4BABC.E8A9DA00 Content-Type: application/octet-stream; name="m32r-tdep.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="m32r-tdep.patch" Content-length: 6139 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.33=0A= diff -u -r1.33 m32r-tdep.c=0A= --- m32r-tdep.c 7 Oct 2004 01:21:53 -0000 1.33=0A= +++ m32r-tdep.c 7 Oct 2004 04:27:00 -0000=0A= @@ -56,62 +56,56 @@=0A= }=0A= =20=0A= =20=0A= -/* BREAKPOINT */=0A= -#define M32R_BE_BREAKPOINT32 {0x10, 0xf1, 0x70, 0x00}=0A= -#define M32R_LE_BREAKPOINT32 {0xf1, 0x10, 0x00, 0x70}=0A= -#define M32R_BE_BREAKPOINT16 {0x10, 0xf1}=0A= -#define M32R_LE_BREAKPOINT16 {0xf1, 0x10}=0A= -=0A= static int=0A= m32r_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)=0A= {=0A= int val;=0A= - unsigned char *bp;=0A= - int bplen;=0A= -=0A= - bplen =3D (addr & 3) ? 2 : 4;=0A= + char buf[4];=0A= + char bp_entry[] =3D { 0x10, 0xf1 }; /* dpt */=0A= =20=0A= /* Save the memory contents. */=0A= - val =3D target_read_memory (addr, contents_cache, bplen);=0A= + val =3D target_read_memory (addr & 0xfffffffc, contents_cache, 4);=0A= if (val !=3D 0)=0A= return val; /* return error */=0A= =20=0A= /* Determine appropriate breakpoint contents and size for this address. = */=0A= if (TARGET_BYTE_ORDER =3D=3D BFD_ENDIAN_BIG)=0A= {=0A= - if (((addr & 3) =3D=3D 0)=0A= - && ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))=0A= + if ((addr & 3) =3D=3D 0)=0A= {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT32;=0A= - bp =3D insn;=0A= - bplen =3D sizeof (insn);=0A= + buf[0] =3D bp_entry[0];=0A= + buf[1] =3D bp_entry[1];=0A= + buf[2] =3D contents_cache[2] & 0x7f;=0A= + buf[3] =3D contents_cache[3];=0A= }=0A= else=0A= {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT16;=0A= - bp =3D insn;=0A= - bplen =3D sizeof (insn);=0A= + buf[0] =3D contents_cache[0];=0A= + buf[1] =3D contents_cache[1];=0A= + buf[2] =3D bp_entry[0];=0A= + buf[3] =3D bp_entry[1];=0A= }=0A= }=0A= - else=0A= - { /* little-endian */=0A= - if (((addr & 3) =3D=3D 0)=0A= - && ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))=0A= - {=0A= - static unsigned char insn[] =3D M32R_LE_BREAKPOINT32;=0A= - bp =3D insn;=0A= - bplen =3D sizeof (insn);=0A= + else /* little-endian */=0A= + {=0A= + if ((addr & 3) =3D=3D 0)=0A= + {=0A= + buf[0] =3D contents_cache[0];=0A= + buf[1] =3D contents_cache[1] & 0x7f;=0A= + buf[2] =3D bp_entry[1];=0A= + buf[3] =3D bp_entry[0];=0A= }=0A= else=0A= {=0A= - static unsigned char insn[] =3D M32R_LE_BREAKPOINT16;=0A= - bp =3D insn;=0A= - bplen =3D sizeof (insn);=0A= + buf[0] =3D bp_entry[1];=0A= + buf[1] =3D bp_entry[0];=0A= + buf[2] =3D contents_cache[2];=0A= + buf[3] =3D contents_cache[3];=0A= }=0A= }=0A= =20=0A= /* Write the breakpoint. */=0A= - val =3D target_write_memory (addr, (char *) bp, bplen);=0A= + val =3D target_write_memory (addr & 0xfffffffc, buf, 4);=0A= return val;=0A= }=0A= =20=0A= @@ -119,47 +113,35 @@=0A= m32r_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)=0A= {=0A= int val;=0A= - int bplen;=0A= + char buf[4];=0A= =20=0A= - /* Determine appropriate breakpoint contents and size for this address. = */=0A= + buf[0] =3D contents_cache[0];=0A= + buf[1] =3D contents_cache[1];=0A= + buf[2] =3D contents_cache[2];=0A= + buf[3] =3D contents_cache[3];=0A= +=0A= + /* Remove parallel bit. */=0A= if (TARGET_BYTE_ORDER =3D=3D BFD_ENDIAN_BIG)=0A= {=0A= - if (((addr & 3) =3D=3D 0)=0A= - && ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))=0A= - {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT32;=0A= - bplen =3D sizeof (insn);=0A= - }=0A= - else=0A= - {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT16;=0A= - bplen =3D sizeof (insn);=0A= - }=0A= + if ((buf[0] & 0x80) =3D=3D 0 && (buf[2] & 0x80) !=3D 0)=0A= + buf[2] &=3D 0x7f;=0A= }=0A= - else=0A= + else /* little-endian */=0A= {=0A= - /* little-endian */=0A= - if (((addr & 3) =3D=3D 0)=0A= - && ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))=0A= - {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT32;=0A= - bplen =3D sizeof (insn);=0A= - }=0A= - else=0A= - {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT16;=0A= - bplen =3D sizeof (insn);=0A= - }=0A= + if ((buf[3] & 0x80) =3D=3D 0 && (buf[1] & 0x80) !=3D 0)=0A= + buf[1] &=3D 0x7f;=0A= }=0A= =20=0A= /* Write contents. */=0A= - val =3D target_write_memory (addr, contents_cache, bplen);=0A= + val =3D target_write_memory (addr & 0xfffffffc, buf, 4);=0A= return val;=0A= }=0A= =20=0A= static const unsigned char *=0A= m32r_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)=0A= {=0A= + static char be_bp_entry[] =3D { 0x10, 0xf1, 0x70, 0x00 }; /* dpt -> nop = */=0A= + static char le_bp_entry[] =3D { 0x00, 0x70, 0xf1, 0x10 }; /* dpt -> nop = */=0A= unsigned char *bp;=0A= =20=0A= /* Determine appropriate breakpoint. */=0A= @@ -167,30 +149,26 @@=0A= {=0A= if ((*pcptr & 3) =3D=3D 0)=0A= {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT32;=0A= - bp =3D insn;=0A= - *lenptr =3D sizeof (insn);=0A= + bp =3D be_bp_entry;=0A= + *lenptr =3D 4;=0A= }=0A= else=0A= {=0A= - static unsigned char insn[] =3D M32R_BE_BREAKPOINT16;=0A= - bp =3D insn;=0A= - *lenptr =3D sizeof (insn);=0A= + bp =3D be_bp_entry;=0A= + *lenptr =3D 2;=0A= }=0A= }=0A= else=0A= {=0A= if ((*pcptr & 3) =3D=3D 0)=0A= {=0A= - static unsigned char insn[] =3D M32R_LE_BREAKPOINT32;=0A= - bp =3D insn;=0A= - *lenptr =3D sizeof (insn);=0A= + bp =3D le_bp_entry;=0A= + *lenptr =3D 4;=0A= }=0A= else=0A= {=0A= - static unsigned char insn[] =3D M32R_LE_BREAKPOINT16;=0A= - bp =3D insn;=0A= - *lenptr =3D sizeof (insn);=0A= + bp =3D le_bp_entry + 2;=0A= + *lenptr =3D 2;=0A= }=0A= }=0A= =20=0A= ------=_NextPart_000_0178_01C4BABC.E8A9DA00--