@@ -1250,12 +1250,17 @@ public void testDAPEvaluateError() throws Exception {
12501250 @ Test
12511251 public void testDAPExceptionBreakpointsAll () throws Exception {
12521252 String script = "@x = 1\n try {\n \t throw(Exception, 'test')\n } catch(Exception @e) {\n \t @y = 1\n }" ;
1253- try (DAPTestHarness h = new DAPTestHarness (script , new int []{},
1253+ try (DAPTestHarness h = new DAPTestHarness (script , new int []{1 },
12541254 DebugContext .ThreadingMode .SYNCHRONOUS )) {
1255+ // Pause at line 1 first, then set exception breakpoints before
1256+ // the throw executes, avoiding the race condition.
1257+ assertTrue (h .awaitStop (0 , 5 ));
12551258 h .setExceptionBreakpoints ("all" );
1259+ h .setBreakpoints (new int []{});
1260+ h .continue_ ();
12561261 // The throw should cause a stop
12571262 assertTrue ("Should break on caught exception" ,
1258- h .awaitStop (0 , 5 ));
1263+ h .awaitStop (1 , 5 ));
12591264 h .continue_ ();
12601265 h .terminated .await (5 , TimeUnit .SECONDS );
12611266 }
@@ -1264,9 +1269,14 @@ public void testDAPExceptionBreakpointsAll() throws Exception {
12641269 @ Test
12651270 public void testDAPExceptionBreakpointsUncaught () throws Exception {
12661271 String script = "@x = 1\n try {\n \t throw(Exception, 'test')\n } catch(Exception @e) {\n \t @y = 1\n }" ;
1267- try (DAPTestHarness h = new DAPTestHarness (script , new int []{},
1272+ try (DAPTestHarness h = new DAPTestHarness (script , new int []{1 },
12681273 DebugContext .ThreadingMode .SYNCHRONOUS )) {
1274+ // Pause at line 1 first, then set exception breakpoints before
1275+ // the throw executes, avoiding the race condition.
1276+ assertTrue (h .awaitStop (0 , 5 ));
12691277 h .setExceptionBreakpoints ("uncaught" );
1278+ h .setBreakpoints (new int []{});
1279+ h .continue_ ();
12701280 // Caught exception should NOT trigger a break with "uncaught" filter
12711281 // Script should complete normally
12721282 assertTrue ("Script should complete without breaking" ,
0 commit comments