Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: Also check for `movl %esp, %ebp' for x32
@ 2012-04-10 20:52 H.J. Lu
  2012-04-16 17:54 ` PING: " H.J. Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: H.J. Lu @ 2012-04-10 20:52 UTC (permalink / raw)
  To: GDB

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.  */


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-05-06 20:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-10 20:52 PATCH: Also check for `movl %esp, %ebp' for x32 H.J. Lu
2012-04-16 17:54 ` PING: " H.J. Lu
2012-04-17 11:35 ` Yao Qi
2012-04-17 14:41   ` H.J. Lu
2012-04-17 11:51 ` Mark Kettenis
2012-04-17 14:32   ` H.J. Lu
2012-04-24 16:33     ` H.J. Lu
2012-04-29 23:21       ` H.J. Lu
2012-05-02 21:44         ` Mark Kettenis
2012-05-02 22:14           ` H.J. Lu
2012-05-03 19:01             ` H.J. Lu
2012-05-03 21:50               ` Mark Kettenis
2012-05-03 21:52                 ` H.J. Lu
2012-05-06 20:31                 ` Mark Kettenis
2012-05-06 20:42                   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox