aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-09 20:50:52 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-09 20:50:52 +0200
commitaa48dd9319dcee78ec17f4d516fb7bfc62b1a4d2 (patch)
tree14384ce116135e45de362cff88b53bc5cc9ad3e4
parent071b3364e7995036816aa4ebf80ecfa04b1a31de (diff)
downloadqemu-aa48dd9319dcee78ec17f4d516fb7bfc62b1a4d2.zip
qemu-aa48dd9319dcee78ec17f4d516fb7bfc62b1a4d2.tar.gz
qemu-aa48dd9319dcee78ec17f4d516fb7bfc62b1a4d2.tar.bz2
Revert "gdbstub: Simplify find_cpu()"
This reverts commit c52a6b67c1d7c6fc9fb2e3ba988d7b978e1487d3, which replaced cpu_index() with cpu_index field, leading to deviation from thread ID for NTPL and off-by-one otherwise. Reported-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--gdbstub.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 3101a43..9ae6576 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2071,13 +2071,17 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc)
static CPUArchState *find_cpu(uint32_t thread_id)
{
+ CPUArchState *env;
CPUState *cpu;
- cpu = qemu_get_cpu(thread_id);
- if (cpu == NULL) {
- return NULL;
+ for (env = first_cpu; env != NULL; env = env->next_cpu) {
+ cpu = ENV_GET_CPU(env);
+ if (cpu_index(cpu) == thread_id) {
+ return env;
+ }
}
- return cpu->env_ptr;
+
+ return NULL;
}
static int gdb_handle_packet(GDBState *s, const char *line_buf)