aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2018-06-22 20:39:26 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2018-08-08 13:14:45 +0100
commit9d4a934ce604afea155c39f06834cdbc47e92a6e (patch)
treecd9eb8f646f081bae3a5978fa8b7790c4094d4c0 /gdb/target.c
parentff36536c9273734af6f84832b583c10f44c5010e (diff)
downloadbinutils-9d4a934ce604afea155c39f06834cdbc47e92a6e.zip
binutils-9d4a934ce604afea155c39f06834cdbc47e92a6e.tar.gz
binutils-9d4a934ce604afea155c39f06834cdbc47e92a6e.tar.bz2
gdb: Fix assert for extended-remote target (PR gdb/18050)
Consider the following GDB session: (gdb) target extended-remote :2347 (gdb) file /path/to/exe (gdb) set remote exec-file /path/to/exe (gdb) set detach-on-fork off (gdb) break breakpt (gdb) run # ... hits breakpoint (gdb) info inferiors Num Description Executable * 1 process 17001 /path/to/exe 2 process 17002 /path/to/exe (gdb) kill (gdb) info inferiors Num Description Executable * 1 <null> /path/to/exe 2 process 17002 /path/to/exe (gdb) target extended-remote :2348 ../../src/gdb/thread.c:660: internal-error: thread_info* any_thread_of_process(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Or, from bug PR gdb/18050: (gdb) start (gdb) add-inferior -exec /path/to/exe (gdb) target extended-remote :2347 ../../src/gdb/thread.c:660: internal-error: thread_info* any_thread_of_process(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. The issue is calling target.c:dispose_inferior with a killed inferior in the inferior list. This assertion is fixed in this commit. The new test for this issue only runs on platforms that support 'detach-on-fork', and when using '--target_board=native-extended-gdbserver'. gdb/ChangeLog: PR gdb/18050: * target.c (dispose_inferior): Don't dispose of inferiors that are already killed. gdb/testsuite/ChangeLog: PR gdb/18050: * gdb.server/extended-remote-restart.c: New file. * gdb.server/extended-remote-restart.exp: New file.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index a5245ab..115e9ae 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2022,6 +2022,12 @@ target_pre_inferior (int from_tty)
static int
dispose_inferior (struct inferior *inf, void *args)
{
+ /* Not all killed inferiors can, or will ever be, removed from the
+ inferior list. Killed inferiors clearly don't need to be killed
+ again, so, we're done. */
+ if (inf->pid == 0)
+ return 0;
+
thread_info *thread = any_thread_of_inferior (inf);
if (thread != NULL)
{