[Lldb-commits] [lldb] r146934 - in /lldb/trunk: source/API/SBStream.cpp test/source-manager/TestSourceManager.py

Johnny Chen johnny.chen at apple.com
Mon Dec 19 16:41:29 PST 2011


Author: johnny
Date: Mon Dec 19 18:41:28 2011
New Revision: 146934

URL: http://llvm.org/viewvc/llvm-project?rev=146934&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 NULL checks for SBStream APIs.

Modified:
    lldb/trunk/source/API/SBStream.cpp
    lldb/trunk/test/source-manager/TestSourceManager.py

Modified: lldb/trunk/source/API/SBStream.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStream.cpp?rev=146934&r1=146933&r2=146934&view=diff
==============================================================================
--- lldb/trunk/source/API/SBStream.cpp (original)
+++ lldb/trunk/source/API/SBStream.cpp Mon Dec 19 18:41:28 2011
@@ -59,6 +59,8 @@
 void
 SBStream::Printf (const char *format, ...)
 {
+    if (!format)
+        return;
     va_list args;
     va_start (args, format);
     ref().PrintfVarArg (format, args);

Modified: lldb/trunk/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/source-manager/TestSourceManager.py?rev=146934&r1=146933&r2=146934&view=diff
==============================================================================
--- lldb/trunk/test/source-manager/TestSourceManager.py (original)
+++ lldb/trunk/test/source-manager/TestSourceManager.py Mon Dec 19 18:41:28 2011
@@ -74,7 +74,11 @@
         #    6    }
         self.expect(stream.GetData(), "Source code displayed correctly",
                     exe=False,
-            patterns = ['=> %d.*Hello world' % self.line])        
+            patterns = ['=> %d.*Hello world' % self.line])
+
+        # Boundary condition testings for SBStream().  LLDB should not crash!
+        stream.Printf(None)
+        stream.RedirectToFile(None, True)
 
     def move_and_then_display_source(self):
         """Test that target.source-map settings work by moving main.c to hidden/main.c."""





More information about the lldb-commits mailing list