On Fri, 12 Dec 2025 23:37:20 GMT, Ioi Lam <[email protected]> wrote: >> The `DCmdFactory::_enabled` is always set to `true` and there doesn't seem >> to be a reason to set it to `false`. >> >> This PR removes this field and simplified the creation of `DCmdFactory` >> objects. >> >> The related `_hidden` field is also currently not used, but may be used in >> the future when deprecating DCmds, so we leave it unchanged. >> >> Note that now `jmm_GetDiagnosticCommandInfo()` always set >> `dcmdInfo::enabled` to `true` to be compatible with Java code. > > Ioi Lam has updated the pull request incrementally with one additional commit > since the last revision: > > @kevinjwalls comments
LGTM More context: https://openjdk.org/jeps/137 > 1-1 Overview > > The diagnostic command framework is fully implemented in native code and > relies on HotSpot's internal exception mechanism. The rationale for a pure > native implementation is to be able to execute diagnostic commands even in > critical situations like an out-of-memory condition. All diagnostic commands > are registered in a single list, and two flags control the way a user can > interact with them. The hidden flag prevents a diagnostic command from > appearing in the list of available commands returned by the help command. > However, it's still possible to get the detailed help message for a hidden > command with the help <command name> syntax, but it requires knowing the name > of the hidden command. The second flag is enabled and it controls whether a > command can be invoked or not. When listed with the help commands, disabled > commands appear with a [disabled] label in their descriptions. If the user > tries to invoke a disabled command, an error message is returned and the > command is not run. This error message can be customized on a per-command basis. The framework just provides these two flags with their semantics; it doesn't provide any policy or mechanism to set or modify these flags. These actions will be delegated to the JVM or specific diagnostic commands. The diagnostic command framework was developed at the same time we had requests to implement "Commercial features", the "enabled" flag might also have been intended to guard those commercial features (gone now). ------------- Marked as reviewed by fparain (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/28794#pullrequestreview-3583740017 PR Comment: https://git.openjdk.org/jdk/pull/28794#issuecomment-3661165228
