Fix invoking "[kill|detach] inferiors" on inferiors that are not running
authorPatrick Palka <patrick@parcs.ath.cx>
Tue, 28 Jul 2015 19:00:58 +0000 (15:00 -0400)
committerPatrick Palka <patrick@parcs.ath.cx>
Sat, 15 Aug 2015 17:32:47 +0000 (13:32 -0400)
commite3ae3c4345fa14f2f3b0b2c5d4d23760af9f74f5
tree3becc238774281fa8eee63ce6747a872a47c8ec9
parent604b263620af66e3bf881f146e329b4de06104a5
Fix invoking "[kill|detach] inferiors" on inferiors that are not running

Invoking either of the above commands on an inferior that's not running
triggers the following assert failure:

  .../binutils-gdb/gdb/thread.c:514: internal-error: any_thread_of_process: Assertion `pid != 0' failed.

The fix is straightforward.  This patch also adds a test to check the
basic functionality of these commands, along with testing this fix in
particular.  Tested on x86_64 Linux.

gdb/ChangeLog:

* inferior.c (detach_inferior_command): Don't call
any_thread_of_process when pid is 0.
(kill_inferior_command): Likewise.

gdb/testsuite/ChangeLog:

* gdb.base/kill-detach-inferiors-cmd.exp: New test file.
* gdb.base/kill-detach-inferiors-cmd.c: New test file.
gdb/ChangeLog
gdb/inferior.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.c [new file with mode: 0644]
gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp [new file with mode: 0644]
This page took 0.025761 seconds and 4 git commands to generate.