RFR: 8318026: jcmd should provide access to low-level JVM debug information [v4]

Thomas Stuefe stuefe at openjdk.org
Mon Mar 4 16:14:58 UTC 2024


On Mon, 4 Mar 2024 15:10:12 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> Introduce the jcmd "VM.debug" to implement access to a useful set of the established debug.cpp utilities, with "jcmd PID VM.debug subcommand ...".
>> 
>> Not recommended for live production use.  Calling these "debug" utilities, and not including them in the jcmd help output, is to remind us they are not general customer-facing tools.
>
> Kevin Walls has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Usage correction
>  - Help to clarify this is VM inspection.  Comment to relate source to debug.cpp.
>  - jcheck trailing whitespace

Of the sub commands given in the CSR:


events        HotSpot JVM Event log
threads       Thread list
find ADDRESS  Describe an address given by the argument
findclass CLASS_PATTERN FLAGS   
findmethod CLASS_PATTERN METHOD_PATTERN FLAGS

1) `events` is redundant (we have VM.events, and events are printed as part of VM.info)
2) `threads` is handled by Thread.info
3) I am still puzzled about `find`. This is to ask a running VM about an arbitrary address. But how do you get such an address? Usually only via debugging. Then I am already attached with a system debugger. Under which circumstances would this be needed? Can you give a usage example?
4) and 5) shared some overlap with VM.classes, VM.class_hierarchy, VM.metaspace and various Compiler.xx commands. 

I am mostly worried about adding such a low-level debug command to jcmd. Especially in such a vague umbrella form. Experiences show that these commands get extended easily, often without CSR. So its an open door for feature creep. 

I mostly worry about unforeseen security consequences, especially if jcmd reach is extended across machine boundaries. Weighted against that, the benefits seem a bit slim to me. Again, real-world use cases would help.

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

PR Comment: https://git.openjdk.org/jdk/pull/17655#issuecomment-1976941359


More information about the hotspot-runtime-dev mailing list