[Bug gdb/21405] New: thread.c:100: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.

ldalessandro at gmail dot com sourceware-bugzilla@sourceware.org
Thu Apr 20 17:07:00 GMT 2017


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

            Bug ID: 21405
           Summary: thread.c:100: internal-error: thread_info*
                    inferior_thread(): Assertion `tp' failed.
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Created attachment 10001
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10001&action=edit
test case

I'm running into the assertion at:

thread.c:100: internal-error: thread_info* inferior_thread(): Assertion `tp'
failed.

I'm using:
1. gcc-6.3
2. valgrind-svn (r16308)
3. gdb-8.0.50.20170420-git

To reproduce:
1. compile the attached testcase
2. run under valgrind with --vgdb-error=0
3. (in a different shell) launch gdb
4. attach to valgrind as a remote target
5. continue

Trace:

<shell 1>
$ cat hello.cpp 
#include <iostream>
#include <thread>
using namespace std;
int main() {
  thread([](){ cout << "hello world\n"; }).join();
  return 0;
}

$ g++ -pthread -o hello hello.cpp 

$ ./hello 
hello world

$ valgrind --vgdb-error=0 ./hello
==22111== Memcheck, a memory error detector
==22111== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==22111== Using Valgrind-3.13.0.SVN and LibVEX; rerun with -h for copyright
info
==22111== Command: ./hello
==22111== 
==22111== (action at startup) vgdb me ... 
==22111== 
==22111== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==22111==   /path/to/gdb ./hello
==22111== and then give GDB the following command
==22111==   target remote |
/u/ldalessa/.local/modules/valgrind/HEAD/lib/valgrind/../../bin/vgdb
--pid=22111
==22111== --pid is optional if only one valgrind process is running
==22111== 

<shell 2>

$ gdb ./hello 
GNU gdb (GDB) 8.0.50.20170420-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./hello...(no debugging symbols found)...done.
(gdb) target remote |
/u/ldalessa/.local/modules/valgrind/HEAD/lib/valgrind/../../bin/vgdb
--pid=22111
Remote debugging using |
/u/ldalessa/.local/modules/valgrind/HEAD/lib/valgrind/../../bin/vgdb
--pid=22111
relaying data between gdb and process 22111
warning: remote target does not support file transfer, attempting to access
files from local filesystem.
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from
/usr/lib/debug//lib/x86_64-linux-gnu/ld-2.19.so...done.
done.
0x00000000040012d0 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) c
Continuing.
thread.c:100: internal-error: thread_info* inferior_thread(): Assertion `tp'
failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

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

thread.c:100: internal-error: thread_info* inferior_thread(): Assertion `tp'
failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Aborted (core dumped)

