11/*
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.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * 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) {
8282 static final String DEBUGGEE_CLASS = TEST_CLASS + "a" ;
8383 static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main" ;
8484 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" ;
8887
8988 protected void runCases () {
90- String [] reply ;
91- Paragrep grep ;
92- int count ;
93- Vector v ;
94- String found ;
95-
9689 if (!checkStop (DEBUGGEE_LOCATION1 )) {
9790 success = false ;
9891 }
@@ -101,25 +94,62 @@ protected void runCases() {
10194 success = false ;
10295 }
10396
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 );
105106 }
106107
107- private boolean checkStop (String location ) {
108+ private boolean checkStop (String location ) {
108109 Paragrep grep ;
109110 String [] reply ;
110111 String found ;
111- boolean result = true ;
112112
113113 log .display ("Trying to set breakpoint at line: " + location );
114114 reply = jdb .receiveReplyFor (JdbCommand .stop_at + location );
115115
116116 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" );
118136 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 ;
121151 }
122152
123- return result ;
153+ return true ;
124154 }
125155}
0 commit comments