Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/coreclr/utilcode/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ HRESULT _OutOfMemory(LPCSTR szFile, int iLine)
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_DEBUG_ONLY;

printf("WARNING: Out of memory condition being issued from: %s, line %d\n", szFile, iLine);
minipal_log_print(minipal_log_flags_warning, "WARNING: Out of memory condition being issued from: %s, line %d\n", szFile, iLine);
return (E_OUTOFMEMORY);
}

Expand Down Expand Up @@ -257,7 +257,7 @@ bool _DbgBreakCheck(
if (formattedMessages)
{
OutputDebugStringUtf8(formatBuffer);
fprintf(stderr, "%s", formatBuffer);
minipal_log_print_error(formatBuffer);
}
else
{
Expand All @@ -268,12 +268,7 @@ bool _DbgBreakCheck(
OutputDebugStringUtf8("\n");
OutputDebugStringUtf8(szExpr);
OutputDebugStringUtf8("\n");
printf("%s", szLowMemoryAssertMessage);
printf("\n");
printf("%s", szFile);
printf("\n");
printf("%s", szExpr);
printf("\n");
minipal_log_print_error("%s\n%s\n%s\n", szLowMemoryAssertMessage, szFile, szExpr);
}

LogAssert(szFile, iLine, szExpr);
Expand Down Expand Up @@ -494,7 +489,7 @@ void DECLSPEC_NORETURN __FreeBuildAssertFail(const char *szFile, int iLine, cons
OutputDebugStringUtf8(buffer.GetUTF8());

// Write out the error to the console
printf("%s", buffer.GetUTF8());
minipal_log_print_error(buffer.GetUTF8());

// Log to the stress log. Note that we can't include the szExpr b/c that
// may not be a string literal (particularly for formatt-able asserts).
Expand Down
32 changes: 16 additions & 16 deletions src/coreclr/utilcode/executableallocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,27 @@ void ExecutableAllocator::DumpHolderUsage()
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);

fprintf(stderr, "Map time with lock sum: %lldms\n", g_mapTimeWithLockSum / (freq.QuadPart / 1000));
fprintf(stderr, "Map time sum: %lldms\n", g_mapTimeSum / (freq.QuadPart / 1000));
fprintf(stderr, "Map find RX time sum: %lldms\n", g_mapFindRXTimeSum / (freq.QuadPart / 1000));
fprintf(stderr, "Map create time sum: %lldms\n", g_mapCreateTimeSum / (freq.QuadPart / 1000));
fprintf(stderr, "Unmap time with lock sum: %lldms\n", g_unmapTimeWithLockSum / (freq.QuadPart / 1000));
fprintf(stderr, "Unmap time sum: %lldms\n", g_unmapTimeSum / (freq.QuadPart / 1000));
minipal_log_print_info("Map time with lock sum: %lldms\n", g_mapTimeWithLockSum / (freq.QuadPart / 1000));
minipal_log_print_info("Map time sum: %lldms\n", g_mapTimeSum / (freq.QuadPart / 1000));
minipal_log_print_info("Map find RX time sum: %lldms\n", g_mapFindRXTimeSum / (freq.QuadPart / 1000));
minipal_log_print_info("Map create time sum: %lldms\n", g_mapCreateTimeSum / (freq.QuadPart / 1000));
minipal_log_print_info("Unmap time with lock sum: %lldms\n", g_unmapTimeWithLockSum / (freq.QuadPart / 1000));
minipal_log_print_info("Unmap time sum: %lldms\n", g_unmapTimeSum / (freq.QuadPart / 1000));

fprintf(stderr, "Reserve count: %lld\n", g_reserveCount);
fprintf(stderr, "Release count: %lld\n", g_releaseCount);
minipal_log_print_info("Reserve count: %lld\n", g_reserveCount);
minipal_log_print_info("Release count: %lld\n", g_releaseCount);

fprintf(stderr, "g_MapRW_Calls: %lld\n", g_MapRW_Calls);
fprintf(stderr, "g_MapRW_CallsWithCacheMiss: %lld\n", g_MapRW_CallsWithCacheMiss);
fprintf(stderr, "g_MapRW_LinkedListWalkDepth: %lld\n", g_MapRW_LinkedListWalkDepth);
fprintf(stderr, "g_MapRW_LinkedListAverageDepth: %f\n", (double)g_MapRW_LinkedListWalkDepth/(double)g_MapRW_CallsWithCacheMiss);
fprintf(stderr, "g_LinkedListTotalDepth: %lld\n", g_LinkedListTotalDepth);
minipal_log_print_info("g_MapRW_Calls: %lld\n", g_MapRW_Calls);
minipal_log_print_info("g_MapRW_CallsWithCacheMiss: %lld\n", g_MapRW_CallsWithCacheMiss);
minipal_log_print_info("g_MapRW_LinkedListWalkDepth: %lld\n", g_MapRW_LinkedListWalkDepth);
minipal_log_print_info("g_MapRW_LinkedListAverageDepth: %f\n", (double)g_MapRW_LinkedListWalkDepth/(double)g_MapRW_CallsWithCacheMiss);
minipal_log_print_info("g_LinkedListTotalDepth: %lld\n", g_LinkedListTotalDepth);

fprintf(stderr, "ExecutableWriterHolder usage:\n");
minipal_log_print_info("ExecutableWriterHolder usage:\n");

for (int i = 0; i < s_logMaxIndex; i++)
{
fprintf(stderr, "Count: %d at %s:%d in %s\n", s_usageLog[i].count, s_usageLog[i].source, s_usageLog[i].line, s_usageLog[i].function);
minipal_log_print_info("Count: %d at %s:%d in %s\n", s_usageLog[i].count, s_usageLog[i].source, s_usageLog[i].line, s_usageLog[i].function);
}
}

Expand Down Expand Up @@ -251,7 +251,7 @@ HRESULT ExecutableAllocator::StaticInitialize(FatalErrorHandler fatalErrorHandle
{
if ((customCacheSize > ARRAY_SIZE(m_cachedMapping)) || (customCacheSize <= 0))
{
printf("Invalid value in 'EXECUTABLE_ALLOCATOR_CACHE_SIZE' environment variable'\n");
minipal_log_print_error("Invalid value in 'EXECUTABLE_ALLOCATOR_CACHE_SIZE' environment variable'\n");
return E_FAIL;
}

Expand Down
41 changes: 24 additions & 17 deletions src/coreclr/utilcode/loaderheap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,33 +533,36 @@ class LoaderHeapSniffer
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_FORBID_FAULT;

printf("\n------------- LoaderHeapEvents (in reverse time order!) --------------------");
minipal_log_print_info("\n------------- LoaderHeapEvents (in reverse time order!) --------------------");

StackSString buf;
LoaderHeapEvent *pEvent = pHeap->m_pEventList;
while (pEvent)
{
printf("\n");
minipal_log_print_info("\n");

switch (pEvent->m_allocationType)
{
case kAllocMem: printf("AllocMem "); break;
case kFreedMem: printf("BackoutMem "); break;
case kAllocMem: buf.AppendUTF8("AllocMem "); break;
case kFreedMem: buf.AppendUTF8("BackoutMem "); break;

}
printf(" ptr = 0x%-8p", pEvent->m_pMem);
printf(" rqsize = 0x%-8x", (DWORD)pEvent->m_dwRequestedSize);
printf(" actsize = 0x%-8x", (DWORD)pEvent->m_dwSize);
printf(" (at %s@%d)", pEvent->m_szFile, pEvent->m_lineNum);
buf.AppendPrintf(" ptr = 0x%-8p", pEvent->m_pMem);
buf.AppendPrintf(" rqsize = 0x%-8x", (DWORD)pEvent->m_dwRequestedSize);
buf.AppendPrintf(" actsize = 0x%-8x", (DWORD)pEvent->m_dwSize);
buf.AppendPrintf(" (at %s@%d)", pEvent->m_szFile, pEvent->m_lineNum);
if (pEvent->m_allocationType == kFreedMem)
{
printf(" (original allocation at %s@%d)", pEvent->m_szAllocFile, pEvent->m_allocLineNum);
buf.AppendPrintf(" (original allocation at %s@%d)", pEvent->m_szAllocFile, pEvent->m_allocLineNum);
}

minipal_log_print_info(buf.GetUTF8());
buf.Clear();

pEvent = pEvent->m_pNext;

}
printf("\n------------- End of LoaderHeapEvents --------------------------------------");
printf("\n");

minipal_log_print_info("\n------------- End of LoaderHeapEvents --------------------------------------\n");
}


Expand Down Expand Up @@ -1925,10 +1928,11 @@ void UnlockedLoaderHeap::DumpFreeList()
LIMITED_METHOD_CONTRACT;
if (m_pFirstFreeBlock == NULL)
{
printf("FREEDUMP: FreeList is empty\n");
minipal_log_print_info("FREEDUMP: FreeList is empty\n");
}
else
{
InlineSString<128> buf;
LoaderHeapFreeBlock *pBlock = m_pFirstFreeBlock;
while (pBlock != NULL)
{
Expand All @@ -1950,10 +1954,13 @@ void UnlockedLoaderHeap::DumpFreeList()
}
}

printf("Addr = %pxh, Size = %xh", pBlock, ((ULONG)dwsize));
if (ccbad) printf(" *** ERROR: NOT CC'd ***");
if (sizeunaligned) printf(" *** ERROR: size not a multiple of ALLOC_ALIGN_CONSTANT ***");
printf("\n");
buf.Printf("Addr = %pxh, Size = %xh", pBlock, ((ULONG)dwsize));
if (ccbad) buf.AppendUTF8(" *** ERROR: NOT CC'd ***");
if (sizeunaligned) buf.AppendUTF8(" *** ERROR: size not a multiple of ALLOC_ALIGN_CONSTANT ***");
buf.AppendUTF8("\n");

minipal_log_print_info(buf.GetUTF8());
buf.Clear();

pBlock = pBlock->m_pNext;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/utilcode/util_nodependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void InitRunningOnVersionStatus ()
else
{
// The current platform isn't supported. Display a message to this effect and exit.
fprintf(stderr, "Platform not supported: Windows 7 is the minimum supported version\n");
minipal_log_print_error("Platform not supported: Windows 7 is the minimum supported version\n");
TerminateProcess(GetCurrentProcess(), NON_SUPPORTED_PLATFORM_TERMINATE_ERROR_CODE);
}
#endif // HOST_WINDOWS
Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1226,10 +1226,7 @@ static void RunMainInternal(Param* pParam)

GCPROTECT_END();

//<TODO>
// When we get mainCRTStartup from the C++ then this should be able to go away.</TODO>
fflush(stdout);
fflush(stderr);
minipal_log_flush_all();
}

/* static */
Expand Down
22 changes: 11 additions & 11 deletions src/coreclr/vm/binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ static void FCallCheckSignature(MethodDesc* pMD, PCODE pImpl)
// when managed type is well known
if (!(strlen(expectedType) == len && SString::_strnicmp(expectedType, pUnmanagedArg, (COUNT_T)len) == 0))
{
printf("CheckExtended: The managed and unmanaged fcall signatures do not match, Method: %s:%s. Argument: %d Expecting: %s Actual: %s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName, argIndex, expectedType, pUnManagedType);
minipal_log_print_error("CheckExtended: The managed and unmanaged fcall signatures do not match, Method: %s:%s. Argument: %d Expecting: %s Actual: %s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName, argIndex, expectedType, pUnManagedType);
}
}
else
Expand Down Expand Up @@ -928,7 +928,7 @@ static void FCallCheckSignature(MethodDesc* pMD, PCODE pImpl)
}
if (bSigError)
{
printf("CheckExtended: The managed and unmanaged fcall signatures do not match, Method: %s:%s. Argument: %d Expecting: (CorElementType)%d actual: %s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName, argIndex, argType, pUnManagedType);
minipal_log_print_error("CheckExtended: The managed and unmanaged fcall signatures do not match, Method: %s:%s. Argument: %d Expecting: (CorElementType)%d actual: %s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName, argIndex, argType, pUnManagedType);
}
}
pUnmanagedArg = (pUnmanagedArgEnd != NULL) ? (pUnmanagedArgEnd+1) : NULL;
Expand All @@ -943,14 +943,14 @@ static void FCallCheckSignature(MethodDesc* pMD, PCODE pImpl)
{
if (!((pUnmanagedArg != NULL) && strcmp(pUnmanagedArg, "...") == 0))
{
printf("CheckExtended: Expecting varargs in unmanaged fcall signature, Method: %s:%s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName);
minipal_log_print_error("CheckExtended: Expecting varargs in unmanaged fcall signature, Method: %s:%s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName);
}
}
else
{
if (!(pUnmanagedArg == NULL))
{
printf("CheckExtended: Unexpected end of unmanaged fcall signature, Method: %s:%s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName);
minipal_log_print_error("CheckExtended: Unexpected end of unmanaged fcall signature, Method: %s:%s\n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName);
}
}
}
Expand Down Expand Up @@ -1042,7 +1042,7 @@ void CoreLibBinder::CheckExtended()

if (fError)
{
printf("CheckExtended: VM expects type to exist: %s.%s\n", CoreLibBinder::GetClassNameSpace(cID), CoreLibBinder::GetClassName(cID));
minipal_log_print_error("CheckExtended: VM expects type to exist: %s.%s\n", CoreLibBinder::GetClassNameSpace(cID), CoreLibBinder::GetClassName(cID));
}
}

Expand All @@ -1065,7 +1065,7 @@ void CoreLibBinder::CheckExtended()

if (fError)
{
printf("CheckExtended: VM expects method to exist: %s.%s::%s\n", CoreLibBinder::GetClassNameSpace(cID), CoreLibBinder::GetClassName(cID), CoreLibBinder::GetMethodName(mID));
minipal_log_print_error("CheckExtended: VM expects method to exist: %s.%s::%s\n", CoreLibBinder::GetClassNameSpace(cID), CoreLibBinder::GetClassName(cID), CoreLibBinder::GetMethodName(mID));
}
}

Expand All @@ -1088,7 +1088,7 @@ void CoreLibBinder::CheckExtended()

if (fError)
{
printf("CheckExtended: VM expects field to exist: %s.%s::%s\n", CoreLibBinder::GetClassNameSpace(cID), CoreLibBinder::GetClassName(cID), CoreLibBinder::GetFieldName(fID));
minipal_log_print_error("CheckExtended: VM expects field to exist: %s.%s::%s\n", CoreLibBinder::GetClassNameSpace(cID), CoreLibBinder::GetClassName(cID), CoreLibBinder::GetFieldName(fID));
}
}

Expand Down Expand Up @@ -1141,7 +1141,7 @@ void CoreLibBinder::CheckExtended()
{
pszClassName = pszNameSpace = "Invalid TypeDef record";
}
printf("CheckExtended: Unable to load class from System.Private.CoreLib: %s.%s\n", pszNameSpace, pszClassName);
minipal_log_print_error("CheckExtended: Unable to load class from System.Private.CoreLib: %s.%s\n", pszNameSpace, pszClassName);
}
EX_END_CATCH(SwallowAllExceptions)

Expand Down Expand Up @@ -1181,7 +1181,7 @@ void CoreLibBinder::CheckExtended()
{
pszName = "Invalid method name";
}
printf("CheckExtended: Unable to find qcall implementation: %s.%s::%s (EntryPoint name: %s)\n", pszNameSpace, pszClassName, pszName, pNMD->GetEntrypointName());
minipal_log_print_error("CheckExtended: Unable to find qcall implementation: %s.%s::%s (EntryPoint name: %s)\n", pszNameSpace, pszClassName, pszName, pNMD->GetEntrypointName());
}
continue;
}
Expand All @@ -1203,7 +1203,7 @@ void CoreLibBinder::CheckExtended()
{
pszName = "Invalid method name";
}
printf("CheckExtended: Unable to find internalcall implementation: %s.%s::%s\n", pszNameSpace, pszClassName, pszName);
minipal_log_print_error("CheckExtended: Unable to find internalcall implementation: %s.%s::%s\n", pszNameSpace, pszClassName, pszName);
}

