Gregory Turner wrote:
The second, -fasync-unwind-tables, provides "dwarf2 unwind tables". I've looked through the dwarf2 spec and some other sources, but I have yet to find solid documentation for this... perhaps it's a "use the source, Luke" situation. But this second option promises "instruction-granularity" unwind tables of some kind. IOW, presumably, this would be enough to implement __try and friends without looking beyond the stack pointer.
By "unwind tables" the GCC manual means here what the DWARF-2 standard calls "Call Frame Information"; they are described in chapter 6.4.
Bascially, the call frame information for a function denotes all points within the routine where 'something interesting' related to the call stack happens: when the function modifies the stack pointer, when the function uses some other register as frame pointer, when and where call-saved registers are stored in the call frame.
Using this information, it is possible for the exception handling runtime to 'virtually unwind' the call stack, which allows to retrieve the frame address, return address, and saved register values for every frame in the call chain.
So... anybody know where these options are actually documented? I mean, I see the blurb in the info pages, which is enticing, but surely there is some API or datastructure to look at somewhere....
Most of the details are internal to the exception handling routines (in libgcc). The exported interface is documented in the unwind.h header (which comes with gcc and/or glibc). To actually trigger stack unwinding, you'd need to use _Unwind_RaiseException or _Unwind_ForcedUnwind. However, those routines are also integrated into the language-specific exception processing, which goes beyond pure unwind tables, so I'm not sure whether you can use them for your purposes.
What exactly do you want to achieve?
Bye, Ulrich