lldb-perf-stepping.cpp revision a3df3b0c89ab584262098f8d877e8a72e3614a08
1#include <CoreFoundation/CoreFoundation.h> 2 3#include "lldb-perf/lib/Timer.h" 4#include "lldb-perf/lib/Metric.h" 5#include "lldb-perf/lib/Measurement.h" 6#include "lldb-perf/lib/TestCase.h" 7#include "lldb-perf/lib/Xcode.h" 8 9#include <unistd.h> 10#include <string> 11 12using namespace lldb_perf; 13 14class StepTest : public TestCase 15{ 16public: 17 StepTest() : 18 m_do_one_step_over_measurement (std::function<void(StepTest &, int)>(&StepTest::DoOneStep)) 19 { 20 } 21 22 virtual 23 ~StepTest() {} 24 25 virtual void 26 Setup (int argc, const char **argv) 27 { 28 m_app_path.assign(argv[1]); 29 m_out_path.assign(argv[2]); 30 TestCase::Setup (argc, argv); 31 32 m_target = m_debugger.CreateTarget(m_app_path.c_str()); 33 const char* file_arg = m_app_path.c_str(); 34 const char* empty = nullptr; 35 const char* args[] = {file_arg, empty}; 36 37 Launch (args,"."); 38 } 39 40private: 41 void 42 DoOneStep (int sequence) 43 { 44 45 } 46 47 TimeMeasurement<std::function<void(StepTest &, int)> > m_do_one_step_over_measurement; 48 std::string m_app_path; 49 std::string m_out_path; 50 51 52}; 53 54// argv[1] == path to app 55// argv[2] == path to result 56int main(int argc, const char * argv[]) 57{ 58 if (argc != 3) 59 { 60 printf ("Wrong number of arguments, should be \"path to app\", \"path to result.\"\n"); 61 return -1; 62 } 63 64 StepTest skt; 65 TestCase::Run(skt,argc,argv); 66 return 0; 67} 68