x32: gdbserver's agent bytecode JIT: fix "call" emission
authorPedro Alves <palves@redhat.com>
Fri, 19 Aug 2016 11:07:45 +0000 (12:07 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 19 Aug 2016 11:12:18 +0000 (12:12 +0100)
Running fast tracepoint tests on x32 exposes a latent bug in the agent
bytecode jitting.  There's a code path that forgets to emit the call
opcode...  Whoops.  Fixes a bunch of gdb.trace/trace-condition.exp
FAILs, like:

  (gdb)
  continue
  Continuing.

  Thread 1 "trace-condition" received signal SIGSEGV, Segmentation fault.
  0x7ffec016 in ?? ()
  (gdb) FAIL: gdb.trace/trace-condition.exp: ftrace: $rip == *set_point: advance through tracing

gdb/gdbserver/ChangeLog:
2016-08-19  Pedro Alves  <palves@redhat.com>

* linux-x86-low.c (amd64_emit_call): Emit missing call opcode.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-x86-low.c

index f59d389db6e60432157be94069b60c25c99475bc..c28c2cb42461a8a7224efa4e01ec628ded84cec6 100644 (file)
@@ -1,3 +1,7 @@
+2016-08-19  Pedro Alves  <palves@redhat.com>
+
+       * linux-x86-low.c (amd64_emit_call): Emit missing call opcode.
+
 2016-08-19  Pedro Alves  <palves@redhat.com>
 
        * linux-x86-low.c (amd64_install_fast_tracepoint_jump_pad): Fix
index 1ba98ba4e07a51ab1d57d13d542c51c24d7a6071..d847b935214017ef18f1a643a403ae1924aa513d 100644 (file)
@@ -1842,6 +1842,8 @@ amd64_emit_call (CORE_ADDR fn)
   else
     {
       int offset32 = offset64; /* we know we can't overflow here.  */
+
+      buf[i++] = 0xe8; /* call <reladdr> */
       memcpy (buf + i, &offset32, 4);
       i += 4;
     }