PATCH: Also check for `movl %esp, %ebp' for x32
H.J. Lu
hongjiu.lu@intel.com
Tue Apr 10 20:52:00 GMT 2012
Hi,
X32 may use `movl %esp, %ebp' in prologue. This patch checks it for
x32. Tested on Linux/x86-64. OK for trunk?
Thanks.
H.J.
--
* amd64-tdep.c (amd64_analyze_prologue): Also check for
`movl %esp, %ebp' if it is an x32 target.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index d15acea..e64de21 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -1900,10 +1927,14 @@ amd64_analyze_prologue (struct gdbarch *gdbarch,
if (current_pc <= pc + 1)
return current_pc;
- /* Check for `movq %rsp, %rbp'. */
+ /* Check for `movq %rsp, %rbp'. Also check for `movl %esp, %ebp'
+ if it is an x32 target. */
read_memory (pc + 1, buf, 3);
if (memcmp (buf, mov_rsp_rbp_1, 3) != 0
- && memcmp (buf, mov_rsp_rbp_2, 3) != 0)
+ && memcmp (buf, mov_rsp_rbp_2, 3) != 0
+ && (gdbarch_ptr_bit (gdbarch) == 64
+ || (memcmp (buf, mov_rsp_rbp_1 + 1, 2) != 0
+ && memcmp (buf, mov_rsp_rbp_2 + 1, 2) != 0)))
return pc + 1;
/* OK, we actually have a frame. */
More information about the Gdb-patches
mailing list