public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Andrew Cagney <cagney@gnu.org>
Cc: gdb@sources.redhat.com
Subject: Re: Identifying bottom-of-stack
Date: Wed, 04 Aug 2004 19:02:00 -0000	[thread overview]
Message-ID: <200408041902.i74J2lTW024331@magilla.sf.frob.com> (raw)
In-Reply-To: Andrew Cagney's message of  Wednesday, 4 August 2004 12:00:50 -0400 <41110832.7040104@gnu.org>

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

  parent reply	other threads:[~2004-08-04 19:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-04 16:01 Andrew Cagney
2004-08-04 17:17 ` Daniel Jacobowitz
2004-08-04 18:12   ` Andrew Cagney
2004-08-04 18:03     ` Daniel Jacobowitz
2004-08-04 18:31       ` Andrew Cagney
2004-08-04 19:02 ` Roland McGrath [this message]
2004-08-05  9:42   ` Mark Kettenis
2004-08-05 13:03     ` Andrew Cagney
2004-08-05 20:18     ` Roland McGrath
2004-08-11 17:51       ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408041902.i74J2lTW024331@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=cagney@gnu.org \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).