[Dwarf-discuss] Using CFI to end a backtrace
Tue Mar 8 13:34:38 GMT 2005
> Several times recently I have wanted a "clean" way to indicate to GDB
> that a backtrace was over - give up, go away, nothing more to see here.
> This is useful in startup code, kernel exception handlers, et cetera.
> There's no immediately obvious way to use .debug_frame for this;
> however, it seems to me that marking the return address column as
> DW_CFA_undefined should do what I want. If we can't find the return
> address, then there's no point in unwinding further.
> Does this interpretation make sense? If so, should it be documented,
> so that others don't need to reinvent it?
It makes sense to me. But it's architecture-specific. Technically, there's
no rule that an architecture has to have a return address or PC column,
although I can't imagine a real one without something like that. I'm not
sure how it would be documented, except maybe just as a suggestion.
BTW, we've done this by indicating a memory location that has a NULL in it.
That saves us from the compiler having to know every routine beyond which one
can't walkback. It then becomes a choice belonging to the linker or runtime
system. Of course, it only works if NULL isn't likely to be a valid PC.
Concurrent Computer Corporation
More information about the Dwarf-discuss