47 |
static int gdbserver_fd = -1; |
static int gdbserver_fd = -1; |
48 |
|
|
49 |
typedef struct GDBState { |
typedef struct GDBState { |
50 |
|
CPUState *env; /* current CPU */ |
51 |
enum RSState state; /* parsing state */ |
enum RSState state; /* parsing state */ |
52 |
int fd; |
int fd; |
53 |
char line_buf[4096]; |
char line_buf[4096]; |
577 |
int ret; |
int ret; |
578 |
|
|
579 |
/* disable single step if it was enable */ |
/* disable single step if it was enable */ |
580 |
cpu_single_step(cpu_single_env, 0); |
cpu_single_step(s->env, 0); |
581 |
|
|
582 |
if (reason == EXCP_DEBUG) { |
if (reason == EXCP_DEBUG) { |
583 |
tb_flush(cpu_single_env); |
tb_flush(s->env); |
584 |
ret = SIGTRAP; |
ret = SIGTRAP; |
585 |
} |
} |
586 |
else |
else |
590 |
} |
} |
591 |
#endif |
#endif |
592 |
|
|
593 |
static void gdb_read_byte(GDBState *s, CPUState *env, int ch) |
static void gdb_read_byte(GDBState *s, int ch) |
594 |
{ |
{ |
595 |
|
CPUState *env = s->env; |
596 |
int i, csum; |
int i, csum; |
597 |
char reply[1]; |
char reply[1]; |
598 |
|
|
678 |
int i; |
int i; |
679 |
|
|
680 |
for (i = 0; i < n; i++) |
for (i = 0; i < n; i++) |
681 |
gdb_read_byte (s, env, buf[i]); |
gdb_read_byte (s, buf[i]); |
682 |
} |
} |
683 |
else if (n == 0 || errno != EAGAIN) |
else if (n == 0 || errno != EAGAIN) |
684 |
{ |
{ |
723 |
vm_start(); |
vm_start(); |
724 |
} else { |
} else { |
725 |
for(i = 0; i < size; i++) |
for(i = 0; i < size; i++) |
726 |
gdb_read_byte(s, cpu_single_env, buf[i]); |
gdb_read_byte(s, buf[i]); |
727 |
} |
} |
728 |
} |
} |
729 |
|
|
761 |
return; |
return; |
762 |
} |
} |
763 |
#endif |
#endif |
764 |
|
s->env = first_cpu; /* XXX: allow to change CPU */ |
765 |
s->fd = fd; |
s->fd = fd; |
766 |
|
|
767 |
fcntl(fd, F_SETFL, O_NONBLOCK); |
fcntl(fd, F_SETFL, O_NONBLOCK); |