提交 41625033 编写于 作者: B bellard

removed RS_CONTINUE 'state'


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1389 c046a42c-6fe2-441c-8c8c-71466251a162
上级 6bae7ed8
...@@ -42,17 +42,19 @@ enum RSState { ...@@ -42,17 +42,19 @@ enum RSState {
RS_GETLINE, RS_GETLINE,
RS_CHKSUM1, RS_CHKSUM1,
RS_CHKSUM2, RS_CHKSUM2,
RS_CONTINUE
}; };
/* XXX: This is not thread safe. Do we care? */ /* XXX: This is not thread safe. Do we care? */
static int gdbserver_fd = -1; static int gdbserver_fd = -1;
typedef struct GDBState { typedef struct GDBState {
enum RSState state; enum RSState state; /* parsing state */
int fd; int fd;
char line_buf[4096]; char line_buf[4096];
int line_buf_index; int line_buf_index;
int line_csum; int line_csum;
#ifdef CONFIG_USER_ONLY
int running_state;
#endif
} GDBState; } GDBState;
#ifdef CONFIG_USER_ONLY #ifdef CONFIG_USER_ONLY
...@@ -431,7 +433,12 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) ...@@ -431,7 +433,12 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
env->npc = addr + 4; env->npc = addr + 4;
#endif #endif
} }
return RS_CONTINUE; #ifdef CONFIG_USER_ONLY
s->running_state = 1;
#else
vm_start();
#endif
return RS_IDLE;
case 's': case 's':
if (*p != '\0') { if (*p != '\0') {
addr = strtoul(p, (char **)&p, 16); addr = strtoul(p, (char **)&p, 16);
...@@ -445,7 +452,12 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) ...@@ -445,7 +452,12 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
#endif #endif
} }
cpu_single_step(env, 1); cpu_single_step(env, 1);
return RS_CONTINUE; #ifdef CONFIG_USER_ONLY
s->running_state = 1;
#else
vm_start();
#endif
return RS_IDLE;
case 'g': case 'g':
reg_size = cpu_gdb_read_registers(env, mem_buf); reg_size = cpu_gdb_read_registers(env, mem_buf);
memtohex(buf, mem_buf, reg_size); memtohex(buf, mem_buf, reg_size);
...@@ -556,8 +568,9 @@ static void gdb_read_byte(GDBState *s, CPUState *env, int ch) ...@@ -556,8 +568,9 @@ static void gdb_read_byte(GDBState *s, CPUState *env, int ch)
/* when the CPU is running, we cannot do anything except stop /* when the CPU is running, we cannot do anything except stop
it when receiving a char */ it when receiving a char */
vm_stop(EXCP_INTERRUPT); vm_stop(EXCP_INTERRUPT);
} else { } else
#endif #endif
{
switch(s->state) { switch(s->state) {
case RS_IDLE: case RS_IDLE:
if (ch == '$') { if (ch == '$') {
...@@ -595,16 +608,8 @@ static void gdb_read_byte(GDBState *s, CPUState *env, int ch) ...@@ -595,16 +608,8 @@ static void gdb_read_byte(GDBState *s, CPUState *env, int ch)
s->state = gdb_handle_packet(s, env, s->line_buf); s->state = gdb_handle_packet(s, env, s->line_buf);
} }
break; break;
case RS_CONTINUE:
#ifndef CONFIG_USER_ONLY
vm_start();
s->state = RS_IDLE;
#endif
break;
} }
#ifndef CONFIG_USER_ONLY
} }
#endif
} }
#ifdef CONFIG_USER_ONLY #ifdef CONFIG_USER_ONLY
...@@ -630,11 +635,10 @@ gdb_handlesig (CPUState *env, int sig) ...@@ -630,11 +635,10 @@ gdb_handlesig (CPUState *env, int sig)
put_packet(s, buf); put_packet(s, buf);
} }
/* TODO: How do we terminate this loop? */
sig = 0; sig = 0;
s->state = RS_IDLE; s->state = RS_IDLE;
while (s->state != RS_CONTINUE) 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)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册