public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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	[thread overview]
Message-ID: <bug-29549-4717-Frt9DojqNc@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29549-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29549

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
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 = 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
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-09-06  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  9:13 [Bug gdb/29549] New: " vries at gcc dot gnu.org
2022-09-06  9:14 ` [Bug gdb/29549] " vries at gcc dot gnu.org
2022-09-06  9:58 ` vries at gcc dot gnu.org [this message]
2022-09-06 10:38 ` vries at gcc dot gnu.org
2022-09-12  8:05 ` vries at gcc dot gnu.org
2022-09-12  8:06 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29549-4717-Frt9DojqNc@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).