internal-error inferior_thread(): Assertion `tp' failed

Luke Dalessandro ldalessandro@gmail.com
Thu Apr 20 16:08:00 GMT 2017


> On Apr 20, 2017, at 11:45 AM, Simon Marchi <simon.marchi@polymtl.ca> wrote:
> 
> On 2017-04-20 10:13, Luke Dalessandro wrote:
>> One of my main uses of gdb is to attach to multithreaded valgrind
>> processes run as `valgrind --vgdb=yes --vgdb-error=0`
>> With recent builds of gdb I have started to encounter this assertion
>> when the valgrind process is creating new threads.
>>    thread.c:89: internal-error: thread_info* inferior_thread():
>> Assertion `tp' failed.
>> I suspect that this has something to do with my environment (I’m
>> configuring and running from a $HOME relative prefix), but the
>> assertion itself doesn’t given me much information to go on, google
>> has been unhelpful, and I’m not aware of any specific changes that
>> I’ve made to my environment.
>> Does anyone have experience with this problem?
>> Thanks,
>> Luke
> 
> Hi Luke,
> 
> This error is quite generic.  It means that the currently selected thread in GDB (identified by a process/thread id) doesn't have a corresponding entry in the GDB thread list.  That's definitely a GDB bug, since it's a state it shouldn't be in.
> 
> If you want to increase the chances of someone looking at the problem, you should provide an easy way to reproduce your problem (small test program, gdb commands used, etc).
> 
> Thanks,
> 
> Simon

Thanks Simon,

To reproduce using two shells:

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

<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=10408
Remote debugging using | /u/ldalessa/.local/modules/valgrind/HEAD/lib/valgrind/../../bin/vgdb --pid=10408
relaying data between gdb and process 10408
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)

If this is really a bug I can just report along with the gdb stack trace via bugzilla. I just wanted to verify that there’s not something obvious on my end that would cause this.

Thanks,
Luke


More information about the Gdb mailing list