This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PATCH: Also check for `movl %esp, %ebp' for x32
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GDB <gdb-patches at sourceware dot org>
- Date: Tue, 10 Apr 2012 13:29:53 -0700
- Subject: PATCH: Also check for `movl %esp, %ebp' for x32
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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. */