Test attaching to a process that isn't a process group leader
authorPedro Alves <palves@redhat.com>
Mon, 6 Nov 2017 15:36:47 +0000 (15:36 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 6 Nov 2017 16:32:04 +0000 (16:32 +0000)
commit46f67f80ddfeea11d4a8134b347c74581faff8f6
tree2484c95618ea5c01643ec5c5fdf83183507e15d4
parentd1928160a324c1b6cd14afeecd4c81ab927883fa
Test attaching to a process that isn't a process group leader

The patch at
<https://sourceware.org/ml/gdb-patches/2017-11/msg00039.html> was
proposing to add an assertion to child_terminal_init that turns out
would fail if you tried to attach to a process that isn't a process
group leader.

Since the testsuite failed to catch the problem, this commit adds a
new testcase that would catch it, like:

  (gdb) attach 12415
  Attaching to program: build/gdb/testsuite/outputs/gdb.base/attach-non-pgrp-leader/attach-non-pgrp-leader, process 12415
  src/gdb/inflow.c:180: internal-error: void child_terminal_init(target_ops*): Assertion `getpgid (inf->pid) == inf->pid' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) FAIL: gdb.base/attach-non-pgrp-leader.exp: child: attach to child (GDB internal error)

gdb/testsuite/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

* gdb.base/attach-non-pgrp-leader.c: New.
* gdb.base/attach-non-pgrp-leader.exp: New.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/attach-non-pgrp-leader.c [new file with mode: 0644]
gdb/testsuite/gdb.base/attach-non-pgrp-leader.exp [new file with mode: 0644]
This page took 0.02562 seconds and 4 git commands to generate.