From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDDSQ-0005DF-Bm for qemu-devel@nongnu.org; Sun, 07 Jun 2009 04:10:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDDSL-00054N-JS for qemu-devel@nongnu.org; Sun, 07 Jun 2009 04:10:21 -0400 Received: from [199.232.76.173] (port=54430 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDDSL-00054E-GJ for qemu-devel@nongnu.org; Sun, 07 Jun 2009 04:10:17 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:50694) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDDSK-0004EV-VR for qemu-devel@nongnu.org; Sun, 07 Jun 2009 04:10:17 -0400 Message-ID: <4A2B75DF.2030105@web.de> Date: Sun, 07 Jun 2009 10:10:07 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig038E9A7D94CCEBBC6D90874C" Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH v999] gdbstub: Add vCont support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nathan Froyd Cc: qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig038E9A7D94CCEBBC6D90874C Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Hi Nathan, this is the promised vCont support. Basically my original, stone-old patch, but now rebased to use cpu_find. Still works nicely for me, so maybe you could check if it also does for user-mode. Hopefully, with two use cases then, this gets finally merged. Jan ---------> This patch adds support for the vCont remote gdb command. It is used by gdb 6.8 or better to switch the debugging focus for single-stepping multi-threaded targets, ie. multi-threaded application in user mode emulation or VCPUs in system emulation. Signed-off-by: Jan Kiszka --- gdbstub.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++ 1 files changed, 58 insertions(+), 0 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 9bd4375..74713fd 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1631,6 +1631,64 @@ static int gdb_handle_packet(GDBState *s, const ch= ar *line_buf) s->signal =3D 0; gdb_continue(s); return RS_IDLE; + case 'v': + if (strncmp(p, "Cont", 4) =3D=3D 0) { + int res_signal, res_thread; + + p +=3D 4; + if (*p =3D=3D '?') { + put_packet(s, "vCont;c;C;s;S"); + break; + } + res =3D 0; + res_signal =3D 0; + res_thread =3D 0; + while (*p) { + int action, signal; + + if (*p++ !=3D ';') { + res =3D 0; + break; + } + action =3D *p++; + signal =3D 0; + if (action =3D=3D 'C' || action =3D=3D 'S') { + signal =3D strtoul(p, (char **)&p, 16); + } else if (action !=3D 'c' && action !=3D 's') { + res =3D 0; + break; + } + thread =3D 0; + if (*p =3D=3D ':') { + thread =3D strtoull(p+1, (char **)&p, 16); + } + action =3D tolower(action); + if (res =3D=3D 0 || (res =3D=3D 'c' && action =3D=3D 's'= )) { + res =3D action; + res_signal =3D signal; + res_thread =3D thread; + } + } + if (res) { + if (res_thread !=3D -1 && res_thread !=3D 0) { + env =3D find_cpu(res_thread); + if (env =3D=3D NULL) { + put_packet(s, "E22"); + break; + } + s->c_cpu =3D env; + } + if (res =3D=3D 's') { + cpu_single_step(s->c_cpu, sstep_flags); + } + s->signal =3D res_signal; + gdb_continue(s); + return RS_IDLE; + } + break; + } else { + goto unknown_command; + } case 'k': /* Kill the target */ fprintf(stderr, "\nQEMU: Terminated via GDBstub\n"); --------------enig038E9A7D94CCEBBC6D90874C 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 iEYEARECAAYFAkordeUACgkQniDOoMHTA+lX1gCfXNQ8wsyYMDUc6bnDHyNQRw4c /kIAnA/2YftyNpTMeee53GxiEjpN6Ze0 =LgHN -----END PGP SIGNATURE----- --------------enig038E9A7D94CCEBBC6D90874C--