RFR: 8355211: nsk/jdi/EventRequest/disable/disable001.java should use JDIBase superclass [v2]

Chris Plummer cjplummer at openjdk.org
Wed Apr 23 21:12:23 UTC 2025


> There is an nsk/jdi superclass called JDIBase that many tests inherit from. It provides common functionality like log support, basic event handling, support for setting a breakpoint, and support for the communication breakpoint that the debugger and debuggee use to synchronize with. disable001 does not inherit from JDIBase and instead implements all this functionality in the test. The reason is because it provides a slightly modified version of the JDIBase.settingBreakpoint() method. The main change is the presence of the following in settingBreakpoint():
> 
> 
> // this is only for this test to get Location object
> location = lineLocation;
> 
> 
> And then in the test:
> 
> 
>               case 11:
>                      log2(".....setting up BreakpointRequest");
>                      eventRequest1 = eventRManager.createBreakpointRequest(location);
>                      break;
> 
> 
> However, now JDIBase.settingBreakpoint() now contains:
> 
> 
>                 lineLocation = (Location) alllineLocations.get(n);
>                 breakpLocation = lineLocation;
> 
> 
> So the test can just use breakpLocation instead. This pattern is already replicated in a large number of tests.
> 
> The other difference in the disable001 version of settingBreakpoint() is that is uses SUSPEND_ALL rather than SUSPEND_EVENT_THREAD. This is easily fixed after setting up the breakpoint request:
> 
>         BreakpointRequest bpRequest = settingBreakpoint(mainThread,
>                                              debuggeeClass,
>                                             bPointMethod, lineForComm, "zero");
>         bpRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
> 
> The test uses JDIBase now and all the code replicated from JDIBase has been stripped out. It is also updated to use the new JDIBase.setupBreakpointForCommunication() method.

Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:

  Add comment

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/24811/files
  - new: https://git.openjdk.org/jdk/pull/24811/files/4531a969..6376fadc

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24811&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24811&range=00-01

  Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/24811.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24811/head:pull/24811

PR: https://git.openjdk.org/jdk/pull/24811


More information about the serviceability-dev mailing list