summaryrefslogtreecommitdiff
path: root/lldb/source/API/SBTarget.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-09-27 00:03:39 +0000
committerGreg Clayton <gclayton@apple.com>2012-09-27 00:03:39 +0000
commit91e407ea07e62cfa8a0a3e14d11bef29d05104f3 (patch)
tree19534d1757011b3eaeecd2ef98b2f7130c1f97ad /lldb/source/API/SBTarget.cpp
parente86fd74901534965640bb8f6ba3c5ffc377f5a26 (diff)
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.
llvm-svn: 164738
Diffstat (limited to 'lldb/source/API/SBTarget.cpp')
-rw-r--r--lldb/source/API/SBTarget.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 75014f0bed97..e7ae0d65eff1 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -853,10 +853,19 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
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));