[lldb-dev] Process spawning and shutdown

Zachary Turner zturner at google.com
Mon Sep 22 11:39:47 PDT 2014

Someone creating the ProcessLaunchInfo could set a custom callback though,
and it seems like it could lead to confusion when this is never invoked.
Probably never happens in practice, but that was the main source of my

On Mon, Sep 22, 2014 at 11:34 AM, Greg Clayton <gclayton at apple.com> wrote:

> > On Sep 22, 2014, at 11:30 AM, Zachary Turner <zturner at google.com> wrote:
> >
> > The only way to wait for a process to exit is calling
> WaitForSingleObject() with the handle. You can specify a timeout to that
> function, and INFINITE is one possible value.  However, it seems like the
> primary use case for LLDB waiting for a process to exit is to fire off the
> exit callback asynchronously.  In that case Windows, like other platforms,
> will probably need to create a background thread, then
> WaitForSingleObject() on the background thread, then fire the callback
> after it returns.
> >
> > What I was thinking is have the HostProcess provide a method called
> BlockUntilExit() which can be used anywhere (even from the main thread)
> should the caller desire it, but when launching a process we would create a
> thread for on each platform that just calls this method on the HostProcess,
> then issues the callback.  This would unify alot of code currently spread
> across the different Host.[cpp/mm] files.
> >
> > One thing that still eludes me though, is that when processes are
> launched using Applescript, no monitoring thread is created, and it looks
> at least like the callback is never invoked on these processes.  Is this by
> design, a bug, or am I misreading the code?
> It is by design. AppleScript is used to launch a process in a separate
> terminal window (allowing you to debug a "vi" or "emacs" style program that
> wants to take over the terminal and use all sorts of fancy terminal
> settings). The shell it runs in will reap the process and also give you a
> prompt back in the terminal so you can check the return value from there
> using the $? shell builtin variable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140922/e22a5e89/attachment.html>

More information about the lldb-dev mailing list