Skip to content

Commit 4d5e05e

Browse files
authored
Make debug tests more robust (#28998)
Makes a few debug tests more robust to non-default initial state. Prior to this PR, some of the FileCheck checks were dependent on the breakpoints for `debuggerBreakHere` being the first and only breakpoint set. This PR makes those checks more dynamic. [Reviewed by @arifthpe]
2 parents 3544b73 + 71e4016 commit 4d5e05e

5 files changed

Lines changed: 36 additions & 24 deletions

File tree

test/llvm/debugInfo/lldb/functionCalls.chpl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ proc main() {
4646
breakpoint;
4747
}
4848

49+
// CHECK: breakpoint set -n debuggerBreakHere -N debuggerBreakHere
50+
// CHECK-NEXT: Breakpoint [[#BREAKPOINT_START:]]
51+
4952
// CHECK: b myFunc
5053
// CHECK-NEXT: functionCalls`myFunc
5154
// CHECK-SAME: functionCalls.chpl:2
@@ -79,28 +82,28 @@ proc main() {
7982
// CHECK-NEXT: functionCalls`getMyClass
8083
// CHECK-SAME: functionCalls.chpl:38
8184

82-
// CHECK: stop reason = breakpoint 2
83-
// CHECK: stop reason = breakpoint 3
85+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+1]]
86+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+2]]
8487
// CHECK: p ret
8588
// CHECK: (int(64)) 6
8689

87-
// CHECK: stop reason = breakpoint 4
88-
// CHECK: stop reason = breakpoint 5
90+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+3]]
91+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+4]]
8992
// CHECK: p ret
9093
// CHECK: (string) "Hello from getString!"
9194

92-
// CHECK: stop reason = breakpoint 6
93-
// CHECK: stop reason = breakpoint 7
95+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+5]]
96+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+6]]
9497
// CHECK: p ret
9598
// CHECK: (functionCalls::myRec) (a = 10, b = 3.14
9699

97-
// CHECK: stop reason = breakpoint 8
98-
// CHECK: stop reason = breakpoint 9
100+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+7]]
101+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+8]]
99102
// CHECK: p ret
100103
// CHECK: (functionCalls::myRec2) (a = 20, b = 2.71, c = true)
101104

102-
// CHECK: stop reason = breakpoint 10
103-
// CHECK: stop reason = breakpoint 11
105+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+9]]
106+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+10]]
104107
// CHECK: p ret
105108
// CHECK: (owned MyClass) 0x{{[0-9a-f]+}} {
106109
// CHECK-NEXT: super

test/llvm/debugInfo/lldb/methodCallsClass.chpl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ proc main() {
2828
breakpoint;
2929
}
3030

31+
// CHECK: breakpoint set -n debuggerBreakHere -N debuggerBreakHere
32+
// CHECK-NEXT: Breakpoint [[#BREAKPOINT_START:]]
33+
3134
// CHECK: b methodCallsClass.chpl:8
3235
// CHECK-NEXT: methodCallsClass`toString
3336
// CHECK-SAME: methodCallsClass.chpl:8
@@ -38,12 +41,12 @@ proc main() {
3841
// CHECK-NEXT: methodCallsClass`setter
3942
// CHECK-SAME: methodCallsClass.chpl:15
4043

41-
// CHECK: stop reason = breakpoint 3
44+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+2]]
4245
// CHECK: p this
4346
// CHECK-NEXT: (methodCallsClass::myClass *) 0x{{0*[0-9a-fA-F]+}}
4447
// CHECK: c
4548

46-
// CHECK: stop reason = breakpoint 4
49+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+3]]
4750
// CHECK: p *this
4851
// CHECK-NEXT: (methodCallsClass::myClass) {
4952
// CHECK-NEXT: super = (cid =
@@ -52,20 +55,20 @@ proc main() {
5255
// CHECK-NEXT: }
5356
// CHECK: c
5457

55-
// CHECK: stop reason = breakpoint 2
58+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+1]]
5659
// CHECK: p this->a
5760
// CHECK-NEXT: (int(64)) 10
5861
// CHECK: p ret
5962
// CHECK-NEXT: (string) "myClass(10, 2.71)"
6063
// CHECK: c
6164

62-
// CHECK: stop reason = breakpoint 3
65+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+2]]
6366
// CHECK: c
6467

65-
// CHECK: stop reason = breakpoint 4
68+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+3]]
6669
// CHECK: c
6770

68-
// CHECK: stop reason = breakpoint 2
71+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+1]]
6972
// CHECK: frame var
7073
// CHECK-NEXT: (methodCallsClass::myClass *) this = 0x{{0*[0-9a-fA-F]+}}
7174
// CHECK-NEXT: (string) ret = "myClass(20, 0.577)"

test/llvm/debugInfo/lldb/methodCallsRec.chpl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ proc main() {
2424
breakpoint;
2525
}
2626

27+
// CHECK: breakpoint set -n debuggerBreakHere -N debuggerBreakHere
28+
// CHECK-NEXT: Breakpoint [[#BREAKPOINT_START:]]
29+
2730
// CHECK: b methodCallsRec.chpl:8
2831
// CHECK-NEXT: methodCallsRec`toString
2932
// CHECK-SAME: methodCallsRec.chpl:8
@@ -34,17 +37,17 @@ proc main() {
3437
// CHECK-NEXT: methodCallsRec`setter
3538
// CHECK-SAME: methodCallsRec.chpl:15
3639

37-
// CHECK: stop reason = breakpoint 3
40+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+2]]
3841
// CHECK: p this
3942
// CHECK-NEXT: (_ref(myRec)) 0x{{0*[0-9a-fA-F]+}} (a = 10, b = 3.14
4043
// CHECK: c
4144

42-
// CHECK: stop reason = breakpoint 4
45+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+3]]
4346
// CHECK: p *this
4447
// CHECK-NEXT: (methodCallsRec::myRec){{.*}}(a = 10, b = 3.14
4548
// CHECK: c
4649

47-
// CHECK: stop reason = breakpoint 2
50+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+1]]
4851
// CHECK: p this->a
4952
// CHECK-NEXT: (int(64)) 10
5053
// CHECK: p this.a

test/llvm/debugInfo/lldb/targetVar.chpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
// CHECK: breakpoint set -n debuggerBreakHere -N debuggerBreakHere
2+
// CHECK-NEXT: Breakpoint [[#BREAKPOINT_START:]]
3+
14
const myGlobal = 42;
25

36
proc foo(myFormal) {
47
const localVar = myFormal + 1;
58
writeln("printing from foo");
6-
// CHECK: stop reason = breakpoint 2
7-
// CHECK-NEXT: targetVar.chpl:5
9+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+1]]
10+
// CHECK-NEXT: targetVar.chpl:8
811
// CHECK: target var
912
// CHECK: (int(64)) myGlobal_chpl = 42
1013
// CHECK: frame var
@@ -15,8 +18,8 @@ proc foo(myFormal) {
1518
}
1619

1720
proc bar(myFormal) {
18-
// CHECK: stop reason = breakpoint 3
19-
// CHECK-NEXT: targetVar.chpl:17
21+
// CHECK: stop reason = breakpoint [[#BREAKPOINT_START+2]]
22+
// CHECK-NEXT: targetVar.chpl:20
2023
// CHECK: target var
2124
// CHECK: (int(64)) myGlobal_chpl = 42
2225
// CHECK: frame var

test/llvm/debugInfo/lldb/targetVarCommands.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
b targetVar.chpl:5
1+
b targetVar.chpl:8
22
b bar
33
r
44
target var

0 commit comments

Comments
 (0)