This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PING: 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: Mon, 16 Apr 2012 09:42:36 -0700
- Subject: PING: PATCH: Also check for `movl %esp, %ebp' for x32
- References: <20120410202953.GA23862@intel.com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Tue, Apr 10, 2012 at 01:29:53PM -0700, H.J. Lu wrote:
> 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. */
PING.
H.J.