[Lldb-commits] [lldb] r178578 - Misc fixes:

Enrico Granata egranata at apple.com
Tue Apr 2 14:31:18 PDT 2013


Author: enrico
Date: Tue Apr  2 16:31:18 2013
New Revision: 178578

URL: http://llvm.org/viewvc/llvm-project?rev=178578&view=rev
Log:
Misc fixes:
- make an overload of Launch() that takes an init list of const char* if all you need to tweak in the launch info are the command-line arguments
- make Run() return an int that you can use as an exit-code
- make dynamic values work properly when recursing in FetchVariables()
- make the po output more obvious in verbose mode

Modified:
    lldb/trunk/tools/lldb-perf/lib/TestCase.cpp
    lldb/trunk/tools/lldb-perf/lib/TestCase.h
    lldb/trunk/tools/lldb-perf/lib/Xcode.cpp

Modified: lldb/trunk/tools/lldb-perf/lib/TestCase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/TestCase.cpp?rev=178578&r1=178577&r2=178578&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/TestCase.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/TestCase.cpp Tue Apr  2 16:31:18 2013
@@ -117,6 +117,15 @@ TestCase::Launch (lldb::SBLaunchInfo &la
     return false;
 }
 
+bool
+TestCase::Launch (std::initializer_list<const char*> args)
+{
+    std::vector<const char*> args_vect(args);
+    args_vect.push_back(NULL);
+    lldb::SBLaunchInfo launch_info((const char**)&args_vect[0]);
+    return Launch(launch_info);
+}
+
 void
 TestCase::SetVerbose (bool b)
 {
@@ -296,7 +305,7 @@ TestCase::Loop ()
 	if (GetVerbose()) printf("I am gonna die at step %d\n",m_step);
 }
 
-void
+int
 TestCase::Run (TestCase& test, int argc, const char** argv)
 {
     if (test.Setup(argc, argv))
@@ -304,6 +313,9 @@ TestCase::Run (TestCase& test, int argc,
         test.Loop();
         Results results;
         test.WriteResults(results);
+        return RUN_SUCCESS;
     }
+    else
+        return RUN_SETUP_ERROR;
 }
 

Modified: lldb/trunk/tools/lldb-perf/lib/TestCase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/TestCase.h?rev=178578&r1=178577&r2=178578&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/TestCase.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/TestCase.h Tue Apr  2 16:31:18 2013
@@ -83,6 +83,9 @@ public:
 	bool
 	Launch (lldb::SBLaunchInfo &launch_info);
 	
+    bool
+	Launch (std::initializer_list<const char*> args = {});
+    
 	void
 	Loop();
     
@@ -113,7 +116,7 @@ public:
         return MemoryMeasurement<A> (a,name, description);
     }
     
-    static void
+    static int
     Run (TestCase& test, int argc, const char** argv);
     
     virtual bool
@@ -158,6 +161,9 @@ public:
         return m_step;
     }
     
+    static const int RUN_SUCCESS = 0;
+    static const int RUN_SETUP_ERROR = 100;
+    
 protected:
     lldb::SBDebugger m_debugger;
 	lldb::SBTarget m_target;

Modified: lldb/trunk/tools/lldb-perf/lib/Xcode.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Xcode.cpp?rev=178578&r1=178577&r2=178578&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Xcode.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/Xcode.cpp Tue Apr  2 16:31:18 2013
@@ -33,7 +33,7 @@ Xcode::FetchVariable (SBValue value, uin
 		auto count = value.GetNumChildren();
 		for (int i = 0; i < count; i++)
 		{
-			SBValue child(value.GetChildAtIndex(i,value.IsDynamic() ? lldb::eDynamicCanRunTarget : lldb::eNoDynamicValues, true));
+			SBValue child(value.GetChildAtIndex(i, lldb::eDynamicCanRunTarget, true));
 			FetchVariable (child,expand-1,verbose);
 		}
 	}
@@ -117,7 +117,7 @@ Xcode::RunExpression (SBFrame frame, con
 	{
 		auto descr = value.GetObjectDescription();
 		if (descr)
-			printf("%s\n",descr);
+			printf("po = %s\n",descr);
 	}
 }
 





More information about the lldb-commits mailing list