From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LoJx6-0006I4-JY for qemu-devel@nongnu.org; Mon, 30 Mar 2009 12:03:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LoJx1-0006Ct-7U for qemu-devel@nongnu.org; Mon, 30 Mar 2009 12:03:07 -0400 Received: from [199.232.76.173] (port=34645 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LoJx1-0006Ck-24 for qemu-devel@nongnu.org; Mon, 30 Mar 2009 12:03:03 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:47234) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LoJx0-0005gx-8F for qemu-devel@nongnu.org; Mon, 30 Mar 2009 12:03:02 -0400 Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id B4FE8FC416E5 for ; Mon, 30 Mar 2009 18:02:59 +0200 (CEST) Received: from [82.82.218.64] (helo=[192.168.2.102]) by smtp07.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #277) id 1LoJwx-0004Wm-00 for qemu-devel@nongnu.org; Mon, 30 Mar 2009 18:02:59 +0200 Message-ID: <49D0ED2A.3020709@web.de> Date: Mon, 30 Mar 2009 18:02:50 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1238268672-6686-1-git-send-email-froydnj@codesourcery.com> In-Reply-To: <1238268672-6686-1-git-send-email-froydnj@codesourcery.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig01A9F6280BE4D58A72CFDF64" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH] factor out setting pc in gdbstub Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig01A9F6280BE4D58A72CFDF64 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Nathan Froyd wrote: > The code for handling the c and s packets both contain code for setting= > the pc. Move that code out to a common function. >=20 > Signed-off-by: Nathan Froyd Yep, that makes it better. Acked-by: Jan Kiszka > --- > gdbstub.c | 63 ++++++++++++++++++++++++-----------------------------= ------- > 1 files changed, 25 insertions(+), 38 deletions(-) >=20 > diff --git a/gdbstub.c b/gdbstub.c > index 518c939..f6d2f1b 100644 > --- a/gdbstub.c > +++ b/gdbstub.c > @@ -1512,6 +1512,29 @@ static void gdb_breakpoint_remove_all(void) > } > } > =20 > +static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) > +{ > +#if defined(TARGET_I386) > + s->c_cpu->eip =3D pc; > + cpu_synchronize_state(s->c_cpu, 1); > +#elif defined (TARGET_PPC) > + s->c_cpu->nip =3D pc; > +#elif defined (TARGET_SPARC) > + s->c_cpu->pc =3D pc; > + s->c_cpu->npc =3D pc + 4; > +#elif defined (TARGET_ARM) > + s->c_cpu->regs[15] =3D pc; > +#elif defined (TARGET_SH4) > + s->c_cpu->pc =3D pc; > +#elif defined (TARGET_MIPS) > + s->c_cpu->active_tc.PC =3D pc; > +#elif defined (TARGET_CRIS) > + s->c_cpu->pc =3D pc; > +#elif defined (TARGET_ALPHA) > + s->c_cpu->pc =3D pc; > +#endif > +} > + > static int gdb_handle_packet(GDBState *s, const char *line_buf) > { > CPUState *env; > @@ -1542,25 +1565,7 @@ static int gdb_handle_packet(GDBState *s, const = char *line_buf) > case 'c': > if (*p !=3D '\0') { > addr =3D strtoull(p, (char **)&p, 16); > -#if defined(TARGET_I386) > - s->c_cpu->eip =3D addr; > - cpu_synchronize_state(s->c_cpu, 1); > -#elif defined (TARGET_PPC) > - s->c_cpu->nip =3D addr; > -#elif defined (TARGET_SPARC) > - s->c_cpu->pc =3D addr; > - s->c_cpu->npc =3D addr + 4; > -#elif defined (TARGET_ARM) > - s->c_cpu->regs[15] =3D addr; > -#elif defined (TARGET_SH4) > - s->c_cpu->pc =3D addr; > -#elif defined (TARGET_MIPS) > - s->c_cpu->active_tc.PC =3D addr; > -#elif defined (TARGET_CRIS) > - s->c_cpu->pc =3D addr; > -#elif defined (TARGET_ALPHA) > - s->c_cpu->pc =3D addr; > -#endif > + gdb_set_cpu_pc(s, addr); > } > s->signal =3D 0; > gdb_continue(s); > @@ -1584,25 +1589,7 @@ static int gdb_handle_packet(GDBState *s, const = char *line_buf) > case 's': > if (*p !=3D '\0') { > addr =3D strtoull(p, (char **)&p, 16); > -#if defined(TARGET_I386) > - s->c_cpu->eip =3D addr; > - cpu_synchronize_state(s->c_cpu, 1); > -#elif defined (TARGET_PPC) > - s->c_cpu->nip =3D addr; > -#elif defined (TARGET_SPARC) > - s->c_cpu->pc =3D addr; > - s->c_cpu->npc =3D addr + 4; > -#elif defined (TARGET_ARM) > - s->c_cpu->regs[15] =3D addr; > -#elif defined (TARGET_SH4) > - s->c_cpu->pc =3D addr; > -#elif defined (TARGET_MIPS) > - s->c_cpu->active_tc.PC =3D addr; > -#elif defined (TARGET_CRIS) > - s->c_cpu->pc =3D addr; > -#elif defined (TARGET_ALPHA) > - s->c_cpu->pc =3D addr; > -#endif > + gdb_set_cpu_pc(s, addr); > } > cpu_single_step(s->c_cpu, sstep_flags); > gdb_continue(s); --------------enig01A9F6280BE4D58A72CFDF64 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAknQ7TEACgkQniDOoMHTA+nyBgCeILXzETtY6E6YGhd1x8Y8/d7F VTcAnR3J079xRKRVrjoR6+mvd5Be3YV+ =HJV0 -----END PGP SIGNATURE----- --------------enig01A9F6280BE4D58A72CFDF64--