aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKwok Yeung <kcy@sourceware.org>2011-03-18 00:27:48 +0000
committerKwok Yeung <kcy@sourceware.org>2011-03-18 00:27:48 +0000
commitf4a1794a6c09c86d60a9cdab337fab30a55e4fad (patch)
treede2540ac1819f5ba64613d86f3e8320f8a7e9f8b /gdb
parent6935e6051c76b4fce3d52fa1b6d28d32896b20cc (diff)
downloadgdb-f4a1794a6c09c86d60a9cdab337fab30a55e4fad.zip
gdb-f4a1794a6c09c86d60a9cdab337fab30a55e4fad.tar.gz
gdb-f4a1794a6c09c86d60a9cdab337fab30a55e4fad.tar.bz2
Fix relocation of jump and call instructions (used when inserting fast
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/amd64-tdep.c15
-rw-r--r--gdb/i386-tdep.c15
3 files changed, 29 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 68b31de..950dc4b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index b964f63d..fdb0c21 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -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));
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9fab6bd..eab8e44 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -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));
}