From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Sjx-0004qX-8b for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Sjv-0005JT-As for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:17 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49791 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Sjv-0005JA-2W for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:15 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 75086A50E4 for ; Tue, 23 Jul 2013 04:54:14 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 23 Jul 2013 04:53:44 +0200 Message-Id: <1374548036-14471-13-git-send-email-afaerber@suse.de> In-Reply-To: <1374548036-14471-1-git-send-email-afaerber@suse.de> References: <1374548036-14471-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 12/24] gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= In particular reindent to 4 instead of 2 spaces. Prepares for changing cpu_single_step() argument in gdb_handlesig(). Signed-off-by: Andreas F=C3=A4rber --- gdbstub.c | 94 +++++++++++++++++++++++++++++++--------------------------= ------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 55d4756..6ddff91 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2761,66 +2761,66 @@ gdb_queuesig (void) } =20 int -gdb_handlesig (CPUArchState *env, int sig) +gdb_handlesig(CPUArchState *env, int sig) { - GDBState *s; - char buf[256]; - int n; + GDBState *s; + char buf[256]; + int n; =20 - s =3D gdbserver_state; - if (gdbserver_fd < 0 || s->fd < 0) - return sig; + s =3D gdbserver_state; + if (gdbserver_fd < 0 || s->fd < 0) { + return sig; + } =20 - /* disable single step if it was enabled */ - cpu_single_step(env, 0); - tb_flush(env); + /* disable single step if it was enabled */ + cpu_single_step(env, 0); + tb_flush(env); =20 - if (sig !=3D 0) - { - snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb (sig)); - put_packet(s, buf); - } - /* put_packet() might have detected that the peer terminated the=20 - connection. */ - if (s->fd < 0) - return sig; - - sig =3D 0; - s->state =3D RS_IDLE; - s->running_state =3D 0; - while (s->running_state =3D=3D 0) { - n =3D read (s->fd, buf, 256); - if (n > 0) - { - int i; + if (sig !=3D 0) { + snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb(sig)); + put_packet(s, buf); + } + /* put_packet() might have detected that the peer terminated the + connection. */ + if (s->fd < 0) { + return sig; + } =20 - for (i =3D 0; i < n; i++) - gdb_read_byte (s, buf[i]); - } - else if (n =3D=3D 0 || errno !=3D EAGAIN) - { - /* XXX: Connection closed. Should probably wait for another - connection before continuing. */ - return sig; + sig =3D 0; + s->state =3D RS_IDLE; + s->running_state =3D 0; + while (s->running_state =3D=3D 0) { + n =3D read(s->fd, buf, 256); + if (n > 0) { + int i; + + for (i =3D 0; i < n; i++) { + gdb_read_byte(s, buf[i]); + } + } else if (n =3D=3D 0 || errno !=3D EAGAIN) { + /* XXX: Connection closed. Should probably wait for another + connection before continuing. */ + return sig; } - } - sig =3D s->signal; - s->signal =3D 0; - return sig; + } + sig =3D s->signal; + s->signal =3D 0; + return sig; } =20 /* Tell the remote gdb that the process has exited due to SIG. */ void gdb_signalled(CPUArchState *env, int sig) { - GDBState *s; - char buf[4]; + GDBState *s; + char buf[4]; =20 - s =3D gdbserver_state; - if (gdbserver_fd < 0 || s->fd < 0) - return; + s =3D gdbserver_state; + if (gdbserver_fd < 0 || s->fd < 0) { + return; + } =20 - snprintf(buf, sizeof(buf), "X%02x", target_signal_to_gdb (sig)); - put_packet(s, buf); + snprintf(buf, sizeof(buf), "X%02x", target_signal_to_gdb(sig)); + put_packet(s, buf); } =20 static void gdb_accept(void) --=20 1.8.1.4