GDB backtrace:
$ gdb `which gdb` core
GNU gdb (GDB) 8.0.50.20170420-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /u/ldalessa/.local/binutils/git/bin/gdb...done.
[New LWP 9856]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `gdb ./hello'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007f1022398c37 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007f1022398c37 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007f102239c028 in __GI_abort () at abort.c:89
#2  0x000000000067b726 in dump_core () at utils.c:465
#3  0x000000000067da88 in internal_vproblem(internal_problem *, const char *,
int, const char *, typedef __va_list_tag __va_list_tag *)
(problem=problem@entry=0xd21160 <internal_error_problem>, file=<optimized out>, 
    line=<optimized out>, fmt=<optimized out>, ap=ap@entry=0x7fff1fd87608) at
utils.c:676
#4  0x000000000067db49 in internal_verror (file=<optimized out>,
line=<optimized out>, fmt=<optimized out>, ap=ap@entry=0x7fff1fd87608) at
utils.c:702
#5  0x000000000059ab52 in internal_error (file=file@entry=0x8db4f7 "thread.c",
line=line@entry=100, fmt=<optimized out>) at common/errors.c:55
#6  0x0000000000670415 in inferior_thread () at thread.c:100
#7  0x00000000004aed4c in tui_on_normal_stop (bs=<optimized out>,
print_frame=<optimized out>) at tui/tui-interp.c:97
#8  0x0000000000609415 in generic_observer_notify (args=0x7fff1fd87720,
subject=<optimized out>) at observer.c:167
#9  observer_notify_normal_stop (bs=bs@entry=0x0, print_frame=<optimized out>)
at observer.inc:61
#10 0x00000000005da1dd in normal_stop () at infrun.c:8373
#11 0x000000000054ab96 in do_my_cleanups (pmy_chain=pmy_chain@entry=0xd1fc80
<cleanup_chain>, old_chain=0x874380 <sentinel_cleanup>) at
common/cleanups.c:154
#12 0x000000000054ad1d in do_cleanups (old_chain=<optimized out>) at
common/cleanups.c:176
#13 0x000000000054ffae in throw_exception_cxx (exception=...) at
common/common-exceptions.c:289
#14 0x0000000000550094 in throw_exception (exception=...) at
common/common-exceptions.c:317
#15 throw_it(return_reason, errors, const char *, typedef __va_list_tag
__va_list_tag *) (reason=reason@entry=RETURN_ERROR, error=<optimized out>,
fmt=<optimized out>, ap=ap@entry=0x7fff1fd87848) at
common/common-exceptions.c:373
#16 0x00000000005502c6 in throw_verror (error=<optimized out>, fmt=<optimized
out>, ap=ap@entry=0x7fff1fd87848) at common/common-exceptions.c:379
#17 0x0000000000550377 in throw_error (error=error@entry=TARGET_CLOSE_ERROR,
fmt=<optimized out>) at common/common-exceptions.c:394
#18 0x0000000000474a33 in readchar (timeout=<optimized out>) at remote.c:8614
#19 0x000000000047544f in getpkt_or_notif_sane_1 (buf=buf@entry=0x19b6040,
sizeof_buf=sizeof_buf@entry=0x19b6048, forever=forever@entry=0,
expecting_notif=expecting_notif@entry=0, is_notif=is_notif@entry=0x0) at
remote.c:9157
#20 0x000000000047e950 in getpkt_sane (forever=0, sizeof_buf=0x19b6048,
buf=0x19b6040) at remote.c:9259
#21 getpkt (forever=0, sizeof_buf=0x19b6048, buf=0x19b6040) at remote.c:9097
#22 remote_pass_signals (numsigs=<optimized out>, pass_signals=0x19feaf0 "",
self=<optimized out>) at remote.c:2036
#23 0x00000000005d61af in do_target_resume (resume_ptid=..., step=0,
sig=GDB_SIGNAL_0) at infrun.c:2369
#24 0x00000000005db87a in resume (sig=GDB_SIGNAL_0) at infrun.c:2760
#25 0x00000000005dc7e3 in keep_going_pass_signal (ecs=ecs@entry=0x7fff1fd87c30)
at infrun.c:7829
#26 0x00000000005dd29b in proceed (addr=<optimized out>, siggnal=<optimized
out>) at infrun.c:3196
#27 0x00000000005d27f7 in continue_command (args=<optimized out>, from_tty=1)
at infcmd.c:862
#28 0x00000000004986b9 in cmd_func (cmd=<optimized out>, args=<optimized out>,
from_tty=<optimized out>) at cli/cli-decode.c:1887
#29 0x0000000000676003 in execute_command (p=<optimized out>, p@entry=0x1bb1b30
"c", from_tty=1) at top.c:674
#30 0x00000000005a2ecc in command_handler (command=0x1bb1b30 "c") at
event-top.c:590
#31 0x00000000005a3198 in command_line_handler (rl=<optimized out>) at
event-top.c:780
#32 0x00000000005a250c in gdb_rl_callback_handler (rl=0x1af9620 "") at
event-top.c:213
#33 0x00000000006b7333 in rl_callback_read_char () at callback.c:220
#34 0x00000000005a244e in gdb_rl_callback_read_char_wrapper_noexcept () at
event-top.c:175
#35 0x00000000005a24b9 in gdb_rl_callback_read_char_wrapper
(client_data=<optimized out>) at event-top.c:192
#36 0x00000000005a29e0 in stdin_event_handler (error=<optimized out>,
client_data=0x1920c30) at event-top.c:518
#37 0x00000000005a185d in gdb_wait_for_event (block=block@entry=1) at
event-loop.c:859
#38 0x00000000005a19c4 in gdb_do_one_event () at event-loop.c:347
#39 0x00000000005a1b35 in gdb_do_one_event () at
./common/common-exceptions.h:221
#40 start_event_loop () at event-loop.c:371
#41 0x00000000005f4d88 in captured_command_loop (data=data@entry=0x0) at
main.c:325
#42 0x00000000005a3aa3 in catch_errors (func=func@entry=0x5f4d60
<captured_command_loop(void*)>, func_args=func_args@entry=0x0,
errstring=errstring@entry=0x8200e2 "", mask=mask@entry=RETURN_MASK_ALL) at
exceptions.c:236
#43 0x00000000005f5cb6 in captured_main (data=0x7fff1fd88000) at main.c:1150
#44 gdb_main (args=args@entry=0x7fff1fd88130) at main.c:1160
#45 0x000000000040e305 in main (argc=<optimized out>, argv=<optimized out>) at
gdb.c:32
(gdb) 

ref: https://sourceware.org/ml/gdb/2017-04/msg00028.html
ref: https://sourceware.org/bugzilla/show_bug.cgi?id=11362

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


More information about the Gdb-prs mailing list