@@ -40,28 +40,28 @@ def test(self):
40
40
target = self .dbg .CreateTarget (exe )
41
41
self .assertTrue (target , VALID_TARGET )
42
42
43
- bp1_line = line_number ("main.c" , "// Set breakpoint 1 here" )
44
- bp2_line = line_number ("main.c" , "// Set breakpoint 2 here" )
45
-
46
- lldbutil .run_break_set_by_file_and_line (
47
- self , "main.c" , bp1_line , num_expected_locations = 1
43
+ main_dot_c = lldb .SBFileSpec ("main.c" )
44
+ bp1 = target .BreakpointCreateBySourceRegex (
45
+ "// Set breakpoint 1 here" , main_dot_c
48
46
)
49
- lldbutil . run_break_set_by_file_and_line (
50
- self , "main.c" , bp2_line , num_expected_locations = 1
47
+ bp2 = target . BreakpointCreateBySourceRegex (
48
+ "// Set breakpoint 2 here" , main_dot_c
51
49
)
52
50
53
51
process = target .LaunchSimple (None , None , self .get_process_working_directory ())
54
52
self .assertTrue (process , VALID_PROCESS )
55
53
56
- thread = process .GetThreadAtIndex (0 )
54
+ thread = self .thread ()
55
+
57
56
if self .TraceOn ():
58
57
print ("Backtrace at the first breakpoint:" )
59
58
for f in thread .frames :
60
59
print (f )
60
+
61
61
# Check that we have stopped at correct breakpoint.
62
62
self .assertEqual (
63
- process . GetThreadAtIndex ( 0 ) .frame [0 ].GetLineEntry ().GetLine (),
64
- bp1_line ,
63
+ thread .frame [0 ].GetLineEntry ().GetLine (),
64
+ bp1 . GetLocationAtIndex ( 0 ). GetAddress (). GetLineEntry (). GetLine () ,
65
65
"LLDB reported incorrect line number." ,
66
66
)
67
67
@@ -70,15 +70,14 @@ def test(self):
70
70
# 'continue' command.
71
71
process .Continue ()
72
72
73
- thread = process .GetThreadAtIndex (0 )
74
73
if self .TraceOn ():
75
74
print ("Backtrace at the second breakpoint:" )
76
75
for f in thread .frames :
77
76
print (f )
78
77
# Check that we have stopped at the breakpoint
79
78
self .assertEqual (
80
79
thread .frame [0 ].GetLineEntry ().GetLine (),
81
- bp2_line ,
80
+ bp2 . GetLocationAtIndex ( 0 ). GetAddress (). GetLineEntry (). GetLine () ,
82
81
"LLDB reported incorrect line number." ,
83
82
)
84
83
# Double-check with GetPCAddress()
0 commit comments