[Lldb-commits] [lldb] r164738 - /lldb/trunk/source/API/SBTarget.cpp

Greg Clayton gclayton at apple.com
Wed Sep 26 17:03:39 PDT 2012


Author: gclayton
Date: Wed Sep 26 19:03:39 2012
New Revision: 164738

URL: http://llvm.org/viewvc/llvm-project?rev=164738&view=rev
Log:
If we are attached to a platform, then make sure that we can verify that a process exists when attaching by "pid" before we try and do a lengthy command that could take a while to timeout.


Modified:
    lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=164738&r1=164737&r2=164738&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Sep 26 19:03:39 2012
@@ -853,10 +853,19 @@
             if (attach_pid != LLDB_INVALID_PROCESS_ID)
             {
                 PlatformSP platform_sp = target_sp->GetPlatform();
-                ProcessInstanceInfo instance_info;
-                if (platform_sp->GetProcessInfo(attach_pid, instance_info))
+                // See if we can pre-verify if a process exists or not
+                if (platform_sp && platform_sp->IsConnected())
                 {
-                    attach_info.SetUserID(instance_info.GetEffectiveUserID());
+                    ProcessInstanceInfo instance_info;
+                    if (platform_sp->GetProcessInfo(attach_pid, instance_info))
+                    {
+                        attach_info.SetUserID(instance_info.GetEffectiveUserID());
+                    }
+                    else
+                    {
+                        error.ref().SetErrorStringWithFormat("no process found with process ID %llu", attach_pid);
+                        return sb_process;
+                    }
                 }
             }
             error.SetError (process_sp->Attach (attach_info));





More information about the lldb-commits mailing list