1""" 2Test the session history command 3""" 4 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12 13class SessionHistoryTestCase(TestBase): 14 15 mydir = TestBase.compute_mydir(__file__) 16 17 @no_debug_info_test 18 def test_history(self): 19 self.runCmd('session history --clear', inHistory=False) 20 self.runCmd('breakpoint list', check=False, inHistory=True) # 0 21 self.runCmd('register read', check=False, inHistory=True) # 1 22 self.runCmd('apropos hello', check=False, inHistory=True) # 2 23 self.runCmd('memory write', check=False, inHistory=True) # 3 24 self.runCmd('log list', check=False, inHistory=True) # 4 25 self.runCmd('disassemble', check=False, inHistory=True) # 5 26 self.runCmd('expression 1', check=False, inHistory=True) # 6 27 self.runCmd( 28 'type summary list -w default', 29 check=False, 30 inHistory=True) # 7 31 self.runCmd('version', check=False, inHistory=True) # 8 32 self.runCmd('frame select 1', check=False, inHistory=True) # 9 33 34 self.expect( 35 "session history -s 3 -c 3", 36 inHistory=True, 37 substrs=[ 38 '3: memory write', 39 '4: log list', 40 '5: disassemble']) 41 42 self.expect("session history -s 3 -e 3", inHistory=True, 43 substrs=['3: memory write']) 44 45 self.expect( 46 "session history -s 6 -e 7", 47 inHistory=True, 48 substrs=[ 49 '6: expression 1', 50 '7: type summary list -w default']) 51 52 self.expect("session history -c 2", inHistory=True, 53 substrs=['0: breakpoint list', '1: register read']) 54 55 self.expect("session history -e 3 -c 1", inHistory=True, 56 substrs=['3: memory write']) 57 58 self.expect( 59 "session history -e 2", 60 inHistory=True, 61 substrs=[ 62 '0: breakpoint list', 63 '1: register read', 64 '2: apropos hello']) 65 66 self.expect( 67 "session history -s 12", 68 inHistory=True, 69 substrs=[ 70 '12: session history -s 6 -e 7', 71 '13: session history -c 2', 72 '14: session history -e 3 -c 1', 73 '15: session history -e 2', 74 '16: session history -s 12']) 75 76 self.expect( 77 "session history -s end -c 3", 78 inHistory=True, 79 substrs=[ 80 '15: session history -e 2', 81 '16: session history -s 12', 82 '17: session history -s end -c 3']) 83 84 self.expect( 85 "session history -s end -e 15", 86 inHistory=True, 87 substrs=[ 88 '15: session history -e 2', 89 '16: session history -s 12', 90 '17: session history -s end -c 3', 91 'session history -s end -e 15']) 92 93 self.expect("session history -s 5 -c 1", inHistory=True, 94 substrs=['5: disassemble']) 95 96 self.expect("session history -c 1 -s 5", inHistory=True, 97 substrs=['5: disassemble']) 98 99 self.expect("session history -c 1 -e 3", inHistory=True, 100 substrs=['3: memory write']) 101 102 self.expect( 103 "session history -c 1 -e 3 -s 5", 104 error=True, 105 inHistory=True, 106 substrs=['error: --count, --start-index and --end-index cannot be all specified in the same invocation']) 107