Skip to content

Commit

Permalink
Update debugger params
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Sep 6, 2023
1 parent 23473a3 commit d46667e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/src/main/java/be/mygod/librootkotlinx/AppProcess.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,15 @@ object AppProcess {
/**
* Compute the shell script line that exec into the corresponding [clazz].
* Extra params can be simply appended to the string.
*
* See also: https://developer.android.com/ndk/guides/wrap-script#debugging_when_using_wrapsh
*/
fun launchString(packageCodePath: String, clazz: String, appProcess: String, niceName: String? = null): String {
val debugParams = if (Debug.isDebuggerConnected()) when (Build.VERSION.SDK_INT) {
in 29..Int.MAX_VALUE -> "-XjdwpProvider:adbconnection"
in 29..Int.MAX_VALUE -> "-XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y"
28 -> "-XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y -Xcompiler-option --debuggable"
else -> "-Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable"
27 -> "-Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable"
else -> ""
} else ""
val extraParams = if (niceName != null) " --nice-name=$niceName" else ""
return "CLASSPATH=$packageCodePath exec $appProcess $debugParams /system/bin$extraParams $clazz"
Expand Down

0 comments on commit d46667e

Please sign in to comment.