gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style

In particular reindent to 4 instead of 2 spaces.

Prepares for changing cpu_single_step() argument in gdb_handlesig().

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-06-24 19:20:57 +02:00
parent ed2803da58
commit 5ca666c765
1 changed files with 47 additions and 47 deletions

View File

@ -2761,44 +2761,43 @@ gdb_queuesig (void)
} }
int int
gdb_handlesig (CPUArchState *env, int sig) gdb_handlesig(CPUArchState *env, int sig)
{ {
GDBState *s; GDBState *s;
char buf[256]; char buf[256];
int n; int n;
s = gdbserver_state; s = gdbserver_state;
if (gdbserver_fd < 0 || s->fd < 0) if (gdbserver_fd < 0 || s->fd < 0) {
return sig; return sig;
}
/* disable single step if it was enabled */ /* disable single step if it was enabled */
cpu_single_step(env, 0); cpu_single_step(env, 0);
tb_flush(env); tb_flush(env);
if (sig != 0) if (sig != 0) {
{ snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb(sig));
snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb (sig));
put_packet(s, buf); put_packet(s, buf);
} }
/* put_packet() might have detected that the peer terminated the /* put_packet() might have detected that the peer terminated the
connection. */ connection. */
if (s->fd < 0) if (s->fd < 0) {
return sig; return sig;
}
sig = 0; sig = 0;
s->state = RS_IDLE; s->state = RS_IDLE;
s->running_state = 0; s->running_state = 0;
while (s->running_state == 0) { while (s->running_state == 0) {
n = read (s->fd, buf, 256); n = read(s->fd, buf, 256);
if (n > 0) if (n > 0) {
{
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++) {
gdb_read_byte (s, buf[i]); gdb_read_byte(s, buf[i]);
} }
else if (n == 0 || errno != EAGAIN) } else if (n == 0 || errno != EAGAIN) {
{
/* XXX: Connection closed. Should probably wait for another /* XXX: Connection closed. Should probably wait for another
connection before continuing. */ connection before continuing. */
return sig; return sig;
@ -2816,10 +2815,11 @@ void gdb_signalled(CPUArchState *env, int sig)
char buf[4]; char buf[4];
s = gdbserver_state; s = gdbserver_state;
if (gdbserver_fd < 0 || s->fd < 0) if (gdbserver_fd < 0 || s->fd < 0) {
return; return;
}
snprintf(buf, sizeof(buf), "X%02x", target_signal_to_gdb (sig)); snprintf(buf, sizeof(buf), "X%02x", target_signal_to_gdb(sig));
put_packet(s, buf); put_packet(s, buf);
} }