On Fri, 4 Mar 2022 22:12:08 GMT, Chris Plummer <cjplum...@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.

I looked a little closer at the options that jdb does not support passing 
through to the debuggee (other than the two I'm adding with this PR). The more 
useful ones are:

- `-showversion`, which is odd because jdb supports `-version`, which is kind 
of useless to support because it just causes the jvm to show the version and 
then exit, so no chance to debug anything.
- `-verbose`
- The 4 assertion related options
- The 3 options related to native and java agents

So maybe it is worth adding `-R` at this point, although the mix of supporting 
some options directly, and supporting all options with `-R` is a bit ugly. You 
know people are going to at some point try an option that is supported and one 
that is not, and be wonder why one works and the other doesn't. Hopefully they 
look a bit closer at the help output and see they can use `-R`. Thoughts?

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

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

Reply via email to