[lldb-dev] Process::SetPrivateState / SetPublicState
Zachary Turner
zturner at google.com
Tue Nov 11 11:21:53 PST 2014
Is there some documentation about async mode somewhere? I've looked at
many of the relevant functions and can't find a comment or anything
describing it.
In async mode, is it ok to return from DoLaunch() before the initial stop
is received? You mention that you get the first stop of the process at the
entry point with no code having been run. I'm not sure if you meant this
literally, but at least on Windows a very small amount of code actually
will run before we get the initial stop. The initial stop is actually a
breakpoint opcode embedded in the OS's loader code, so execution has to to
run to there before we get the stop. So is it ok if I create the process,
return immediately with public = private = launching, then when we get the
initial stop, check the whether the launch flag is set to stop at entry and
update the private and public state accordingly?
Also, async / sync mode doesn't seem to be in the ProcessLaunchInfo. Do I
need to find a way to get at the top level Debugger object to find this out?
On Tue Nov 11 2014 at 10:27:02 AM Greg Clayton <gclayton at apple.com> wrote:
>
> > On Nov 11, 2014, at 9:46 AM, Zachary Turner <zturner at google.com> wrote:
> >
> > A follow up question. Trying to make sure I get this right for the
> sequence of launching a process. You launch the process, wait for the
> initial stop, then lldb resumes your process, then it's running.
> Conceptually it seems like the following state sequence makes the most sense
> >
> > Upon returning from Process::DoLaunch() Public = Private = Launching
> > After the initial stop is received Public = launching, private =
> stopped
> > After LLDB calls DoResume() Public = private = running
> >
> > On the other hand, you said I should never touch the public state
> myself. Did I understand this correctly, or is it ok to set the public
> state from within my process plugin?
>
> Launching and attaching are funny in that we hijack the public events so
> they don't get delivered to the user. So in the launch and attach case you
> might need to set the public state directly. I would follow what the other
> plugins are doing. Once your process is launched and stopped, you won't
> ever play with the public state directly, but you might need to during
> launch and attach because the events are hijacked. When we hijack the
> public events, we can consume one or more events so they don't get
> delivered. For example, we have sync and async mode. In sync mode when you
> launch it expects you to wait until the process stops before returning from
> any commands that run the target. So your launch could actually consume all
> events and the process can exit. When you return from launch in sync mode,
> you can then just check the state of the process and see if you are stopped
> or exited. In async mode, we might get the first stop of the process (at
> the entry point with no code having been run), but continue your process
> for you if you didn't specify to stop at entry in your launch prefs. So we
> actually eat a public stop for the stop at the entry, and then resume the
> process but we don't consume that event...
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20141111/90439fdb/attachment.html>
More information about the lldb-dev
mailing list