diff options
author | Andreas Färber <afaerber@suse.de> | 2013-05-17 17:49:10 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-06-28 13:25:12 +0200 |
commit | c52a6b67c1d7c6fc9fb2e3ba988d7b978e1487d3 (patch) | |
tree | d73512c08a972a82635b9fca1c4a6241a33d4335 /gdbstub.c | |
parent | 8d0f2baebe57ccdb09a21da80b2994b772854ad6 (diff) |
gdbstub: Simplify find_cpu()
Use qemu_get_cpu() and CPUState::env_ptr.
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'gdbstub.c')
-rw-r--r-- | gdbstub.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -2071,17 +2071,13 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) static CPUArchState *find_cpu(uint32_t thread_id) { - CPUArchState *env; CPUState *cpu; - for (env = first_cpu; env != NULL; env = env->next_cpu) { - cpu = ENV_GET_CPU(env); - if (cpu_index(cpu) == thread_id) { - return env; - } + cpu = qemu_get_cpu(thread_id); + if (cpu == NULL) { + return NULL; } - - return NULL; + return cpu->env_ptr; } static int gdb_handle_packet(GDBState *s, const char *line_buf) |