From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F6F338582AD; Tue, 6 Sep 2022 09:58:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F6F338582AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1662458292; bh=vdJYE3sV3dyvWVSaCFypsQV8E8spDUpW/Nk0QxRvcV8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nBQxpUXf6Cio/Pcfm5XZIP3MqdTBqlhYdiVxWX2/1Hi4ql8QfirPmD7/svpLfdicw yhIrh1njZS6Sy+ZHQXPVoJReCIwxvpOfunSTlxIVpJkUCn4TlQYemutGw3HsQ1SamR uvYJwT7b1Ux0DFV1jGtxIom/5a2xkeHAj3DuzKC4= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/29549] [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception Date: Tue, 06 Sep 2022 09:58:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29549 --- Comment #2 from Tom de Vries --- Tentative patch: ... diff --git a/gdb/unittests/main-thread-selftests.c b/gdb/unittests/main-thread-selftests.c index 7e1a30d7e80..8ab0c445d42 100644 --- a/gdb/unittests/main-thread-selftests.c +++ b/gdb/unittests/main-thread-selftests.c @@ -20,6 +20,7 @@ #include "defs.h" #include "gdbsupport/selftest.h" #include "gdbsupport/block-signals.h" +#include "gdbsupport/scope-exit.h" #include "run-on-main-thread.h" #include "gdbsupport/event-loop.h" #if CXX_STD_THREAD @@ -52,6 +53,11 @@ run_tests () { gdb::block_signals blocker; + SCOPE_EXIT + { + if (thread.joinable ()) + thread.join (); + }; thread =3D std::thread (set_done); } @@ -61,8 +67,6 @@ run_tests () /* Actually the test will just hang, but we want to test something. */ SELF_CHECK (done); - - thread.join (); } #endif ... --=20 You are receiving this mail because: You are on the CC list for the bug.=