From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kUcuDkEh7mptwSkAWB0awg (envelope-from ) for ; Fri, 06 Nov 2026 13:49:37 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uH+XiZQx; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3588C1E043; Fri, 06 Nov 2026 13:49:37 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9C1A01E043 for ; Fri, 06 Nov 2026 13:49:35 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 32B4B4BA2E1B for ; Fri, 6 Nov 2026 18:49:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32B4B4BA2E1B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uH+XiZQx Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 256994BA2E1F for ; Fri, 6 Nov 2026 18:49:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 256994BA2E1F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 256994BA2E1F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793990941; cv=none; b=b7iRcyTSMIJt1FfJdjMBBIFV1le+ptsnHhRqwd8Oq0hgM9ZzSODM+MtX938rYg5EWODMWJF41kAU/pDiNkefuWd7qW90NIpVWPLfaPDwwskY95F8w8k6H5cnwP0jy8+Q5AnVGxRRofdfylt/MdXOfmrVMSujlAft1UruhQhHtbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793990941; c=relaxed/simple; bh=/67aZa8ARS1j/nnCohSoGqISXc60OhWhyfGKnqJEyjY=; h=DKIM-Signature:To:Date:Message-ID:MIME-Version:From:Subject; b=ednss1/+CWLjLJfsYDYp1IGu71Wv13IU621C9ymw4qdamHMmKkNs8fHaUXPlbKzkCk/gFo59ddfUUGrkNM9Tl4qYkIv4OlQHsHyvv+Nq6imfCwtfHirgcCtkrsX2bWnLxFFtDS4XLE4Fei4/dCT4UxvMFgMr+uDebZs0X+pPOs4= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uH+XiZQx DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 256994BA2E1F Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4a5036bbac7so6397965e9.3 for ; Fri, 06 Nov 2026 10:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793990940; x=1794595740; darn=sourceware.org; h=subject:from:content-transfer-encoding:content-type:mime-version :message-id:date:to:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rDN5yJVbJwJXFvfvWh7ScelfGqx4mciwgLTrBhuE30M=; b=uH+XiZQxAM0vIazJG5yjpA80jPCrNLOkuWFOH/5gnk/n9q6WK+UqVqDWaq5q+mpwj4 4C5bh262+jqwAWkscvcRNEqdzTVu07gySBnv5AaRBXnCfqFrj4fh2aF8QyxcT2FVuYIK S2i8XA4IRPfRQD5o1zeRYTEr5NhujxrH49hPVcZopduMtEvaeIS0eQDa1Cgv2Im7pl8S Yl1Rr0Ieewy+WcWi6VMwagZaNX6kLfuuzHPF2i2xpdO1etQww1E6KbJYAPyOV7m/+Kqi VZA4IH7upFZg+oh0F9a0mq8UPaYvwswbJw03SiHCUmx3y7iUF5JG851InMgOH1MCh8KS tA8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793990940; x=1794595740; h=subject:from:content-transfer-encoding:content-type:mime-version :message-id:date:to:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=rDN5yJVbJwJXFvfvWh7ScelfGqx4mciwgLTrBhuE30M=; b=b1NQMTZ2hQrxZtRIrgoyDQjz4hk3EHYshCMK5ApQ81ZsNZMx8OCQs5rjs8mZtUXfP0 USoc1YLfRe39OTP8Z6BEuoZTf/5GmrQilbBIJenlcvAuR5mMoCyBhUoUO7ZlsST02Er8 6FRuYH2JlBq7Bfrm8tvSOHmYWGjkJkMRtgVCcrCTaNu8V9Z49Y0HHpzGw9F45AYqJf/u SwDe2YnwVe/Py2z9mnUdH9hcC7b0Kfl3D/9dHjvJaqNlPfVMqP4w+aw3JZTAnmpX+5A2 zJuDYy/CxgXfkNGzIKm9Wc5yeCE8+hXsJMiL5+VW7Yio3e3y2D2TKqianfoG5FY8b/Rn OW7g== X-Gm-Message-State: APuU4Z8BP2XG7oQcw96DRXWhlTADW6YzgGgIDMXXhOhbfd+jpTWI5JBJ XozLzvrP37ZdPhIuA4ABpDmSChG1N8e/3ZM450JdKpDZlxAARY6lvvXV+cEjOQ== X-Gm-Gg: AYBFou0i931ddbmqL3EoosDCBCf94htwpYGU33uZ20iMMPZkfMLj73VIyT4DKEMfCq+ aZc+La94CR/7x/pBo3UBJfeAO8VnrgBviVPpHm7HCrNk2zrlsJKe2fvIuNomDt1PqDo/bN4dXOV SEtYzFbFOO583Etymp5Mk7g9kANoLVAQCDOwFvsOSHi1qt7l2iKsp9i9VQfbqLkomUONRM0OS1/ E0Z3SB3VHtaKxEk54FFPZU04c9JvPqMqp8bw/Nt2G7eUW4+dogxwZ0wNT4rQMkcpQoA7zmi6Gl5 fSMjt0t4XvDJO+wl2ncRNvlZQZ1Z6TV418t2wbjV/f/PzcdAJy9X9zpr3Rhe46Y+HP6eyqrHFVZ U5dQAOmAShwKBlYB7AdoD5EzjYRres8vb9eSUS5z58OuxhLJ8K+7K0hw8q4eIUSt9u2HuNjpliH Bl712hMNkr9GCwsfw5guVrqCJPFrG4TWBZG27NZvbTcQ1itV1ZFXwcZ/7NpYqcmoOx3dfO/ozYW y7D/jEei6+cy3jgbxX/GK4ijL4Vs+LtiyNChhFjUOubq/OSQW+DG78CyqhNrQW4OK9IOlYp4tx4 hKerIXlZf4xxphBJVEODrM05osE+i29BtrLEiaxKnDOxOrcgeVdh X-Received: by 2002:a05:600c:3f08:b0:4a1:d97e:cd60 with SMTP id 5b1f17b1804b1-4b6df21303fmr55682355e9.16.1793990939916; Fri, 06 Nov 2026 10:48:59 -0800 (PST) Received: from [127.0.1.1] ([212.23.215.93]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-492d72333f9sm5120664f8f.29.2026.11.06.10.48.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 10:48:59 -0800 (PST) To: gdb-patches@sourceware.org Date: Fri, 06 Nov 2026 18:48:48 +0000 Message-ID: <179399092827.2913928.12619639377821397955@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Josip Seketa Subject: [PATCH] gdb: do not hide a lost connection in print_stack_frame X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org print_stack_frame catches every error. If the remote connection is lost while it reads the frame, the catch also swallows the TARGET_CLOSE_ERROR. The target is gone by then, so do_print_stop_event goes on to call inferior_thread, which fails its assertion: thread.c:91: internal-error: inferior_thread: Assertion `current_thread_ != nullptr' failed. This happens when a stub dies between sending a stop reply and answering the memory read that prints the stop. Rethrow TARGET_CLOSE_ERROR, as the error handling in printcmd.c does, so that the error reaches the user. --- Found with a stub that dies between a stop reply and the memory read that prints the stop. Before: rc 134 with the assertion. After: Program received signal SIGTRAP, Trace/breakpoint trap. Remote connection closed with target-async on and off, and in MI. The randomized stub I used hit this in 5 of 300 runs before the patch, and in none after. Tested on x86-64 GNU/Linux, with my other pipe patches: gdb.base, gdb.server, gdb.threads, gdb.mi, gdb.multi and gdb.python on native-stdio-gdbserver, native-gdbserver and native-extended-gdbserver, compared with master test by test. There is no testcase here yet. I have no FSF copyright assignment. gdb/stack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdb/stack.c b/gdb/stack.c index f075db20c..cd6b1de5d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -407,6 +407,9 @@ print_stack_frame (const frame_info_ptr &frame, int print_level, } catch (const gdb_exception_error &e) { + /* The connection is gone: do not hide that from the caller. */ + if (e.error == TARGET_CLOSE_ERROR) + throw; } } -- 2.56.0