summaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorkcy <kcy>2011-03-18 00:27:47 +0000
committerkcy <kcy>2011-03-18 00:27:47 +0000
commit668b4b04f97211730132a59215b60849e9b803be (patch)
treedf57e12c802a758053769c133e858c9dde48a6f5 /gdb/i386-tdep.c
parentdcc23d8511269c700b6812263ff1aaf19e1f8a1f (diff)
downloadgdb-668b4b04f97211730132a59215b60849e9b803be.tar.gz
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/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9fab6bdd99e..eab8e44b0c7 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));
}