public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/27682] New: Continue event in Python delivered after thread dies
@ 2021-04-01 13:51 enedil at outlook dot com
  2021-04-01 13:52 ` [Bug python/27682] Continue event in Python delivered after thread dies: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed enedil at outlook dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: enedil at outlook dot com @ 2021-04-01 13:51 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 27682
           Summary: Continue event in Python delivered after thread dies
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: enedil at outlook dot com
  Target Milestone: ---

I have this C++ (this is C++, not C) code:

#include <pthread.h>
#include <stdlib.h>
#include <signal.h>
#include <stdint.h>

void* foo(void* ptr) {
    return NULL;
}

int main() {
    pthread_t th;
    pthread_create(&th, NULL, foo, NULL);
    pthread_kill(pthread_self(), SIGSEGV);
    pthread_join(th, NULL);
}


This is what happens:
/tmp $ /tmp/gdb/bin/gdb -q -n -ex 'pi gdb.events.cont.connect(lambda ev:
gdb.parse_and_eval("2137"))' -ex 'run' ./test
Reading symbols from ./test...
Starting program: /tmp/test 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff7dae640 (LWP 426580)]
thread.c:72: internal-error: thread_info* inferior_thread(): Assertion
`current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)



I compile it in either of these ways:
    gcc -x c++ testcase.cc -g -pthread -o test
    g++ testcase.cc -g -pthread -o test
    clang++ testcase.cc -g -pthread -o test
These however don't trigger the bug:
    gcc -x c testcase.cc -g -pthread -o test
    gcc -x c++ testcase.cc -pthread -o test
    clang -x c testcase.cc -g -pthread -o test

My environment: fully upgraded Fedora 33 Desktop (amd64), with GDB just taken
from master branch (GNU gdb (GDB) 11.0.50.20210331-git) 
Compilers: 
    gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)
    clang version 11.0.0 (Fedora 11.0.0-2.fc33)

Bug was confirmed on default configuration of Arch Linux.


It should be noted, that if I use GNU gdb (GDB) Fedora 10.1-4.fc33, the doesn't
show up just after `run`, but if I make a `break main`, and later issue
`continue`, it appears once again.

Possibly connected bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22474

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

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

* [Bug python/27682] Continue event in Python delivered after thread dies: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed.
  2021-04-01 13:51 [Bug python/27682] New: Continue event in Python delivered after thread dies enedil at outlook dot com
@ 2021-04-01 13:52 ` enedil at outlook dot com
  2021-04-01 13:52 ` enedil at outlook dot com
  2021-09-16  1:11 ` parke.nexus at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: enedil at outlook dot com @ 2021-04-01 13:52 UTC (permalink / raw)
  To: gdb-prs

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

Michał Radwański <enedil at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Continue event in Python    |Continue event in Python
                   |delivered after thread dies |delivered after thread
                   |                            |dies: internal-error:
                   |                            |thread_info*
                   |                            |inferior_thread():
                   |                            |Assertion `current_thread_
                   |                            |!= nullptr' failed.

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

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

* [Bug python/27682] Continue event in Python delivered after thread dies: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed.
  2021-04-01 13:51 [Bug python/27682] New: Continue event in Python delivered after thread dies enedil at outlook dot com
  2021-04-01 13:52 ` [Bug python/27682] Continue event in Python delivered after thread dies: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed enedil at outlook dot com
@ 2021-04-01 13:52 ` enedil at outlook dot com
  2021-09-16  1:11 ` parke.nexus at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: enedil at outlook dot com @ 2021-04-01 13:52 UTC (permalink / raw)
  To: gdb-prs

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

Michał Radwański <enedil at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |enedil at outlook dot com

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

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

* [Bug python/27682] Continue event in Python delivered after thread dies: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed.
  2021-04-01 13:51 [Bug python/27682] New: Continue event in Python delivered after thread dies enedil at outlook dot com
  2021-04-01 13:52 ` [Bug python/27682] Continue event in Python delivered after thread dies: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed enedil at outlook dot com
  2021-04-01 13:52 ` enedil at outlook dot com
@ 2021-09-16  1:11 ` parke.nexus at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: parke.nexus at gmail dot com @ 2021-09-16  1:11 UTC (permalink / raw)
  To: gdb-prs

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

Parke <parke.nexus at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |parke.nexus at gmail dot com

--- Comment #1 from Parke <parke.nexus at gmail dot com> ---
I encounter a similar bug.  Easy to reproduce.

On Arch Linux:

$  gdb  --version
GNU gdb (GDB) 10.2
[snip]

$  gdb  -q -ex run /bin/true
Reading symbols from /bin/true...
(No debugging symbols found in /bin/true)
Starting program: /usr/bin/true 
[Inferior 1 (process 339) exited normally]
../../gdb/thread.c:95: internal-error: thread_info* inferior_thread():
Assertion `current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

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

Aborted (core dumped)

$  cat  ~/.gdbinit
define  hook-quit
  set  confirm  off
end

python

def  exit_handler  ( event ):
  if  hasattr ( event, 'exit_code' )  and  event .exit_code == 0:
    gdb .execute ( "quit" )

gdb .events .exited .connect ( exit_handler )

end


----

I encounter a similar bug on Ubuntu 20.04.

$  gdb --version
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
[snip]

$  gdb  -q  -ex run /bin/true
Reading symbols from /bin/true...
(No debugging symbols found in /bin/true)
Starting program: /usr/bin/true 
[Inferior 1 (process 4134946) exited normally]
/build/gdb-OxeNvS/gdb-9.2/gdb/inferior.c:283: internal-error: inferior*
find_inferior_pid(int): Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

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

Aborted (core dumped)

Possibly related:
https://sourceware.org/bugzilla/show_bug.cgi?id=26761

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

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

end of thread, other threads:[~2021-09-16  1:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 13:51 [Bug python/27682] New: Continue event in Python delivered after thread dies enedil at outlook dot com
2021-04-01 13:52 ` [Bug python/27682] Continue event in Python delivered after thread dies: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed enedil at outlook dot com
2021-04-01 13:52 ` enedil at outlook dot com
2021-09-16  1:11 ` parke.nexus at gmail dot com

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