diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 059f91c44445..967ea6b836f1 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -379,7 +379,7 @@ SBTarget::AttachToProcessWithName ) { SBProcess sb_process; - if (m_opaque_sp) + if (name && m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); diff --git a/lldb/test/python_api/hello_world/TestHelloWorld.py b/lldb/test/python_api/hello_world/TestHelloWorld.py index 79e3248ed6d6..34299e52e1e3 100644 --- a/lldb/test/python_api/hello_world/TestHelloWorld.py +++ b/lldb/test/python_api/hello_world/TestHelloWorld.py @@ -155,6 +155,13 @@ class HelloWorldTestCase(TestBase): error = lldb.SBError() # Pass 'False' since we don't want to wait for new instance of "hello_world" to be launched. name = os.path.basename(self.exe) + + # While we're at it, make sure that passing a None as the process name + # does not hang LLDB. + target.AttachToProcessWithName(listener, None, False, error) + # Also boundary condition test ConnectRemote(), too. + target.ConnectRemote(listener, None, None, error) + process = target.AttachToProcessWithName(listener, name, False, error) self.assertTrue(error.Success() and process, PROCESS_IS_VALID)