[Lldb-commits] [lldb][PATCH] Clear thread unwinder when stack is reset

Jason Molenda jmolenda at apple.com
Tue Nov 13 16:45:01 PST 2012


On Nov 13, 2012, at 4:29 PM, Greg Clayton <gclayton at apple.com> wrote:

> 
> On Nov 13, 2012, at 4:18 PM, Jason Molenda <jmolenda at apple.com> wrote:
> 
>> Hi Andy, sorry again for putting this one off.
>> 
>> I think your patch is fine.  I traced through the ownership of all the relevant objects.  There is the slight oddity that an UnwindLLDB has a vector of RegisterContextLLDB shared pointers, and the RegisterContextLLDB objects have a pointer back to the UnwindLLDB that owns them.  They need the back pointer to avoid using recursion when we try to retrieve register values / do a stack walk - the UnwindLLDB object can do an iterative lookup over the vector of SP's to find a saved value.
> 
> We should use weak pointers to solve this so it is done right.

Then the StackFrame objects would need to be able to handle the case where its RegisterContext weak pointer could not be converted into a SharedPointer (i.e. its RegisterContext goes away).

A better approach might be for the Thread to abandon its existing UnwindLLDB object and create a new one.  Existing StackFrameLists with pointers into the abandoned-UnwindLLDB/RegisterContextLLDB objects would continue to work until they were destroyed at which point the whole thing would be freed.

J



More information about the lldb-commits mailing list