@@ -26,19 +26,26 @@ def do_sequence_test(self, filename, bkpt_name):
2626 substrs = ["stopped" , "stop reason = instruction step into" ],
2727 )
2828
29- pc = cur_thread .GetFrameAtIndex (0 ).GetPC ()
29+ # Get the instruction we stopped at
30+ pc = cur_thread .GetFrameAtIndex (0 ).GetPCAddress ()
31+ inst = target .ReadInstructions (pc , 1 ).GetInstructionAtIndex (0 )
3032
31- return pc - entry_pc
33+ inst_mnemonic = inst .GetMnemonic (target )
34+ inst_operands = inst .GetOperands (target )
35+ if not inst_operands :
36+ return inst_mnemonic
3237
33- @skipIf (archs = no_match ("^rv.*" ))
38+ return f"{ inst_mnemonic } { inst_operands } "
39+
40+ @skipIf (archs = no_match ("^riscv.*" ))
3441 def test_cas (self ):
3542 """
3643 This test verifies LLDB instruction step handling of a proper lr/sc pair.
3744 """
38- difference = self .do_sequence_test ("main" , "cas" )
39- self .assertEqual (difference , 0x1A )
45+ instruction = self .do_sequence_test ("main" , "cas" )
46+ self .assertEqual (instruction , "nop" )
4047
41- @skipIf (archs = no_match ("^rv .*" ))
48+ @skipIf (archs = no_match ("^riscv .*" ))
4249 def test_branch_cas (self ):
4350 """
4451 LLDB cannot predict the actual state of registers within a critical section (i.e., inside an atomic
@@ -51,29 +58,29 @@ def test_branch_cas(self):
5158 test is nearly identical to the previous one, except for the branch condition, which is inverted and
5259 will result in a taken jump.
5360 """
54- difference = self .do_sequence_test ("branch" , "branch_cas" )
55- self .assertEqual (difference , 0x1A )
61+ instruction = self .do_sequence_test ("branch" , "branch_cas" )
62+ self .assertEqual (instruction , "ret" )
5663
57- @skipIf (archs = no_match ("^rv .*" ))
64+ @skipIf (archs = no_match ("^riscv .*" ))
5865 def test_incomplete_sequence_without_lr (self ):
5966 """
6067 This test verifies the behavior of a standalone sc instruction without a preceding lr. Since the sc
6168 lacks the required lr pairing, LLDB should treat it as a non-atomic store rather than part of an
6269 atomic sequence.
6370 """
64- difference = self .do_sequence_test (
71+ instruction = self .do_sequence_test (
6572 "incomplete_sequence_without_lr" , "incomplete_cas"
6673 )
67- self .assertEqual (difference , 0x4 )
74+ self .assertEqual (instruction , "and a5, a2, a4" )
6875
69- @skipIf (archs = no_match ("^rv .*" ))
76+ @skipIf (archs = no_match ("^riscv .*" ))
7077 def test_incomplete_sequence_without_sc (self ):
7178 """
7279 This test checks the behavior of a standalone lr instruction without a subsequent sc. Since the lr
7380 lacks its required sc counterpart, LLDB should treat it as a non-atomic load rather than part of an
7481 atomic sequence.
7582 """
76- difference = self .do_sequence_test (
83+ instruction = self .do_sequence_test (
7784 "incomplete_sequence_without_sc" , "incomplete_cas"
7885 )
79- self .assertEqual (difference , 0x4 )
86+ self .assertEqual (instruction , "and a5, a2, a4" )
0 commit comments