mirror of
https://github.com/mii443/qemu.git
synced 2025-12-17 01:28:52 +00:00
Revert "gdbstub: Simplify find_cpu()"
This reverts commit c52a6b67c1, 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>
This commit is contained in:
12
gdbstub.c
12
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)
|
static CPUArchState *find_cpu(uint32_t thread_id)
|
||||||
{
|
{
|
||||||
|
CPUArchState *env;
|
||||||
CPUState *cpu;
|
CPUState *cpu;
|
||||||
|
|
||||||
cpu = qemu_get_cpu(thread_id);
|
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
||||||
if (cpu == NULL) {
|
cpu = ENV_GET_CPU(env);
|
||||||
return NULL;
|
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)
|
static int gdb_handle_packet(GDBState *s, const char *line_buf)
|
||||||
|
|||||||
Reference in New Issue
Block a user