From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2326 invoked by alias); 28 May 2003 14:39:26 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2261 invoked from network); 28 May 2003 14:39:25 -0000 Received: from unknown (HELO kerberos.suse.cz) (195.47.106.10) by sources.redhat.com with SMTP; 28 May 2003 14:39:25 -0000 Received: from chimera.suse.cz (chimera.suse.cz [10.20.0.2]) by kerberos.suse.cz (SuSE SMTP server) with ESMTP id 5773A59E529; Wed, 28 May 2003 16:39:24 +0200 (CEST) Received: from suse.cz (naga.suse.cz [10.20.1.16]) by chimera.suse.cz (Postfix) with ESMTP id 19F8E4F68; Wed, 28 May 2003 16:39:24 +0200 (CEST) Message-ID: <3ED4CA1B.2000004@suse.cz> Date: Wed, 28 May 2003 14:39:00 -0000 From: Michal Ludvig Organization: SuSE CR, s.r.o. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030507 X-Accept-Language: cs, cz, en MIME-Version: 1.0 To: Mark Kettenis Cc: GDB Patches Subject: [RFC/i385newframe] Fix sigtramp unwinder. Content-Type: multipart/mixed; boundary="------------060203070201080009040706" X-SW-Source: 2003-05/txt/msg00502.txt.bz2 This is a multi-part message in MIME format. --------------060203070201080009040706 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 321 Hi, this patch fixes x86_64_linux_sigcontext_addr() which returned wrong address, and consequently enables unwinding from signal handlers. Detailed explanation of this change is in the comment in the patch. OK to apply? Michal Ludvig -- * SuSE CR, s.r.o * mludvig@suse.cz * (+420) 296.545.373 * http://www.suse.cz --------------060203070201080009040706 Content-Type: text/plain; name="unwind-sigctx-1.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="unwind-sigctx-1.diff" Content-length: 1941 2003-05-28 Michal Ludvig * x86-64-linux-tdep.c (x86_64_linux_sigcontext_addr): Correctly determine sigcontext address. Index: x86-64-linux-tdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/x86-64-linux-tdep.c,v retrieving revision 1.17.18.1 diff -u -p -c -r1.17.18.1 x86-64-linux-tdep.c *** x86-64-linux-tdep.c 17 May 2003 15:09:15 -0000 1.17.18.1 --- x86-64-linux-tdep.c 28 May 2003 14:32:12 -0000 *************** x86_64_linux_sigcontext_addr (struct fra *** 110,124 **** CORE_ADDR sp, ucontext_addr; char buf[8]; =20=20 frame_unwind_register (next_frame, SP_REGNUM, buf); sp =3D extract_unsigned_integer (buf, 8); =20=20 ! /* The sigcontext structure is part of the user context. A pointer ! to the user context is passed as the third argument to the signal ! handler. */ ! read_memory (sp + 16, buf, 8); ! ucontext_addr =3D extract_unsigned_integer (buf, 8); ! return ucontext_addr + X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET; } =0C =20=20 --- 110,126 ---- CORE_ADDR sp, ucontext_addr; char buf[8]; =20=20 + /* The sigcontext structure is part of the user context. A pointer + to the user context is passed as the third argument to the signal + handler, i.e. in register RDX. Unfortunately RDX isn't a callee=20 + saved register and so it's unwound value isn't reliable.=20 + Fortunately struct ucontext is right above the return address from=20 + the signal handler, i.e. also unwound RSP points to the user context= =20 + and we can use it instead of RDX. */ frame_unwind_register (next_frame, SP_REGNUM, buf); sp =3D extract_unsigned_integer (buf, 8); =20=20 ! return sp + X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET; } =0C =20=20 --------------060203070201080009040706--