22Test lldb-dap disassemble request
33"""
44
5-
6- import dap_server
7- from lldbsuite .test .decorators import *
8- from lldbsuite .test .lldbtest import *
9- from lldbsuite .test import lldbutil
5+ from lldbsuite .test .decorators import skipIfWindows
6+ from lldbsuite .test .lldbtest import line_number
107import lldbdap_testcase
11- import os
128
139
1410class TestDAP_disassemble (lldbdap_testcase .DAPTestCaseBase ):
@@ -23,15 +19,23 @@ def test_disassemble(self):
2319 self .set_source_breakpoints (source , [line_number (source , "// breakpoint 1" )])
2420 self .continue_to_next_stop ()
2521
26- _ , pc_assembly = self .disassemble (frameIndex = 0 )
27- self .assertIn ("location" , pc_assembly , "Source location missing." )
28- self .assertIn ("instruction" , pc_assembly , "Assembly instruction missing." )
22+ insts_with_bp , pc_with_bp_assembly = self .disassemble (frameIndex = 0 )
23+ no_bp = self .set_source_breakpoints (source , [])
24+ self .assertEqual (len (no_bp ), 0 , "expect no breakpoints." )
25+ self .assertIn (
26+ "instruction" , pc_with_bp_assembly , "Assembly instruction missing."
27+ )
2928
30- # The calling frame (qsort) is coming from a system library, as a result
31- # we should not have a source location.
32- _ , qsort_assembly = self .disassemble (frameIndex = 1 )
33- self .assertNotIn ("location" , qsort_assembly , "Source location not expected." )
34- self .assertIn ("instruction" , pc_assembly , "Assembly instruction missing." )
29+ # the disassembly instructions should be the same even if there is a breakpoint;
30+ insts_no_bp , pc_no_bp_assembly = self .disassemble (frameIndex = 0 )
31+ self .assertDictEqual (
32+ insts_with_bp ,
33+ insts_no_bp ,
34+ "Expects instructions are the same after removing breakpoints." ,
35+ )
36+ self .assertIn ("instruction" , pc_no_bp_assembly , "Assembly instruction missing." )
37+
38+ self .continue_to_exit ()
3539
3640 @skipIfWindows
3741 def test_disassemble_backwards (self ):
@@ -74,3 +78,7 @@ def test_disassemble_backwards(self):
7478 backwards_instructions ,
7579 f"requested instruction should be preceeded by { backwards_instructions } instructions. Actual index: { frame_instruction_index } " ,
7680 )
81+
82+ # clear breakpoints
83+ self .set_source_breakpoints (source , [])
84+ self .continue_to_exit ()
0 commit comments