[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/24] gdbstub: Change GDBState::query_cpu to CPUStat
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 01/24] gdbstub: Change GDBState::query_cpu to CPUState |
Date: |
Tue, 23 Jul 2013 04:53:33 +0200 |
Since first_cpu/next_cpu are CPUState, CPUArchState is no longer needed.
This resolves a NULL pointer dereference of query_cpu, introduced
with commit 182735efaf956ccab50b6d74a4fed163e0f35660 and reported by
TeLeMan and Max Filippov.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
gdbstub.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index 0ee82a9..bdba19b 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -289,7 +289,7 @@ enum RSState {
typedef struct GDBState {
CPUArchState *c_cpu; /* current CPU for step/continue ops */
CPUArchState *g_cpu; /* current CPU for other ops */
- CPUArchState *query_cpu; /* for q{f|s}ThreadInfo */
+ CPUState *query_cpu; /* for q{f|s}ThreadInfo */
enum RSState state; /* parsing state */
char line_buf[MAX_PACKET_LENGTH];
int line_buf_index;
@@ -2401,15 +2401,14 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
put_packet(s, "QC1");
break;
} else if (strcmp(p,"fThreadInfo") == 0) {
- s->query_cpu = first_cpu->env_ptr;
+ s->query_cpu = first_cpu;
goto report_cpuinfo;
} else if (strcmp(p,"sThreadInfo") == 0) {
report_cpuinfo:
if (s->query_cpu) {
- snprintf(buf, sizeof(buf), "m%x",
- cpu_index(ENV_GET_CPU(s->query_cpu)));
+ snprintf(buf, sizeof(buf), "m%x", cpu_index(s->query_cpu));
put_packet(s, buf);
- s->query_cpu = ENV_GET_CPU(s->query_cpu)->next_cpu->env_ptr;
+ s->query_cpu = s->query_cpu->next_cpu;
} else
put_packet(s, "l");
break;
--
1.8.1.4
- [Qemu-devel] [PULL 00/24] QOM CPUState patch queue 2013-07-22, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 05/24] target-m68k: Implement CPUClass::set_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 01/24] gdbstub: Change GDBState::query_cpu to CPUState,
Andreas Färber <=
- [Qemu-devel] [PULL 03/24] HACKING: Document vaddr type usage, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 06/24] target-moxie: Implement CPUClass::set_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 02/24] cpu: Introduce vaddr type, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 07/24] target-unicore32: Implement CPUClass::set_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 04/24] cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 09/24] target-alpha: Copy singlestep_enabled to DisasContext, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 10/24] target-alpha: Copy implver to DisasContext, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 12/24] gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 13/24] cpu: Change cpu_single_step() argument to CPUState, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 08/24] cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb(), Andreas Färber, 2013/07/22