android / android/ndk

[BUG] LLDB 21.0.0 (ASFP Panda 2 Canary 2025.3.2) fails to attach to Android U (API 36) system processes with "SIGHUP received" and connection refusal

Open
#2,224 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

**Description**
LLDB 19.0.1 (bundled with Android Studio for Platform (ASFP) 2025.1.3.7) crashes immediately with a pthread_mutex_lock violation when attempting to debug system-level processes (e.g., surfaceflinger) on Android API 36 (Android U) devices. The crash prevents ASFP from establishing a debug connection, while LLDB 20.0.0 works flawlessly in the same environment.

**Environment**
Component Details
**_ASFP Version_** Narwhal 3 Feature Drop-2025.1.3.7
**_NDK Support Plugin_** Bundled version: 251.26094.121.2513.14007798
**_Target Device_** Qualcomm Canoe (Android API 36 / Android U, arm64-v8a)
**_LLDB Versions_** - Failing: 19.0.1 (ASFP-bundled, BuildID: b3a530ec6537146650e42be89f1089e9a3588460)
- Working: 20.0.0 (manual deployment, BuildID: b718bcaf8c198c82f3021447d943401e3ab5bd54)
**_NDK Version_** r27-beta1 (for lldb-server binary)
**_Host OS_** Ubuntu 20.04 LTS
**_Device Configuration_** - adbd running as root (adb root confirmed)
- SELinux: Permissive (adb shell getenforce verified)
- JDWP enabled: setprop persist.debug.dalvik.vm.jdwp.enabled 1

**Reproduction Steps**
1.Prepare Target Device:
Enable root access: adb root (confirm "restarting adbd as root")
Set SELinux to Permissive: adb shell setenforce 0
Enable JDWP: adb shell setprop persist.debug.dalvik.vm.jdwp.enabled 1
(Optional) Reboot to apply system properties
2.Launch ASFP: Open Android Studio for Platform 2025.1.3.7
3.Initiate Debugging:
Navigate to Run > Attach Android Process
Select the surfaceflinger system process
Start native (LLDB) debugging
4.Observe Failure: ASFP repeatedly attempts to connect to the LLDB server and fails

**Expected Behavior**
LLDB server (19.0.1) starts successfully on the device
ASFP establishes a stable connection to the LLDB server
Native debugging works (breakpoints, memory inspection, call stack visualization)

**Actual Behavior**
1.LLDB Server Crash:
ASFP pushes lldb-server (19.0.1) to /data/local/tmp and copies it to /data/data/surfaceflinger/lldb/bin/ (chmod 700)
ASFP executes start_lldb_server.sh with:
/data/data/surfaceflinger/lldb unix-abstract /surfaceflinger--1 platform-1772093286407.sock "lldb process:gdb-remote packets"
LLDB server crashes immediately with:
```
error: lost connection
lldb-server exiting...
FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xb400006f7a6117c0)
PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace.
SIGHUP received, exiting lldb-server...
Stack dump:
0. Program arguments: /data/data/surfaceflinger/lldb/bin/lldb-server platform --server --listen unix-abstract:///surfaceflinger--1/platform-1772093286407.sock --log-file /data/data/surfaceflinger/lldb/log/platform.log --log-channels "lldb process:gdb-remote packets"
```

2.Connection Failure:

ASFP debug console error:
Failed to connect platform (attempt 1 of 10) - retrying. Error was: Connection shut down by remote side while waiting for reply to initial handshake packet

adbd logs show socket connection failure:
2026-02-10 20:11:00.981 5790-5790 adbd E failed to connect to socket 'localabstract:/surfaceflinger--1/platform-1772093286407.sock': could not connect to localabstract address 'localabstract:/surfaceflinger--1/platform-1772093286407.sock'

3.No Crash Artifacts:

No core dump generated (even with setprop debug.debuggerd.wait_for_debugger true)
No additional crash traces in logcat or dmesg
Socket is created (verified via adb shell netstat -an | grep surfaceflinger) but server crashes before accepting connections

**Troubleshooting Attempts**
Debuggerd Configuration: set debug.debuggerd.wait_for_debugger true to capture core dumps → no crash reproduce with lldbclient.py
LLDB Version Comparison:
LLDB 19.0.1 (ASFP-bundled): Consistent crash
LLDB 20.0.0 (manual deployment via ./development/scripts/lldbclient.py -p 2087): Works perfectly (can attach/debug surfaceflinger without issues)
Permission Verification: Confirmed /data/data/surfaceflinger/lldb/ and binaries have correct permissions (700 for executables)

**Additional Context**
The working LLDB 20.0.0 binary details:
```
adb shell /data/local/tmp/arm64-lldb-server v
lldb version 20.0.0 (/mnt/disks/build-disk/src/android/llvm-r547379-release/out/llvm-project/lldb revision b718bcaf8c198c82f3021447d943401e3ab5bd54)
clang revision b718bcaf8c198c82f3021447d943401e3ab5bd54
llvm revision b718bcaf8c198c82f3021447d943401e3ab5bd54
```

LLDB Server Binary Info:

```
adb shell file /data/data/surfaceflinger/lldb/bin/lldb-server
/data/data/surfaceflinger/lldb/bin/lldb-server: ELF executable, 64-bit LSB arm64, static, for Android 30, built by NDK r27-beta1 (11883388), BuildID=a1e347d5e636857916274b823cf3f8c05efc3732, not stripped
```

**Impact**
Blocks native debugging of critical system processes (surfaceflinger, zygote, system_server) on Android API 36
Forces reliance on manual LLDB scripting (lldbclient.py) which lacks ASFP’s GUI productivity features (visual breakpoints, variable inspection)
Significantly impedes platform-level development/debugging workflows for Android U (API 36)

**Note**
This issue is specific to LLDB 19.0.1 (NDK r27-beta1) and does not occur with LLDB 20.0.0. The issue is reproducible on Android API 36 (Android U) devices with the described configuration.

**Affected Versions**
NDK r27 (specifically r27-beta1)
Android Studio for Platform Narwhal 3 Feature Drop-2025.1.3.7

**Logs**
ASFP Log: [idea.log](https://github.com/user-attachments/files/25570403/idea.log) (full debugging session logs)
LLDB Server Logs: [log.zip](https://github.com/user-attachments/files/25570413/log.zip) (from /data/data/surfaceflinger/lldb/log/ – includes platform-stdout.log, platform.log, gdb-server.log)

### I am using a supported NDK

- [x] I have checked and the NDK I'm using is not currently supported

### Affected versions

r27

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the attached ASFP and LLDB server logs, then compare the failing lldb-server 19.0.1 with the working 20.0.0 binary. Reproduce the surfaceflinger attach flow using start_lldb_server.sh and lldbclient.py on an Android API 36 device. Done means the affected server remains running and ASFP completes its platform handshake without the mutex or SIGHUP failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.