From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27255 invoked by alias); 17 Apr 2012 11:43:56 -0000 Received: (qmail 27244 invoked by uid 22791); 17 Apr 2012 11:43:53 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Apr 2012 11:43:14 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id q3HBhAFL020133; Tue, 17 Apr 2012 13:43:10 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id q3HBh9LV021759; Tue, 17 Apr 2012 13:43:09 +0200 (CEST) Date: Tue, 17 Apr 2012 11:51:00 -0000 Message-Id: <201204171143.q3HBh9LV021759@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: hjl.tools@gmail.com CC: gdb-patches@sourceware.org In-reply-to: <20120410202953.GA23862@intel.com> (hongjiu.lu@intel.com) Subject: Re: PATCH: Also check for `movl %esp, %ebp' for x32 References: <20120410202953.GA23862@intel.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00457.txt.bz2 > Date: Tue, 10 Apr 2012 13:29:53 -0700 > From: "H.J. Lu" > > Hi, > > X32 may use `movl %esp, %ebp' in prologue. This patch checks it for > x32. Tested on Linux/x86-64. OK for trunk? Sorry, but I'm not sure it is a good idea to mix ABIs in the code like that. Up until now, I've made a conscious attempt to keep the i386 and amd64 ABIs seperated out as much as possible. Can you post a complete diff of the -tdep.c related changes to support x32 in GDB, such that I can judge where this is heading? > 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. */ >