[lldb-dev] Why does Platform::DebugProcess always launch and then attach?

Zachary Turner zturner at google.com
Wed May 13 14:59:54 PDT 2015


In particular this code:

    error = LaunchProcess (launch_info);
    if (error.Success())
    {
        if (log)
            log->Printf ("Platform::%s LaunchProcess() call succeeded
(pid=%" PRIu64 ")", __FUNCTION__, launch_info.GetProcessID ());
        if (launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID)
        {
            ProcessAttachInfo attach_info (launch_info);
            process_sp = Attach (attach_info, debugger, target, error);

For Windows if you want to launch a program under the debugger the method
you use launch to launch the process also does the attach at the same
time.  Until recently, PlatformWindows::CanDebugProcess() had been
returning false, so it was falling back to calling Process::DoLaunch(),
which has been working fine.

I'm adding support for attaching to processes though, and this requires
changing that function to return true.  So now both launches and attaches
go through this path of launching first, and then attaching, which causes
the launch codepath to break.

What is the correct way to handle this?  Could I add a method to Platform
called SupportsAtomicLaunchAndAttach() that if true will just call
Process::DoLaunch() directly, and if false will continue down the existing
codepath?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150513/a4246748/attachment.html>


More information about the lldb-dev mailing list