Fix relocation of jump and call instructions (used when inserting fast
authorKwok Yeung <kcy@sourceware.org>
Fri, 18 Mar 2011 00:27:48 +0000 (00:27 +0000)
committerKwok Yeung <kcy@sourceware.org>
Fri, 18 Mar 2011 00:27:48 +0000 (00:27 +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 68b31de9221b1dcc7648377fdf6f0f6f77d14398..950dc4bcc08ef0767f4c3d35e83124dfa4aa850e 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-17  Joel Brobecker  <brobecker@gnat.com>
 
        * target.h (struct target_ops): Remove to_lookup_symbol field.
index b964f63d83354149aac32d01ef9616bc5dde60f4..fdb0c213f25fe5c0c7c449e6d13ad17f19733d42 100644 (file)
@@ -1575,7 +1575,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);
@@ -1598,11 +1605,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 9fab6bdd99e9b2ca395e08000cfd8473276c3817..eab8e44b0c7b2157e2d35d084e49b68f1a92e3e6 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));
     }
This page took 0.034658 seconds and 4 git commands to generate.