public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29549] New: [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception
@ 2022-09-06  9:13 vries at gcc dot gnu.org
  2022-09-06  9:14 ` [Bug gdb/29549] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-06  9:13 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29549
           Summary: [gdb/selftest] selftest run_on_main_thread + ^C:
                    terminate called without an active exception
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ With gdb build from trunk of today, and with gdb-patches patch "[PATCH,v2]
[Arm] Fix endianness handling for arm record self tests" applied, which I
assume is unrelated. ]

I ran the selftests like this:
...
$ ./gdb.sh -q -batch -ex "maint selftest" | grep -i arm
...
and pressed ^C a few times.

This gave me:
...
Running selftest run_on_main_thread.
terminate called without an active exception

Fatal signal: Aborted
----- Backtrace -----
0x580e38 gdb_internal_backtrace_1
        /home/vries/gdb_versions/devel/src/gdb/bt-utils.c:122
0x580edb _Z22gdb_internal_backtracev
        /home/vries/gdb_versions/devel/src/gdb/bt-utils.c:168
0x7605c1 handle_fatal_signal
        /home/vries/gdb_versions/devel/src/gdb/event-top.c:948
0x7fc538f76d6f ???
       
/usr/src/debug/glibc-2.31-150300.37.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7fc538f76cdb __GI_raise
        ../sysdeps/unix/sysv/linux/raise.c:51
0x7fc538f78374 __GI_abort
        /usr/src/debug/glibc-2.31-150300.37.1.x86_64/stdlib/abort.c:79
0x7fc5395defc5 ???
0x7fc5395ea83b ???
0x7fc5395ea8a6 ???
0xc394de _ZNSt6threadD2Ev
        /usr/include/c++/7/thread:135
0xc39118 run_tests
       
/home/vries/gdb_versions/devel/src/gdb/unittests/main-thread-selftests.c:48
0x41be04 _ZNSt17_Function_handlerIFvvEPS0_E9_M_invokeERKSt9_Any_data
        /usr/include/c++/7/bits/std_function.h:316
0x5f8095 _ZNKSt8functionIFvvEEclEv
        /usr/include/c++/7/bits/std_function.h:706
0x13bc142 _ZN9selftests9run_testsEN3gdb10array_viewIKPKcEEb
        /home/vries/gdb_versions/devel/src/gdbsupport/selftest.cc:100
0x8b0f96 maintenance_selftest
        /home/vries/gdb_versions/devel/src/gdb/maint.c:1164
0x5d7b83 do_simple_func
        /home/vries/gdb_versions/devel/src/gdb/cli/cli-decode.c:95
0x5dc933 _Z8cmd_funcP16cmd_list_elementPKci
        /home/vries/gdb_versions/devel/src/gdb/cli/cli-decode.c:2543
0xbc678d _Z15execute_commandPKci
        /home/vries/gdb_versions/devel/src/gdb/top.c:692
0x8a6748 catch_command_errors
        /home/vries/gdb_versions/devel/src/gdb/main.c:513
0x8a6920 execute_cmdargs
        /home/vries/gdb_versions/devel/src/gdb/main.c:608
0x8a7cb0 captured_main_1
        /home/vries/gdb_versions/devel/src/gdb/main.c:1299
0x8a7eb3 captured_main
        /home/vries/gdb_versions/devel/src/gdb/main.c:1320
0x8a7f1e _Z8gdb_mainP18captured_main_args
        /home/vries/gdb_versions/devel/src/gdb/main.c:1345
0x41506d main
        /home/vries/gdb_versions/devel/src/gdb/gdb.c:32
---------------------
A fatal error internal to GDB has been detected, further
debugging is not possible.  GDB will now terminate.

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.

./gdb.sh: line 35:  6508 Aborted                 (core dumped) $DBG $GDB -nw
-iex "add-auto-load-safe-path
/home/vries/gdb_versions/devel/build/gdb/gdb-gdb.gdb" -iex
"add-auto-load-safe-path /home/vries/gdb_versions/devel/build/gdb/gdb-gdb.py"
"${flags[@]}" "$@"
...

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/29549] [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception
  2022-09-06  9:13 [Bug gdb/29549] New: [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception vries at gcc dot gnu.org
@ 2022-09-06  9:14 ` vries at gcc dot gnu.org
  2022-09-06  9:58 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-06  9:14 UTC (permalink / raw)
  To: gdb-prs

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

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/29549] [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception
  2022-09-06  9:13 [Bug gdb/29549] New: [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception 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
  2022-09-06 10:38 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-06  9:58 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/29549] [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception
  2022-09-06  9:13 [Bug gdb/29549] New: [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception 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
@ 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
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-06 10:38 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-September/191703.html

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/29549] [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception
  2022-09-06  9:13 [Bug gdb/29549] New: [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-12  8:05 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3d36a6396fbfacd7b1941527d84ff6c0f40ff121

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/29549] [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception
  2022-09-06  9:13 [Bug gdb/29549] New: [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-09-12  8:05 ` vries at gcc dot gnu.org
@ 2022-09-12  8:06 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-12  8:06 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.1

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-12  8:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06  9:13 [Bug gdb/29549] New: [gdb/selftest] selftest run_on_main_thread + ^C: terminate called without an active exception 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
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

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).