<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[lldb][Android] Fix platform process list regression (#164333)</title>
<updated>2025-11-11T15:41:21+00:00</updated>
<author>
<name>Chad Smith</name>
<email>cssmith@fb.com</email>
</author>
<published>2025-11-11T15:41:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f8cb6cd989c8159ede0b454a433dd2b5632c1cb6'/>
<id>f8cb6cd989c8159ede0b454a433dd2b5632c1cb6</id>
<content type='text'>
## Summary

Fix `FindProcesses` to respect Android's `hidepid=2` security model and
enable name matching for Android apps.

## Problem

1. Called `adb shell pidof` or `adb shell ps` directly, bypassing
Android's process visibility restrictions
2. Name matching failed for Android apps - searched for
`com.example.myapp` but GDB Remote Protocol reports `app_process64`

Android apps fork from Zygote, so `/proc/PID/exe` points to
`app_process64` for all apps. The actual package name is only in
`/proc/PID/cmdline`. The previous implementation applied name filters
without supplementing with cmdline, so searches failed.

## Fix

- Delegate to lldb-server via GDB Remote Protocol (respects `hidepid=2`)
- Get all visible processes, supplement zygote/app_process entries with
cmdline, then apply name matching
- Only fetch cmdline for zygote apps (performance), parallelize with
`xargs -P 8`
- Remove redundant code (GDB Remote Protocol already provides GID/arch)

## Test Results

### Before this fix:

```
(lldb) platform process list
error: no processes were found on the "remote-android" platform

(lldb) platform process list -n com.example.hellojni
1 matching process was found on "remote-android"
PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
5276   359    u0_a192                                   com.example.hellojni
                         ^^^^^^^^ Missing triple!
```

### After this fix:

```
(lldb) platform process list
PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
1      0      root       aarch64-unknown-linux-android  init
2      0      root                                      [kthreadd]
359    1      system     aarch64-unknown-linux-android  app_process64
5276   359    u0_a192    aarch64-unknown-linux-android  com.example.hellojni
5357   5355   u0_a192    aarch64-unknown-linux-android  sh
5377   5370   u0_a192    aarch64-unknown-linux-android  lldb-server
                          ^^^^^^^^ User-space processes now have triples!

(lldb) platform process list -n com.example.hellojni
1 matching process was found on "remote-android"
PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
5276   359    u0_a192    aarch64-unknown-linux-android  com.example.hellojni


(lldb) process attach -n com.example.hellojni
Process 5276 stopped
* thread #1, name = 'example.hellojni', stop reason = signal SIGSTOP
```

## Test Plan

With an Android device/emulator connected:

1. Start lldb-server on device:
```bash
adb push lldb-server /data/local/tmp/
adb shell chmod +x /data/local/tmp/lldb-server
adb shell /data/local/tmp/lldb-server platform  --listen 127.0.0.1:9500 --server
```

2. Connect from LLDB:
```
(lldb) platform select remote-android
(lldb) platform connect connect://127.0.0.1:9500
(lldb) platform process list
```

3. Verify:
- `platform process list` returns all processes with triple information
- `platform process list -n com.example.app` finds Android apps by
package name
- `process attach -n com.example.app` successfully attaches to Android
apps

## Impact

Restores `platform process list` on Android with architecture
information and package name lookup. All name matching modes now work
correctly.

Fixes https://github.com/llvm/llvm-project/issues/164192</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
## Summary

Fix `FindProcesses` to respect Android's `hidepid=2` security model and
enable name matching for Android apps.

## Problem

1. Called `adb shell pidof` or `adb shell ps` directly, bypassing
Android's process visibility restrictions
2. Name matching failed for Android apps - searched for
`com.example.myapp` but GDB Remote Protocol reports `app_process64`

Android apps fork from Zygote, so `/proc/PID/exe` points to
`app_process64` for all apps. The actual package name is only in
`/proc/PID/cmdline`. The previous implementation applied name filters
without supplementing with cmdline, so searches failed.

## Fix

- Delegate to lldb-server via GDB Remote Protocol (respects `hidepid=2`)
- Get all visible processes, supplement zygote/app_process entries with
cmdline, then apply name matching
- Only fetch cmdline for zygote apps (performance), parallelize with
`xargs -P 8`
- Remove redundant code (GDB Remote Protocol already provides GID/arch)

## Test Results

### Before this fix:

```
(lldb) platform process list
error: no processes were found on the "remote-android" platform

(lldb) platform process list -n com.example.hellojni
1 matching process was found on "remote-android"
PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
5276   359    u0_a192                                   com.example.hellojni
                         ^^^^^^^^ Missing triple!
```

### After this fix:

```
(lldb) platform process list
PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
1      0      root       aarch64-unknown-linux-android  init
2      0      root                                      [kthreadd]
359    1      system     aarch64-unknown-linux-android  app_process64
5276   359    u0_a192    aarch64-unknown-linux-android  com.example.hellojni
5357   5355   u0_a192    aarch64-unknown-linux-android  sh
5377   5370   u0_a192    aarch64-unknown-linux-android  lldb-server
                          ^^^^^^^^ User-space processes now have triples!

(lldb) platform process list -n com.example.hellojni
1 matching process was found on "remote-android"
PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
5276   359    u0_a192    aarch64-unknown-linux-android  com.example.hellojni


(lldb) process attach -n com.example.hellojni
Process 5276 stopped
* thread #1, name = 'example.hellojni', stop reason = signal SIGSTOP
```

## Test Plan

With an Android device/emulator connected:

1. Start lldb-server on device:
```bash
adb push lldb-server /data/local/tmp/
adb shell chmod +x /data/local/tmp/lldb-server
adb shell /data/local/tmp/lldb-server platform  --listen 127.0.0.1:9500 --server
```

2. Connect from LLDB:
```
(lldb) platform select remote-android
(lldb) platform connect connect://127.0.0.1:9500
(lldb) platform process list
```

3. Verify:
- `platform process list` returns all processes with triple information
- `platform process list -n com.example.app` finds Android apps by
package name
- `process attach -n com.example.app` successfully attaches to Android
apps

## Impact

Restores `platform process list` on Android with architecture
information and package name lookup. All name matching modes now work
correctly.

Fixes https://github.com/llvm/llvm-project/issues/164192</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] fix Android host build failure: use of undeclared identifier 'HostInfo' (#163075)</title>
<updated>2025-10-13T16:08:50+00:00</updated>
<author>
<name>Chad Smith</name>
<email>cssmith@fb.com</email>
</author>
<published>2025-10-13T16:08:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=55b0d143d654d9f6c0bc515eaf5a66980a151a4d'/>
<id>55b0d143d654d9f6c0bc515eaf5a66980a151a4d</id>
<content type='text'>
This should fix
https://github.com/llvm/llvm-project/issues/163050#issuecomment-3394533840

Thank you for tagging me @trcrsired!

```
[105/1932] Building CXX object tools/lldb/source/Plugins/Platfor...d/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.
FAILED: [code=1] tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o 
/home/cqwrteur/toolchains/llvm/x86_64-linux-gnu/llvm/bin/clang++ --target=aarch64-linux-android30 --sysroot=/home/cqwrteur/toolchains/llvm/aarch64-linux-android30/aarch64-linux-android30 -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/source/Plugins/Platform/Android -I/home/cqwrteur/toolchains_build/llvm-project/lldb/source/Plugins/Platform/Android -I/home/cqwrteur/toolchains_build/llvm-project/lldb/include -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/include -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/include -I/home/cqwrteur/toolchains_build/llvm-project/llvm/include -I/home/cqwrteur/toolchains_build/llvm-project/llvm/../clang/include -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/../clang/include -I/home/cqwrteur/toolchains_build/llvm-project/lldb/source -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/source -isystem /home/cqwrteur/toolchains/llvm/aarch64-linux-android30/aarch64-linux-android30/usr/include/libxml2 -fuse-ld=lld -fuse-lipo=llvm-lipo -flto=thin -Wno-unused-command-line-argument -rtlib=compiler-rt -stdlib=libc++ --unwindlib=libunwind -lc++abi -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -flto=thin -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17 -fPIC  -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o -MF tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o.d -o tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o -c /home/cqwrteur/toolchains_build/llvm-project/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
/home/cqwrteur/toolchains_build/llvm-project/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp:66:48: error: use of undeclared identifier 'HostInfo'
   66 |     default_platform_sp-&gt;SetSystemArchitecture(HostInfo::GetArchitecture());
      |                                                ^
1 error generated.
[118/1932] Linking CXX shared library lib/libLLVMAnalysis.so.22.0git
ninja: build stopped: subcommand failed.
llvm: Ninja build failed for aarch64-linux-android30
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This should fix
https://github.com/llvm/llvm-project/issues/163050#issuecomment-3394533840

Thank you for tagging me @trcrsired!

```
[105/1932] Building CXX object tools/lldb/source/Plugins/Platfor...d/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.
FAILED: [code=1] tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o 
/home/cqwrteur/toolchains/llvm/x86_64-linux-gnu/llvm/bin/clang++ --target=aarch64-linux-android30 --sysroot=/home/cqwrteur/toolchains/llvm/aarch64-linux-android30/aarch64-linux-android30 -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/source/Plugins/Platform/Android -I/home/cqwrteur/toolchains_build/llvm-project/lldb/source/Plugins/Platform/Android -I/home/cqwrteur/toolchains_build/llvm-project/lldb/include -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/include -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/include -I/home/cqwrteur/toolchains_build/llvm-project/llvm/include -I/home/cqwrteur/toolchains_build/llvm-project/llvm/../clang/include -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/../clang/include -I/home/cqwrteur/toolchains_build/llvm-project/lldb/source -I/home/cqwrteur/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/aarch64-linux-android30/llvm/tools/lldb/source -isystem /home/cqwrteur/toolchains/llvm/aarch64-linux-android30/aarch64-linux-android30/usr/include/libxml2 -fuse-ld=lld -fuse-lipo=llvm-lipo -flto=thin -Wno-unused-command-line-argument -rtlib=compiler-rt -stdlib=libc++ --unwindlib=libunwind -lc++abi -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -flto=thin -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17 -fPIC  -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o -MF tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o.d -o tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/PlatformAndroid.cpp.o -c /home/cqwrteur/toolchains_build/llvm-project/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
/home/cqwrteur/toolchains_build/llvm-project/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp:66:48: error: use of undeclared identifier 'HostInfo'
   66 |     default_platform_sp-&gt;SetSystemArchitecture(HostInfo::GetArchitecture());
      |                                                ^
1 error generated.
[118/1932] Linking CXX shared library lib/libLLVMAnalysis.so.22.0git
ninja: build stopped: subcommand failed.
llvm: Ninja build failed for aarch64-linux-android30
```</pre>
</div>
</content>
</entry>
<entry>
<title>support attaching by name for platform android (#160931)</title>
<updated>2025-10-09T18:28:13+00:00</updated>
<author>
<name>Chad Smith</name>
<email>cssmith@fb.com</email>
</author>
<published>2025-10-09T18:28:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a19c9a8ba1b01f324f893481d825a375a5a68bc6'/>
<id>a19c9a8ba1b01f324f893481d825a375a5a68bc6</id>
<content type='text'>
## Bug
Trying to attach to an android process by name fails:
```
(lldb) process attach -n com.android.bluetooth
error: attach failed: could not find a process named com.android.bluetooth
```

## Root Cause
PlatformAndroid does not implement the `FindProcesses` method.

As described in `include/lldb/Target/Platform.h`:
```
  // The base class Platform will take care of the host platform. Subclasses
  // will need to fill in the remote case.
  virtual uint32_t FindProcesses(const ProcessInstanceInfoMatch &amp;match_info,
                                 ProcessInstanceInfoList &amp;proc_infos);
```

## Fix
Implement the `FindProcesses` method in PlatformAndroid. Use adb to get
the pid of the process name on the device with the adb client connection
using `adb shell pidof &lt;name&gt;`.

## Reproduce
With an android device connected, run the following

Install and start lldb-server on device
```
adb push lldb-server /data/local/tmp/
adb shell chmod +x /data/local/tmp/lldb-server
adb shell /data/local/tmp/lldb-server platform  --listen 127.0.0.1:9500 --server
```

Start lldb, and run
```
platform select remote-android
platform connect connect://127.0.0.1:9500
log enable lldb platform
```

Connect to the process by name:
```
process attach -n com.android.bluetooth
```

## Test Plan
Before:
```
(lldb) process attach -n com.android.bluetooth
error: attach failed: could not find a process named com.android.bluetooth
```

After:
```
(lldb) process attach -n com.android.bluetooth
lldb             AdbClient::ResolveDeviceID Resolved device ID: 127.0.0.1
lldb             AdbClient::AdbClient(device_id='127.0.0.1') - Creating AdbClient with device ID
lldb             Connecting to ADB server at connect://127.0.0.1:5037
lldb             Connected to Android device "127.0.0.1"
lldb             Forwarding remote TCP port 38315 to local TCP port 35243
lldb             AdbClient::~AdbClient() - Destroying AdbClient for device: 127.0.0.1
lldb             gdbserver connect URL: connect://127.0.0.1:35243
lldb             AdbClient::AdbClient(device_id='127.0.0.1') - Creating AdbClient with device ID
lldb             Connecting to ADB server at connect://127.0.0.1:5037
lldb             Selecting device: 127.0.0.1
lldb             PlatformAndroid::FindProcesses found process 'com.android.bluetooth' with PID 2223
lldb             AdbClient::~AdbClient() - Destroying AdbClient for device: 127.0.0.1
llvm-worker-48   PlatformRemoteGDBServer::GetModuleSpec - got module info for (/apex/com.android.art/lib64/libc++.so:aarch64-unknown-linux-android) : file = '/apex/com.android.art/lib64/libc++.so', arch = aarch64-unknown-linux-android, uuid = 552995D0-A86D-055F-1F03-C13783A2A16C, object size = 754128
llvm-worker-9    PlatformRemoteGDBServer::GetModuleSpec - got module info for (/apex/com.android.art/lib64/liblzma.so:aarch64-unknown-linux-android) : file = '/apex/com.android.art/lib64/liblzma.so', arch = aarch64-unknown-linux-android, uuid = E51CAC98-666F-6C3F-F605-1498079542E0, object size = 179944
Process 2223 stopped
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
## Bug
Trying to attach to an android process by name fails:
```
(lldb) process attach -n com.android.bluetooth
error: attach failed: could not find a process named com.android.bluetooth
```

## Root Cause
PlatformAndroid does not implement the `FindProcesses` method.

As described in `include/lldb/Target/Platform.h`:
```
  // The base class Platform will take care of the host platform. Subclasses
  // will need to fill in the remote case.
  virtual uint32_t FindProcesses(const ProcessInstanceInfoMatch &amp;match_info,
                                 ProcessInstanceInfoList &amp;proc_infos);
```

## Fix
Implement the `FindProcesses` method in PlatformAndroid. Use adb to get
the pid of the process name on the device with the adb client connection
using `adb shell pidof &lt;name&gt;`.

## Reproduce
With an android device connected, run the following

Install and start lldb-server on device
```
adb push lldb-server /data/local/tmp/
adb shell chmod +x /data/local/tmp/lldb-server
adb shell /data/local/tmp/lldb-server platform  --listen 127.0.0.1:9500 --server
```

Start lldb, and run
```
platform select remote-android
platform connect connect://127.0.0.1:9500
log enable lldb platform
```

Connect to the process by name:
```
process attach -n com.android.bluetooth
```

## Test Plan
Before:
```
(lldb) process attach -n com.android.bluetooth
error: attach failed: could not find a process named com.android.bluetooth
```

After:
```
(lldb) process attach -n com.android.bluetooth
lldb             AdbClient::ResolveDeviceID Resolved device ID: 127.0.0.1
lldb             AdbClient::AdbClient(device_id='127.0.0.1') - Creating AdbClient with device ID
lldb             Connecting to ADB server at connect://127.0.0.1:5037
lldb             Connected to Android device "127.0.0.1"
lldb             Forwarding remote TCP port 38315 to local TCP port 35243
lldb             AdbClient::~AdbClient() - Destroying AdbClient for device: 127.0.0.1
lldb             gdbserver connect URL: connect://127.0.0.1:35243
lldb             AdbClient::AdbClient(device_id='127.0.0.1') - Creating AdbClient with device ID
lldb             Connecting to ADB server at connect://127.0.0.1:5037
lldb             Selecting device: 127.0.0.1
lldb             PlatformAndroid::FindProcesses found process 'com.android.bluetooth' with PID 2223
lldb             AdbClient::~AdbClient() - Destroying AdbClient for device: 127.0.0.1
llvm-worker-48   PlatformRemoteGDBServer::GetModuleSpec - got module info for (/apex/com.android.art/lib64/libc++.so:aarch64-unknown-linux-android) : file = '/apex/com.android.art/lib64/libc++.so', arch = aarch64-unknown-linux-android, uuid = 552995D0-A86D-055F-1F03-C13783A2A16C, object size = 754128
llvm-worker-9    PlatformRemoteGDBServer::GetModuleSpec - got module info for (/apex/com.android.art/lib64/liblzma.so:aarch64-unknown-linux-android) : file = '/apex/com.android.art/lib64/liblzma.so', arch = aarch64-unknown-linux-android, uuid = E51CAC98-666F-6C3F-F605-1498079542E0, object size = 179944
Process 2223 stopped
```</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] refactor PlatformAndroid and make threadsafe (attempt 2) (#159676)</title>
<updated>2025-09-25T19:05:31+00:00</updated>
<author>
<name>Chad Smith</name>
<email>cssmith@meta.com</email>
</author>
<published>2025-09-25T19:05:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=223cfa8018595ff2a809b4e10701bfea884af709'/>
<id>223cfa8018595ff2a809b4e10701bfea884af709</id>
<content type='text'>
Reattempt at https://github.com/llvm/llvm-project/pull/145382 (cc
@labath). This time setenv() was replaced with set_env()
(https://github.com/llvm/llvm-project/pull/145382#issuecomment-3187227704).

---------

Co-authored-by: Chad Smith &lt;cssmith@meta.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reattempt at https://github.com/llvm/llvm-project/pull/145382 (cc
@labath). This time setenv() was replaced with set_env()
(https://github.com/llvm/llvm-project/pull/145382#issuecomment-3187227704).

---------

Co-authored-by: Chad Smith &lt;cssmith@meta.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[lldb] refactor PlatformAndroid and make threadsafe" (#153626)</title>
<updated>2025-08-14T17:36:50+00:00</updated>
<author>
<name>Leandro Lupori</name>
<email>leandro.lupori@linaro.org</email>
</author>
<published>2025-08-14T17:36:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=91418ecbdef0e259f83e6ddac5ddfc22a8b6eced'/>
<id>91418ecbdef0e259f83e6ddac5ddfc22a8b6eced</id>
<content type='text'>
Reverts llvm/llvm-project#145382

This broke a couple of buildbots.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#145382

This broke a couple of buildbots.</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] refactor PlatformAndroid and make threadsafe (#145382)</title>
<updated>2025-08-13T22:43:45+00:00</updated>
<author>
<name>Chad Smith</name>
<email>cs01@users.noreply.github.com</email>
</author>
<published>2025-08-13T22:43:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bcb48aa5b2cfc75967c734a97201e0c91273169d'/>
<id>bcb48aa5b2cfc75967c734a97201e0c91273169d</id>
<content type='text'>
## Problem

When the new setting

```
set target.parallel-module-load true
```
was added, lldb began fetching modules from the devices from multiple
threads simultaneously. This caused crashes of lldb when debugging on
android devices.

The top of the stack in the crash look something like this:
```
#0 0x0000555aaf2b27fe llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/llvm/bin/lldb-dap+0xb87fe)
 #1 0x0000555aaf2b0a99 llvm::sys::RunSignalHandlers() (/opt/llvm/bin/lldb-dap+0xb6a99)
 #2 0x0000555aaf2b2fda SignalHandler(int, siginfo_t*, void*) (/opt/llvm/bin/lldb-dap+0xb8fda)
 #3 0x00007f9c02444560 __restore_rt /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/signal/../sysdeps/unix/sysv/linux/libc_sigaction.c:13:0
 #4 0x00007f9c04ea7707 lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Status*) (usr/bin/../lib/liblldb.so.15+0x22a7707)
 #5 0x00007f9c04ea5b41 lldb_private::ConnectionFileDescriptor::~ConnectionFileDescriptor() (usr/bin/../lib/liblldb.so.15+0x22a5b41)
 #6 0x00007f9c04ea5c1e lldb_private::ConnectionFileDescriptor::~ConnectionFileDescriptor() (usr/bin/../lib/liblldb.so.15+0x22a5c1e)
 #7 0x00007f9c052916ff lldb_private::platform_android::AdbClient::SyncService::Stat(lldb_private::FileSpec const&amp;, unsigned int&amp;, unsigned int&amp;, unsigned int&amp;) (usr/bin/../lib/liblldb.so.15+0x26916ff)
 #8 0x00007f9c0528b9dc lldb_private::platform_android::PlatformAndroid::GetFile(lldb_private::FileSpec const&amp;, lldb_private::FileSpec const&amp;) (usr/bin/../lib/liblldb.so.15+0x268b9dc)
```
Our workaround was to set `set target.parallel-module-load ` to `false`
to avoid the crash.

## Background

PlatformAndroid creates two different classes with one stateful adb
connection shared between the two -- one through AdbClient and another
through AdbClient::SyncService. The connection management and state is
complex, and seems to be responsible for the segfault we are seeing. The
AdbClient code resets these connections at times, and re-establishes
connections if they are not active. Similarly, PlatformAndroid caches
its SyncService, which uses an AdbClient class, but the SyncService puts
its connection into a different 'sync' state that is incompatible with a
standard connection.

## Changes in this diff

* This diff refactors the code to (hopefully) have clearer ownership of
the connection, clearer separation of AdbClient and SyncService by
making a new class for clearer separations of concerns, called
AdbSyncService.
* New unit tests are added
* Additional logs were added (see
https://github.com/llvm/llvm-project/pull/145382#issuecomment-3055535017
for details)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
## Problem

When the new setting

```
set target.parallel-module-load true
```
was added, lldb began fetching modules from the devices from multiple
threads simultaneously. This caused crashes of lldb when debugging on
android devices.

The top of the stack in the crash look something like this:
```
#0 0x0000555aaf2b27fe llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/llvm/bin/lldb-dap+0xb87fe)
 #1 0x0000555aaf2b0a99 llvm::sys::RunSignalHandlers() (/opt/llvm/bin/lldb-dap+0xb6a99)
 #2 0x0000555aaf2b2fda SignalHandler(int, siginfo_t*, void*) (/opt/llvm/bin/lldb-dap+0xb8fda)
 #3 0x00007f9c02444560 __restore_rt /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/signal/../sysdeps/unix/sysv/linux/libc_sigaction.c:13:0
 #4 0x00007f9c04ea7707 lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Status*) (usr/bin/../lib/liblldb.so.15+0x22a7707)
 #5 0x00007f9c04ea5b41 lldb_private::ConnectionFileDescriptor::~ConnectionFileDescriptor() (usr/bin/../lib/liblldb.so.15+0x22a5b41)
 #6 0x00007f9c04ea5c1e lldb_private::ConnectionFileDescriptor::~ConnectionFileDescriptor() (usr/bin/../lib/liblldb.so.15+0x22a5c1e)
 #7 0x00007f9c052916ff lldb_private::platform_android::AdbClient::SyncService::Stat(lldb_private::FileSpec const&amp;, unsigned int&amp;, unsigned int&amp;, unsigned int&amp;) (usr/bin/../lib/liblldb.so.15+0x26916ff)
 #8 0x00007f9c0528b9dc lldb_private::platform_android::PlatformAndroid::GetFile(lldb_private::FileSpec const&amp;, lldb_private::FileSpec const&amp;) (usr/bin/../lib/liblldb.so.15+0x268b9dc)
```
Our workaround was to set `set target.parallel-module-load ` to `false`
to avoid the crash.

## Background

PlatformAndroid creates two different classes with one stateful adb
connection shared between the two -- one through AdbClient and another
through AdbClient::SyncService. The connection management and state is
complex, and seems to be responsible for the segfault we are seeing. The
AdbClient code resets these connections at times, and re-establishes
connections if they are not active. Similarly, PlatformAndroid caches
its SyncService, which uses an AdbClient class, but the SyncService puts
its connection into a different 'sync' state that is incompatible with a
standard connection.

## Changes in this diff

* This diff refactors the code to (hopefully) have clearer ownership of
the connection, clearer separation of AdbClient and SyncService by
making a new class for clearer separations of concerns, called
AdbSyncService.
* New unit tests are added
* Additional logs were added (see
https://github.com/llvm/llvm-project/pull/145382#issuecomment-3055535017
for details)</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Move ValueObject into its own library (NFC) (#113393)</title>
<updated>2024-10-25T03:20:48+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2024-10-25T03:20:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b852fb1ec5fa15f0b913cc4988cbd09239b19904'/>
<id>b852fb1ec5fa15f0b913cc4988cbd09239b19904</id>
<content type='text'>
ValueObject is part of lldbCore for historical reasons, but conceptually
it deserves to be its own library. This does introduce a (link-time) circular
dependency between lldbCore and lldbValueObject, which is unfortunate
but probably unavoidable because so many things in LLDB rely on
ValueObject. We already have cycles and these libraries are never built
as dylibs so while this doesn't improve the situation, it also doesn't
make things worse.

The header includes were updated with the following command:

```
find . -type f -exec sed -i.bak "s%include \"lldb/Core/ValueObject%include \"lldb/ValueObject/ValueObject%" '{}' \;
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ValueObject is part of lldbCore for historical reasons, but conceptually
it deserves to be its own library. This does introduce a (link-time) circular
dependency between lldbCore and lldbValueObject, which is unfortunate
but probably unavoidable because so many things in LLDB rely on
ValueObject. We already have cycles and these libraries are never built
as dylibs so while this doesn't improve the situation, it also doesn't
make things worse.

The header includes were updated with the following command:

```
find . -type f -exec sed -i.bak "s%include \"lldb/Core/ValueObject%include \"lldb/ValueObject/ValueObject%" '{}' \;
```</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Turn lldb_private::Status into a value type. (#106163)</title>
<updated>2024-08-27T17:59:31+00:00</updated>
<author>
<name>Adrian Prantl</name>
<email>aprantl@apple.com</email>
</author>
<published>2024-08-27T17:59:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0642cd768b80665585c8500bed2933a3b99123dc'/>
<id>0642cd768b80665585c8500bed2933a3b99123dc</id>
<content type='text'>
This patch removes all of the Set.* methods from Status.

This cleanup is part of a series of patches that make it harder use the
anti-pattern of keeping a long-lives Status object around and updating
it while dropping any errors it contains on the floor.

This patch is largely NFC, the more interesting next steps this enables
is to:
1. remove Status.Clear()
2. assert that Status::operator=() never overwrites an error
3. remove Status::operator=()

Note that step (2) will bring 90% of the benefits for users, and step
(3) will dramatically clean up the error handling code in various
places. In the end my goal is to convert all APIs that are of the form

`    ResultTy DoFoo(Status&amp; error)
`
to

`    llvm::Expected&lt;ResultTy&gt; DoFoo()
`
How to read this patch?

The interesting changes are in Status.h and Status.cpp, all other
changes are mostly

` perl -pi -e 's/\.SetErrorString/ = Status::FromErrorString/g' $(git
grep -l SetErrorString lldb/source)
`
plus the occasional manual cleanup.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch removes all of the Set.* methods from Status.

This cleanup is part of a series of patches that make it harder use the
anti-pattern of keeping a long-lives Status object around and updating
it while dropping any errors it contains on the floor.

This patch is largely NFC, the more interesting next steps this enables
is to:
1. remove Status.Clear()
2. assert that Status::operator=() never overwrites an error
3. remove Status::operator=()

Note that step (2) will bring 90% of the benefits for users, and step
(3) will dramatically clean up the error handling code in various
places. In the end my goal is to convert all APIs that are of the form

`    ResultTy DoFoo(Status&amp; error)
`
to

`    llvm::Expected&lt;ResultTy&gt; DoFoo()
`
How to read this patch?

The interesting changes are in Status.h and Status.cpp, all other
changes are mostly

` perl -pi -e 's/\.SetErrorString/ = Status::FromErrorString/g' $(git
grep -l SetErrorString lldb/source)
`
plus the occasional manual cleanup.</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Fix string truncation method when substring is the prefix of string (NFC) (#94785)</title>
<updated>2024-07-11T07:27:50+00:00</updated>
<author>
<name>Shivam Gupta</name>
<email>shivam98.tkg@gmail.com</email>
</author>
<published>2024-07-11T07:27:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a18f45f556c781d711f82043bf451fcce8324163'/>
<id>a18f45f556c781d711f82043bf451fcce8324163</id>
<content type='text'>
Correct the method used to truncate the source_file string when
substring is a prefix. The previous method used substr, which was
changed to resize for clarity and efficiency.

Caught by cppcheck - 
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp:290:19:
performance: Ineffective call of function 'substr' because a prefix of
the string is assigned to itself. Use resize() or pop_back() instead.
[uselessCallsSubstr]

Source code - 
source_file = source_file.substr(0, pos);

Fix #91211

---------

Co-authored-by: Shivam Gupta &lt;shivma98.tkg@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Correct the method used to truncate the source_file string when
substring is a prefix. The previous method used substr, which was
changed to resize for clarity and efficiency.

Caught by cppcheck - 
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp:290:19:
performance: Ineffective call of function 'substr' because a prefix of
the string is assigned to itself. Use resize() or pop_back() instead.
[uselessCallsSubstr]

Source code - 
source_file = source_file.substr(0, pos);

Fix #91211

---------

Co-authored-by: Shivam Gupta &lt;shivma98.tkg@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][NFCI] Remove unneeded ConstString conversions</title>
<updated>2023-08-31T18:27:59+00:00</updated>
<author>
<name>Alex Langford</name>
<email>alangford@apple.com</email>
</author>
<published>2023-08-30T22:56:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=14d95b26aee0ac0ac8a70252e8a3c7a986e0e812'/>
<id>14d95b26aee0ac0ac8a70252e8a3c7a986e0e812</id>
<content type='text'>
ConstString can be implicitly converted into a llvm::StringRef. This is
very useful in many places, but it also hides places where we are
creating a ConstString only to use it as a StringRef for the entire
lifespan of the ConstString object.

I locally removed the implicit conversion and found some of the places we
were doing this.

Differential Revision: https://reviews.llvm.org/D159237
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ConstString can be implicitly converted into a llvm::StringRef. This is
very useful in many places, but it also hides places where we are
creating a ConstString only to use it as a StringRef for the entire
lifespan of the ConstString object.

I locally removed the implicit conversion and found some of the places we
were doing this.

Differential Revision: https://reviews.llvm.org/D159237
</pre>
</div>
</content>
</entry>
</feed>
