Add regression test for PR gdb/19858 (JIT code registration on attach)
authorPedro Alves <palves@redhat.com>
Thu, 31 Mar 2016 18:28:47 +0000 (19:28 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 31 Mar 2016 18:28:47 +0000 (19:28 +0100)
commit64cdf930d9ed85e93ae55adbc20b0f9848ef863b
tree02dad0ba923b0897520d2e1e020d13ca342e1a89
parent40dea8cbf6b40f159bdfab4f3d8ec9010c293e84
Add regression test for PR gdb/19858 (JIT code registration on attach)

This test would fail without the previous gdb/jit.c fix:

  (gdb) attach 23031
  Attaching to program: .../build/gdb/testsuite/outputs/gdb.base/jit/jit-main, process 23031
  [...]
  207           WAIT_FOR_GDB; i = 0;  /* gdb break here 1 */
  (gdb) PASS: gdb.base/jit.exp: attach: one_jit_test-2: attach
  set var wait_for_gdb = 0
  (gdb) PASS: gdb.base/jit.exp: attach: one_jit_test-2: set var wait_for_gdb = 0
  info function ^jit_function
  All functions matching regular expression "^jit_function":
  (gdb) FAIL: gdb.base/jit.exp: attach: one_jit_test-2: info function ^jit_function

gdb/testsuite/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

PR gdb/19858
* gdb.base/jit-main.c: Include unistd.h.
(ATTACH): Define to 0 if not already defined.
(wait_for_gdb, mypid): New globals.
(WAIT_FOR_GDB): New macro.
(MAIN): Set an alarm.  Store the process's pid.  Wait for GDB at
some breakpoint locations.
* gdb.base/jit.exp (clean_reattach, continue_to_test_location):
New procedures.
(one_jit_test): Add REATTACH parameter, and handle it.  Use
continue_to_test_location.
(top level): Test attach, and adjusts calls to one_jit_test.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/jit-main.c
gdb/testsuite/gdb.base/jit.exp