[Lldb-commits] [lldb] [lldb][Windows] Use LazyImport for WaitForDebugEventEx (PR #201118)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 2 06:35:48 PDT 2026
================
----------------
charles-zablit wrote:
```suggestion
static LazyImport<WaitForDebugEventFn *> s_wait_for_debug_event_ex = {
L"kernel32.dll", "WaitForDebugEventEx"};
if (g_wait_for_debug_event)
return;
if (!s_wait_for_debug_event_ex) {
LLDB_LOG(
GetLog(LLDBLog::Host),
"WaitForDebugEventEx unavailable, using WaitForDebugEvent instead. "
"Unicode strings from OutputDebugStringW might show incorrectly.");
g_wait_for_debug_event = &WaitForDebugEvent;
} else {
g_wait_for_debug_event = *s_wait_for_debug_event_ex;
}
}
```
We do this slightly differently in https://github.com/llvm/llvm-project/blob/0bbb91b73430cf6e436cb9c0fe61a2f280d9453b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp#L178.
Overall, throughout the code base, I've noticed we do:
```cpp
auto value_or_err = GetValueOrExpected();
if (!value_or_err)
// error path
auto value = *value_or_err;
```
This would more closely match the pattern above.
What do you think?
I don't have a strong opinion.
https://github.com/llvm/llvm-project/pull/201118
More information about the lldb-commits
mailing list