Skip to content

Commit

Permalink
8338894: Deprecate jhsdb debugd for removal
Browse files Browse the repository at this point in the history
Reviewed-by: cjplummer, alanb
  • Loading branch information
kevinjwalls committed Sep 10, 2024
1 parent be0dca0 commit 3352522
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/jdk.hotspot.agent/doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ <h3>SA Modes</h3>
<ul>
<li>attaching to a local process
<li>opening a core file
<li>attaching to a remote "debug server"
<li>attaching to a remote "debug server" (deprecated)
</ul>
<p><strong>WARNING: <b>jhsdb debugd</b> is deprecated and will be removed in a future release.</strong></p>
<p>
The remote case requires running the debug server on the remote machine. This
is done by running "jhsdb debugd", and also adding arguments specifying the core
Expand Down
1 change: 1 addition & 0 deletions src/jdk.hotspot.agent/doc/transported_core.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ <h1>Debugging transported core dumps</h1>
it was produced on. This is done by first running <b>jhsdb debugd</b> on the machine with
the core dump, and then attaching to it from another machine by using the jhsdb
<b>--connect</b> argument. See the <b>jhsdb</b> man page for details.
<p><strong>WARNING: <b>jhsdb debugd</b> is deprecated and will be removed in a future release.</strong></p>
</ul>
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.oops.*;

