Bug 17207 - internal error on "c -a &": Assertion `lp != NULL' failed.
Summary: internal error on "c -a &": Assertion `lp != NULL' failed.
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: threads (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-27 20:07 UTC by Doug Evans
Modified: 2014-07-28 02:12 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
testcase (857 bytes, text/x-csrc)
2014-07-27 20:09 UTC, Doug Evans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Evans 2014-07-27 20:07:31 UTC
Trying some additions to the testcase for my interrupt command fix (pr 14236) I hit an internal error, repro'd with clean HEAD.

--snip---foo.gdb
set trace-commands on
set height 0
set width 0
dir ../../../interrupt/gdb/testsuite/gdb.threads
file /hack/build/interrupt/obj64/gdb/testsuite/gdb.threads/interrupt-command
set non-stop on
delete breakpoints
info breakpoints
break main
run
break all_threads_running
continue
info threads
set var test_thread_creation_p = 1
c &
info thread 1
c -a &
---snip---

bash$ ./gdb -D ./data-directory <foo.gdb
GNU gdb (GDB) 7.8.50.20140727-cvs
...
Type "apropos word" to search for commands related to "word".
(gdb) (gdb) (gdb) +set height 0
(gdb) +set width 0
(gdb) +dir ../../../interrupt/gdb/testsuite/gdb.threads
Warning: /hack/build/interrupt/obj64/gdb/../../../interrupt/gdb/testsuite/gdb.threads: No such file or directory.
Source directories searched: /hack/build/interrupt/obj64/gdb/../../../interrupt/gdb/testsuite/gdb.threads:$cdir:$cwd
(gdb) +file /hack/build/interrupt/obj64/gdb/testsuite/gdb.threads/interrupt-command
Reading symbols from /hack/build/interrupt/obj64/gdb/testsuite/gdb.threads/interrupt-command...done.
(gdb) +set non-stop on
(gdb) +delete breakpoints
(gdb) +info breakpoints
No breakpoints or watchpoints.
(gdb) +break main
Breakpoint 1 at 0x4007a6: file ../../../interrupt/gdb/testsuite/gdb.threads/interrupt-command.c, line 98.
(gdb) +run
Starting program: /hack/build/interrupt/obj64/gdb/testsuite/gdb.threads/interrupt-command
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, main (argc=1, argv=0x7fffffffe218) at ../../../interrupt/gdb/testsuite/gdb.threads/interrupt-command.c:98
98        alarm (60);
(gdb) +break all_threads_running
Breakpoint 2 at 0x400795: file ../../../interrupt/gdb/testsuite/gdb.threads/interrupt-command.c, line 91.
(gdb) +continue
Continuing.
[New Thread 0x7ffff7fcb700 (LWP 20395)]
[New Thread 0x7ffff777a700 (LWP 20396)]
[New Thread 0x7ffff6f29700 (LWP 20397)]
[New Thread 0x7ffff66d8700 (LWP 20398)]

Breakpoint 2, all_threads_running () at ../../../interrupt/gdb/testsuite/gdb.threads/interrupt-command.c:91
91      }
(gdb) +info threads
  Id   Target Id         Frame
  5    Thread 0x7ffff66d8700 (LWP 20398) "interrupt-comma" (running)
  4    Thread 0x7ffff6f29700 (LWP 20397) "interrupt-comma" (running)
  3    Thread 0x7ffff777a700 (LWP 20396) "interrupt-comma" (running)
  2    Thread 0x7ffff7fcb700 (LWP 20395) "interrupt-comma" (running)
* 1    Thread 0x7ffff7fcc740 (LWP 20391) "interrupt-comma" all_threads_running () at ../../../interrupt/gdb/testsuite/gdb.threads/interrupt-command.c:91
(gdb) +set var test_thread_creation_p = 1
(gdb) +c &
Continuing.
(gdb) [New Thread 0x7ffff4de5700 (LWP 20400)]
[New Thread 0x7ffff5e87700 (LWP 20402)]
+info thread 1
[New Thread 0x7ffff5636700 (LWP 20401)]
[New Thread 0x7ffff4594700 (LWP 20399)]
  Id   Target Id         Frame
* 1    Thread 0x7ffff7fcc740 (LWP 20391) "interrupt-comma" (running)
(gdb) +c -a &
Continuing.
../../binutils-gdb/gdb/linux-nat.c:1751: internal-error: linux_nat_resume: Assertion `lp != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Comment 1 Doug Evans 2014-07-27 20:09:06 UTC
Created attachment 7728 [details]
testcase

testcase is a work-in-progress, but is sufficient to repro the bug
Comment 2 Doug Evans 2014-07-28 02:12:02 UTC
Data point: The thread is in thread_list but not lwp_list.
We iterate over all threads in thread_list, fail to find it in lwp_list, and boom.

Time to have just one copy of the list.  Ideally.