<rdar://10950312>

Need to GetProcess() to set the uid of the process to attach.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151679 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 79b4548..7dbcf95 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -815,6 +815,16 @@
             sb_process.SetSP (process_sp);
             
             ProcessAttachInfo &attach_info = sb_attach_info.ref();
+            lldb::pid_t attach_pid = attach_info.GetProcessID();
+            if (attach_pid != LLDB_INVALID_PROCESS_ID)
+            {
+                PlatformSP platform_sp = target_sp->GetPlatform();
+                ProcessInstanceInfo instance_info;
+                if (platform_sp->GetProcessInfo(attach_pid, instance_info))
+                {
+                    attach_info.SetUserID(instance_info.GetEffectiveUserID());
+                }
+            }
             error.SetError (process_sp->Attach (attach_info));            
             // If we are doing synchronous mode, then wait for the
             // process to stop!
@@ -907,7 +917,6 @@
             if (platform_sp->GetProcessInfo(pid, instance_info))
             {
                 attach_info.SetUserID(instance_info.GetEffectiveUserID());
-                
             }
             error.SetError (process_sp->Attach (attach_info));            
             // If we are doing synchronous mode, then wait for the