[Lldb-commits] [lldb] [lldb][Windows] Don't synthesise a fake thread name from the executable (PR #199983)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Wed May 27 08:05:05 PDT 2026
charles-zablit wrote:
I experimented with this program:
```cpp
#include <windows.h>
#include <processthreadsapi.h>
#include <stdio.h>
int main() {
HANDLE thread = GetCurrentThread();
HRESULT hr = SetThreadDescription(thread, L"MyAwesomeThread");
if (FAILED(hr)) {
fprintf(stderr, "SetThreadDescription failed: 0x%08lx\n", hr);
return 1;
}
printf("Thread name set successfully.\n"); // break here
return 0;
}
```
# With `LLDB_USE_LLDB_SERVER=0`
```
lldb.exe "C:\Users\charleszablit\Developer\testing\main.exe" -o "break set -p 'break here'" -o r -o q
(lldb) target create "C:\\Users\\charleszablit\\Developer\\testing\\main.exe"
Current executable set to 'C:\Users\charleszablit\Developer\testing\main.exe' (x86_64).
(lldb) break set -p 'break here'
Breakpoint 1: where = main.exe`main + 81 at main.cpp:14, address = 0x00000001400072d1
(lldb) r
Process 9400 launched: 'C:\Users\charleszablit\Developer\testing\main.exe' (x86_64)
Process 9400 stopped
* thread #1, name = 'MyAwesomeThread', stop reason = breakpoint 1.1
frame #0: 0x00007ff7141272d1 main.exe`main at main.cpp:14
11 return 1;
12 }
13
-> 14 printf("Thread name set successfully.\n"); // break here
15 return 0;
16 }
(lldb) q
```
# With `LLDB_USE_LLDB_SERVER=1` (and the fix):
```
lldb.exe "C:\Users\charleszablit\Developer\testing\main.exe" -o "break set -p 'break here'" -o r -o q
(lldb) target create "C:\\Users\\charleszablit\\Developer\\testing\\main.exe"
Current executable set to 'C:\Users\charleszablit\Developer\testing\main.exe' (x86_64).
(lldb) break set -p 'break here'
Breakpoint 1: where = main.exe`main + 81 at main.cpp:14, address = 0x00000001400072d1
(lldb) r
ValueError: compile(): unrecognised flags
Process 40364 launched: 'C:\Users\charleszablit\Developer\testing\main.exe' (x86_64)
Process 40364 stopped
* thread #1, stop reason = breakpoint 1.1
frame #0: 0x00007ff7141272d1 main.exe`main at main.cpp:14
11 return 1;
12 }
13
-> 14 printf("Thread name set successfully.\n"); // break here
15 return 0;
16 }
(lldb) q
```
So this is still a regression compared to the current default behavior without `LLDB_USE_LLDB_SERVER=1`. I will look into making both paths behave the same.
https://github.com/llvm/llvm-project/pull/199983
More information about the lldb-commits
mailing list