When a target thread returned an empty but not `nullptr` string as its
name, the thread would show up with an empty name in lldb-dap.
I don't know how this works on macOS and Linux, but on Windows,
[`TargetThreadWindows::GetName`](deedc8a181/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp (L178-L204))
returns a non-null pointer to an empty string, because on MSVC's STL,
`std::string{}.c_str()` returns a pointer to inside the object (the SSO
storage).
This changes the check in `CreateThread`, when no custom thread
formatter is set, to check for the length of the thread and queue name
instead of it being `nullptr`.
19 lines
270 B
C++
19 lines
270 B
C++
#include <cstdio>
|
|
#include <thread>
|
|
|
|
int state_var;
|
|
|
|
void thread() {
|
|
state_var++; // break here
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
std::thread t1(thread);
|
|
t1.join();
|
|
std::thread t2(thread);
|
|
t2.join();
|
|
|
|
printf("state_var is %d\n", state_var);
|
|
return 0;
|
|
}
|