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

Chris Plummer cjplummer at openjdk.java.net
Tue Mar 8 19:20:07 UTC 2022


On Tue, 8 Mar 2022 14:32:29 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> 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.

> There is some magic that lets us add "--add-modules", then "jdk.attach" separately, but retrieve them later as "--add-modules=jdk.attach" in the test. I don't see what is doing that, so I ran it and verified the test works.

Yes, there is some magic. No, I don't know where it's done. It seems it must be done by the launcher somewhere, but I can't find it. But the hotspot arguments.cpp does expect it:


    } else if (match_option(option, "--add-modules=", &tail)) {
      if (!create_numbered_module_property("jdk.module.addmods", tail, addmods_count++)) {
        return JNI_ENOMEM;
      }

I don't see any checks for `--add-modules` without the `=`.

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

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


More information about the serviceability-dev mailing list