LLDB Setup Guide
LLDB is a command-line debugging tool used for debugging on Android devices.
Follow the steps below to set up LLDB debugging with a QDC Android device:
- Install Android NDK on your Windows machine and set up environment variables.
- Start an interactive session and set up an SSH tunnel to the QDC device.
- Start lldb-server on the QDC device's interactive session.
- Run the LLDB client on your Windows machine to connect to the lldb-server on the QDC device.
1: Install Android NDK and set up environment variables
-
Download Android NDK version r29 from android-ndk-r29-windows.zip
-
Unzip to a folder, such as,
C:\Programs\AndroidSDK\android-ndk-r29 -
Locate the commands lldb.cmd and lldb-server:
C:\Programs\AndroidSDK\android-ndk-r29\toolchains\llvm\prebuilt\windows-x86_64\bin\lldb.cmd
C:\Programs\AndroidSDK\android-ndk-r29\toolchains\llvm\prebuilt\windows-x86_64\lib\clang\21\lib\linux\aarch64\lldb-server- Set up your environment variables:
ANDROID_ADB_SERVER_PORT=5037
ANDROID_PLATFORM_LOCAL_PORT=8901
ANDROID_PLATFORM_LOCAL_GDB_PORT=89022: Start an interactive session on a QDC Android device and set up an SSH tunnel
Start an interactive session. On your Windows interactive session browser screen, find the "Connect" button at the top right of the screen.
Set up an SSH tunnel to listen on 3 ports: 5037 / 8901 / 8902, following the guide when you click the "Connect" button:
- Identify the following values with your session details, before setting up the SSH tunnel:
| Value | Description | Where to find it |
|---|---|---|
{path_to_private_key} | Path to your SSH private key file | The file you created/uploaded when setting up the session |
{session_id} | Your session ID | Shown in the Connect dialog of your Interactive Session |
- On your Windows machine, open a PowerShell instance and start an SSH tunnel to listen on port 5037:
ssh -i {path_to_private_key} -L 5037:sa{session_id}.sa.svc.cluster.local:5037 -N sshtunnel@ssh.qdc.qualcomm.com- Open another PowerShell instance and listen on ports 8901 / 8902:
ssh -i {path_to_private_key} -L 8901:sa{session_id}.sa.svc.cluster.local:8901 -L 8902:sa{session_id}.sa.svc.cluster.local:8902 -N sshtunnel@ssh.qdc.qualcomm.com- Open another PowerShell instance and run the adb command to confirm all 3 listening ports are ready:
adb devicesExpected output:
List of devices attached
620427c7 deviceThen run,
adb forward --listExpected output:
620427c7 tcp:8901 tcp:8901
620427c7 tcp:8902 tcp:8902Device ID 620427c7 listed above is an example — your device ID will differ. Use the one shown in your adb devices output. This ID will be used in step 4 when running LLDB commands.
3: Start lldb-server on the QDC device's interactive session
- Push the lldb-server file onto the QDC device:
adb push "C:\Programs\AndroidSDK\android-ndk-r29\toolchains\llvm\prebuilt\windows-x86_64\lib\clang\21\lib\linux\aarch64\lldb-server" /data/local/tmp- Run lldb-server from the QDC Android device's ADB console embedded in the interactive session browser screen:
cd /data/local/tmp
chmod 744 ./lldb-server
./lldb-server platform --listen "*:8901" --server4: Run LLDB command to connect to lldb-server on the QDC device
- On your Windows machine, open a PowerShell instance and run the following LLDB command:
C:\Programs\AndroidSDK\android-ndk-r29\toolchains\llvm\prebuilt\windows-x86_64\bin\lldb.cmdThen run,
platform select remote-androidExpected output:
Platform: remote-android
Connected: noThen run,
platform connect connect://620427c7:8901Expected output:
Platform: remote-android
Triple: aarch64-unknown-linux-android
OS Version: 36 (6.12.38-android16-5-maybe-dirty-4k)
Hostname: localhost
Connected: yes
WorkingDir: /data/local/tmp
Kernel: #1 SMP PREEMPT Thu Jan 1 00:00:00 UTC 1970-
Confirm connection established
At the QDC Android device's ADB console, the following message is displayed:
Connection established