Summary
Add --connect
option to both hsdb
and clhsdb
subcommands in jhsdb to connect to a debug server in startup.
Problem
Most of subcommands in jhsdb support connecting to a debug server via the --connect
command line option. For example, we can use it on jhsdb jstack
as following:
$ jhsdb jstack --connect id@debugserver
--connect
is described in manpage of jhsdb for each supported subcommands. For example, jstack is described as below:
jhsdb jstack (--pid pid | --exe executable --core coredump | --connect [server-id@]debugd-host) [options]
However, hsdb
and clhsdb
subcommands do not accept it.
Both HSDB and CLHSDB already support connecting to a debug server, but only after starting up. With HSDB there is a GUI menu item to do this, and with CLHSDB you can use the attach
command. However, as pointed out above, this ability to connect to a debug server using the --connect
command line argument is not available like it is with other jhsdb subcommands.
Solution
Add --connect
option to both hsdb
and clhsdb
subcommands like the others in jhsdb. It does not affect other subcommands.
We can see the capability to connect to debug server on help message as following:
$ jhsdb hsdb --help
--pid <pid> To attach to and operate on the given live process.
--core <corefile> To operate on the given core file.
--exe <executable for corefile>
--connect [<id>@]<host> To connect to a remote debug server (debugd).
The --core and --exe options must be set together to give the core
file, and associated executable, to operate on. They can use
absolute or relative paths.
The --pid option can be set to operate on a live process.
The --connect option can be set to connect to a debug server (debugd).
--core, --pid, and --connect are mutually exclusive.
Examples: jhsdb hsdb --pid 1234
or jhsdb hsdb --core ./core.1234 --exe ./myexe
or jhsdb hsdb --connect debugserver
or jhsdb hsdb --connect id@debugserver
Specification
jhsdb has a manpage, we need to change it for this proposal as below:
--- a/src/jdk.hotspot.agent/share/man/jhsdb.1
+++ b/src/jdk.hotspot.agent/share/man/jhsdb.1
@@ -31,12 +31,12 @@ analyze the content of a core dump from a crashed Java Virtual Machine
.SH SYNOPSIS
.PP
\f[CB]jhsdb\f[R] \f[CB]clhsdb\f[R] [\f[CB]\-\-pid\f[R] \f[I]pid\f[R] |
-\f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R]
-\f[I]coredump\f[R]]
+\f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] |
+\f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host\f[R]\]
.PP
\f[CB]jhsdb\f[R] \f[CB]hsdb\f[R] [\f[CB]\-\-pid\f[R] \f[I]pid\f[R] |
-\f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R]
-\f[I]coredump\f[R]]
+\f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] |
+\f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host\f[R]\]
.PP
\f[CB]jhsdb\f[R] \f[CB]debugd\f[R] (\f[CB]\-\-pid\f[R] \f[I]pid\f[R] |
\f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R]
Before:
SYNOPSIS
jhsdb clhsdb [--pid pid | --exe executable --core coredump]
jhsdb hsdb [--pid pid | --exe executable --core coredump]
After:
SYNOPSIS
jhsdb clhsdb [--pid pid | --exe executable --core coredump | --connect [server-id@]debugd-host]
jhsdb hsdb [--pid pid | --exe executable --core coredump | --connect [server-id@]debugd-host]
- csr of
-
JDK-8263342 Add --connect option to jhsdb hsdb/clhsdb
-
- Resolved
-