From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8567 invoked by alias); 17 Nov 2005 15:54:25 -0000 Received: (qmail 8558 invoked by uid 22791); 17 Nov 2005 15:54:22 -0000 Received: from lon-del-03.spheriq.net (HELO lon-del-03.spheriq.net) (195.46.50.99) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 17 Nov 2005 15:54:22 +0000 Received: from lon-out-02.spheriq.net ([195.46.50.130]) by lon-del-03.spheriq.net with ESMTP id jAHFsJSd010427 for ; Thu, 17 Nov 2005 15:54:19 GMT Received: from lon-cus-02.spheriq.net (lon-cus-02.spheriq.net [195.46.50.38]) by lon-out-02.spheriq.net with ESMTP id jAHFsINv022782 for ; Thu, 17 Nov 2005 15:54:18 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-02.spheriq.net with ESMTP id jAHFsF4b023754 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Thu, 17 Nov 2005 15:54:17 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6C383DA44 for ; Thu, 17 Nov 2005 15:54:15 +0000 (GMT) Received: by zeta.dmz-eu.st.com (STMicroelectronics, from userid 60012) id 940714744D; Thu, 17 Nov 2005 15:57:14 +0000 (GMT) Received: from zeta.dmz-eu.st.com (localhost [127.0.0.1]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 37049759AE for ; Thu, 17 Nov 2005 15:57:14 +0000 (UTC) Received: from mail1.cro.st.com (mail1.cro.st.com [164.129.40.131]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E8C28474CE for ; Thu, 17 Nov 2005 15:57:12 +0000 (GMT) Received: from crx549.cro.st.com (crx549.cro.st.com [164.129.44.49]) by mail1.cro.st.com (MOS 3.5.8-GR) with ESMTP id CGA19726 (AUTH "frederic riss"); Thu, 17 Nov 2005 16:54:11 +0100 (CET) Subject: [RFC] DW_CFA_restore handling causes memory fault From: Frederic RISS To: gdb-patches@sources.redhat.com Content-Type: multipart/mixed; boundary="=-cdkTRvHuEd4p23GgtKZ5" Date: Thu, 17 Nov 2005 18:58:00 -0000 Message-Id: <1132242850.8685.47.camel@crx549.cro.st.com> Mime-Version: 1.0 X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.1.07 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2005-11/txt/msg00286.txt.bz2 --=-cdkTRvHuEd4p23GgtKZ5 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 528 Hello, The current handling of DW_CFA_restore in dwarf2-frame.c doesn't check if the value it tries to restore has actually been allocated. This produces strange results (from undeterministic behavour to a GDB crash). The attached patch tries to fix that by following the GCC 'convention' that an unspecified register implies "same value". It's debatable wether the compiler is right to produce DW_CFA_restore without specifying all the registers initial state in the CIE, but that's another story, isn't it ? Regards, Fred. --=-cdkTRvHuEd4p23GgtKZ5 Content-Disposition: attachment; filename=dwarf2.patch Content-Type: text/x-patch; name=dwarf2.patch; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 703 2005-11-17 Frédéric Riss * dwarf2-frame.c: (execute_cfa_program): Don't access past the allocated dwarf2_frame_state.initial.regs. Index: dwarf2-frame.c =================================================================== --- dwarf2-frame.c (revision 98) +++ dwarf2-frame.c (working copy) @@ -294,7 +294,10 @@ gdb_assert (fs->initial.reg); reg = insn & 0x3f; dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); - fs->regs.reg[reg] = fs->initial.reg[reg]; + if (reg < fs->initial.num_regs) + fs->regs.reg[reg] = fs->initial.reg[reg]; + else + fs->regs.reg[reg].how = DWARF2_FRAME_REG_UNSPECIFIED; } else { --=-cdkTRvHuEd4p23GgtKZ5--