[LLVMdev] About unwind...

Duncan Sands baldrick at free.fr
Fri Dec 21 12:28:57 PST 2007


Hi,

> > 2) When I unwind, the stack gets popped but it would make sense to pass
> > some
> > Passing extra info on the stack doesn't make much sense because the stack
> > gets popped...
> >
> 
> I don't know how llvm implements unwind,

the unwinder in the gcc runtime does the unwinding.

> but in principle it is possible to 
> walk (and pop) the stack to the right point, then push a parameter, then
> push the proper return address, then return.

This is what the gcc unwinder does (more or less), only it uses a register
rather than the stack: when calling the unwinder routine that does the
unwinding you give it a pointer to an exception object, and when execution
is to recommence in a landing pad it puts the value of that pointer in a special
register so you can get hold of it before jumping to the landing pad.

Ciao,

Duncan.



More information about the llvm-dev mailing list