RFR: 8282691: add jdb support for passing --enable-preview and --add-modules to the debuggee JVM [v2]

Alan Bateman alanb at openjdk.java.net
Tue Mar 8 14:37:07 UTC 2022


On Tue, 8 Mar 2022 03:37:44 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> jdb has 3 types of arguments:
>> 
>> 1. Those that are jdb specific, such as -attach, -launch, and -listconnectors
>> 2. Those that are passed to the JVM used to run jdb. These are all prefixed with -J, and any valid JVM argument can be passed in this manner.
>> 3. Those that are passed to the debuggee JVM when it is launched, such as -classpath, -D<property>, and any option that starts with -X (including -XX)
>> 
>> The problem with the 3rd group is that (other than for -D and -X), jdb will only pass through arguments that it recognizes, and that list is very limited. When you want to launch the debuggee with an argument that jdb doesn't recognize, you have no choice but to launch the debuggee yourself (using a separate command line and using the -agentlib:jdwp argument) and then tell jdb to attach to the debuggee process. It's much easier when you can just let jdb launch the debuggee, and our nsk/jdb testing currently relies on this feature.
>> 
>> This PR adds --enable-preview and --add-modules to the list of arguments that jdb recognizes and passes through to the debuggee JVM. These seem to be the two most glaring omissions, and are two that will likely be needed soon in order for loom nsk/jdb testing to work properly.
>
> Chris Plummer has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Re-add copyright change.
>  - Remove copyright change.
>  - Support -R instead of --enable-preview and --add-modules.

src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java line 480:

> 478:              "    -tclient          run the application in the HotSpot(TM) Client Compiler\n" +
> 479:              "    -tserver          run the application in the HotSpot(TM) Server Compiler\n" +
> 480:              "    -R<option>        Forward <option> to debuggee process\n" +

The existing description start with a lowercase character so probably best to keep that consistent.

Also maybe it should make it clear that the options are forwarded to the debuggee then it is launched by jdb, the option is otherwise ignored.

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

PR: https://git.openjdk.java.net/jdk/pull/7708


More information about the serviceability-dev mailing list