This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Identifying bottom-of-stack


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]