From 52243bd9d87757d232d07110eaef08f4a34cd40d Mon Sep 17 00:00:00 2001 From: ALTracer <11005378+ALTracer@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:10:00 +0300 Subject: [PATCH 1/2] gdb_main: Modify halt-responses to report thread p1.1 not 1 (regression since v1.10.0-1548-g 1a9fc96d) * GDB 10 through 12 works fine with T05 but generates bogus inferior 2 with T05thread:1; * This form (T05thread:p1.1;) seems to fix that but it breaks again with run/vKill-packet (even for GDB-13 and newer) --- src/gdb_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gdb_main.c b/src/gdb_main.c index 9ad36976bde..3b117cd68b6 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -674,7 +674,7 @@ static void exec_v_attach(const char *const packet, const size_t length) * https://sourceware.org/pipermail/gdb-patches/2022-April/188058.html * https://sourceware.org/pipermail/gdb-patches/2022-July/190869.html */ - gdb_putpacket_str_f("T%02Xthread:1;", GDB_SIGTRAP); + gdb_putpacket_str_f("T%02Xthread:p1.1;", GDB_SIGTRAP); } else gdb_put_packet_error(1U); @@ -967,16 +967,16 @@ void gdb_poll_target(void) morse("TARGET LOST.", true); break; case TARGET_HALT_REQUEST: - gdb_putpacket_str_f("T%02Xthread:1;", GDB_SIGINT); + gdb_putpacket_str_f("T%02Xthread:p1.1;", GDB_SIGINT); break; case TARGET_HALT_WATCHPOINT: gdb_putpacket_str_f( "T%02Xwatch:%0" PRIX32 "%08" PRIX32 ";", GDB_SIGTRAP, (uint32_t)(watch >> 32U), (uint32_t)watch); break; case TARGET_HALT_FAULT: - gdb_putpacket_str_f("T%02Xthread:1;", GDB_SIGSEGV); + gdb_putpacket_str_f("T%02Xthread:p1.1;", GDB_SIGSEGV); break; default: - gdb_putpacket_str_f("T%02Xthread:1;", GDB_SIGTRAP); + gdb_putpacket_str_f("T%02Xthread:p1.1;", GDB_SIGTRAP); } } From a7c58c9416a072f7a63e8d6ab8de1e76dc6147b5 Mon Sep 17 00:00:00 2001 From: ALTracer <11005378+ALTracer@users.noreply.github.com> Date: Mon, 9 Feb 2026 19:55:23 +0300 Subject: [PATCH 2/2] gdb_main: Modify qC (current thread id) and qfThreadInfo to report multiprocess p1.1 thread name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * This change should match p1.1 in halt-responses, without "QCp1.1" GDB-15 breaks after vKill/vRun. > In addition, the remote protocol supports a multiprocess feature in which the thread-id syntax is extended to optionally include both process and thread ID fields, as ‘ppid.tid’. --- src/gdb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gdb_main.c b/src/gdb_main.c index 3b117cd68b6..3e684e8a85b 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -557,7 +557,7 @@ static void exec_q_c(const char *packet, const size_t length) { (void)packet; (void)length; - gdb_put_packet_str("QC1"); + gdb_put_packet_str("QCp1.1"); } /* @@ -571,7 +571,7 @@ static void exec_q_thread_info(const char *packet, const size_t length) { (void)length; if (packet[-11] == 'f' && cur_target) - gdb_put_packet_str("m1"); + gdb_put_packet_str("mp1.1"); else gdb_put_packet_str("l"); }