if (id != 0)
Expand Down Expand Up @@ -1231,7 +1231,7 @@ void CoreLibBinder::CheckExtended()
#define ASMCONSTANTS_RUNTIME_ASSERT(cond) _ASSERTE(cond)
#include "asmconstants.h"

printf("CheckExtended: completed without exception.\n");
minipal_log_print_info("CheckExtended: completed without exception.\n");

ErrExit:
_ASSERTE(SUCCEEDED(hr));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/ceemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ void EEStartupHelper()
Disassembler::StaticInitialize();
if (!Disassembler::IsAvailable())
{
fprintf(stderr, "External disassembler is not available.\n");
minipal_log_print_error("External disassembler is not available.\n");
IfFailGo(E_FAIL);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,7 @@ void MethodTable::DebugRecursivelyDumpInstanceFields(LPCUTF8 pszClassName, BOOL
{
FieldDesc *pFD = &GetClass()->GetFieldDescList()[i];
#ifdef DEBUG_LAYOUT
printf("offset %s%3d %s\n", pFD->IsByValue() ? "byvalue " : "", pFD->GetOffset(), pFD->GetName());
minipal_log_print_info("offset %s%3d %s\n", pFD->IsByValue() ? "byvalue " : "", pFD->GetOffset(), pFD->GetName());
#endif
if(debug) {
ssBuff.Printf("offset %3d %s\n", pFD->GetOffset(), pFD->GetName());
Expand Down
16 changes: 10 additions & 6 deletions src/coreclr/vm/classcompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,25 +499,29 @@ InteropMethodTableData *MethodTableBuilder::BuildInteropVTable(AllocMemTracker *
PCCOR_SIGNATURE pSig;
ULONG cbSig;

printf("InteropMethodTable\n--------------\n");
printf("VTable\n------\n");
minipal_log_print_info("InteropMethodTable\n--------------\nVTable\n------\n");

StackSString message;
for (DWORD i = 0; i < pInteropMT->cVTable; i++)
{
// Print the method name
InteropMethodTableSlotData *pInteropMD = &pInteropMT->pVTable[i];
printf(pInteropMD->pMD->GetName());
printf(" ");
message.AppendUTF8(pInteropMD->pMD->GetName());
message.AppendUTF8(" ");

// Print the sig
if (FAILED(pInteropMD->pMD->GetMDImport()->GetSigOfMethodDef(pInteropMD->pMD->GetMemberDef(), &cbSig, &pSig)))
{
pSig = NULL;
cbSig = 0;
}

PrettyPrintSigInternalLegacy(pSig, cbSig, "", &qb, pInteropMD->pMD->GetMDImport());
printf((LPCUTF8) qb.Ptr());
printf("\n");
message.AppendUTF8((LPCUTF8) qb.Ptr());
message.AppendUTF8("\n");

minipal_log_print_info(message.GetUTF8());
message.Clear();
}
}
#endif // _DEBUG
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/vm/codeman.h
Original file line number Diff line number Diff line change
Expand Up @@ -2431,8 +2431,7 @@ class ExecutionManager

static void DumpExecutionManagerUsage()
{
fprintf(stderr, "JumpStub usage count:\n");
fprintf(stderr, "Normal: %u, LCG: %u\n", m_normal_JumpStubLookup, m_LCG_JumpStubLookup);
minipal_log_print_info("JumpStub usage count:\nNormal: %u, LCG: %u\n", m_normal_JumpStubLookup, m_LCG_JumpStubLookup);
}

struct JumpStubCache
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/codepitchingmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static void LookupOrCreateInPitchingCandidate(MethodDesc* pMD, ULONG sizeOfCode)
const char* szClassName = className.GetUTF8();
const char* szMethodSig = methodSig.GetUTF8();

printf("Candidate %lu %s :: %s %s\n",
minipal_log_print_info("Candidate %lu %s :: %s %s\n",
sizeOfCode, szClassName, pMD->GetName(), szMethodSig);
}
#endif
Expand Down Expand Up @@ -415,7 +415,7 @@ void MethodDesc::PitchNativeCode()
const char* szClassName = className.GetUTF8();
const char* szMethodSig = methodSig.GetUTF8();

printf("Pitched %lu %lu %s :: %s %s\n",
minipal_log_print_info("Pitched %lu %lu %s :: %s %s\n",
s_PitchedMethodCounter, pitchedBytes, szClassName, GetName(), szMethodSig);
}

Expand Down Expand Up @@ -490,7 +490,7 @@ EXTERN_C void SavePitchingCandidate(MethodDesc* pMD, ULONG sizeOfCode)
SimpleWriteLockHolder swlh(s_totalNCSizeLock);
s_totalNCSize += sizeOfCode;
if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_JitPitchPrintStat) != 0)
printf("jitted %lu (bytes) pitched %lu (bytes)\n", s_totalNCSize, s_jitPitchedBytes);
minipal_log_print_info("jitted %lu (bytes) pitched %lu (bytes)\n", s_totalNCSize, s_jitPitchedBytes);
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/debughelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static StackWalkAction PrintStackTraceCallback(CrawlFrame* pCF, VOID* pData)

if (pCBD->toStdout)
{
printf("%s\n", buff);
minipal_log_print_info("%s\n", buff);
}
#ifdef _DEBUG
else if (pCBD->toLOG)
Expand Down
Loading
Loading