================
@@ -703,14 +714,74 @@ void NativeProcessWindows::OnExitThread(lldb::tid_t
thread_id,
}
void NativeProcessWindows::OnLoadDll(const ModuleSpec &module_spec,
- lldb::addr_t module_addr) {
- m_loaded_modules.clear();
+ lldb::addr_t module_addr,
+ lldb::tid_t thread_id) {
+ Log *log = GetLog(WindowsLog::Process);
+
+ if (module_spec.GetFileSpec()) {
+ FileSpec resolved = module_spec.GetFileSpec();
+ FileSystem::Instance().Resolve(resolved);
+ m_loaded_modules[resolved] = module_addr;
+ }
m_pending_library_events = true;
+
+ if (!m_initial_stop_seen || !m_client_supports_libraries_read)
+ return;
+
+ NativeThreadWindows *loader_thread = GetThreadByID(thread_id);
+ if (!loader_thread && !m_threads.empty()) {
+ LLDB_LOG(log, "LOAD_DLL on unknown tid {0:x}. Falling back to main
thread.",
+ thread_id);
+ loader_thread = static_cast<NativeThreadWindows *>(m_threads[0].get());
+ }
+ if (loader_thread) {
+ SetCurrentThreadID(loader_thread->GetID());
+ if (loader_thread->DoStop().Fail())
+ LLDB_LOG(log, "Failed to suspend thread {0} on LOAD_DLL.",
+ loader_thread->GetID());
+ ThreadStopInfo info;
+ info.reason = lldb::eStopReasonNone;
+ info.signo = 0;
+ loader_thread->SetStopReason(info, "");
+ }
+ SetState(eStateStopped, true);
----------------
JDevlieghere wrote:
Could this lead to a race? This delivers the stop reply synchronously before
WaitForResumeAfterDllEvent stores m_pending_dll_event=true. Then Resume then
sees !HasPendingDllEvent(), skips ContinueAsyncDllEvent(), and parks the
debugger thread forever? Do we need to set the pending flag / reset the
predicate before SetState?
https://github.com/llvm/llvm-project/pull/203334
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits