1import lldb 2from intelpt_testcase import * 3from lldbsuite.test.lldbtest import * 4from lldbsuite.test import lldbutil 5from lldbsuite.test.decorators import * 6 7class TestTraceDumpInfo(TraceIntelPTTestCaseBase): 8 mydir = TestBase.compute_mydir(__file__) 9 10 def testErrorMessages(self): 11 # We first check the output when there are no targets 12 self.expect("thread trace dump info", 13 substrs=["error: invalid target, create a target using the 'target create' command"], 14 error=True) 15 16 # We now check the output when there's a non-running target 17 self.expect("target create " + 18 os.path.join(self.getSourceDir(), "intelpt-trace", "a.out")) 19 20 self.expect("thread trace dump info", 21 substrs=["error: invalid process"], 22 error=True) 23 24 # Now we check the output when there's a running target without a trace 25 self.expect("b main") 26 self.expect("run") 27 28 self.expect("thread trace dump info", 29 substrs=["error: Process is not being traced"], 30 error=True) 31 32 def testDumpRawTraceSize(self): 33 self.expect("trace load -v " + 34 os.path.join(self.getSourceDir(), "intelpt-trace", "trace.json"), 35 substrs=["intel-pt"]) 36 37 self.expect("thread trace dump info", 38 substrs=['''Trace technology: intel-pt 39 40thread #1: tid = 3842849 41 Raw trace size: 4096 bytes''']) 42