From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14021 invoked by alias); 11 Dec 2006 22:40:41 -0000 Received: (qmail 13826 invoked by uid 22791); 11 Dec 2006 22:40:40 -0000 X-Spam-Check-By: sourceware.org Received: from sccrmhc14.comcast.net (HELO sccrmhc14.comcast.net) (63.240.77.84) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 11 Dec 2006 22:40:26 +0000 Received: from gateway.sf.frob.com (c-24-5-197-144.hsd1.ca.comcast.net[24.5.197.144]) by comcast.net (sccrmhc14) with ESMTP id <2006121122402401400q17tge>; Mon, 11 Dec 2006 22:40:24 +0000 Received: from magilla.sf.frob.com (magilla.sf.frob.com [198.49.250.228]) by gateway.sf.frob.com (Postfix) with ESMTP id F07E7357B; Mon, 11 Dec 2006 14:40:22 -0800 (PST) Received: by magilla.sf.frob.com (Postfix, from userid 5281) id AD76E1800E7; Mon, 11 Dec 2006 14:40:22 -0800 (PST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Jan Kratochvil Cc: gcc@gcc.gnu.org, libc-alpha@sources.redhat.com, gdb@sourceware.org, Jakub Jelinek , Richard Henderson Subject: Re: Unwinding CFI gcc practice of assumed `same value' regs In-Reply-To: Jan Kratochvil's message of Monday, 11 December 2006 20:03:00 +0100 <20061211190300.GA4372@host0.dyn.jankratochvil.net> X-Shopping-List: (1) Despondent laxatives (2) Flirtatious goats (3) Neurotic commanders (4) Surreptitious ashes (5) No-Action persecuters Message-Id: <20061211224022.AD76E1800E7@magilla.sf.frob.com> Date: Mon, 11 Dec 2006 22:40:00 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00090.txt.bz2 GCC's unwinder doesn't distinguish undefined from same_value, because it doesn't matter for EH unwinding purposes. Both mean "nothing to be done for this register". The distinction only matters to informative unwinding purposes like debugging. I'm not sure why libgcc's unwinder really ought to care. It's not that I'm against it knowing the difference; that certainly seems a cleaner way for it to be internally. But as to the idea that it needs to distinguish them for correctness, and thus other things need to rely on having a libgcc_s version that does, and so forth, I don't see the motivation. In the ideal world, things would use cfi_undefined on the pc regno to indicate the base frame, as the dwarf3 spec says to. I certainly think it would be cleanest for everything to do that. But again, in practice on i386 and x86_64, I'm not sure I see the need. Correct unwind info should always restore the caller's bp register value. When that unwinds to the outermost frame, that will be a zero value as the runtime code of base frames sets it. My reading is that the "ABI authoring body" for GNU systems or the "compilation system authoring body" for GNU compilers already specifies that the default rule is same_value for callee-saves registers (as chosen by each particular ABI), even if this has not been formally documented anywhere heretofore. (This is how I've written ABI support in another unwinder implementation I've worked on.) As you've said, this is the only reading by which current CFI is correct and complete for getting the values of callee-saves registers. I presume that GCC's omission of rules for those registers is in fact simply because EH unwinding doesn't care and people on the generation side just didn't think about it beyond that. Regardless of the true reasons for the history, the description above applies to the manifest practice that constitutes what we want the formal specification to mean. Thanks, Roland