[lldb-dev] Process::SetPrivateState / SetPublicState

Zachary Turner zturner at google.com
Thu Nov 6 14:07:40 PST 2014

Thanks, makes sense.

On Thu Nov 06 2014 at 2:05:15 PM Greg Clayton <gclayton at apple.com> wrote:

> > What is the difference between these two, and when would I use one over
> the other?  SetPrivateState() doesn't appear to modify the public state,
> and SetPublicState doesn't appear to modify the private state, so it seems
> a little confusing that these can get out of sync with each other.  What's
> the use case here?
> When you detect the truth (when your process starts or stops), you set the
> private state. The public state could be set to running, but you are
> implementing a source line single step which may involve starting and
> stopping the process 100s of times before the step is actually done. So the
> thread plans use the private state and determine when the public state
> should be updated. Another example is running an expression. The public
> state may say "stopped", but privately the process can be resumed and
> stopped many times when evaluating the expression, but you wouldn't want
> the public (people listening to the process events) to know about such
> changes.
> So the thread plans and process use the private state to make things
> happen and this tracks the "truth" of what the current process is doing.
> The public facing state is what causes the events to be broadcast to
> whomever is listening to the process events and should only notify the GUI
> or command line when it would like to update the views or display the stop
> reason, etc.
> In the classes that are controlling your actual process, you should always
> be setting the private state. Never touch the public state yourself.
> Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20141106/91347194/attachment.html>

More information about the lldb-dev mailing list