From 9a974a6be90324e1b9e4627ab974d11f9154e155 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Thu, 24 May 2018 15:52:32 -0700 Subject: [PATCH] Removing unnecessary hacks Commit migrated from https://github.com/dotnet/coreclr/commit/6a9384827f7e1059bec5e246425e46cc7f3fc140 --- src/coreclr/src/debug/di/divalue.cpp | 6 +- src/coreclr/src/debug/di/process.cpp | 2 - src/coreclr/src/debug/di/rspriv.h | 94 +++---------------------- src/coreclr/src/debug/di/shimevents.cpp | 2 +- src/coreclr/src/debug/ee/controller.cpp | 21 +----- src/coreclr/src/debug/ee/controller.h | 2 +- src/coreclr/src/debug/ee/debugger.cpp | 14 +--- src/coreclr/src/debug/ee/debugger.h | 2 +- src/coreclr/src/debug/ee/rcthread.cpp | 2 + src/coreclr/src/utilcode/log.cpp | 120 ++++++++++++++++---------------- src/coreclr/src/vm/debugdebugger.cpp | 1 + 11 files changed, 82 insertions(+), 184 deletions(-) diff --git a/src/coreclr/src/debug/di/divalue.cpp b/src/coreclr/src/debug/di/divalue.cpp index e8975ec..59cd382 100644 --- a/src/coreclr/src/debug/di/divalue.cpp +++ b/src/coreclr/src/debug/di/divalue.cpp @@ -427,11 +427,7 @@ HRESULT CordbValue::InternalCreateHandle(CorDebugHandleType handleType, *ppHandle = NULL; - if (handleType == 3) - { - fStrong = 2; - } - else if (handleType == HANDLE_STRONG) + if (handleType == HANDLE_STRONG) { fStrong = TRUE; } diff --git a/src/coreclr/src/debug/di/process.cpp b/src/coreclr/src/debug/di/process.cpp index 04f63f8..1ab0724 100644 --- a/src/coreclr/src/debug/di/process.cpp +++ b/src/coreclr/src/debug/di/process.cpp @@ -938,7 +938,6 @@ CordbProcess::CordbProcess(ULONG64 clrInstanceId, m_syncCompleteReceived(false), m_pShim(pShim), m_userThreads(11), - m_dataBreakpoints(4), m_oddSync(false), #ifdef FEATURE_INTEROP_DEBUGGING m_unmanagedThreads(11), @@ -1304,7 +1303,6 @@ void CordbProcess::NeuterChildren() // Sweep neuter lists. m_ExitNeuterList.NeuterAndClear(this); m_ContinueNeuterList.NeuterAndClear(this); - m_dataBreakpoints.NeuterAndClear(GetProcessLock()); m_userThreads.NeuterAndClear(GetProcessLock()); diff --git a/src/coreclr/src/debug/di/rspriv.h b/src/coreclr/src/debug/di/rspriv.h index 868d6f6..a9f5893 100644 --- a/src/coreclr/src/debug/di/rspriv.h +++ b/src/coreclr/src/debug/di/rspriv.h @@ -82,7 +82,6 @@ class CordbInternalFrame; class CordbContext; class CordbThread; class CordbVariableHome; -class CordbValueBreakpoint; #ifdef FEATURE_INTEROP_DEBUGGING class CordbUnmanagedThread; @@ -144,32 +143,6 @@ template class CordbSafeHashTable; -typedef struct _DR7 *PDR7; -typedef struct _DR7 { - DWORD L0 : 1; - DWORD G0 : 1; - DWORD L1 : 1; - DWORD G1 : 1; - DWORD L2 : 1; - DWORD G2 : 1; - DWORD L3 : 1; - DWORD G3 : 1; - DWORD LE : 1; - DWORD GE : 1; - DWORD Pad1 : 3; - DWORD GD : 1; - DWORD Pad2 : 1; - DWORD Pad3 : 1; - DWORD Rwe0 : 2; - DWORD Len0 : 2; - DWORD Rwe1 : 2; - DWORD Len1 : 2; - DWORD Rwe2 : 2; - DWORD Len2 : 2; - DWORD Rwe3 : 2; - DWORD Len3 : 2; -} DR7; - //--------------------------------------------------------------------------------------- // // This is an encapsulation of the information necessary to connect to the debugger proxy on a remote machine. @@ -3832,8 +3805,6 @@ private: // This is just used for backwards compat. CORDB_ADDRESS m_clrInstanceId; - CordbSafeHashTable m_dataBreakpoints; - // List of things that get neutered on process exit and Continue respectively. NeuterList m_ExitNeuterList; NeuterList m_ContinueNeuterList; @@ -8817,18 +8788,14 @@ public: }; /* ------------------------------------------------------------------------- * - * Value Breakpoint class - * ------------------------------------------------------------------------- */ +* Value Breakpoint class +* ------------------------------------------------------------------------- */ class CordbValueBreakpoint : public CordbBreakpoint, - public ICorDebugValueBreakpoint + public ICorDebugValueBreakpoint { public: - CordbValueBreakpoint(unsigned int index, CordbValue *pValue, CordbProcess* pProcess): CordbBreakpoint(pProcess, CordbBreakpointType::CBT_VALUE) - { - m_value = pValue; - m_index = index; - } + CordbValueBreakpoint(CordbValue *pValue); #ifdef _DEBUG @@ -8847,43 +8814,14 @@ public: { return (BaseRelease()); } - COM_METHOD QueryInterface(REFIID riid, void **ppInterface) - { - if (riid == IID_ICorDebugValueBreakpoint) - { - *ppInterface = static_cast(this); - } - else if (riid == IID_ICorDebugBreakpoint) - { - *ppInterface = static_cast(static_cast(this)); - } - else if (riid == IID_IUnknown) - { - *ppInterface = static_cast(static_cast(this)); - } - else - { - return E_NOINTERFACE; - } - - ExternalAddRef(); - return S_OK; - } + COM_METHOD QueryInterface(REFIID riid, void **ppInterface); //----------------------------------------------------------- // ICorDebugValueBreakpoint //----------------------------------------------------------- - COM_METHOD GetValue(ICorDebugValue **ppValue) - { - return S_OK; - } - - COM_METHOD Activate(BOOL bActive) - { - return S_OK; - } - + COM_METHOD GetValue(ICorDebugValue **ppValue); + COM_METHOD Activate(BOOL bActive); COM_METHOD IsActive(BOOL *pbActive) { VALIDATE_POINTER_TO_OBJECT(pbActive, BOOL *); @@ -8895,25 +8833,15 @@ public: // Non-COM methods //----------------------------------------------------------- - void Disconnect() - { - } - - unsigned int GetIndex() - { - return m_index; - } + void Disconnect(); public: - CordbValue *m_value; - -private: - unsigned int m_index; + CordbValue * m_value; }; /* ------------------------------------------------------------------------- * - * Generic Value class - * ------------------------------------------------------------------------- */ +* Generic Value class +* ------------------------------------------------------------------------- */ class CordbGenericValue : public CordbValue, public ICorDebugGenericValue, public ICorDebugValue2, public ICorDebugValue3 { diff --git a/src/coreclr/src/debug/di/shimevents.cpp b/src/coreclr/src/debug/di/shimevents.cpp index 15f4316..a2d0ea6 100644 --- a/src/coreclr/src/debug/di/shimevents.cpp +++ b/src/coreclr/src/debug/di/shimevents.cpp @@ -78,7 +78,7 @@ ICorDebugManagedCallback3 * ManagedEvent::DispatchArgs::GetCallback3() return m_pCallback3; } -// trivial accessor to get callback 3 +// trivial accessor to get callback 4 ICorDebugManagedCallback4 * ManagedEvent::DispatchArgs::GetCallback4() { return m_pCallback4; diff --git a/src/coreclr/src/debug/ee/controller.cpp b/src/coreclr/src/debug/ee/controller.cpp index 7b14244..5ae9a95 100644 --- a/src/coreclr/src/debug/ee/controller.cpp +++ b/src/coreclr/src/debug/ee/controller.cpp @@ -46,6 +46,7 @@ DebuggerControllerPage *DebuggerController::g_protections = NULL; CrstStatic DebuggerController::g_criticalSection; int DebuggerController::g_cTotalMethodEnter = 0; + // Is this patch at a position at which it's safe to take a stack? bool DebuggerControllerPatch::IsSafeForStackTrace() { @@ -3026,26 +3027,6 @@ DPOSS_ACTION DebuggerController::DispatchPatchOrSingleStep(Thread *thread, CONTE context->Dr2 = c.Dr2; context->Dr3 = c.Dr3; - //if (context->Dr0 != NULL && DebuggerDataBreakpoint::g_DataBreakpointCount == 0) - //{ - // DebuggerDataBreakpoint::CreateDebuggerDataBreakpoint(thread, thread->GetDomain(), context); - //} - - //if (context->Dr1 != NULL && DebuggerDataBreakpoint::g_DataBreakpointCount == 1) - //{ - // DebuggerDataBreakpoint::CreateDebuggerDataBreakpoint(thread, thread->GetDomain(), context); - //} - - //if (context->Dr2 != NULL && DebuggerDataBreakpoint::g_DataBreakpointCount == 2) - //{ - // DebuggerDataBreakpoint::CreateDebuggerDataBreakpoint(thread, thread->GetDomain(), context); - //} - - //if (context->Dr3 != NULL && DebuggerDataBreakpoint::g_DataBreakpointCount == 3) - //{ - // DebuggerDataBreakpoint::CreateDebuggerDataBreakpoint(thread, thread->GetDomain(), context); - //} - if (!atSafePlace) g_pDebugger->DecThreadsAtUnsafePlaces(); diff --git a/src/coreclr/src/debug/ee/controller.h b/src/coreclr/src/debug/ee/controller.h index 5a46981..4d91d7d 100644 --- a/src/coreclr/src/debug/ee/controller.h +++ b/src/coreclr/src/debug/ee/controller.h @@ -991,7 +991,7 @@ inline void VerifyExecutableAddress(const BYTE* address) // DebuggerController: DebuggerController serves // both as a static class that dispatches exceptions coming from the -// EE, and as an abstract base class for the five classes that derive +// EE, and as an abstract base class for the five classes that derrive // from it. class DebuggerController { diff --git a/src/coreclr/src/debug/ee/debugger.cpp b/src/coreclr/src/debug/ee/debugger.cpp index 1099032..8439e0f 100644 --- a/src/coreclr/src/debug/ee/debugger.cpp +++ b/src/coreclr/src/debug/ee/debugger.cpp @@ -11461,7 +11461,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) Object * pObject = (Object*)pEvent->CreateHandle.objectToken; OBJECTREF objref = ObjectToOBJECTREF(pObject); AppDomain * pAppDomain = pEvent->vmAppDomain.GetRawPtr(); - int fStrong = (int) pEvent->CreateHandle.fStrong; + BOOL fStrong = pEvent->CreateHandle.fStrong; OBJECTHANDLE objectHandle; // This is a synchronous event (reply required) @@ -11482,10 +11482,6 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) // create strong handle objectHandle = pAppDomain->CreateStrongHandle(objref); } - else if (fStrong == 2) - { - objectHandle = pAppDomain->CreatePinningHandle(objref); - } else { // create the weak long handle @@ -11754,12 +11750,8 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) case DB_IPCE_GET_CONTAINER: { DebuggerIPCEvent * pResult = m_pRCThread->GetIPCEventReceiveBuffer(); - // TODO, databp, replace with the right find_object call - pResult->GetContainerResult.answer = ((void*)(((long long)pEvent->GetContainer.interiorPointer) - sizeof(void*))); - - // This is the right code for calling the method in GC, but that code has a bug such that it does not work in this scenario - // Object *pObject = GCHeapUtilities::GetGCHeap()->GetContainingObject(pEvent->GetContainer.interiorPointer, false); - // pResult->GetContainerResult.answer = pObject; + Object *pObject = GCHeapUtilities::GetGCHeap()->GetContainingObject(pEvent->GetContainer.interiorPointer, false); + pResult->GetContainerResult.answer = pObject; InitIPCEvent(pResult, DB_IPCE_GET_CONTAINER_RESULT, NULL, NULL); pResult->hr = S_OK; m_pRCThread->SendIPCReply(); diff --git a/src/coreclr/src/debug/ee/debugger.h b/src/coreclr/src/debug/ee/debugger.h index ac0f7be..10d62d6 100644 --- a/src/coreclr/src/debug/ee/debugger.h +++ b/src/coreclr/src/debug/ee/debugger.h @@ -418,7 +418,7 @@ HRESULT ValidateObject(Object *objPtr); //----------------------------------------------------------------------------- // Execution control needs several ways to get at the context of a thread -// stopped in managed code (stepping, setip, func-eval). +// stopped in mangaged code (stepping, setip, func-eval). // We want to abstract away a few things: // - active: this thread is stopped at a patch // - inactive: this threads was managed suspended somewhere in jitted code diff --git a/src/coreclr/src/debug/ee/rcthread.cpp b/src/coreclr/src/debug/ee/rcthread.cpp index 200e91e..00a2fdc 100644 --- a/src/coreclr/src/debug/ee/rcthread.cpp +++ b/src/coreclr/src/debug/ee/rcthread.cpp @@ -13,6 +13,7 @@ #include "stdafx.h" #include "threadsuspend.h" #ifndef FEATURE_PAL + #include "securitywrapper.h" #endif #include @@ -1795,6 +1796,7 @@ HRESULT DebuggerRCThread::SendIPCEvent() } } + PRECONDITION(ThisMaybeHelperThread()); } CONTRACTL_END; diff --git a/src/coreclr/src/utilcode/log.cpp b/src/coreclr/src/utilcode/log.cpp index 03b6b59..bbe5d0f 100644 --- a/src/coreclr/src/utilcode/log.cpp +++ b/src/coreclr/src/utilcode/log.cpp @@ -31,33 +31,32 @@ #define LOG_ENABLE 0x0040 -static DWORD LogFlags = 0; -//static DWORD LogFlags = LOG_ENABLE | LOG_ENABLE_FILE_LOGGING | LOG_ENABLE_DEBUGGER_LOGGING; +static DWORD LogFlags = 0; static CQuickWSTR szLogFileName; -static HANDLE LogFileHandle = INVALID_HANDLE_VALUE; -static MUTEX_COOKIE LogFileMutex = 0; -static DWORD LogFacilityMask = LF_ALL; -static DWORD LogFacilityMask2 = 0; -static DWORD LogVMLevel = LL_EVERYTHING; - // @todo FIX should probably only display warnings and above by default +static HANDLE LogFileHandle = INVALID_HANDLE_VALUE; +static MUTEX_COOKIE LogFileMutex = 0; +static DWORD LogFacilityMask = LF_ALL; +static DWORD LogFacilityMask2 = 0; +static DWORD LogVMLevel = LL_INFO100; +// @todo FIX should probably only display warnings and above by default VOID InitLogging() { STATIC_CONTRACT_NOTHROW; - - // FIX bit of a workaround for now, check for the log file in the - // registry and if there, turn on file logging VPM - - LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogEnable, LOG_ENABLE); + + // FIX bit of a workaround for now, check for the log file in the + // registry and if there, turn on file logging VPM + + LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogEnable, LOG_ENABLE); LogFacilityMask = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_LogFacility, LogFacilityMask) | LF_ALWAYS; LogVMLevel = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_LogLevel, LogVMLevel); LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogFileAppend, LOG_ENABLE_APPEND_FILE); - LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogFlushFile, LOG_ENABLE_FLUSH_FILE); + LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogFlushFile, LOG_ENABLE_FLUSH_FILE); LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogToDebugger, LOG_ENABLE_DEBUGGER_LOGGING); - LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogToFile, LOG_ENABLE_FILE_LOGGING); - LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogToConsole, LOG_ENABLE_CONSOLE_LOGGING); - + LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogToFile, LOG_ENABLE_FILE_LOGGING); + LogFlags |= REGUTIL::GetConfigFlag_DontUse_(CLRConfig::INTERNAL_LogToConsole, LOG_ENABLE_CONSOLE_LOGGING); + LogFacilityMask2 = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_LogFacility2, LogFacilityMask2) | LF_ALWAYS; if (SUCCEEDED(szLogFileName.ReSizeNoThrow(MAX_LONGPATH))) @@ -94,10 +93,10 @@ VOID InitLogging() FILE_SHARE_READ, NULL, fdwCreate, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | ((LogFlags & LOG_ENABLE_FLUSH_FILE) ? FILE_FLAG_WRITE_THROUGH : 0), + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | ((LogFlags & LOG_ENABLE_FLUSH_FILE) ? FILE_FLAG_WRITE_THROUGH : 0), NULL); - if(0 == LogFileMutex) + if (0 == LogFileMutex) { LogFileMutex = ClrCreateMutex( NULL, @@ -106,7 +105,7 @@ VOID InitLogging() _ASSERTE(LogFileMutex != 0); } - // Some other logging may be going on, try again with another file name + // Some other logging may be going on, try again with another file name if (LogFileHandle == INVALID_HANDLE_VALUE && wcslen(szLogFileName.Ptr()) + 3 <= szLogFileName.Size()) { WCHAR* ptr = szLogFileName.Ptr() + wcslen(szLogFileName.Ptr()) + 1; @@ -114,7 +113,7 @@ VOID InitLogging() ptr[0] = W('0'); ptr[1] = 0; - for(int i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) { LogFileHandle = WszCreateFile( szLogFileName.Ptr(), @@ -122,7 +121,7 @@ VOID InitLogging() FILE_SHARE_READ, NULL, fdwCreate, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | ((LogFlags & LOG_ENABLE_FLUSH_FILE) ? FILE_FLAG_WRITE_THROUGH : 0), + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | ((LogFlags & LOG_ENABLE_FLUSH_FILE) ? FILE_FLAG_WRITE_THROUGH : 0), NULL); if (LogFileHandle != INVALID_HANDLE_VALUE) break; @@ -153,7 +152,7 @@ VOID InitLogging() { if (LogFlags & LOG_ENABLE_APPEND_FILE) SetFilePointer(LogFileHandle, 0, NULL, FILE_END); - LogSpew( LF_ALWAYS, FATALERROR, "************************ New Output *****************\n" ); + LogSpew(LF_ALWAYS, FATALERROR, "************************ New Output *****************\n"); } } } @@ -167,7 +166,7 @@ VOID EnterLogLock() // rather hard to care about this, as we LOG all over the place. CONTRACT_VIOLATION(TakesLockViolation); - if(LogFileMutex != 0) + if (LogFileMutex != 0) { DWORD status; status = ClrWaitForMutex(LogFileMutex, INFINITE, FALSE); @@ -180,7 +179,7 @@ VOID LeaveLogLock() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - if(LogFileMutex != 0) + if (LogFileMutex != 0) { BOOL success; success = ClrReleaseMutex(LogFileMutex); @@ -207,9 +206,9 @@ VOID FlushLogging() { { // We must take the lock, as an OS deadlock can occur between // FlushFileBuffers and WriteFile. - EnterLogLock(); - FlushFileBuffers( LogFileHandle ); - LeaveLogLock(); + EnterLogLock(); + FlushFileBuffers(LogFileHandle); + LeaveLogLock(); } } @@ -218,8 +217,8 @@ VOID ShutdownLogging() STATIC_CONTRACT_NOTHROW; if (LogFileHandle != INVALID_HANDLE_VALUE) { - LogSpew( LF_ALWAYS, FATALERROR, "Logging shutting down\n"); - CloseHandle( LogFileHandle ); + LogSpew(LF_ALWAYS, FATALERROR, "Logging shutting down\n"); + CloseHandle(LogFileHandle); } LogFileHandle = INVALID_HANDLE_VALUE; bLoggingInitialized = false; @@ -240,8 +239,8 @@ bool LoggingOn(DWORD facility, DWORD level) { _ASSERTE(LogFacilityMask & LF_ALWAYS); // LF_ALWAYS should always be enabled return((LogFlags & LOG_ENABLE) && - level <= LogVMLevel && - (facility & LogFacilityMask)); + level <= LogVMLevel && + (facility & LogFacilityMask)); } bool Logging2On(DWORD facility2, DWORD level) { @@ -250,8 +249,8 @@ bool Logging2On(DWORD facility2, DWORD level) { _ASSERTE(LogFacilityMask2 & LF_ALWAYS); // LF_ALWAYS should always be enabled return((LogFlags & LOG_ENABLE) && - level <= LogVMLevel && - (facility2 & LogFacilityMask2)); + level <= LogVMLevel && + (facility2 & LogFacilityMask2)); } // @@ -262,7 +261,7 @@ VOID LogSpewValist(DWORD facility, DWORD level, const char *fmt, va_list args) SCAN_IGNORE_FAULT; // calls to new (nothrow) in logging code are OK STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - + if (!LoggingOn(facility, level)) return; @@ -277,7 +276,7 @@ VOID LogSpew2Valist(DWORD facility2, DWORD level, const char *fmt, va_list args) SCAN_IGNORE_FAULT; // calls to new (nothrow) in logging code are OK STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - + if (!Logging2On(facility2, level)) return; @@ -292,7 +291,7 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args) SCAN_IGNORE_FAULT; // calls to new (nothrow) in logging code are OK STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - + DEBUG_ONLY_FUNCTION; // We can't do heap allocations at all. The current thread may have @@ -315,8 +314,8 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args) EnterLogLock(); - char * pBuffer = &rgchBuffer[0]; - DWORD buflen = 0; + char * pBuffer = &rgchBuffer[0]; + DWORD buflen = 0; DWORD written; static bool needsPrefix = true; @@ -324,19 +323,20 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args) if (needsPrefix) buflen = sprintf_s(pBuffer, COUNTOF(rgchBuffer), "TID %04x: ", GetCurrentThreadId()); - needsPrefix = (fmt[strlen(fmt)-1] == '\n'); + needsPrefix = (fmt[strlen(fmt) - 1] == '\n'); - int cCountWritten = _vsnprintf_s(&pBuffer[buflen], BUFFERSIZE-buflen, _TRUNCATE, fmt, args ); - pBuffer[BUFFERSIZE-1] = 0; + int cCountWritten = _vsnprintf_s(&pBuffer[buflen], BUFFERSIZE - buflen, _TRUNCATE, fmt, args); + pBuffer[BUFFERSIZE - 1] = 0; if (cCountWritten < 0) { buflen = BUFFERSIZE - 1; - } else { + } + else { buflen += cCountWritten; } // Its a little late for this, but at least you wont continue // trashing your program... - _ASSERTE((buflen < (DWORD) BUFFERSIZE) && "Log text is too long!") ; + _ASSERTE((buflen < (DWORD)BUFFERSIZE) && "Log text is too long!"); #if !PLATFORM_UNIX //convert NL's to CR NL to fixup notepad @@ -365,7 +365,7 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args) { WriteFile(LogFileHandle, pBuffer, buflen, &written, NULL); if (LogFlags & LOG_ENABLE_FLUSH_FILE) { - FlushFileBuffers( LogFileHandle ); + FlushFileBuffers(LogFileHandle); } } @@ -374,7 +374,7 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args) WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pBuffer, buflen, &written, 0); //@TODO ...Unnecessary to flush console? if (LogFlags & LOG_ENABLE_FLUSH_FILE) - FlushFileBuffers( GetStdHandle(STD_OUTPUT_HANDLE) ); + FlushFileBuffers(GetStdHandle(STD_OUTPUT_HANDLE)); } if (LogFlags & LOG_ENABLE_DEBUGGER_LOGGING) @@ -385,12 +385,12 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args) LeaveLogLock(); } -VOID LogSpew(DWORD facility, DWORD level, const char *fmt, ... ) +VOID LogSpew(DWORD facility, DWORD level, const char *fmt, ...) { STATIC_CONTRACT_WRAPPER; - + ENTER_SO_NOT_MAINLINE_CODE; - + #ifdef SELF_NO_HOST if (TRUE) #else //!SELF_NO_HOST @@ -399,7 +399,7 @@ VOID LogSpew(DWORD facility, DWORD level, const char *fmt, ... ) { va_list args; va_start(args, fmt); - LogSpewValist (facility, level, fmt, args); + LogSpewValist(facility, level, fmt, args); va_end(args); } else @@ -407,16 +407,16 @@ VOID LogSpew(DWORD facility, DWORD level, const char *fmt, ... ) // Cannot acquire the required lock, as this would call back // into the host. Eat the log message. } - + LEAVE_SO_NOT_MAINLINE_CODE; } -VOID LogSpew2(DWORD facility2, DWORD level, const char *fmt, ... ) +VOID LogSpew2(DWORD facility2, DWORD level, const char *fmt, ...) { STATIC_CONTRACT_WRAPPER; - + ENTER_SO_NOT_MAINLINE_CODE; - + #ifdef SELF_NO_HOST if (TRUE) #else //!SELF_NO_HOST @@ -433,16 +433,16 @@ VOID LogSpew2(DWORD facility2, DWORD level, const char *fmt, ... ) // Cannot acquire the required lock, as this would call back // into the host. Eat the log message. } - + LEAVE_SO_NOT_MAINLINE_CODE; } -VOID LogSpewAlways (const char *fmt, ... ) +VOID LogSpewAlways(const char *fmt, ...) { STATIC_CONTRACT_WRAPPER; - + ENTER_SO_NOT_MAINLINE_CODE; - + #ifdef SELF_NO_HOST if (TRUE) #else //!SELF_NO_HOST @@ -451,7 +451,7 @@ VOID LogSpewAlways (const char *fmt, ... ) { va_list args; va_start(args, fmt); - LogSpewValist (LF_ALWAYS, LL_ALWAYS, fmt, args); + LogSpewValist(LF_ALWAYS, LL_ALWAYS, fmt, args); va_end(args); } else @@ -459,7 +459,7 @@ VOID LogSpewAlways (const char *fmt, ... ) // Cannot acquire the required lock, as this would call back // into the host. Eat the log message. } - + LEAVE_SO_NOT_MAINLINE_CODE; } diff --git a/src/coreclr/src/vm/debugdebugger.cpp b/src/coreclr/src/vm/debugdebugger.cpp index ab05d63..daadc91 100644 --- a/src/coreclr/src/vm/debugdebugger.cpp +++ b/src/coreclr/src/vm/debugdebugger.cpp @@ -99,6 +99,7 @@ UINT_PTR FindMostRecentUserCodeOnStack(void) return address; } + // This does a user break, triggered by System.Diagnostics.Debugger.Break, or the IL opcode for break. // // Notes: -- 2.7.4