public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@jive.nl>
To: roland@redhat.com
Cc: cagney@gnu.org, gdb@sources.redhat.com
Subject: Re: Identifying bottom-of-stack
Date: Thu, 05 Aug 2004 09:42:00 -0000	[thread overview]
Message-ID: <200408050941.i759fNJE010167@juw15.nfra.nl> (raw)
In-Reply-To: <200408041902.i74J2lTW024331@magilla.sf.frob.com> (message from Roland McGrath on Wed, 4 Aug 2004 12:02:47 -0700)

   Date: Wed, 4 Aug 2004 12:02:47 -0700
   From: Roland McGrath <roland@redhat.com>

   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?

The problem is that a zero frame pointer is an insufficient condition
to determine the bottom of the stack.  With code generated with
-fno-frame-pointer, the register that was traditionally used for the
frame pointer can be used for other purposes, and may very well
contain zero.

   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?

There is.  On amd64 -fno-frame-pointer is the default.  So this effort
of not generating CFI and clearing the framepointer is pointless.

   > - GLIBC marking those outermost frames with CFI indicating that both the 
   > CFA and the RA are "unknown"?

Andrew, please choose your wording carefully.  We now have,
"unspecified", "undefined", "unknown".  It's all very much unclear
what we mean by that.  I'm very uncomfortable with using any of
these..  Let's specify things in an explicit way if we're going to
specify something at all.

Mark

  reply	other threads:[~2004-08-05  9:42 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
2004-08-05  9:42   ` Mark Kettenis [this message]
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=200408050941.i759fNJE010167@juw15.nfra.nl \
    --to=kettenis@jive.nl \
    --cc=cagney@gnu.org \
    --cc=gdb@sources.redhat.com \
    --cc=roland@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).