Skip to content

Ghidra is a software reverse engineering (SRE) framework

Updated remote vm debug command-line options

dragonmacherca2a6bbb0a18
diff --git a/Ghidra/RuntimeScripts/Linux/support/launch.sh b/Ghidra/RuntimeScripts/Linux/support/launch.sh
index b0837b2df3..8fb54aa451 100755
--- a/Ghidra/RuntimeScripts/Linux/support/launch.sh
+++ b/Ghidra/RuntimeScripts/Linux/support/launch.sh
@@ -151,12 +151,10 @@ if [ "${MODE}" = "debug" ] || [ "${MODE}" = "debug-suspend" ]; then
if [ "${MODE}" = "debug-suspend" ]; then
SUSPEND=y
fi
-
- VMARG_LIST+=" -Xdebug"
- VMARG_LIST+=" -Xnoagent"
- VMARG_LIST+=" -Djava.compiler=NONE"
+
VMARG_LIST+=" -Dlog4j.configuration=\"${DEBUG_LOG4J}\""
- VMARG_LIST+=" -Xrunjdwp:transport=dt_socket,server=y,suspend=${SUSPEND},address=${DEBUG_ADDRESS}"
+ VMARG_LIST+=" -agentlib:jdwp=transport=dt_socket,server=y,suspend=${SUSPEND},address=${DEBUG_ADDRESS}"
+
elif [ "${MODE}" = "fg" ]; then
:
diff --git a/Ghidra/RuntimeScripts/Windows/server/ghidraSvr.bat b/Ghidra/RuntimeScripts/Windows/server/ghidraSvr.bat
index 09a4979711..5c84319168 100644
--- a/Ghidra/RuntimeScripts/Windows/server/ghidraSvr.bat
+++ b/Ghidra/RuntimeScripts/Windows/server/ghidraSvr.bat
@@ -123,7 +123,7 @@ if "%JAVA_HOME%" == "" (
rem reestablish JAVA path based upon final JAVA_HOME
set "JAVA=%JAVA_HOME%\bin\java.exe"
-:: set DEBUG=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:18888
+:: set DEBUG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:18888
if "%OPTION%"=="console" (
start "%APP_LONG_NAME%" "%JAVA%" %DEBUG% -jar "%WRAPPER_HOME%/wrapper.jar" -c "%WRAPPER_CONF%"
diff --git a/Ghidra/RuntimeScripts/Windows/support/launch.bat b/Ghidra/RuntimeScripts/Windows/support/launch.bat
index 5621f4e895..98160e6c33 100644
--- a/Ghidra/RuntimeScripts/Windows/support/launch.bat
+++ b/Ghidra/RuntimeScripts/Windows/support/launch.bat
@@ -136,11 +136,8 @@ if "%DEBUG%"=="y" (
set DEBUG_ADDRESS=127.0.0.1:18001
)
- set VMARG_LIST=!VMARG_LIST! -Xdebug
- set VMARG_LIST=!VMARG_LIST! -Xnoagent
- set VMARG_LIST=!VMARG_LIST! -Djava.compiler=NONE
- set VMARG_LIST=!VMARG_LIST! -Dlog4j.configuration="!DEBUG_LOG4J!"
- set VMARG_LIST=!VMARG_LIST! -Xrunjdwp:transport=dt_socket,server=y,suspend=!SUSPEND!,address=!DEBUG_ADDRESS!
+ set VMARG_LIST=!VMARG_LIST! -Dlog4j.configuration="!DEBUG_LOG4J!"
+ set VMARG_LIST=!VMARG_LIST! -agentlib:jdwp=transport=dt_socket,server=y,suspend=!SUSPEND!,address=!DEBUG_ADDRESS!
goto continue3
)
diff --git a/gradle/javaTestProject.gradle b/gradle/javaTestProject.gradle
index 800cc4aed5..525ce3e32b 100644
--- a/gradle/javaTestProject.gradle
+++ b/gradle/javaTestProject.gradle
@@ -179,10 +179,18 @@ def initTestJVM(Task task, String rootDirName) {
'-Djdk.attach.allowAttachSelf',
'-javaagent:' + jmockitPath,
'-DLock.DEBUG=true',
- '-Xdebug',
- '-Xnoagent',
- '-Djava.compiler=NONE',
- '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=' + debugPort
+ '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=' + debugPort
+
+
+ // Note: modern remote debug invocation;
+ // -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
+
+ //
+ // We removed these lines, which should not be needed in modern JVMs
+ // -Xdebug
+ // -Xnoagent
+ // -Djava.compiler=NONE
+ // -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
}
}
/*********************************************************************************
diff --git a/gradle/root/test.gradle b/gradle/root/test.gradle
index 11d20483fd..1284ec7229 100644
--- a/gradle/root/test.gradle
+++ b/gradle/root/test.gradle
@@ -347,10 +347,18 @@ def initTestJVM(Task task, String rootDirName) {
'-Djdk.attach.allowAttachSelf',
'-javaagent:' + jmockitPath,
'-DLock.DEBUG=true',
- '-Xdebug',
- '-Xnoagent',
- '-Djava.compiler=NONE',
- '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=' + debugPort
+ '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=' + debugPort
+
+
+ // Note: modern remote debug invocation;
+ // -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
+
+ //
+ // We removed these lines, which should not be needed in modern JVMs
+ // -Xdebug
+ // -Xnoagent
+ // -Djava.compiler=NONE
+ // -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
}
}