@Deprecated(since="24", forRemoval=true)
public class DebugServer {
private void usage() {
System.out.println("usage: java " + getClass().getName() + " <pid> [server id]");
Expand All @@ -42,9 +43,11 @@ private void usage() {
}

public static void main(String[] args) {
System.err.println("WARNING: DebugServer is deprecated and will be removed in a future release.");
new DebugServer().run(args);
}

@SuppressWarnings("removal")
private void run(String[] args) {
if ((args.length < 1) || (args.length > 3)) {
usage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public synchronized boolean detach() throws DebuggerException {
specific debuggee on the server. Allows to specify the port number
to which the RMI connector is bound. If not specified a random
available port is used. */
@Deprecated(since="24", forRemoval=true)
public synchronized void startServer(int processID,
String serverID,
String serverName,
Expand All @@ -224,13 +225,15 @@ public synchronized void startServer(int processID,
starts a debug server, allowing remote machines to connect and
examine this process. Uses specified name to uniquely identify a
specific debuggee on the server */
@Deprecated(since="24", forRemoval=true)
public synchronized void startServer(int processID, String serverID, String serverName) {
startServer(processID, serverID, serverName, 0);
}

/** This attaches to a process running on the local machine and
starts a debug server, allowing remote machines to connect and
examine this process. */
@Deprecated(since="24", forRemoval=true)
public synchronized void startServer(int processID)
throws DebuggerException {
startServer(processID, null, null);
Expand All @@ -241,6 +244,7 @@ public synchronized void startServer(int processID)
core file. Uses supplied uniqueID to uniquely identify a specific
debuggee. Allows to specify the port number to which the RMI connector
is bound. If not specified a random available port is used. */
@Deprecated(since="24", forRemoval=true)
public synchronized void startServer(String javaExecutableName,
String coreFileName,
String serverID,
Expand All @@ -266,6 +270,7 @@ public synchronized void startServer(String javaExecutableName,
server, allowing remote machines to connect and examine this
core file. Uses supplied uniqueID to uniquely identify a specific
debuggee */
@Deprecated(since="24", forRemoval=true)
public synchronized void startServer(String javaExecutableName,
String coreFileName,
String serverID,
Expand All @@ -276,13 +281,15 @@ public synchronized void startServer(String javaExecutableName,
/** This opens a core file on the local machine and starts a debug
server, allowing remote machines to connect and examine this
core file. */
@Deprecated(since="24", forRemoval=true)
public synchronized void startServer(String javaExecutableName, String coreFileName)
throws DebuggerException {
startServer(javaExecutableName, coreFileName, null, null);
}

/** This may only be called on the server side after startServer()
has been called */
@Deprecated(since="24", forRemoval=true)
public synchronized boolean shutdownServer() throws DebuggerException {
if (!isServer) {
throw new DebuggerException("Should not call shutdownServer() for client configuration");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class SALauncher {
private static boolean launcherHelp() {
System.out.println(" clhsdb \tcommand line debugger");
System.out.println(" hsdb \tui debugger");
System.out.println(" debugd --help\tto get more information");
System.out.println(" debugd --help\tto get more information (deprecated)");
System.out.println(" jstack --help\tto get more information");
System.out.println(" jmap --help\tto get more information");
System.out.println(" jinfo --help\tto get more information");
Expand Down Expand Up @@ -71,12 +71,14 @@ private static boolean commonHelp(String mode, boolean canConnectToRemote) {
System.out.println(" --connect [<serverid>@]<host>[:registryport][/servername] To connect to a remote debug server (debugd).");
}
System.out.println();
if (canConnectToRemote) {
System.out.println(" The --connect option is deprecated and will be removed in a future release.");
}
System.out.println(" The --core and --exe options must be set together to give the core");
System.out.println(" file, and associated executable, to operate on. They can use");
System.out.println(" absolute or relative paths.");
System.out.println(" The --pid option can be set to operate on a live process.");
if (canConnectToRemote) {
System.out.println(" The --connect option can be set to connect to a debug server (debugd).");
System.out.println(" --core, --pid, and --connect are mutually exclusive.");
} else {
System.out.println(" --core and --pid are mutually exclusive.");
Expand All @@ -91,6 +93,7 @@ private static boolean commonHelp(String mode, boolean canConnectToRemote) {
}

private static boolean debugdHelp() {
System.out.println("WARNING: debugd is deprecated and will be removed in a future release.");
System.out.println(" --serverid <id> A unique identifier for this debugd server.");
System.out.println(" --servername <name> Instance name of debugd server.");
System.out.println(" --rmiport <port> Sets the port number to which the RMI connector is bound." +
Expand Down Expand Up @@ -213,6 +216,7 @@ private static String[] buildAttachArgs(Map<String, String> newArgMap,

newArgs.add(core);
} else if (connect != NO_REMOTE) {
System.err.println("WARNING: --connect is deprecated and will be removed in a future release.");
newArgs.add(connect);
}

Expand Down Expand Up @@ -361,7 +365,10 @@ private static void runJSNAP(String[] oldArgs) {
JSnap.main(buildAttachArgs(newArgMap, false));
}

@SuppressWarnings("removal")
private static void runDEBUGD(String[] args) {
System.err.println("WARNING: debugd is deprecated and will be removed in a future release.");

// By default SA agent classes prefer Windows process debugger
// to windbg debugger. SA expects special properties to be set
// to choose other debuggers. We will set those here before
Expand Down
16 changes: 13 additions & 3 deletions test/lib/jdk/test/lib/process/OutputAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public final class OutputAnalyzer {

private static final String jvmwarningmsg = ".* VM warning:.*";

private static final String deprecatedmsg = ".* VM warning:.* deprecated.*";
private static final String VM_DEPRECATED_MSG = ".* VM warning:.* deprecated.*";
private static final String OTHER_DEPRECATED_MSG = "^WARNING: .* is deprecated.*";

private static final String FATAL_ERROR_PAT = "# A fatal error has been detected.*";

Expand Down Expand Up @@ -182,7 +183,7 @@ public OutputAnalyzer stderrShouldBeEmptyIgnoreWarnings() {
* If stderr was not empty
*/
public OutputAnalyzer stderrShouldBeEmptyIgnoreDeprecatedWarnings() {
if (!getStderr().replaceAll(deprecatedmsg + "\\R", "").isEmpty()) {
if (!getStderrNoDeprecatedWarnings().isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stderr was not empty");
}
Expand Down Expand Up @@ -603,6 +604,15 @@ public String getStderr() {
return buffer.getStderr();
}

/**
* Get the contents of the stderr buffer, with known deprecation warning patterns removed
*
* @return stderr buffer, with known deprecation warnings removed
*/
public String getStderrNoDeprecatedWarnings() {
return getStderr().replaceAll(VM_DEPRECATED_MSG + "\\R", "").replaceAll(OTHER_DEPRECATED_MSG + "\\R", "");
}

/**
* Get the process exit value
*
Expand Down Expand Up @@ -689,7 +699,7 @@ public OutputAnalyzer stderrShouldMatchIgnoreVMWarnings(String pattern) {
* @throws RuntimeException If the pattern was not found
*/
public OutputAnalyzer stderrShouldMatchIgnoreDeprecatedWarnings(String pattern) {
String stderr = getStderr().replaceAll(deprecatedmsg + "\\R", "");
String stderr = getStderrNoDeprecatedWarnings();
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (!matcher.find()) {
reportDiagnosticSummary();
Expand Down

1 comment on commit 3352522

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.