From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26141 invoked by alias); 4 Aug 2004 19:02:51 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 26093 invoked from network); 4 Aug 2004 19:02:50 -0000 Received: from unknown (HELO gateway.sf.frob.com) (64.81.54.130) by sourceware.org with SMTP; 4 Aug 2004 19:02:50 -0000 Received: from magilla.sf.frob.com (magilla.sf.frob.com [198.49.250.228]) by gateway.sf.frob.com (Postfix) with ESMTP id 9CF17357B; Wed, 4 Aug 2004 12:02:49 -0700 (PDT) Received: from magilla.sf.frob.com (localhost.localdomain [127.0.0.1]) by magilla.sf.frob.com (8.12.11/8.12.9) with ESMTP id i74J2mAT024334; Wed, 4 Aug 2004 12:02:48 -0700 Received: (from roland@localhost) by magilla.sf.frob.com (8.12.11/8.12.11/Submit) id i74J2lTW024331; Wed, 4 Aug 2004 12:02:47 -0700 Date: Wed, 04 Aug 2004 19:02:00 -0000 Message-Id: <200408041902.i74J2lTW024331@magilla.sf.frob.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Andrew Cagney Cc: gdb@sources.redhat.com Subject: Re: Identifying bottom-of-stack In-Reply-To: Andrew Cagney's message of Wednesday, 4 August 2004 12:00:50 -0400 <41110832.7040104@gnu.org> X-Zippy-Says: I'm having a BIG BANG THEORY!! X-SW-Source: 2004-08/txt/msg00042.txt.bz2 Which machines are you talking about here that have a problem? On older architectures that worked before the advent of DWARF CFI, the outermost frame of new threads as no DWARF CFI at all and has the frame pointer register set to zero. I assume that GDB's idea of "CFA" in a frame without DWARF CFI is the value of the frame pointer register. I also assume that when the computed CFA is zero, GDB calls that "outermost". If these assumptions hold then there is no problem when the outermost frame has no CFI at all (and zeroes the frame pointer). Right? On the x86-64, the code of the call that sets up the outermost frame (clone) has CFI but is careful to make sure that it doesn't cover the code that runs in the outermost frame of a new thread. That code clears its frame pointer before calling anyone. So except for a small window of the first few instructions a new thread runs before it's cleared its frame pointer, my theory says there shouldn't be a problem for x86-64. Is there one? > - GLIBC marking those outermost frames with CFI indicating that both the > CFA and the RA are "unknown"? What would such CFI look like exactly? I am not much of an expert on DWARF, but from my reading of the spec I can think of one way to encode "unknown". That is DW_CFA_def_cfa giving some register plus DW_CFA_undefined for that register. AFAICS the spec doesn't say anything like "a computed CFA value of zero means the outermost frame". But at a guess that this is how it would always be determined, another option is just DW_CFA_def_cfa giving a register that is in fact zero in actual frames. Is this the kind of thing you have in mind? Thanks, Roland