@@ -0,0 +1,2141 @@
+%22%22%22Test lldb's stepping speed.%22%22%22%0A%0Aimport os, sys%0Aimport unittest2%0Aimport lldb%0Aimport pexpect%0Afrom lldbbench import *%0A%0Aclass RunHooksThenSteppingsBench(BenchBase):%0A%0A    mydir = os.path.join(%22benchmarks%22, %22stepping%22)%0A%0A    def setUp(self):%0A        BenchBase.setUp(self)%0A        self.stepping_avg = None%0A%0A    @benchmarks_test%0A    def test_lldb_runhooks_then_steppings(self):%0A        %22%22%22Test lldb steppings on a large executable.%22%22%22%0A        print%0A        self.run_lldb_runhooks_then_steppings(50)%0A        print %22lldb stepping benchmark:%22, self.stopwatch%0A%0A    def run_lldb_runhooks_then_steppings(self, count):%0A        # Set self.child_prompt, which is %22(lldb) %22.%0A        self.child_prompt = '(lldb) '%0A        prompt = self.child_prompt%0A%0A        self.child = pexpect.spawn('%25s %25s' %25 (self.lldbHere, self.lldbOption))%0A        self.child.expect_exact(prompt)%0A        # So that the child gets torn down after the test.%0A        child = self.child%0A%0A        # Turn on logging for what the child sends back.%0A        if self.TraceOn():%0A            child.logfile_read = sys.stdout%0A%0A        #lldb.runHooks = %5B'process attach -n Mail'%5D%0A%0A        # Perform the run hooks to bring lldb debugger to the desired state.%0A        if not lldb.runHooks:%0A            self.skipTest(%22No runhooks specified for lldb, skip the test%22)%0A        for hook in lldb.runHooks:%0A            child.sendline(hook)%0A            child.expect_exact(prompt)%0A%0A        # Reset the stopwatch now.%0A        self.stopwatch.reset()%0A        for i in range(count):%0A            with self.stopwatch:%0A                # Disassemble the function.%0A                child.sendline('next') # Aka 'thread step-over'.%0A                child.expect_exact(prompt)%0A%0A        child.sendline('quit')%0A        try:%0A            self.child.expect(pexpect.EOF)%0A        except:%0A            pass%0A%0A        self.stepping_avg = self.stopwatch.avg()%0A        if self.TraceOn():%0A            print %22lldb stepping benchmark:%22, str(self.stopwatch)%0A        self.child = None%0A%0A%0Aif __name__ == '__main__':%0A    import atexit%0A    lldb.SBDebugger.Initialize()%0A    atexit.register(lambda: lldb.SBDebugger.Terminate())%0A    unittest2.main()%0A

Add a more generic stepping benchmark, which uses the '-k' option of the test driver to be able to specify the runhook(s) to bring the debug session to a certain state before running the benchmarking logic. An example,