How to remote-debug Android native code with RustRover (lldb-server gdbserver mode)
1. Start lldb-server on Android (gdbserver mode)
-
Make sure your app is installed and running on the device/emulator.
-
Find the app PID (example):
adb shell ps | grep com.example.app # note the PID, e.g. 27072 -
Use a helper script like this (adapt paths and APP/ABI/PID):
#!/usr/bin/env bash export APP=com.example.app export ABI=i386 export PID=27072 # replace with real PID function start_adb() { # Push tools (adjust NDK path if needed) adb push "$HOME/Android/Sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/19/lib/linux/$ABI"* /data/local/tmp/tools # Copy lldb-server into app data adb shell "run-as ${APP} cp /data/local/tmp/lldb-server /data/data/${APP}/lldb-server" # Forward port 5039 from host to device adb forward tcp:5039 tcp:5039 # IMPORTANT: use gdbserver mode (NOT platform mode) adb shell "run-as ${APP} /data/data/${APP}/lldb-server gdbserver *:5039 --attach ${PID}" } start_adb -
Check that the script completes without error and that your app process remains running (now under
lldb-servercontrol).
Key rule: do not use lldb-server platform --listen ... --server; always use lldb-server gdbserver ....
2. Create a Remote Debug configuration in RustRover
- In RustRover, go to Run | Edit Configurations….
- Click + → choose Remote Debug.
- Select LLDB as the debugger (bundled LLDB is usually fine).
Fill in:
-
process connect url:
connect://localhost:5039 -
Symbol file: local path to the debug build of the binary/library running on the device (for example:
.../target/i686-linux-android/debug/libmy_native.so).
Optionally (recommended in cross‑platform setups):
- Sysroot: local path with target libraries and debug symbols (from your NDK / sysroot).
- Path mappings:
- Remote:
/data/data/com.example.app/lib/→ Local:/path/to/project/target/i686-linux-android/debug/ - Add others as needed so source paths line up.
- Remote:
3. Run the debug session
- On Android: run your
start_adbscript again whenever you restart the app or device. - In RustRover:
- Open the project, place breakpoints in your native code.
- Select the Remote Debug configuration.
- Click Debug.
If everything is configured correctly, RustRover will:
- connect to
lldb-server gdbserveron the device, - stop at the entry point or your first breakpoint,
- let you step through and inspect variables as if the code were local.
4. Quick troubleshooting checklist
If you see:
- "No stop reply packet was received"
→ Most often means you started
lldb-serverin platform mode instead of gdbserver mode. Re‑check the script: it must saylldb-server gdbserver .... - Breakpoints never hit
- Ensure the Symbol file points to the correct debug binary (not stripped).
- Verify Path mappings match remote vs local paths.
- Make sure you rebuilt and re‑deployed the same binary that RustRover is using for symbols.
- Connection fails immediately
- Confirm
adb forward tcp:5039 tcp:5039is in effect. - Verify no firewall or other process is blocking port 5039.
- Make sure the device is visible via
adb devices.
- Confirm
Related articles
[Guide]: Setup Remote-debugging Android native code with RustRover + lldb-server (gdbserver mode) Standalone
Please sign in to leave a comment.