Fix a few gdb.base/jit-simple.exp problems
authorPedro Alves <palves@redhat.com>
Thu, 6 Oct 2016 11:53:51 +0000 (12:53 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 6 Oct 2016 11:53:51 +0000 (12:53 +0100)
commit5a122fbc307f35093b8fe038a8e6caa51b4d0dae
treef364fcb59be4f3a293055bfeb635cf1cabcaac77
parent6bd7996d3d45d9dfcbf695ec680fb43b5275ee89
Fix a few gdb.base/jit-simple.exp problems

I noticed that we sometimes get this:

  (gdb) print &__jit_debug_descriptor
  $1 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
  (gdb) PASS: gdb.base/jit-simple.exp: blah 1
  [...]
  (gdb) run
  [...]
  Starting program: build/gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple
  Unsupported JIT protocol version 4 in descriptor (expected 1)

  Breakpoint 2, main () at src/gdb/testsuite/gdb.base/jit-simple.c:36
  36        return 0;
  (gdb) print &__jit_debug_descriptor
  $2 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
  (gdb) PASS: gdb.base/jit-simple.exp: blah 1

All tests PASSed, but note the "Unsupported JIT protocol version 4"
message.

Also notice that "__jit_debug_descriptor" has the same address before
and after the rerun, while the test is built in a way that should make
that address change between runs.

The test doesn't catch any of this because it doesn't compare
before/after addresses.

And then notice the "blah 1" test messages.  "blah" is clearly a WIP
message, but it should be at least "blah 2" the second time.  :-)

The reason this sometimes happens is that the test recompiles the
program and expects gdb to reload it automaticallyt on "run".  However,
if the original program and the new recompilation happen to be in the
same second, then gdb does not realize that the binary needs to be
reloaded.  (This is an old problem out of scope of this series.)  If
that happens, then GDB ends up using the wrong symbols for the program
that it spawns, reads the JIT descriptor out of the wrong address,
finds garbage, and prints that "unsupported version" notice.

Fix that in the same way gdb.base/reread.exp handles it -- by sleeping
one second before recompiling.

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

* gdb.base/jit-simple.exp (top level) Delete get_compiler_info
call.
(jit_run): Delete.
(jit_test_reread): Use with_test_prefix.  Reload the main binary
explicitly.  Compare the before/after addresses of the JIT
descriptor.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/jit-simple.exp
This page took 0.026429 seconds and 4 git commands to generate.