diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index 28de989969e501..b9218b4845d721 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -5061,6 +5061,23 @@ void CordbProcess::RawDispatchEvent( case DB_IPCE_LOAD_MODULE: { + LOG((LF_CORDB, LL_INFO100, + "RCET::HRCE: load module (includes assembly loading) on thread %#x Asm:0x%08x AD:0x%08x \n", + dwVolatileThreadId, + VmPtrToCookie(pEvent->LoadModuleData.vmDomainAssembly), + VmPtrToCookie(pEvent->vmAppDomain))); + + _ASSERTE (pAppDomain != NULL); + + // Determine if this Assembly is cached. + CordbAssembly * pAssembly = pAppDomain->LookupOrCreateAssembly(pEvent->LoadModuleData.vmDomainAssembly); + _ASSERTE(pAssembly != NULL); // throws on error + + // If created, or have, an Assembly, notify callback. + { + PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent); + hr = pCallback1->LoadAssembly(pAppDomain, pAssembly); + } _ASSERTE (pAppDomain != NULL); CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->LoadModuleData.vmDomainAssembly); @@ -5375,29 +5392,6 @@ void CordbProcess::RawDispatchEvent( break; - case DB_IPCE_LOAD_ASSEMBLY: - { - LOG((LF_CORDB, LL_INFO100, - "RCET::HRCE: load assembly on thread %#x Asm:0x%08x AD:0x%08x \n", - dwVolatileThreadId, - VmPtrToCookie(pEvent->AssemblyData.vmDomainAssembly), - VmPtrToCookie(pEvent->vmAppDomain))); - - _ASSERTE (pAppDomain != NULL); - - // Determine if this Assembly is cached. - CordbAssembly * pAssembly = pAppDomain->LookupOrCreateAssembly(pEvent->AssemblyData.vmDomainAssembly); - _ASSERTE(pAssembly != NULL); // throws on error - - // If created, or have, an Assembly, notify callback. - { - PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent); - hr = pCallback1->LoadAssembly(pAppDomain, pAssembly); - } - } - - break; - case DB_IPCE_UNLOAD_ASSEMBLY: { LOG((LF_CORDB, LL_INFO100, "RCET::DRCE: unload assembly on thread %#x Asm:0x%x AD:0x%x\n", diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 9a935112a09938..7d7c4e9b96be7b 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -9250,62 +9250,6 @@ void Debugger::SendCreateAppDomainEvent(AppDomain * pRuntimeAppDomain) } - -// -// LoadAssembly is called when a new Assembly gets loaded. -// -void Debugger::LoadAssembly(DomainAssembly * pDomainAssembly) -{ - CONTRACTL - { - MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; - MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; - } - CONTRACTL_END; - - if (CORDBUnrecoverableError(this)) - return; - - LOG((LF_CORDB, LL_INFO100, "D::LA: Load Assembly Asy:0x%p AD:0x%p which:%s\n", - pDomainAssembly, AppDomain::GetCurrentDomain(), pDomainAssembly->GetAssembly()->GetDebugName() )); - - if (!CORDebuggerAttached()) - { - return; - } - - Thread *pThread = g_pEEInterface->GetThread(); - SENDIPCEVENT_BEGIN(this, pThread) - - - if (CORDebuggerAttached()) - { - // Send a load assembly event to the Right Side. - DebuggerIPCEvent* ipce = m_pRCThread->GetIPCEventSendBuffer(); - InitIPCEvent(ipce, - DB_IPCE_LOAD_ASSEMBLY, - pThread); - - ipce->AssemblyData.vmDomainAssembly.SetRawPtr(pDomainAssembly); - - m_pRCThread->SendIPCEvent(); - } - else - { - LOG((LF_CORDB,LL_INFO1000, "D::LA: Skipping SendIPCEvent because RS detached.")); - } - - // Stop all Runtime threads - if (CORDebuggerAttached()) - { - TrapAllRuntimeThreads(); - } - - SENDIPCEVENT_END; -} - - - // // UnloadAssembly is called when a Runtime thread unloads an assembly. // diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h index 15915b00d72ccf..79ba57770b2a4f 100644 --- a/src/coreclr/debug/ee/debugger.h +++ b/src/coreclr/debug/ee/debugger.h @@ -2623,9 +2623,6 @@ class Debugger : public DebugInterface void SendCreateAppDomainEvent(AppDomain * pAppDomain); - // Notify the debugger that an assembly has been loaded - void LoadAssembly(DomainAssembly * pDomainAssembly); - // Notify the debugger that an assembly has been unloaded void UnloadAssembly(DomainAssembly * pDomainAssembly); diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 5e74fd4e7c84fc..85a87d4ff82e9a 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -423,7 +423,6 @@ class LoadLevelLimiter final enum { - ATTACH_ASSEMBLY_LOAD = 0x1, ATTACH_MODULE_LOAD = 0x2, ATTACH_CLASS_LOAD = 0x4, diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 95fd73a73ad64d..cf6e0834dcb180 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -2365,7 +2365,7 @@ void Assembly::DeliverSyncEvents() SetShouldNotifyDebugger(); // Still work to do even if no debugger is attached. - NotifyDebuggerLoad(ATTACH_ASSEMBLY_LOAD, FALSE); + NotifyDebuggerLoad(ATTACH_MODULE_LOAD, FALSE); } #endif // DEBUGGING_SUPPORTED @@ -2488,16 +2488,7 @@ BOOL Assembly::NotifyDebuggerLoad(int flags, BOOL attaching) } // There is still work we need to do even when no debugger is attached. - if (flags & ATTACH_ASSEMBLY_LOAD) - { - if (ShouldNotifyDebugger()) - { - g_pDebugInterface->LoadAssembly(GetDomainAssembly()); - } - result = TRUE; - } - - if(this->ShouldNotifyDebugger()) + if(this->ShouldNotifyDebugger() && !(flags & ATTACH_MODULE_LOAD)) { result = result || this->GetModule()->NotifyDebuggerLoad(GetDomainAssembly(), flags, attaching); diff --git a/src/coreclr/vm/dbginterface.h b/src/coreclr/vm/dbginterface.h index 0b2eadf4479507..23fec81a3474be 100644 --- a/src/coreclr/vm/dbginterface.h +++ b/src/coreclr/vm/dbginterface.h @@ -299,14 +299,6 @@ class DebugInterface virtual HRESULT UpdateAppDomainEntryInIPC (AppDomain *pAppDomain) = 0; - // Called when an assembly is being loaded into an AppDomain. - // This includes when a domain neutral assembly is loaded into a new AppDomain. - // This is called only when a debugger is attached, and will occur after the - // related AddAppDomainToIPCBlock call and before any LoadModule or - // LoadClass calls for this assembly. - virtual void LoadAssembly(DomainAssembly * pDomainAssembly) = 0; // the assembly being loaded - - // Called for all assemblies in an AppDomain when the AppDomain is unloaded. // This includes domain neutral assemblies that are also loaded into other domains. // This is called only when a debugger is attached, and will occur after all UnloadClass