]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix relocation of jump and call instructions (used when inserting fast
authorKwok Yeung <kcy@sourceware.org>
Fri, 18 Mar 2011 00:32:13 +0000 (00:32 +0000)
committerKwok Yeung <kcy@sourceware.org>
Fri, 18 Mar 2011 00:32:13 +0000 (00:32 +0000)
tracepoints).

2011-03-18  Kwok Cheung Yeung  <kcy@codesourcery.com>

* amd64-tdep.c (amd64_relocate_instruction): Fix ordering of arguments
        to store_signed_integer.  Add debug message when relocating CALL
        instructions.  Fix formatting of debug message.
        * i386-tdep.c (i386_relocate_instruction): Ditto.

gdb/ChangeLog
gdb/amd64-tdep.c
gdb/i386-tdep.c

index ea27ff3d59763a6c77155a1013407bc0bf77ab53..a6895fd98e2407488ff85504f3bc21d00fd70be5 100644 (file)
@@ -1,3 +1,10 @@
+2011-03-18  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+       * amd64-tdep.c (amd64_relocate_instruction): Fix ordering of arguments
+        to store_signed_integer.  Add debug message when relocating CALL
+        instructions.  Fix formatting of debug message.
+        * i386-tdep.c (i386_relocate_instruction): Ditto.
+
 2011-03-14  Tom Tromey  <tromey@redhat.com>
 
        PR gdb/12576:
index 9feed905a65e1c0928eb9a9121c9076a10e33e30..dcfa96577135182dd368146b518c1f756b6e19b7 100644 (file)
@@ -1588,7 +1588,14 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
       /* Adjust the destination offset.  */
       rel32 = extract_signed_integer (insn + 1, 4, byte_order);
       newrel = (oldloc - *to) + rel32;
-      store_signed_integer (insn + 1, 4, newrel, byte_order);
+      store_signed_integer (insn + 1, 4, byte_order, newrel);
+
+      if (debug_displaced)
+       fprintf_unfiltered (gdb_stdlog,
+                           "Adjusted insn rel32=%s at %s to"
+                           " rel32=%s at %s\n",
+                           hex_string (rel32), paddress (gdbarch, oldloc),
+                           hex_string (newrel), paddress (gdbarch, *to));
 
       /* Write the adjusted jump into its displaced location.  */
       append_insns (to, 5, insn);
@@ -1611,11 +1618,11 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
     {
       rel32 = extract_signed_integer (insn + offset, 4, byte_order);
       newrel = (oldloc - *to) + rel32;
-      store_signed_integer (insn + offset, 4, newrel, byte_order);
+      store_signed_integer (insn + offset, 4, byte_order, newrel);
       if (debug_displaced)
        fprintf_unfiltered (gdb_stdlog,
-                           "Adjusted insn rel32=0x%s at 0x%s to"
-                           " rel32=0x%s at 0x%s\n",
+                           "Adjusted insn rel32=%s at %s to"
+                           " rel32=%s at %s\n",
                            hex_string (rel32), paddress (gdbarch, oldloc),
                            hex_string (newrel), paddress (gdbarch, *to));
     }
index 435b623151abefbb2e66deb39bc03430231a36ee..810242652104f79706e618b0185f67206346d4a6 100644 (file)
@@ -747,7 +747,14 @@ i386_relocate_instruction (struct gdbarch *gdbarch,
       /* Adjust the destination offset.  */
       rel32 = extract_signed_integer (insn + 1, 4, byte_order);
       newrel = (oldloc - *to) + rel32;
-      store_signed_integer (insn + 1, 4, newrel, byte_order);
+      store_signed_integer (insn + 1, 4, byte_order, newrel);
+
+      if (debug_displaced)
+       fprintf_unfiltered (gdb_stdlog,
+                           "Adjusted insn rel32=%s at %s to"
+                           " rel32=%s at %s\n",
+                           hex_string (rel32), paddress (gdbarch, oldloc),
+                           hex_string (newrel), paddress (gdbarch, *to));
 
       /* Write the adjusted jump into its displaced location.  */
       append_insns (to, 5, insn);
@@ -766,11 +773,11 @@ i386_relocate_instruction (struct gdbarch *gdbarch,
     {
       rel32 = extract_signed_integer (insn + offset, 4, byte_order);
       newrel = (oldloc - *to) + rel32;
-      store_signed_integer (insn + offset, 4, newrel, byte_order);
+      store_signed_integer (insn + offset, 4, byte_order, newrel);
       if (debug_displaced)
        fprintf_unfiltered (gdb_stdlog,
-                           "Adjusted insn rel32=0x%s at 0x%s to"
-                           " rel32=0x%s at 0x%s\n",
+                           "Adjusted insn rel32=%s at %s to"
+                           " rel32=%s at %s\n",
                            hex_string (rel32), paddress (gdbarch, oldloc),
                            hex_string (newrel), paddress (gdbarch, *to));
     }