From d659dc16cc0896b66d50d25abe7cb4adde2d8180 Mon Sep 17 00:00:00 2001 From: Daniel Malea Date: Mon, 1 Apr 2013 19:47:00 +0000 Subject: [PATCH] Avoid hang in attach-by-name test case - Check that process attach succeeded before attempting to WaitForProcessToStop (observed to cause hangs on Linux) - Update comment in TestHelloWorld case -- attaching by name still broken llvm-svn: 178491 --- lldb/source/API/SBTarget.cpp | 11 +++++++---- lldb/test/python_api/hello_world/TestHelloWorld.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index f7d6bca55f06..8687cad69bf4 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -1114,10 +1114,13 @@ SBTarget::AttachToProcessWithName attach_info.GetExecutableFile().SetFile(name, false); attach_info.SetWaitForLaunch(wait_for); error.SetError (process_sp->Attach (attach_info)); - // If we are doing synchronous mode, then wait for the - // process to stop! - if (target_sp->GetDebugger().GetAsyncExecution () == false) - process_sp->WaitForProcessToStop (NULL); + if (error.Success()) + { + // If we are doing synchronous mode, then wait for the + // process to stop! + if (target_sp->GetDebugger().GetAsyncExecution () == false) + process_sp->WaitForProcessToStop (NULL); + } } else { diff --git a/lldb/test/python_api/hello_world/TestHelloWorld.py b/lldb/test/python_api/hello_world/TestHelloWorld.py index 2b895b9d1a59..f6fc61ca2ebe 100644 --- a/lldb/test/python_api/hello_world/TestHelloWorld.py +++ b/lldb/test/python_api/hello_world/TestHelloWorld.py @@ -67,7 +67,7 @@ class HelloWorldTestCase(TestBase): self.setTearDownCleanup(dictionary=self.d) self.hello_world_attach_with_name_api() - @expectedFailureLinux # due to bugzilla 14541 + @expectedFailureLinux # due to bugzilla 14541 -- lldb is unable to attach to process by name @python_api_test @dwarf_test def test_with_dwarf_and_attach_to_process_with_name_api(self):