summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKalle Lindström <karl.lindstrom@mullvad.net>2025-07-24 14:21:52 +0200
committerKalle Lindström <karl.lindstrom@mullvad.net>2025-07-24 14:21:52 +0200
commita7c5ab43de135c4a342eb67dea1582eb29fd17be (patch)
treecb948a7cc4b802a7784886f167ab2dac2348e87b
parent75fb47db0e7d0bf98e3add90865c238c049d565e (diff)
parenta7b764913235c236775ff326487bfbf87ec9b3a6 (diff)
downloadmullvadvpn-a7c5ab43de135c4a342eb67dea1582eb29fd17be.tar.xz
mullvadvpn-a7c5ab43de135c4a342eb67dea1582eb29fd17be.zip
Merge branch 'update-android-native-debug-instructions'
-rw-r--r--android/app/build.gradle.kts5
-rw-r--r--android/docs/DebugInstructions.md23
-rw-r--r--android/gradle.properties4
3 files changed, 23 insertions, 9 deletions
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index 24172279fc..63c2e477ff 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -279,7 +279,10 @@ cargo {
add("--package=mullvad-jni")
add("--locked")
}
- exec = { spec, _ -> spec.environment("RUSTFLAGS", generateRemapArguments()) }
+ exec = { spec, _ ->
+ if (getBooleanProperty("mullvad.app.build.replaceRustPathPrefix"))
+ spec.environment("RUSTFLAGS", generateRemapArguments())
+ }
}
tasks.register<Exec>("cargoClean") {
diff --git a/android/docs/DebugInstructions.md b/android/docs/DebugInstructions.md
index 9faa5237b2..e76fe1fbc5 100644
--- a/android/docs/DebugInstructions.md
+++ b/android/docs/DebugInstructions.md
@@ -1,13 +1,20 @@
## Debugging the native libraries in Android Studio with LLDB
-1. In Android Studio, go to `Run -> Edit configurations...`
-2. Make sure the `app` configuration is selected.
-3. In the `Debugger` tab, select `Dual (Java + Native)`
-4. Start debugging the app as usual from Android Studio. The app should now stop on a SIGURG signal.
-5. Select the `LLDB` tab in the debugger. Now you can set breakpoints etc, e.g.
- `breakpoint set -n open_tun`
-6. Before continuing run `pro hand -p true -s false SIGURG`
-7. Click `Resume Program` and the app will resume until the breakpoint is hit.
+1. In `gradle.properties` or in your `$HOME/.gradle/gradle.properties` file set the following:
+
+```
+mullvad.app.build.keepDebugSymbols=true
+mullvad.app.build.replaceRustPathPrefix=false
+```
+
+2. In Android Studio, go to `Run -> Edit configurations...`
+3. Make sure the `app` configuration is selected.
+4. In the `Debugger` tab, select `Dual (Java + Native)`
+5. Start debugging the app as usual from Android Studio.
+6. Click the `View Breakpoints...` icon in the debug view.
+7. Click `+ -> Symbolic Breakpoints` and enter a function name in the `Symbol name` field.
+
+Android Studio should now break on the function you selected.
NOTE: When running LLDB, Android Studio can sometimes get into a state where it will try to
connect to the debugger when running the app normally, which blocks the app from starting.
diff --git a/android/gradle.properties b/android/gradle.properties
index ffb8ff476b..8ea46b2cab 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -32,6 +32,10 @@ mullvad.app.build.cargo.cleanBuild=true
# Keep debug symbols in debug builds, this will cause the debug artifacts
# to be substantially larger.
mullvad.app.build.keepDebugSymbols=false
+# Replace source file path prefixes in the Rust build artifacts with fixed values.
+# This must be set to true for the app build to be reprodcible, but should be set to false
+# when debugging to the Rust native libs from Android Studio.
+mullvad.app.build.replaceRustPathPrefix=true
# Enable/Disable boringtun
mullvad.app.build.boringtun.enable=false