Summary: | [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception | ||
---|---|---|---|
Product: | gdb | Reporter: | Tom de Vries <vries> |
Component: | gdb | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | 13.1 | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Tom de Vries
2022-09-06 09:13:32 UTC
From the core file we get a bit more specific backtrace: ... #0 raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00000000007606a6 in handle_fatal_signal (sig=6) at /home/vries/gdb_versions/devel/src/gdb/event-top.c:971 #2 <signal handler called> #3 __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #4 0x00007f2dbd731375 in __GI_abort () at abort.c:79 #5 0x00007f2dbdd97fc6 in ?? () from /usr/lib64/libstdc++.so.6 #6 0x00007f2dbdda383c in ?? () from /usr/lib64/libstdc++.so.6 #7 0x00007f2dbdda38a7 in std::terminate() () from /usr/lib64/libstdc++.so.6 #8 0x0000000000c394df in std::thread::~thread (this=0x7ffe5ffacb80, __in_chrg=<optimized out>) at /usr/include/c++/7/thread:135 #9 0x0000000000c39119 in selftests::main_thread_tests::run_tests () at /home/vries/gdb_versions/devel/src/gdb/unittests/main-thread-selftests.c:48 #10 0x000000000041be05 in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/7/bits/std_function.h:316 #11 0x00000000005f8096 in std::function<void ()>::operator()() const (this=0x3fadf90) at /usr/include/c++/7/bits/std_function.h:706 #12 0x00000000013bc143 in selftests::run_tests (filters=..., verbose=false) at /home/vries/gdb_versions/devel/src/gdbsupport/selftest.cc:100 #13 0x00000000008b0f97 in maintenance_selftest (args=0x7ffe5ffae141 "run_on_main_thread", ... 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 ... |