[lldb-dev] Host::LaunchProcess vs. ProcessPlugin::DoLaunch

Zachary Turner zturner at google.com
Tue Aug 12 15:58:52 PDT 2014


Thanks, that makes sense.  The problem is that Host::LaunchProcess doesn't
really return anything useful.  When I create a process on Windows, I get a
HANDLE back that I can use to later manipulate the process.  Note that this
isn't the same as a Pid.  I guess Host::LaunchProcess will return the pid
in the launch_info structure, which I could then use to get another handle,
but that would involve closing the first handle before I get the second
handle, which I'm a little wary of, and I would feel better just using the
original handle.  But there's no obvious way to pass it back.

I'm not sure what the right abstraction is here that would make sense on
all platforms, but I feel like what is needed is some kind of NativeProcess
class, and LaunchProcess's signature could change to this:

static Error
Host::LaunchProcess (ProcessLaunchInfo &launch_info, NativeProcess
**process);

If the user passes in NULL, then we just clean up the process handle (or do
nothing, depending on platform), and if it's not NULL, then Host allocates
the appropriate type of Platform specific Process object.  For example, it
allocates a NativeProcessLinux, or a NativeProcessMacOSX, or a
NativeProcessWindows, etc.

Do you think something like this could work?  Or maybe have other ideas?


On Tue, Aug 12, 2014 at 3:47 PM, Greg Clayton <gclayton at apple.com> wrote:

> You should be implementing the launching in your Host layer one time:
>
>     static Error
>     Host::LaunchProcess (ProcessLaunchInfo &launch_info);
>
> Then you should be using this in your ProcessPluginWindows plug-in.
>
> > On Aug 8, 2014, at 5:14 PM, Zachary Turner <zturner at google.com> wrote:
> >
> > Why are there different code paths for launching a process through these
> two methods?  Shouldn't there just be one codepath for launching a process?
> >
> > I've implemented a very primitive process launch for Windows in
> ProcessPluginWindows::DoLaunch, but now I'm running into cases where tests
> are failing because Host::LaunchProcess isn't implemented yet on Windows.
>  What do I need to understand about the differences between these two
> codepaths to make sure I implement the two correctly?  And is there perhaps
> a way to refactor some of this code so that all of the process-spawning
> code lives in the same place, and the launch args are flexible enough to
> support all of the different use cases?
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140812/810b6a2f/attachment.html>


More information about the lldb-dev mailing list