1
1
/*
2
- * Copyright (c) 2002, 2020 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2002, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -82,17 +82,10 @@ public static int run(String argv[], PrintStream out) {
82
82
static final String DEBUGGEE_CLASS = TEST_CLASS + "a" ;
83
83
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main" ;
84
84
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak" ;
85
- static final String DEBUGGEE_LOCATION1 = DEBUGGEE_CLASS + "$Nested$DeeperNested$DeepestNested:43" ;
86
- static final String DEBUGGEE_LOCATION2 = DEBUGGEE_CLASS + "$Inner$MoreInner:57" ;
87
- static final String FAILURE_PATTERN = "Unable to set" ;
85
+ static final String DEBUGGEE_LOCATION1 = DEBUGGEE_CLASS + "$Nested$DeeperNested$DeepestNested:64" ;
86
+ static final String DEBUGGEE_LOCATION2 = DEBUGGEE_CLASS + "$Inner$MoreInner:78" ;
88
87
89
88
protected void runCases () {
90
- String [] reply ;
91
- Paragrep grep ;
92
- int count ;
93
- Vector v ;
94
- String found ;
95
-
96
89
if (!checkStop (DEBUGGEE_LOCATION1 )) {
97
90
success = false ;
98
91
}
@@ -101,25 +94,62 @@ protected void runCases() {
101
94
success = false ;
102
95
}
103
96
104
- jdb .contToExit (3 );
97
+ if (!checkBreakpointHit (DEBUGGEE_LOCATION1 )) {
98
+ success = false ;
99
+ }
100
+
101
+ if (!checkBreakpointHit (DEBUGGEE_LOCATION2 )) {
102
+ success = false ;
103
+ }
104
+
105
+ jdb .contToExit (1 );
105
106
}
106
107
107
- private boolean checkStop (String location ) {
108
+ private boolean checkStop (String location ) {
108
109
Paragrep grep ;
109
110
String [] reply ;
110
111
String found ;
111
- boolean result = true ;
112
112
113
113
log .display ("Trying to set breakpoint at line: " + location );
114
114
reply = jdb .receiveReplyFor (JdbCommand .stop_at + location );
115
115
116
116
grep = new Paragrep (reply );
117
- found = grep .findFirst (FAILURE_PATTERN );
117
+ found = grep .findFirst ("Deferring breakpoint " + location );
118
+ if (found .length () == 0 ) {
119
+ log .complain ("jdb failed to setup deferred breakpoint at line: " + location );
120
+ return false ;
121
+ }
122
+
123
+ return true ;
124
+ }
125
+
126
+ private boolean checkBreakpointHit (String location ) {
127
+ Paragrep grep ;
128
+ String [] reply ;
129
+ String found ;
130
+
131
+ log .display ("continuing to breakpoint at line: " + location );
132
+ reply = jdb .receiveReplyFor (JdbCommand .cont );
133
+ grep = new Paragrep (reply );
134
+
135
+ found = grep .findFirst ("Unable to set deferred breakpoint" );
118
136
if (found .length () > 0 ) {
119
- log .complain ("jdb failed to set line breakpoint at line: " + found );
120
- result = false ;
137
+ log .complain ("jdb failed to set deferred breakpoint at line: " + location );
138
+ return false ;
139
+ }
140
+
141
+ found = grep .findFirst ("Set deferred breakpoint " + location );
142
+ if (found .length () == 0 ) {
143
+ log .complain ("jdb failed to set deferred breakpoint at line: " + location );
144
+ return false ;
145
+ }
146
+
147
+ found = grep .findFirst ("Breakpoint hit: \" thread=main\" , " );
148
+ if (found .length () == 0 ) {
149
+ log .complain ("jdb failed to hit breakpoint at line: " + location );
150
+ return false ;
121
151
}
122
152
123
- return result ;
153
+ return true ;
124
154
}
125
155
}
0 commit comments