[Lldb-commits] [lldb] r146948 - in /lldb/trunk: source/API/SBTarget.cpp test/python_api/hello_world/TestHelloWorld.py

Johnny Chen johnny.chen at apple.com
Mon Dec 19 17:22:04 PST 2011


Author: johnny
Date: Mon Dec 19 19:22:03 2011
New Revision: 146948

URL: http://llvm.org/viewvc/llvm-project?rev=146948&view=rev
Log:
Work in progress for:

rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add a NULL check for SBTarget.AttachToProcessWithName() so it will not hang.

Modified:
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/test/python_api/hello_world/TestHelloWorld.py

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=146948&r1=146947&r2=146948&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Mon Dec 19 19:22:03 2011
@@ -379,7 +379,7 @@
 )
 {
     SBProcess sb_process;
-    if (m_opaque_sp)
+    if (name && m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
 

Modified: lldb/trunk/test/python_api/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/hello_world/TestHelloWorld.py?rev=146948&r1=146947&r2=146948&view=diff
==============================================================================
--- lldb/trunk/test/python_api/hello_world/TestHelloWorld.py (original)
+++ lldb/trunk/test/python_api/hello_world/TestHelloWorld.py Mon Dec 19 19:22:03 2011
@@ -155,6 +155,13 @@
         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)





More information about the lldb-commits mailing list