summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-10-12 16:10:12 +0000
committerGreg Clayton <gclayton@apple.com>2012-10-12 16:10:12 +0000
commit926cce7619b0b42fe05b9523f3618b89a51a37aa (patch)
treeb87da9401fbbb141cde141cc5ca2bb4fe21a5f35 /lldb/source/Target/Process.cpp
parent4d88f05fe08d5dcfd6166408ac6c5331f5c43be1 (diff)
downloadbcm5719-llvm-926cce7619b0b42fe05b9523f3618b89a51a37aa.tar.gz
bcm5719-llvm-926cce7619b0b42fe05b9523f3618b89a51a37aa.zip
Modified patch from Matt Kopec that makes sure the run lock is acquired when attaching and makes sure the pid is being set on linux in the process info.
llvm-svn: 165804
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 2dbe88f76dd..077b9709924 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2750,10 +2750,19 @@ Process::Attach (ProcessAttachInfo &attach_info)
error = WillAttachToProcessWithName(process_name, wait_for_launch);
if (error.Success())
{
- m_should_detach = true;
+ if (m_run_lock.WriteTryLock())
+ {
+ m_should_detach = true;
+ SetPublicState (eStateAttaching);
+ // Now attach using these arguments.
+ error = DoAttachToProcessWithName (process_name, wait_for_launch, attach_info);
+ }
+ else
+ {
+ // This shouldn't happen
+ error.SetErrorString("failed to acquire process run lock");
+ }
- SetPublicState (eStateAttaching);
- error = DoAttachToProcessWithName (process_name, wait_for_launch, attach_info);
if (error.Fail())
{
if (GetID() != LLDB_INVALID_PROCESS_ID)
@@ -2817,10 +2826,20 @@ Process::Attach (ProcessAttachInfo &attach_info)
error = WillAttachToProcessWithID(attach_pid);
if (error.Success())
{
- m_should_detach = true;
- SetPublicState (eStateAttaching);
- error = DoAttachToProcessWithID (attach_pid, attach_info);
+ if (m_run_lock.WriteTryLock())
+ {
+ // Now attach using these arguments.
+ m_should_detach = true;
+ SetPublicState (eStateAttaching);
+ error = DoAttachToProcessWithID (attach_pid, attach_info);
+ }
+ else
+ {
+ // This shouldn't happen
+ error.SetErrorString("failed to acquire process run lock");
+ }
+
if (error.Success())
{
OpenPOWER on IntegriCloud