[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 04/24] gdbstub: use 0 ("any process") on packets with no PID
From: |
Richard Henderson |
Subject: |
[PATCH v9 04/24] gdbstub: use 0 ("any process") on packets with no PID |
Date: |
Fri, 4 Aug 2023 15:00:12 -0700 |
From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
Previously, qemu-user would always report PID 1 to GDB. This was changed
at dc14a7a6e9 (gdbstub: Report the actual qemu-user pid, 2023-06-30),
but read_thread_id() still considers GDB packets with "no PID" as "PID
1", which is not the qemu-user PID. Fix that by parsing "no PID" as "0",
which the GDB Remote Protocol defines as "any process".
Note that this should have no effect for system emulation as, in this
case, gdb_create_default_process() will assign PID 1 for the first
process and that is what the gdbstub uses for GDB requests with no PID,
or PID 0.
This issue was found with hexagon-lldb, which sends a "Hg" packet with
only the thread-id, but no process-id, leading to the invalid usage of
"PID 1" by qemu-hexagon and a subsequent "E22" reply.
Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id:
<78a3b06f6ab90a7ff8e73ae14a996eb27ec76c85.1690904195.git.quic_mathbern@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
gdbstub/gdbstub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index ce8b42eb15..e74ecc78cc 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -537,7 +537,7 @@ static GDBThreadIdKind read_thread_id(const char *buf,
const char **end_buf,
/* Skip '.' */
buf++;
} else {
- p = 1;
+ p = 0;
}
ret = qemu_strtoul(buf, &buf, 16, &t);
--
2.34.1
- [PATCH v9 01/24] accel/tcg: Adjust parameters and locking with do_{ld, st}_mmio_*, (continued)
- [PATCH v9 01/24] accel/tcg: Adjust parameters and locking with do_{ld, st}_mmio_*, Richard Henderson, 2023/08/04
- [PATCH v9 06/24] linux-user: Fix MAP_FIXED_NOREPLACE on old kernels, Richard Henderson, 2023/08/04
- [PATCH v9 10/24] linux-user: Do not align brk with host page size, Richard Henderson, 2023/08/04
- [PATCH v9 15/24] linux-user: Define ELF_ET_DYN_BASE in $guest/target_mman.h, Richard Henderson, 2023/08/04
- [PATCH v9 21/24] linux-user: Do not adjust zero_bss for host page size, Richard Henderson, 2023/08/04
- [PATCH v9 09/24] linux-user: Do nothing if too small brk is specified, Richard Henderson, 2023/08/04
- [PATCH v9 12/24] bsd-user: Remove last_brk, Richard Henderson, 2023/08/04
- [PATCH v9 14/24] linux-user: Define TASK_UNMAPPED_BASE in $guest/target_mman.h, Richard Henderson, 2023/08/04
- [PATCH v9 17/24] linux-user: Use elf_et_dyn_base for ET_DYN with interpreter, Richard Henderson, 2023/08/04
- [PATCH v9 22/24] linux-user: Use zero_bss for PT_LOAD with no file contents too, Richard Henderson, 2023/08/04
- [PATCH v9 04/24] gdbstub: use 0 ("any process") on packets with no PID,
Richard Henderson <=
- [PATCH v9 03/24] accel/tcg: Do not issue misaligned i/o, Richard Henderson, 2023/08/04
- [PATCH v9 11/24] linux-user: Remove last_brk, Richard Henderson, 2023/08/04
- [PATCH v9 05/24] linux-user: Unset MAP_FIXED_NOREPLACE for host, Richard Henderson, 2023/08/04
- [PATCH v9 16/24] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap, Richard Henderson, 2023/08/04
- [PATCH v9 18/24] linux-user: Adjust initial brk when interpreter is close to executable, Richard Henderson, 2023/08/04
- [PATCH v9 20/24] linux-user: Do not adjust image mapping for host page size, Richard Henderson, 2023/08/04
- [PATCH v9 23/24] accel/tcg: Call save_iotlb_data from io_readx as well., Richard Henderson, 2023/08/04
- [PATCH v9 24/24] linux-user/elfload: Set V in ELF_HWCAP for RISC-V, Richard Henderson, 2023/08/04
- Re: [PATCH v9 for-8.1 00/24] linux-user + tcg patch queue, Michael Tokarev, 2023/08/05