Skip to content

Commit

Permalink
8227229: Deprecate the launcher -Xdebug/-debug flags that have not do…
Browse files Browse the repository at this point in the history
…ne anything since Java 6

Reviewed-by: alanb, cjplummer, dholmes
  • Loading branch information
jaikiran committed Jul 21, 2023
1 parent 9e4fc56 commit 842d632
Show file tree
Hide file tree
Showing 25 changed files with 32 additions and 41 deletions.
2 changes: 1 addition & 1 deletion make/ide/netbeans/langtools/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
</nbjpdastart>
<property
name="@{jpda.jvmargs.property}"
value="-Xdebug -Xrunjdwp:transport=dt_socket,address=${jpda.address}"
value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"
/>
</sequential>
</macrodef>
Expand Down
4 changes: 1 addition & 3 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ char* Arguments::_java_command = nullptr;
SystemProperty* Arguments::_system_properties = nullptr;
size_t Arguments::_conservative_max_heap_alignment = 0;
Arguments::Mode Arguments::_mode = _mixed;
bool Arguments::_xdebug_mode = false;
const char* Arguments::_java_vendor_url_bug = nullptr;
const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
bool Arguments::_sun_java_launcher_is_altjvm = false;
Expand Down Expand Up @@ -2655,8 +2654,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
}
// -Xdebug
} else if (match_option(option, "-Xdebug")) {
// note this flag has been used, then ignore
set_xdebug_mode(true);
warning("Option -Xdebug was deprecated in JDK 22 and will likely be removed in a future release.");
// -Xnoagent
} else if (match_option(option, "-Xnoagent")) {
warning("Option -Xnoagent was deprecated in JDK 22 and will likely be removed in a future release.");
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/runtime/arguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@ class Arguments : AllStatic {
static Mode _mode;
static void set_mode_flags(Mode mode);

// -Xdebug flag
static bool _xdebug_mode;
static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; }
static bool xdebug_mode() { return _xdebug_mode; }

// preview features
static bool _enable_preview;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ java.launcher.X.usage=\n\
\ append to end of bootstrap class path\n\
\ -Xcheck:jni perform additional checks for JNI functions\n\
\ -Xcomp forces compilation of methods on first invocation\n\
\ -Xdebug does nothing. Provided for backward compatibility.\n\
\ -Xdebug does nothing; deprecated for removal in a future release.\n\
\ -Xdiag show additional diagnostic messages\n\
\ -Xfuture enable strictest checks, anticipating future default.\n\
\ This option is deprecated and may be removed in a\n\
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/man/java.1
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,7 @@ Testing mode to exercise JIT compilers.
This option should not be used in production environments.
.TP
\f[V]-Xdebug\f[R]
Does nothing.
Provided for backward compatibility.
Does nothing; deprecated for removal in a future release.
.TP
\f[V]-Xdiag\f[R]
Shows additional diagnostic messages.
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/native/libjli/java.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ ParseArguments(int *pargc, char ***pargv,
} else if (JLI_StrCmp(arg, "-tm") == 0) {
AddOption("-Xtm", NULL);
} else if (JLI_StrCmp(arg, "-debug") == 0) {
AddOption("-Xdebug", NULL);
JLI_ReportErrorMessage(ARG_DEPRECATED, "-debug");
} else if (JLI_StrCmp(arg, "-noclassgc") == 0) {
AddOption("-Xnoclassgc", NULL);
} else if (JLI_StrCmp(arg, "-Xfuture") == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ static boolean hasWhitespace(String string) {

String command = exePath + ' ' +
options + ' ' +
"-Xdebug " +
"-Xrunjdwp:" + xrun + ' ' +
mainClassAndArgs;

Expand Down
6 changes: 3 additions & 3 deletions test/hotspot/jtreg/runtime/6294277/SourceDebugExtension.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,8 +25,8 @@
* @test
* @bug 6294277
* @requires vm.jvmti
* @summary java -Xdebug crashes on SourceDebugExtension attribute larger than 64K
* @run main/othervm -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n SourceDebugExtension
* @summary verify that the JVM doesn't crash when SourceDebugExtension attribute is larger than 64K
* @run main/othervm -Xrunjdwp:transport=dt_socket,server=y,suspend=n SourceDebugExtension
*/
import java.io.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private int runIt(String argv[], PrintStream out) {
String java = argHandler.getLaunchExecPath()
+ " " + argHandler.getLaunchOptions();
String cmd = java
+ " -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=0"
+ " -Xrunjdwp:transport=dt_socket,server=y,address=0"
+ " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private int runIt(String argv[], PrintStream out) {
String java = argHandler.getLaunchExecPath()
+ " " + argHandler.getLaunchOptions();
String cmd = java +
" -Xdebug -Xrunjdwp:transport=dt_shmem,server=y,address=" +
" -Xrunjdwp:transport=dt_shmem,server=y,address=" +
name + " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private int runIt(String argv[], PrintStream out) {
String java = argHandler.getLaunchExecPath()
+ " " + argHandler.getLaunchOptions();
String cmd = java
+ " -Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0"
+ " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0"
+ " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private Map<String,? extends com.sun.jdi.connect.Connector.Argument> setupConnec
Connector.Argument a = (Connector.Argument) cava[i];
if (a.name().equals("command"))
a.setValue(java +
" -Xdebug -Xrunjdwp:suspend=y,transport=" +
" -Xrunjdwp:suspend=y,transport=" +
TRANSPORT_NAME +
",address=" + host + ":" + port +
" " + DEBUGEE_CLASS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private Map<java.lang.String,? extends com.sun.jdi.connect.Connector.Argument> s
Connector.Argument a = (Connector.Argument) cava[i];
if (a.name().equals("command"))
a.setValue(java +
" -Xdebug -Xrunjdwp:suspend=y,transport=" +
" -Xrunjdwp:suspend=y,transport=" +
TRANSPORT_NAME +
",address=" + name +
" " + DEBUGEE_CLASS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private int runIt(String argv[], PrintStream out) {
String java = argHandler.getLaunchExecPath()
+ " " + argHandler.getLaunchOptions();
String cmd = java +
" -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=" +
" -Xrunjdwp:transport=dt_socket,server=n,address=" +
connAddr + " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private int runIt(String argv[], PrintStream out) {
String java = argHandler.getLaunchExecPath()
+ " " + argHandler.getLaunchOptions();
String cmd = java +
" -Xdebug -Xrunjdwp:transport=dt_shmem,server=n,address=" +
" -Xrunjdwp:transport=dt_shmem,server=n,address=" +
connAddr + " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private int runIt(String argv[], PrintStream out) {
String java = argHandler.getLaunchExecPath()
+ " " + argHandler.getLaunchOptions();
String cmd = java +
" -Xdebug -Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=" +
" -Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=" +
connAddr + " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private int runIt(String argv[], PrintStream out) {
+ " " + argHandler.getLaunchOptions();

String cmd = java +
" -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=" +
" -Xrunjdwp:transport=dt_socket,server=n,address=" +
addr + " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private int runIt(String argv[], PrintStream out) {
+ " " + argHandler.getLaunchOptions();

String cmd = java +
" -Xdebug -Xrunjdwp:transport=dt_shmem,server=n,address=" +
" -Xrunjdwp:transport=dt_shmem,server=n,address=" +
addr + " " + DEBUGEE_CLASS;

Binder binder = new Binder(argHandler, log);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -131,7 +131,7 @@ private int runThis (String argv[], PrintStream out) {

String targetJava = argsHandler.getLaunchExecPath()
+ " " + argsHandler.getLaunchOptions();
String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" +
String commandToRun = targetJava + " -Xrunjdwp:transport=dt_socket,address=" +
testTransportServiceListenKey.address() +
// Addind "suspend=n' option helps avoid debugee hang. See 6803636.
",suspend=n" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -136,7 +136,7 @@ private int runThis (String argv[], PrintStream out) {

String targetJava = argsHandler.getLaunchExecPath()
+ " " + argsHandler.getLaunchOptions();
String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" +
String commandToRun = targetJava + " -Xrunjdwp:transport=dt_socket,address=" +
testTransportServiceListenKey.address() + " " + targetVMClassName;

Binder binder = new Binder(argsHandler, logHandler);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -139,7 +139,7 @@ private int runThis (String argv[], PrintStream out) {

String targetJava = argsHandler.getLaunchExecPath()
+ " " + argsHandler.getLaunchOptions();
String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" +
String commandToRun = targetJava + " -Xrunjdwp:transport=dt_socket,address=" +
testTransportServiceListenKey.address() + " " + targetVMClassName;

Binder binder = new Binder(argsHandler, logHandler);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -135,7 +135,7 @@ private int runThis (String argv[], PrintStream out) {

String targetJava = argsHandler.getLaunchExecPath()
+ " " + argsHandler.getLaunchOptions();
String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" +
String commandToRun = targetJava + " -Xrunjdwp:transport=dt_socket,address=" +
testTransportServiceListenKey.address() + " " + targetVMClassName;

Binder binder = new Binder(argsHandler, logHandler);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -144,7 +144,7 @@ public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments

String exe = System.getProperty("java.home") + File.separator + "bin" +
File.separator + "java";
String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
String cmd = exe + " -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
key.address() +
" -classpath " + System.getProperty("test.classes") +
" " + className;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -90,7 +90,7 @@ public void start() {
String javaPath = System.getProperty("java.home", "");
String cmd = javaPath + File.separator + "bin" + File.separator
+ "java -cp " + System.getProperty("test.classes", ".") +
//+ "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 "
//+ "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 "
" THTMLConsumer"
//+ stFormats
;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -79,7 +79,7 @@ public void windowClosing(WindowEvent e) {


ProcessResults processResults =
// ProcessCommunicator.executeChildProcess(this.getClass()," -cp \"C:\\Documents and Settings\\df153228\\IdeaProjects\\UnicodeTestDebug\\out\\production\\UnicodeTestDebug\" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 ", args);
// ProcessCommunicator.executeChildProcess(this.getClass()," -cp \"C:\\Documents and Settings\\df153228\\IdeaProjects\\UnicodeTestDebug\\out\\production\\UnicodeTestDebug\" -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 ", args);
ProcessCommunicator.executeChildProcess(this.getClass(), args);

verifyTestResults(processResults);
Expand Down

1 comment on commit 842d632

@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.