summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2015-08-22 01:00:11 -0700
committerMike McLaughlin <mikem@microsoft.com>2015-08-22 01:00:11 -0700
commite0a90672053736de74a2530fc1b31ea70f3d2dc8 (patch)
treea766f9fa5de081e5abbaa797f7e1652f8b5bf483 /src
parentf7958cfe0c7b83b8c068ad0d082fbf6cebb2c0a9 (diff)
parent2f4462661a5134428738c0da4ef2061857b7528e (diff)
downloadcoreclr-e0a90672053736de74a2530fc1b31ea70f3d2dc8.tar.gz
coreclr-e0a90672053736de74a2530fc1b31ea70f3d2dc8.tar.bz2
coreclr-e0a90672053736de74a2530fc1b31ea70f3d2dc8.zip
Merge pull request #1423 from mikem8361/gcroot
Enable gcroot and other gc related sos commands.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/ToolBox/SOS/CMakeLists.txt2
-rw-r--r--src/ToolBox/SOS/Strike/CMakeLists.txt4
-rw-r--r--src/ToolBox/SOS/Strike/ExpressionNode.cpp82
-rw-r--r--src/ToolBox/SOS/Strike/WatchCmd.cpp16
-rw-r--r--src/ToolBox/SOS/Strike/datatarget.cpp4
-rw-r--r--src/ToolBox/SOS/Strike/datatarget.h4
-rw-r--r--src/ToolBox/SOS/Strike/disasm.cpp4
-rw-r--r--src/ToolBox/SOS/Strike/disasm.h2
-rw-r--r--src/ToolBox/SOS/Strike/disasmX86.cpp12
-rw-r--r--src/ToolBox/SOS/Strike/dllsext.cpp2
-rw-r--r--src/ToolBox/SOS/Strike/eeheap.cpp16
-rw-r--r--src/ToolBox/SOS/Strike/exts.cpp6
-rw-r--r--src/ToolBox/SOS/Strike/gchist.cpp2
-rw-r--r--src/ToolBox/SOS/Strike/gcroot.cpp26
-rw-r--r--src/ToolBox/SOS/Strike/metadata.cpp16
-rw-r--r--src/ToolBox/SOS/Strike/sildasm.cpp4
-rw-r--r--src/ToolBox/SOS/Strike/sos.cpp18
-rw-r--r--src/ToolBox/SOS/Strike/sos.h12
-rw-r--r--src/ToolBox/SOS/Strike/stressLogDump.cpp40
-rw-r--r--src/ToolBox/SOS/Strike/strike.cpp117
-rw-r--r--src/ToolBox/SOS/Strike/strike.h31
-rw-r--r--src/ToolBox/SOS/Strike/util.cpp112
-rw-r--r--src/ToolBox/SOS/Strike/util.h70
-rw-r--r--src/ToolBox/SOS/Strike/vm.cpp4
-rw-r--r--src/inc/daccess.h14
-rw-r--r--src/inc/fusionbind.h4
-rw-r--r--src/inc/holder.h6
-rw-r--r--src/inc/safemath.h4
-rw-r--r--src/inc/sospriv.idl30
-rw-r--r--src/inc/utilcode.h5
-rw-r--r--src/pal/inc/pal.h75
-rw-r--r--src/pal/inc/pal_mstypes.h5
-rw-r--r--src/pal/inc/rt/palrt.h8
-rw-r--r--src/pal/inc/rt/sal.h2
-rw-r--r--src/pal/inc/rt/specstrings.h2
-rw-r--r--src/pal/inc/strsafe.h4
-rw-r--r--src/pal/prebuilt/inc/sospriv.h60
-rw-r--r--src/pal/src/cruntime/silent_printf.cpp1
39 files changed, 439 insertions, 393 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4520b9307c..ded1a95bbc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,6 +22,11 @@ include_directories("classlibnative/cryptography")
include_directories("classlibnative/inc")
if(CLR_CMAKE_PLATFORM_UNIX)
+ add_subdirectory(ToolBox/SOS/Strike)
+
+ # Include the dummy c++ include files
+ include_directories("pal/inc/rt/cpp")
+
# This prevents inclusion of standard C compiler headers
add_compile_options(-nostdinc)
@@ -29,7 +34,6 @@ if(CLR_CMAKE_PLATFORM_UNIX)
# This prevents inclusion of standard C++ compiler headers
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc++")
endif(NOT CLR_CMAKE_PLATFORM_DARWIN)
-
endif(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(utilcode)
diff --git a/src/ToolBox/SOS/CMakeLists.txt b/src/ToolBox/SOS/CMakeLists.txt
index 6eb50fdd90..a0c7a24239 100644
--- a/src/ToolBox/SOS/CMakeLists.txt
+++ b/src/ToolBox/SOS/CMakeLists.txt
@@ -1,5 +1,5 @@
-add_subdirectory(Strike)
if(WIN32)
+ add_subdirectory(Strike)
add_subdirectory(DacTableGen)
add_subdirectory(diasdk)
endif(WIN32)
diff --git a/src/ToolBox/SOS/Strike/CMakeLists.txt b/src/ToolBox/SOS/Strike/CMakeLists.txt
index eba017105d..3ab4072318 100644
--- a/src/ToolBox/SOS/Strike/CMakeLists.txt
+++ b/src/ToolBox/SOS/Strike/CMakeLists.txt
@@ -91,6 +91,10 @@ if(WIN32)
ntdll.lib
)
else(WIN32)
+ add_definitions(-DPAL_STDCPP_COMPAT=1)
+ add_compile_options(-Wno-null-arithmetic)
+ add_compile_options(-Wno-format)
+
include_directories(../lldbplugin/inc)
include_directories(BEFORE ${VM_DIR})
include_directories(${CLR_DIR}/src/debug/shim)
diff --git a/src/ToolBox/SOS/Strike/ExpressionNode.cpp b/src/ToolBox/SOS/Strike/ExpressionNode.cpp
index ee69f51563..7fd4089e29 100644
--- a/src/ToolBox/SOS/Strike/ExpressionNode.cpp
+++ b/src/ToolBox/SOS/Strike/ExpressionNode.cpp
@@ -474,17 +474,17 @@ BOOL ExpressionNode::ShouldExpandVariable(__in_z WCHAR* varToExpand)
if(pAbsoluteExpression == NULL || varToExpand == NULL) return FALSE;
// if there is a cast operation, move past it
- WCHAR* pEndCast = wcschr(varToExpand, L')');
+ WCHAR* pEndCast = _wcschr(varToExpand, L')');
varToExpand = (pEndCast == NULL) ? varToExpand : pEndCast+1;
- size_t varToExpandLen = wcslen(varToExpand);
- size_t currentExpansionLen = wcslen(pAbsoluteExpression);
+ size_t varToExpandLen = _wcslen(varToExpand);
+ size_t currentExpansionLen = _wcslen(pAbsoluteExpression);
if(currentExpansionLen > varToExpandLen) return FALSE;
if(currentExpansionLen < varToExpandLen &&
varToExpand[currentExpansionLen] != L'.' &&
varToExpand[currentExpansionLen] != L'[')
return FALSE;
- if(wcsncmp(pAbsoluteExpression, varToExpand, currentExpansionLen) != 0) return FALSE;
+ if(_wcsncmp(pAbsoluteExpression, varToExpand, currentExpansionLen) != 0) return FALSE;
return TRUE;
}
@@ -558,9 +558,9 @@ HRESULT ExpressionNode::ExpandFields(ICorDebugValue* pInnerValue, __in_z WCHAR*
ExpressionNode* pBaseTypeNode = NULL;
if(SUCCEEDED(pType->GetBase(&pBaseType)) && pBaseType != NULL && SUCCEEDED(CalculateTypeName(pBaseType, baseTypeName, mdNameLen)))
{
- if(wcsncmp(baseTypeName, L"System.Enum", 11) == 0)
+ if(_wcsncmp(baseTypeName, L"System.Enum", 11) == 0)
return S_OK;
- else if(wcsncmp(baseTypeName, L"System.Object", 13) != 0 && wcsncmp(baseTypeName, L"System.ValueType", 16) != 0)
+ else if(_wcsncmp(baseTypeName, L"System.Object", 13) != 0 && _wcsncmp(baseTypeName, L"System.ValueType", 16) != 0)
{
pBaseTypeNode = new ExpressionNode(pAbsoluteExpression, ChildKind_BaseClass, L"<baseclass>", pInnerValue, pBaseType, pILFrame);
AddChild(pBaseTypeNode);
@@ -629,9 +629,9 @@ HRESULT ExpressionNode::ExpandFields(ICorDebugValue* pInnerValue, __in_z WCHAR*
if(pBaseTypeNode == NULL) return Status;
if(fieldExpanded) return Status;
- WCHAR* pEndCast = wcschr(varToExpand, L')');
+ WCHAR* pEndCast = _wcschr(varToExpand, L')');
WCHAR* pNonCast = (pEndCast == NULL) ? varToExpand : pEndCast+1;
- if(wcscmp(pNonCast, pAbsoluteExpression) != 0)
+ if(_wcscmp(pNonCast, pAbsoluteExpression) != 0)
{
pBaseTypeNode->Expand(varToExpand);
return Status;
@@ -641,8 +641,8 @@ HRESULT ExpressionNode::ExpandFields(ICorDebugValue* pInnerValue, __in_z WCHAR*
{
int cchCastTypeName = ((int)(pEndCast-1)-(int)varToExpand)/2;
PopulateType();
- if(wcslen(pTypeName) != (cchCastTypeName) ||
- wcsncmp(varToExpand+1, pTypeName, cchCastTypeName) != 0)
+ if(_wcslen(pTypeName) != (cchCastTypeName) ||
+ _wcsncmp(varToExpand+1, pTypeName, cchCastTypeName) != 0)
{
pBaseTypeNode->Expand(varToExpand);
return Status;
@@ -712,7 +712,7 @@ BOOL ExpressionNode::IsEnum(ICorDebugValue * pInputValue)
if(FAILED(pType->GetBase(&pBaseType)) || pBaseType == NULL) return FALSE;
if(FAILED(CalculateTypeName(pBaseType, baseTypeName, mdNameLen))) return FALSE;
- return (wcsncmp(baseTypeName, L"System.Enum", 11) == 0);
+ return (_wcsncmp(baseTypeName, L"System.Enum", 11) == 0);
}
// Calculates the value text for nodes that have enum values
@@ -1208,7 +1208,7 @@ VOID ExpressionNode::EvaluateExpressionFrameScanCallback(ICorDebugFrame* pFrame,
VOID ExpressionNode::EvaluateExpressionVariableScanCallback(ICorDebugValue* pValue, __in_z WCHAR* pName, __out_z WCHAR* pErrorMessage, VOID* pUserData)
{
EvaluateExpressionFrameScanData* pData = (EvaluateExpressionFrameScanData*)pUserData;
- if(wcscmp(pName, pData->pIdentifier) == 0)
+ if(_wcscmp(pName, pData->pIdentifier) == 0)
{
// found it
pData->pFoundValue = pValue;
@@ -1484,7 +1484,7 @@ HRESULT ExpressionNode::CreateExpressionNodeHelper(__in_z WCHAR* pExpression,
UVCP_CONSTANT pDefaultValue;
ULONG cchDefaultValue;
if(SUCCEEDED(pBaseTypeMD->GetFieldProps(fieldDef, NULL, mdName, mdNameLen, &nameLen, &fieldAttr, NULL, NULL, (DWORD*)&fieldDefaultValueEt, &pDefaultValue, &cchDefaultValue)) &&
- wcscmp(mdName, pIdentifier) == 0)
+ _wcscmp(mdName, pIdentifier) == 0)
{
ToRelease<ICorDebugType> pFieldValType = NULL;
ToRelease<ICorDebugValue> pFieldVal;
@@ -1576,12 +1576,12 @@ HRESULT ExpressionNode::ParseNextIdentifier(__in_z WCHAR** expression, __inout_e
WCHAR* expressionStart = *expression;
DWORD currentCharsParsed = *charactersParsed;
- DWORD identifierLen = (DWORD) wcscspn(expressionStart, L".[");
+ DWORD identifierLen = (DWORD) _wcscspn(expressionStart, L".[");
// if the first character was a . or [ skip over it. Note that we don't
// do this always in case the first WCHAR was part of a surrogate pair
if(identifierLen == 0)
{
- identifierLen = (DWORD) wcscspn(expressionStart+1, L".[") + 1;
+ identifierLen = (DWORD) _wcscspn(expressionStart+1, L".[") + 1;
}
*expression += identifierLen;
@@ -1676,7 +1676,7 @@ HRESULT ExpressionNode::EnumerateParameters(IMetaDataImport * pMD,
if(SUCCEEDED(pMD->GetParamForMethodIndex(methodDef, idx, &paramDef)))
pMD->GetParamProps(paramDef, NULL, NULL, paramName, mdNameLen, &paramNameLen, NULL, NULL, NULL, NULL);
}
- if(wcslen(paramName) == 0)
+ if(_wcslen(paramName) == 0)
swprintf_s(paramName, mdNameLen, L"param_%d\0", i);
ToRelease<ICorDebugValue> pValue;
@@ -1736,7 +1736,7 @@ HRESULT ExpressionNode::EnumerateLocals(IMetaDataImport * pMD,
ULONG cArgsFetched;
hr = pLocalsEnum->Next(1, &pValue, &cArgsFetched);
}
- if(wcslen(paramName) == 0)
+ if(_wcslen(paramName) == 0)
swprintf_s(paramName, mdNameLen, L"local_%d\0", i);
if (FAILED(hr))
@@ -1899,75 +1899,75 @@ HRESULT ExpressionNode::GetCanonicalElementTypeForTypeName(__in_z WCHAR* pTypeNa
//Sadly ICorDebug deliberately prevents creating ICorDebugType instances
//that use canonical short form element types... seems like an issue to me.
- if(wcscmp(pTypeName, L"System.String")==0)
+ if(_wcscmp(pTypeName, L"System.String")==0)
{
*et = ELEMENT_TYPE_STRING;
}
- else if(wcscmp(pTypeName, L"System.Object")==0)
+ else if(_wcscmp(pTypeName, L"System.Object")==0)
{
*et = ELEMENT_TYPE_OBJECT;
}
- else if(wcscmp(pTypeName, L"System.Void")==0)
+ else if(_wcscmp(pTypeName, L"System.Void")==0)
{
*et = ELEMENT_TYPE_VOID;
}
- else if(wcscmp(pTypeName, L"System.Boolean")==0)
+ else if(_wcscmp(pTypeName, L"System.Boolean")==0)
{
*et = ELEMENT_TYPE_BOOLEAN;
}
- else if(wcscmp(pTypeName, L"System.Char")==0)
+ else if(_wcscmp(pTypeName, L"System.Char")==0)
{
*et = ELEMENT_TYPE_CHAR;
}
- else if(wcscmp(pTypeName, L"System.Byte")==0)
+ else if(_wcscmp(pTypeName, L"System.Byte")==0)
{
*et = ELEMENT_TYPE_U1;
}
- else if(wcscmp(pTypeName, L"System.Sbyte")==0)
+ else if(_wcscmp(pTypeName, L"System.Sbyte")==0)
{
*et = ELEMENT_TYPE_I1;
}
- else if(wcscmp(pTypeName, L"System.Int16")==0)
+ else if(_wcscmp(pTypeName, L"System.Int16")==0)
{
*et = ELEMENT_TYPE_I2;
}
- else if(wcscmp(pTypeName, L"System.UInt16")==0)
+ else if(_wcscmp(pTypeName, L"System.UInt16")==0)
{
*et = ELEMENT_TYPE_U2;
}
- else if(wcscmp(pTypeName, L"System.UInt32")==0)
+ else if(_wcscmp(pTypeName, L"System.UInt32")==0)
{
*et = ELEMENT_TYPE_U4;
}
- else if(wcscmp(pTypeName, L"System.Int32")==0)
+ else if(_wcscmp(pTypeName, L"System.Int32")==0)
{
*et = ELEMENT_TYPE_I4;
}
- else if(wcscmp(pTypeName, L"System.UInt64")==0)
+ else if(_wcscmp(pTypeName, L"System.UInt64")==0)
{
*et = ELEMENT_TYPE_U8;
}
- else if(wcscmp(pTypeName, L"System.Int64")==0)
+ else if(_wcscmp(pTypeName, L"System.Int64")==0)
{
*et = ELEMENT_TYPE_I8;
}
- else if(wcscmp(pTypeName, L"System.Single")==0)
+ else if(_wcscmp(pTypeName, L"System.Single")==0)
{
*et = ELEMENT_TYPE_R4;
}
- else if(wcscmp(pTypeName, L"System.Double")==0)
+ else if(_wcscmp(pTypeName, L"System.Double")==0)
{
*et = ELEMENT_TYPE_R8;
}
- else if(wcscmp(pTypeName, L"System.IntPtr")==0)
+ else if(_wcscmp(pTypeName, L"System.IntPtr")==0)
{
*et = ELEMENT_TYPE_U;
}
- else if(wcscmp(pTypeName, L"System.UIntPtr")==0)
+ else if(_wcscmp(pTypeName, L"System.UIntPtr")==0)
{
*et = ELEMENT_TYPE_I;
}
- else if(wcscmp(pTypeName, L"System.TypedReference")==0)
+ else if(_wcscmp(pTypeName, L"System.TypedReference")==0)
{
*et = ELEMENT_TYPE_TYPEDBYREF;
}
@@ -2056,8 +2056,8 @@ HRESULT ExpressionNode::FindTypeByName(ICorDebugModule* pModule, __in_z WCHAR* p
// before the list
WCHAR rootName[mdNameLen];
WCHAR* pRootName = NULL;
- int typeNameLen = (int) wcslen(pTypeName);
- int genericParamListStart = (int) wcscspn(pTypeName, L"<");
+ int typeNameLen = (int) _wcslen(pTypeName);
+ int genericParamListStart = (int) _wcscspn(pTypeName, L"<");
if(genericParamListStart != typeNameLen)
{
if(pTypeName[typeNameLen-1] != L'>' || genericParamListStart > mdNameLen)
@@ -2112,8 +2112,8 @@ HRESULT ExpressionNode::FindTypeByName(ICorDebugModule* pModule, __in_z WCHAR* p
for(int i = 0; i < countTypeParams; i++)
{
WCHAR typeParamName[mdNameLen];
- WCHAR* pNextComma = wcschr(pCurName, L',');
- int len = (pNextComma != NULL) ? (int)(pNextComma - pCurName) : (int)wcslen(pCurName)-1;
+ WCHAR* pNextComma = _wcschr(pCurName, L',');
+ int len = (pNextComma != NULL) ? (int)(pNextComma - pCurName) : (int)_wcslen(pCurName)-1;
if(len > mdNameLen)
return E_FAIL;
wcsncpy_s(typeParamName, mdNameLen, pCurName, len);
@@ -2166,8 +2166,8 @@ HRESULT ExpressionNode::IsTokenValueTypeOrEnum(mdToken token, IMetaDataImport* p
IfFailRet(pMetadata->GetTypeDefProps(token, nameBuffer, _countof(nameBuffer), &chTypeDef, NULL, NULL));
}
- if(wcscmp(nameBuffer, L"System.ValueType") == 0 ||
- wcscmp(nameBuffer, L"System.Enum") == 0)
+ if(_wcscmp(nameBuffer, L"System.ValueType") == 0 ||
+ _wcscmp(nameBuffer, L"System.Enum") == 0)
{
*pResult = TRUE;
}
diff --git a/src/ToolBox/SOS/Strike/WatchCmd.cpp b/src/ToolBox/SOS/Strike/WatchCmd.cpp
index f5b59ac169..a005f9a4fb 100644
--- a/src/ToolBox/SOS/Strike/WatchCmd.cpp
+++ b/src/ToolBox/SOS/Strike/WatchCmd.cpp
@@ -112,7 +112,7 @@ HRESULT WatchCmd::Print(int expansionIndex, __in_z WCHAR* expansionPath, __in_z
pFilterList = pPersistListHead;
while(pFilterList != NULL)
{
- if(wcscmp(pFilterList->pName, pFilterName)==0)
+ if(_wcscmp(pFilterList->pName, pFilterName)==0)
break;
pFilterList = pFilterList->pNext;
}
@@ -135,7 +135,7 @@ HRESULT WatchCmd::Print(int expansionIndex, __in_z WCHAR* expansionPath, __in_z
PersistWatchExpression* pCurFilterExpr = pHeadFilterExpr;
while(pCurFilterExpr != NULL)
{
- if(wcscmp(pCurFilterExpr->pExpression, pResult->GetAbsoluteExpression())==0)
+ if(_wcscmp(pCurFilterExpr->pExpression, pResult->GetAbsoluteExpression())==0)
break;
pCurFilterExpr = pCurFilterExpr->pNext;
}
@@ -146,7 +146,7 @@ HRESULT WatchCmd::Print(int expansionIndex, __in_z WCHAR* expansionPath, __in_z
{
WCHAR pCurPersistResult[MAX_EXPRESSION];
FormatPersistResult(pCurPersistResult, MAX_EXPRESSION, pResult);
- if(wcscmp(pCurPersistResult, pCurFilterExpr->pPersistResult)==0)
+ if(_wcscmp(pCurPersistResult, pCurFilterExpr->pPersistResult)==0)
{
print = FALSE;
}
@@ -178,7 +178,7 @@ HRESULT WatchCmd::RemoveList(__in_z WCHAR* pListName)
PersistList** ppList = &pPersistListHead;
while(*ppList != NULL)
{
- if(wcscmp((*ppList)->pName, pListName) == 0)
+ if(_wcscmp((*ppList)->pName, pListName) == 0)
{
PersistList* toDelete = *ppList;
*ppList = (*ppList)->pNext;
@@ -193,12 +193,12 @@ HRESULT WatchCmd::RemoveList(__in_z WCHAR* pListName)
// Renames a previously saved persisted watch list
HRESULT WatchCmd::RenameList(__in_z WCHAR* pOldName, __in_z WCHAR* pNewName)
{
- if(wcscmp(pOldName, pNewName)==0)
+ if(_wcscmp(pOldName, pNewName)==0)
return S_OK;
PersistList** ppList = &pPersistListHead;
while(*ppList != NULL)
{
- if(wcscmp((*ppList)->pName, pOldName) == 0)
+ if(_wcscmp((*ppList)->pName, pOldName) == 0)
{
PersistList* pListToChangeName = *ppList;
RemoveList(pNewName);
@@ -300,9 +300,9 @@ VOID WatchCmd::EvalPrintCallback(ExpressionNode* pExpressionNode, int depth, VOI
{
// names can have '<' and '>' in them, need to escape
WCHAR pEscapedTypeName[MAX_EXPRESSION];
- DmlEscape(pExpressionNode->GetTypeName(), (int)wcslen(pExpressionNode->GetTypeName()), pEscapedTypeName, MAX_EXPRESSION);
+ DmlEscape(pExpressionNode->GetTypeName(), (int)_wcslen(pExpressionNode->GetTypeName()), pEscapedTypeName, MAX_EXPRESSION);
WCHAR pRelativeExpression[MAX_EXPRESSION];
- DmlEscape(pExpressionNode->GetRelativeExpression(), (int)wcslen(pExpressionNode->GetRelativeExpression()), pRelativeExpression, MAX_EXPRESSION);
+ DmlEscape(pExpressionNode->GetRelativeExpression(), (int)_wcslen(pExpressionNode->GetRelativeExpression()), pRelativeExpression, MAX_EXPRESSION);
DMLOut("%S <exec cmd=\"%S (%S)%S\">%S</exec> %S\n", pEscapedTypeName, pData->pCommand, pEscapedTypeName, pExpressionNode->GetAbsoluteExpression(), pRelativeExpression, pExpressionNode->GetTextValue());
}
}
diff --git a/src/ToolBox/SOS/Strike/datatarget.cpp b/src/ToolBox/SOS/Strike/datatarget.cpp
index 15d61d449b..4c8ad370e1 100644
--- a/src/ToolBox/SOS/Strike/datatarget.cpp
+++ b/src/ToolBox/SOS/Strike/datatarget.cpp
@@ -21,8 +21,8 @@ DataTarget::DataTarget(void) :
STDMETHODIMP
DataTarget::QueryInterface(
THIS_
- __in REFIID InterfaceId,
- __out PVOID* Interface
+ ___in REFIID InterfaceId,
+ ___out PVOID* Interface
)
{
if (InterfaceId == IID_IUnknown ||
diff --git a/src/ToolBox/SOS/Strike/datatarget.h b/src/ToolBox/SOS/Strike/datatarget.h
index b0e68d56ca..b82ab935d8 100644
--- a/src/ToolBox/SOS/Strike/datatarget.h
+++ b/src/ToolBox/SOS/Strike/datatarget.h
@@ -16,8 +16,8 @@ public:
// IUnknown.
STDMETHOD(QueryInterface)(
THIS_
- __in REFIID InterfaceId,
- __out PVOID* Interface
+ ___in REFIID InterfaceId,
+ ___out PVOID* Interface
);
STDMETHOD_(ULONG, AddRef)(
THIS
diff --git a/src/ToolBox/SOS/Strike/disasm.cpp b/src/ToolBox/SOS/Strike/disasm.cpp
index 8c107885d7..fa0463f72d 100644
--- a/src/ToolBox/SOS/Strike/disasm.cpp
+++ b/src/ToolBox/SOS/Strike/disasm.cpp
@@ -515,7 +515,7 @@ void NextTerm (__deref_inout_z char *& ptr)
// Parses something like 6e24d310, 0x6e24d310, or 6e24d310h.
// On 64-bit, also parses things like 000006fb`f9b70f50 and
// 000006fbf9b70f50 (as well as their 0x-prefix, -h suffix variations).
-INT_PTR ParseHexNumber (__in_z char *ptr, __out char **endptr)
+INT_PTR ParseHexNumber (__in_z char *ptr, ___out char **endptr)
{
char *endptr1;
INT_PTR value1 = strtoul(ptr, &endptr1, 16);
@@ -705,7 +705,7 @@ const char * HelperFuncName (size_t IP)
// Note:
// The return is a pointer to a global buffer, therefore this value must
// be consumed as soon as possible after a call to this function.
-LPCWSTR EHTypedClauseTypeName(__in const DACEHInfo* pEHInfo)
+LPCWSTR EHTypedClauseTypeName(___in const DACEHInfo* pEHInfo)
{
_ASSERTE(pEHInfo != NULL);
if ((pEHInfo->clauseType == EHTyped) && pEHInfo->isCatchAllHandler)
diff --git a/src/ToolBox/SOS/Strike/disasm.h b/src/ToolBox/SOS/Strike/disasm.h
index dde2846999..c5aa1323e0 100644
--- a/src/ToolBox/SOS/Strike/disasm.h
+++ b/src/ToolBox/SOS/Strike/disasm.h
@@ -80,7 +80,7 @@ HRESULT CheckEEDll ();
void DisasmAndClean (DWORD_PTR &IP, __out_ecount_opt(length) char *line, ULONG length);
-INT_PTR GetValueFromExpr(__in __in_z char *ptr, INT_PTR &value);
+INT_PTR GetValueFromExpr(___in __in_z char *ptr, INT_PTR &value);
void NextTerm (__deref_inout_z char *& ptr);
diff --git a/src/ToolBox/SOS/Strike/disasmX86.cpp b/src/ToolBox/SOS/Strike/disasmX86.cpp
index 18953e3189..0cdd8a23fa 100644
--- a/src/ToolBox/SOS/Strike/disasmX86.cpp
+++ b/src/ToolBox/SOS/Strike/disasmX86.cpp
@@ -50,7 +50,7 @@ struct Register
};
// Find the index for a register name
-inline RegIndex FindReg (__in __in_z char *ptr, __out_opt int *plen = NULL, __out_opt int *psize = NULL)
+inline RegIndex FindReg (___in __in_z char *ptr, __out_opt int *plen = NULL, __out_opt int *psize = NULL)
{
struct RegName
{
@@ -169,7 +169,7 @@ inline RegIndex FindReg (__in __in_z char *ptr, __out_opt int *plen = NULL, __ou
}
// Find the value of an expression.
-inline BOOL FindSrc (__in_z char *ptr, __in Register *reg, INT_PTR &value, BOOL &bDigit)
+inline BOOL FindSrc (__in_z char *ptr, ___in Register *reg, INT_PTR &value, BOOL &bDigit)
{
if (GetValueFromExpr (ptr, value))
{
@@ -220,7 +220,7 @@ struct InstData
INT_PTR value;
};
-void FindMainReg (__in __in_z char *ptr, RegState &reg)
+void FindMainReg (___in __in_z char *ptr, RegState &reg)
{
int size = 0;
@@ -229,7 +229,7 @@ void FindMainReg (__in __in_z char *ptr, RegState &reg)
reg.bFullReg = (reg.reg!=NONE && sizeof(void*)==size) ? TRUE : FALSE;
}
-static void DecodeAddressIndirect (__in __in_z char *term, InstData& arg)
+static void DecodeAddressIndirect (___in __in_z char *term, InstData& arg)
{
arg.mode = BAD;
arg.value = 0;
@@ -308,7 +308,7 @@ static void DecodeAddressIndirect (__in __in_z char *term, InstData& arg)
}
}
-void DecodeAddressTerm (__in __in_z char *term, InstData& arg)
+void DecodeAddressTerm (___in __in_z char *term, InstData& arg)
{
arg.mode = BAD;
arg.reg[0].scale = 0;
@@ -1133,7 +1133,7 @@ void
///
/// This is dead code, not called from anywhere, not linked in the final product.
///
-static BOOL DecodeLine (__in __in_z char *line, __in __in_z const char *const inst, InstData& arg1, InstData& arg2)
+static BOOL DecodeLine (___in __in_z char *line, ___in __in_z const char *const inst, InstData& arg1, InstData& arg2)
{
char *ptr = line;
if (inst[0] == '*' || !strncmp (ptr, inst, strlen (inst)))
diff --git a/src/ToolBox/SOS/Strike/dllsext.cpp b/src/ToolBox/SOS/Strike/dllsext.cpp
index 74c382e769..4647a4fc6f 100644
--- a/src/ToolBox/SOS/Strike/dllsext.cpp
+++ b/src/ToolBox/SOS/Strike/dllsext.cpp
@@ -270,7 +270,7 @@ DllsName(
}
#ifndef FEATURE_PAL
- if (wcsrchr (dllName, '\\') == NULL) {
+ if (_wcsrchr (dllName, '\\') == NULL) {
DllsNameFromPeb (addrContaining,dllName);
}
#endif
diff --git a/src/ToolBox/SOS/Strike/eeheap.cpp b/src/ToolBox/SOS/Strike/eeheap.cpp
index 426ebdbee5..e0ca39cbd7 100644
--- a/src/ToolBox/SOS/Strike/eeheap.cpp
+++ b/src/ToolBox/SOS/Strike/eeheap.cpp
@@ -38,15 +38,15 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize)
if (bHasStrings)
{
- size_t capacity_pNew = wcslen((wchar_t*)aData) + 1;
- wchar_t *pNew = new wchar_t[capacity_pNew];
+ size_t capacity_pNew = _wcslen((WCHAR*)aData) + 1;
+ WCHAR *pNew = new WCHAR[capacity_pNew];
if (pNew == NULL)
{
ReportOOM();
ControlC = TRUE;
return;
}
- wcscpy_s(pNew, capacity_pNew, (wchar_t*)aData);
+ wcscpy_s(pNew, capacity_pNew, (WCHAR*)aData);
aData = (DWORD_PTR)pNew;
}
@@ -96,15 +96,15 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize)
if (bHasStrings)
{
- size_t capacity_pNew = wcslen((wchar_t*)aData) + 1;
- wchar_t *pNew = new wchar_t[capacity_pNew];
+ size_t capacity_pNew = _wcslen((WCHAR*)aData) + 1;
+ WCHAR *pNew = new WCHAR[capacity_pNew];
if (pNew == NULL)
{
ReportOOM();
ControlC = TRUE;
return;
}
- wcscpy_s(pNew, capacity_pNew, (wchar_t*)aData);
+ wcscpy_s(pNew, capacity_pNew, (WCHAR*)aData);
aData = (DWORD_PTR)pNew;
}
@@ -131,7 +131,7 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize)
int HeapStat::CompareData(DWORD_PTR d1, DWORD_PTR d2)
{
if (bHasStrings)
- return wcscmp((wchar_t*)d1, (wchar_t*)d2);
+ return _wcscmp((WCHAR*)d1, (WCHAR*)d2);
if (d1 > d2)
return 1;
@@ -329,7 +329,7 @@ void HeapStat::Delete()
head = head->right;
if (bHasStrings)
- delete[] ((wchar_t*)tmp->data);
+ delete[] ((WCHAR*)tmp->data);
delete tmp;
}
diff --git a/src/ToolBox/SOS/Strike/exts.cpp b/src/ToolBox/SOS/Strike/exts.cpp
index cf34981165..4bbd4ff2c1 100644
--- a/src/ToolBox/SOS/Strike/exts.cpp
+++ b/src/ToolBox/SOS/Strike/exts.cpp
@@ -153,9 +153,9 @@ extern HMODULE g_hInstance;
// This function throws an exception that can be caught by the debugger,
// instead of allowing the default CRT behavior of invoking Watson to failfast.
void __cdecl _SOS_invalid_parameter(
- const wchar_t * expression,
- const wchar_t * function,
- const wchar_t * file,
+ const WCHAR * expression,
+ const WCHAR * function,
+ const WCHAR * file,
unsigned int line,
uintptr_t pReserved
)
diff --git a/src/ToolBox/SOS/Strike/gchist.cpp b/src/ToolBox/SOS/Strike/gchist.cpp
index 1901704d4c..ba73c7470c 100644
--- a/src/ToolBox/SOS/Strike/gchist.cpp
+++ b/src/ToolBox/SOS/Strike/gchist.cpp
@@ -31,8 +31,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include <malloc.h>
#include <stddef.h>
// We need to define the target address type. This will be used in the
diff --git a/src/ToolBox/SOS/Strike/gcroot.cpp b/src/ToolBox/SOS/Strike/gcroot.cpp
index b13e3c510b..2592664cb4 100644
--- a/src/ToolBox/SOS/Strike/gcroot.cpp
+++ b/src/ToolBox/SOS/Strike/gcroot.cpp
@@ -26,6 +26,7 @@
* we use a unordered_set. Similarly to keep track of MethodTable data we use a unordered_map to track the
* mt -> mtinfo mapping.
*/
+
#include "sos.h"
#include "disasm.h"
@@ -101,8 +102,6 @@ bool LinearReadCache::MoveToPage(TADDR addr, unsigned int size)
}
-#ifndef FEATURE_PAL
-
static const char *NameForHandle(unsigned int type)
{
switch (type)
@@ -402,7 +401,7 @@ void GCRootImpl::ReportSizeInfo(const SOSHandleData &handle, TADDR obj)
TADDR mt = ReadPointer(obj);
MTInfo *mtInfo = GetMTInfo(mt);
- const wchar_t *type = mtInfo ? mtInfo->GetTypeName() : W("unknown type");
+ const WCHAR *type = mtInfo ? mtInfo->GetTypeName() : W("unknown type");
size_t size = mSizes[obj];
ExtOut("Handle (%s): %p -> %p: %d (0x%x) bytes (%S)\n", NameForHandle(handle.Type), SOS_PTR(handle.Handle),
@@ -423,7 +422,7 @@ void GCRootImpl::ReportSizeInfo(DWORD thread, const SOSStackRefData &stackRef, T
TADDR mt = ReadPointer(obj);
MTInfo *mtInfo = GetMTInfo(mt);
- const wchar_t *type = mtInfo ? mtInfo->GetTypeName() : W("unknown type");
+ const WCHAR *type = mtInfo ? mtInfo->GetTypeName() : W("unknown type");
size_t size = mSizes[obj];
ExtOut("Thread %x (%S): %S: %d (0x%x) bytes (%S)\n", thread, frame.c_str(), regOutput.c_str(), size, size, type);
@@ -1311,7 +1310,6 @@ void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyFo
ExtOut("\n");
}
-#endif // FEATURE_PAL
////////////////////////////////////////////////////////////////////////////////
//
@@ -1621,7 +1619,6 @@ BOOL VerifyObject(const DacpGcHeapDetails &heap, const DacpHeapSegmentData &seg,
return FALSE;
}
-#ifndef FEATURE_PAL
// If we requested to verify the object's members, the GC may be in a state where that's not possible.
// Here we check to see if the object in question needs to have its members updated. If so, we turn off
// verification for the object.
@@ -1631,7 +1628,6 @@ BOOL VerifyObject(const DacpGcHeapDetails &heap, const DacpHeapSegmentData &seg,
should_check_bgc_mark(heap, seg, &consider_bgc_mark, &check_current_sweep, &check_saved_sweep);
bVerifyMember = fgc_should_consider_object(heap, objAddr, seg, consider_bgc_mark, check_current_sweep, check_saved_sweep);
}
-#endif // !defined(FEATURE_PAL)
return bVerifyMember ? VerifyObjectMember(heap, objAddr) : TRUE;
}
@@ -1684,8 +1680,6 @@ BOOL VerifyObject(const DacpGcHeapDetails &heap, DWORD_PTR objAddr, DWORD_PTR MT
return VerifyObject(heap, seg, objAddr, MTAddr, objSize, bVerifyMember);
}
-#ifndef FEATURE_PAL
-
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
typedef void (*TYPETREEVISIT)(size_t methodTable, size_t ID, LPVOID token);
@@ -1827,9 +1821,7 @@ BOOL HeapTraverser::Initialize()
return FALSE;
}
-#ifndef FEATURE_PAL
GCRootImpl::GetDependentHandleMap(mDependentHandleMap);
-#endif
size_t startID = 1;
TypeTree::setTypeIDs(m_pTypeTree, &startID);
@@ -1910,10 +1902,10 @@ size_t HeapTraverser::getID(size_t mTable)
}
#ifndef FEATURE_PAL
-void replace(std::wstring &str, const wchar_t *toReplace, const wchar_t *replaceWith)
+void replace(std::wstring &str, const WCHAR *toReplace, const WCHAR *replaceWith)
{
- const size_t replaceLen = wcslen(toReplace);
- const size_t replaceWithLen = wcslen(replaceWith);
+ const size_t replaceLen = _wcslen(toReplace);
+ const size_t replaceWithLen = _wcslen(replaceWith);
size_t i = str.find(toReplace);
while (i != std::wstring::npos)
@@ -1928,7 +1920,6 @@ void HeapTraverser::PrintType(size_t ID,LPCWSTR name)
{
if (m_format==FORMAT_XML)
{
-
#ifndef FEATURE_PAL
// Sanitize name based on XML spec.
std::wstring wname = name;
@@ -2216,7 +2207,6 @@ void HeapTraverser::PrintRefs(size_t obj, size_t methodTable, size_t size)
PrintObjectMember(*itr, false);
}
-#ifndef FEATURE_PAL
std::unordered_map<TADDR, std::list<TADDR>>::iterator itr = mDependentHandleMap.find((TADDR)obj);
if (itr != mDependentHandleMap.end())
{
@@ -2225,10 +2215,8 @@ void HeapTraverser::PrintRefs(size_t obj, size_t methodTable, size_t size)
PrintObjectMember(*litr, true);
}
}
-#endif
}
-#endif // FEATURE_PAL
void sos::ObjectIterator::BuildError(char *out, size_t count, const char *format, ...) const
{
@@ -2489,7 +2477,6 @@ bool sos::ObjectIterator::Verify(char *reason, size_t count) const
BOOL bVerifyMember = TRUE;
-#ifndef FEATURE_PAL
// If we requested to verify the object's members, the GC may be in a state where that's not possible.
// Here we check to see if the object in question needs to have its members updated. If so, we turn off
// verification for the object.
@@ -2497,7 +2484,6 @@ bool sos::ObjectIterator::Verify(char *reason, size_t count) const
should_check_bgc_mark(mHeaps[mCurrHeap], mSegment, &consider_bgc_mark, &check_current_sweep, &check_saved_sweep);
bVerifyMember = fgc_should_consider_object(mHeaps[mCurrHeap], mCurrObj.GetAddress(), mSegment,
consider_bgc_mark, check_current_sweep, check_saved_sweep);
-#endif // !defined(FEATURE_PAL)
if (bVerifyMember)
return VerifyObjectMembers(reason, count);
diff --git a/src/ToolBox/SOS/Strike/metadata.cpp b/src/ToolBox/SOS/Strike/metadata.cpp
index 23850b89c2..fe423d6eac 100644
--- a/src/ToolBox/SOS/Strike/metadata.cpp
+++ b/src/ToolBox/SOS/Strike/metadata.cpp
@@ -48,7 +48,7 @@ static HRESULT NameForTypeDef_s(mdTypeDef tkTypeDef, IMetaDataImport *pImport,
if (hr != S_OK) {
return hr;
}
- size_t Len = wcslen (mdName);
+ size_t Len = _wcslen (mdName);
if (Len < mdNameLen-2) {
mdName[Len++] = L'+';
mdName[Len] = L'\0';
@@ -245,10 +245,10 @@ HRESULT NameForTokenNew(mdTypeDef mb, IMDInternalImport *pImport, WCHAR *mdName,
if (mdClass != mdTypeDefNil && bClassName)
{
hr = NameForTypeDefNew (mdClass, pImport, mdName);
- wcscat (mdName, W("."));
+ _wcscat (mdName, W("."));
}
name[size] = L'\0';
- wcscat (mdName, name);
+ _wcscat (mdName, name);
}
}
else if (TypeFromToken(mb) == mdtMethodDef)
@@ -263,10 +263,10 @@ HRESULT NameForTokenNew(mdTypeDef mb, IMDInternalImport *pImport, WCHAR *mdName,
if (mdClass != mdTypeDefNil && bClassName)
{
hr = NameForTypeDefNew (mdClass, pImport, mdName);
- wcscat (mdName, W("."));
+ _wcscat (mdName, W("."));
}
name[size] = L'\0';
- wcscat (mdName, name);
+ _wcscat (mdName, name);
}
}
else
@@ -427,7 +427,7 @@ void GetMethodName(mdMethodDef methodDef, IMetaDataImport * pImport, CQuickBytes
// Tables for mapping element type to text
-const wchar_t *g_wszMapElementType[] =
+const WCHAR *g_wszMapElementType[] =
{
W("End"), // 0x0
W("Void"), // 0x1
@@ -465,7 +465,7 @@ const wchar_t *g_wszMapElementType[] =
W("INTERNAL"),
};
-const wchar_t *g_wszCalling[] =
+const WCHAR *g_wszCalling[] =
{
W("[DEFAULT]"),
W("[C]"),
@@ -755,7 +755,7 @@ LPCWSTR MDInfo::TypeDeforRefName(mdToken inToken)
HRESULT MDInfo::AddToSigBuffer(LPCWSTR string)
{
HRESULT hr;
- IfFailRet(m_pSigBuf->ReSize((wcslen((LPWSTR)m_pSigBuf->Ptr()) + wcslen(string) + 1) * sizeof(WCHAR)));
+ IfFailRet(m_pSigBuf->ReSize((_wcslen((LPWSTR)m_pSigBuf->Ptr()) + _wcslen(string) + 1) * sizeof(WCHAR)));
wcscat_s((LPWSTR)m_pSigBuf->Ptr(), m_pSigBuf->Size()/sizeof(WCHAR),string);
return NOERROR;
}
diff --git a/src/ToolBox/SOS/Strike/sildasm.cpp b/src/ToolBox/SOS/Strike/sildasm.cpp
index 3cc5cfbe44..ff71833bbc 100644
--- a/src/ToolBox/SOS/Strike/sildasm.cpp
+++ b/src/ToolBox/SOS/Strike/sildasm.cpp
@@ -389,14 +389,14 @@ void DecodeIL(IMetaDataImport *pImport, BYTE *buffer, ULONG bufSize)
long l = readData<long>();
ULONG numChars;
- wchar_t str[84];
+ WCHAR str[84];
if ((pImport != NULL) && (pImport->GetUserString((mdString) l, str, 80, &numChars) == S_OK))
{
if (numChars < 80)
str[numChars] = 0;
wcscpy_s(&str[79], 4, L"...");
- wchar_t* ptr = str;
+ WCHAR* ptr = str;
while(*ptr != 0) {
if (*ptr < 0x20 || * ptr >= 0x80) {
*ptr = '.';
diff --git a/src/ToolBox/SOS/Strike/sos.cpp b/src/ToolBox/SOS/Strike/sos.cpp
index 8c1a974fe6..e2399ed9d7 100644
--- a/src/ToolBox/SOS/Strike/sos.cpp
+++ b/src/ToolBox/SOS/Strike/sos.cpp
@@ -143,7 +143,7 @@ namespace sos
return TO_TADDR(objData.ElementTypeHandle);
}
- const wchar_t *Object::GetTypeName() const
+ const WCHAR *Object::GetTypeName() const
{
if (mTypeName == NULL)
mTypeName = CreateMethodTableName(GetMT(), GetComponentMT());
@@ -293,7 +293,7 @@ namespace sos
{
// Zombie objects are objects that reside in an unloaded AppDomain.
MethodTable mt = addr;
- return wcscmp(mt.GetName(), W("<Unloaded Type>")) == 0;
+ return _wcscmp(mt.GetName(), W("<Unloaded Type>")) == 0;
}
void MethodTable::Clear()
@@ -305,7 +305,7 @@ namespace sos
}
}
- const wchar_t *MethodTable::GetName() const
+ const WCHAR *MethodTable::GetName() const
{
if (mName == NULL)
mName = CreateMethodTableName(mMT);
@@ -356,7 +356,7 @@ namespace sos
return out.ThreadId != 0 && out.ThreadPtr != NULL;
}
- bool Object::GetStringData(__out_ecount(size) wchar_t *buffer, size_t size) const
+ bool Object::GetStringData(__out_ecount(size) WCHAR *buffer, size_t size) const
{
SOS_Assert(IsString());
SOS_Assert(buffer);
@@ -849,7 +849,7 @@ namespace sos
return TO_TADDR(mData.appDomainPtr);
}
- void BuildTypeWithExtraInfo(TADDR addr, unsigned int size, __inout_ecount(size) wchar_t *buffer)
+ void BuildTypeWithExtraInfo(TADDR addr, unsigned int size, __inout_ecount(size) WCHAR *buffer)
{
try
{
@@ -866,7 +866,7 @@ namespace sos
}
else if (isString)
{
- wchar_t str[32];
+ WCHAR str[32];
obj.GetStringData(str, _countof(str));
_snwprintf_s(buffer, size, _TRUNCATE, W("%s: \"%s\""), mt.GetName(), str);
@@ -880,10 +880,10 @@ namespace sos
{
int len = MultiByteToWideChar(CP_ACP, 0, e.what(), -1, NULL, 0);
- ArrayHolder<wchar_t> tmp = new wchar_t[len];
- MultiByteToWideChar(CP_ACP, 0, e.what(), -1, (wchar_t*)tmp, len);
+ ArrayHolder<WCHAR> tmp = new WCHAR[len];
+ MultiByteToWideChar(CP_ACP, 0, e.what(), -1, (WCHAR*)tmp, len);
- swprintf_s(buffer, size, W("<invalid object: '%s'>"), (wchar_t*)tmp);
+ swprintf_s(buffer, size, W("<invalid object: '%s'>"), (WCHAR*)tmp);
}
}
}
diff --git a/src/ToolBox/SOS/Strike/sos.h b/src/ToolBox/SOS/Strike/sos.h
index d222faa0ae..d04990a9f2 100644
--- a/src/ToolBox/SOS/Strike/sos.h
+++ b/src/ToolBox/SOS/Strike/sos.h
@@ -222,14 +222,14 @@ namespace sos
* valid through the lifetime of the MethodTable object and should not be
* freed.
*/
- const wchar_t *GetName() const;
+ const WCHAR *GetName() const;
private:
void Clear();
private:
TADDR mMT;
- mutable wchar_t *mName;
+ mutable WCHAR *mName;
};
/* This represents an object on the GC heap in the target process. This class
@@ -416,7 +416,7 @@ namespace sos
* True if the string data was successfully requested and placed in
* buffer, false otherwise.
*/
- bool GetStringData(__out_ecount(size) wchar_t *buffer, size_t size) const;
+ bool GetStringData(__out_ecount(size) WCHAR *buffer, size_t size) const;
/* Returns the name of the type of this object. E.g. System.String.
* Throws:
@@ -424,7 +424,7 @@ namespace sos
* Returns:
* A string containing the type of the object.
*/
- const wchar_t *GetTypeName() const;
+ const WCHAR *GetTypeName() const;
private:
void FillMTData() const;
@@ -442,7 +442,7 @@ namespace sos
mutable size_t mSize;
mutable bool mPointers;
mutable DacpMethodTableData *mMTData;
- mutable wchar_t *mTypeName;
+ mutable WCHAR *mTypeName;
};
/* Enumerates all the GC references (objects) contained in an object. This uses the GCDesc
@@ -789,5 +789,5 @@ namespace sos
}
- void BuildTypeWithExtraInfo(TADDR addr, unsigned int size, __inout_ecount(size) wchar_t *buffer);
+ void BuildTypeWithExtraInfo(TADDR addr, unsigned int size, __inout_ecount(size) WCHAR *buffer);
} \ No newline at end of file
diff --git a/src/ToolBox/SOS/Strike/stressLogDump.cpp b/src/ToolBox/SOS/Strike/stressLogDump.cpp
index 1cd1e38dc9..aa55572b60 100644
--- a/src/ToolBox/SOS/Strike/stressLogDump.cpp
+++ b/src/ToolBox/SOS/Strike/stressLogDump.cpp
@@ -110,7 +110,7 @@ const char *getFacilityName(DWORD_PTR lf)
/* be altered if format string contains %s */
// TODO: This function assumes the pointer size of the target equals the pointer size of the host
// TODO: replace uses of void* with appropriate TADDR or CLRDATA_ADDRESS
-void formatOutput(struct IDebugDataSpaces* memCallBack, __in FILE* file, __inout __inout_z char* format, unsigned threadId, double timeStamp, DWORD_PTR facility, __in void** args)
+void formatOutput(struct IDebugDataSpaces* memCallBack, ___in FILE* file, __inout __inout_z char* format, unsigned threadId, double timeStamp, DWORD_PTR facility, ___in void** args)
{
fprintf(file, "%4x %13.9f : ", threadId, timeStamp);
fprintf(file, "%-20s ", getFacilityName ( facility ));
@@ -316,6 +316,7 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
{
ULONG64 g_hThisInst;
BOOL bDoGcHist = (fileName == NULL);
+ FILE* file = NULL;
// Fetch the circular buffer bookeeping data
StressLog inProcLog;
@@ -355,6 +356,7 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
ThreadStressLog** logsPtr = &logs;
int threadCtr = 0;
unsigned __int64 lastTimeStamp = 0;// timestamp of last log entry
+
while(outProcPtr != 0) {
inProcPtr = new ThreadStressLog;
hr = memCallBack->ReadVirtual(outProcPtr, inProcPtr, sizeof (*inProcPtr), 0);
@@ -430,9 +432,7 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
threadCtr++;
}
- FILE* file;
- file = NULL;
- if (!bDoGcHist && (fopen_s(&file, fileName, "w") != 0))
+ if (!bDoGcHist && ((file = fopen(fileName, "w")) != NULL))
{
hr = GetLastError();
goto FREE_MEM;
@@ -462,9 +462,9 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
if (!bDoGcHist)
{
- fprintf(file, "\nTHREAD TIMESTAMP FACILITY MESSAGE\n");
- fprintf(file, " ID (sec from start)\n");
- fprintf(file, "--------------------------------------------------------------------------------------\n");
+ fprintf(file, "\nTHREAD TIMESTAMP FACILITY MESSAGE\n");
+ fprintf(file, " ID (sec from start)\n");
+ fprintf(file, "--------------------------------------------------------------------------------------\n");
}
char format[257];
format[256] = format[0] = 0;
@@ -481,9 +481,11 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
break;
}
- if (latestLog == 0) {
+ if (latestLog == 0)
+ {
break;
}
+
StressMsg* latestMsg = latestLog->readPtr;
if (latestMsg->formatOffset != 0 && !latestLog->CompletedDump())
{
@@ -505,16 +507,16 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
}
else
{
- if (strcmp(format, ThreadStressLog::TaskSwitchMsg()) == 0)
- {
- fprintf (file, "Task was switched from %x\n", (unsigned)(size_t)latestMsg->args[0]);
- latestLog->threadId = (unsigned)(size_t)latestMsg->args[0];
- }
+ if (strcmp(format, ThreadStressLog::TaskSwitchMsg()) == 0)
+ {
+ fprintf (file, "Task was switched from %x\n", (unsigned)(size_t)latestMsg->args[0]);
+ latestLog->threadId = (unsigned)(size_t)latestMsg->args[0];
+ }
else
{
- args = latestMsg->args;
- formatOutput(memCallBack, file, format, latestLog->threadId, deltaTime, latestMsg->facility, args);
- }
+ args = latestMsg->args;
+ formatOutput(memCallBack, file, format, latestLog->threadId, deltaTime, latestMsg->facility, args);
+ }
}
msgCtr++;
}
@@ -525,8 +527,8 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
latestLog->readPtr = NULL;
if (!bDoGcHist)
{
- fprintf(file, "------------ Last message from thread %x -----------\n", latestLog->threadId);
- }
+ fprintf(file, "------------ Last message from thread %x -----------\n", latestLog->threadId);
+ }
}
if (msgCtr % 64 == 0)
@@ -541,7 +543,7 @@ HRESULT StressLog::Dump(ULONG64 outProcLog, const char* fileName, struct IDebugD
vDoOut(bDoGcHist, file, "---------------------------- %d total entries ------------------------------------\n", msgCtr);
if (!bDoGcHist)
{
- fclose(file);
+ fclose(file);
}
FREE_MEM:
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp
index a6b1834373..dd1dd805ba 100644
--- a/src/ToolBox/SOS/Strike/strike.cpp
+++ b/src/ToolBox/SOS/Strike/strike.cpp
@@ -85,8 +85,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include <malloc.h>
#include <stddef.h>
#include "strike.h"
@@ -1499,12 +1497,12 @@ HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE)
DWORD_PTR size = (DWORD_PTR)objData.Size;
ExtOut("Size: %" POINTERSIZE_TYPE "d(0x%" POINTERSIZE_TYPE "x) bytes\n", size, size);
- if (wcscmp(obj.GetTypeName(), W("System.RuntimeType")) == 0)
+ if (_wcscmp(obj.GetTypeName(), W("System.RuntimeType")) == 0)
{
PrintRuntimeTypeInfo(taObj, objData);
}
- if (wcscmp(obj.GetTypeName(), W("System.RuntimeType+RuntimeTypeCache")) == 0)
+ if (_wcscmp(obj.GetTypeName(), W("System.RuntimeType+RuntimeTypeCache")) == 0)
{
// Get the method table
int iOffset = GetObjFieldOffset (taObj, objData.MethodTable, W("m_runtimeType"));
@@ -1666,7 +1664,7 @@ HRESULT PrintPermissionSet (TADDR p_PermSet)
sos::MethodTable mt = TO_TADDR(PermSetData.MethodTable);
- if (wcscmp (W("System.Security.PermissionSet"), mt.GetName()) != 0 && wcscmp(W("System.Security.NamedPermissionSet"), mt.GetName()) != 0)
+ if (_wcscmp (W("System.Security.PermissionSet"), mt.GetName()) != 0 && _wcscmp(W("System.Security.NamedPermissionSet"), mt.GetName()) != 0)
{
ExtOut("Invalid PermissionSet object\n");
return S_FALSE;
@@ -1886,7 +1884,7 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe
//length is only supported for single-dimension array
if (objData.dwRank == 1 && flags.Length != (DWORD_PTR)-1)
{
- bounds[0] = min(bounds[0], (DWORD)(flags.Length + flags.startIndex) - lowerBounds[0]);
+ bounds[0] = _min(bounds[0], (DWORD)(flags.Length + flags.startIndex) - lowerBounds[0]);
}
DWORD *indices = (DWORD *)alloca(dwRankAllocSize);
@@ -2053,7 +2051,7 @@ CLRDATA_ADDRESS isSecurityExceptionObj(CLRDATA_ADDRESS mtObj)
break;
}
NameForMT_s(TO_TADDR(walkMT), g_mdName, mdNameLen);
- if (wcscmp(W("System.Security.SecurityException"), g_mdName) == 0)
+ if (_wcscmp(W("System.Security.SecurityException"), g_mdName) == 0)
{
return walkMT;
}
@@ -2076,7 +2074,7 @@ size_t AddExceptionHeader (__out_ecount_opt(bufferLength) WCHAR *wszBuffer, size
{
swprintf_s(wszBuffer, bufferLength, wszHeader);
}
- return wcslen(wszHeader);
+ return _wcslen(wszHeader);
}
struct StackTraceElement
@@ -2106,8 +2104,8 @@ public:
BOOL Append(__in_z LPCWSTR pszStr)
{
- size_t iInputLen = wcslen (pszStr);
- size_t iCurLen = wcslen (cs.String());
+ size_t iInputLen = _wcslen (pszStr);
+ size_t iCurLen = _wcslen (cs.String());
if ((iCurLen + iInputLen + 1) > cs.Size())
{
if (cs.ReSize(iCurLen + iInputLen + 1) != S_OK)
@@ -2122,7 +2120,7 @@ public:
size_t Length()
{
- return wcslen(cs.String());
+ return _wcslen(cs.String());
}
WCHAR *String()
@@ -2318,7 +2316,7 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr,
swprintf_s(wszLineBuffer, _countof(wszLineBuffer), W(" %s [%S @ %d]\n"), so.String(), filename, linenum);
}
- Length += wcslen(wszLineBuffer);
+ Length += _wcslen(wszLineBuffer);
if (wszBuffer)
{
@@ -3493,7 +3491,7 @@ void PrintRuntimeTypes(DWORD_PTR objAddr,size_t Size,DWORD_PTR methodTable,LPVOI
{
NameForMT_s(methodTable, g_mdName, mdNameLen);
- if (wcscmp(g_mdName, W("System.RuntimeType")) == 0)
+ if (_wcscmp(g_mdName, W("System.RuntimeType")) == 0)
{
pArgs->mtOfRuntimeType = methodTable;
pArgs->handleFieldOffset = GetObjFieldOffset(objAddr, methodTable, W("m_handle"));
@@ -3793,7 +3791,7 @@ private:
if (mType != NULL)
{
WString name = obj.GetTypeName();
- return wcsstr(name.c_str(), mType) != NULL;
+ return _wcsstr(name.c_str(), mType) != NULL;
}
return true;
@@ -3881,7 +3879,7 @@ private:
str[0] = 0;
}
- StringSetEntry(__in_ecount(64) wchar_t tmp[64], size_t _size)
+ StringSetEntry(__in_ecount(64) WCHAR tmp[64], size_t _size)
: count(1), size(_size)
{
memcpy(str, tmp, sizeof(str));
@@ -3895,11 +3893,11 @@ private:
mutable size_t count;
mutable size_t size;
- wchar_t str[64];
+ WCHAR str[64];
bool operator<(const StringSetEntry &rhs) const
{
- return wcscmp(str, rhs.str) == -1;
+ return _wcscmp(str, rhs.str) == -1;
}
};
@@ -3937,12 +3935,12 @@ private:
// Don't bother calculating the size of the string, just read the full 64 characters of the buffer. The null
// terminator we read will terminate the string.
- HRESULT hr = g_ExtData->ReadVirtual(TO_CDADDR(addr+offset), tmp.str, sizeof(wchar_t)*(_countof(tmp.str)-1), &fetched);
+ HRESULT hr = g_ExtData->ReadVirtual(TO_CDADDR(addr+offset), tmp.str, sizeof(WCHAR)*(_countof(tmp.str)-1), &fetched);
if (SUCCEEDED(hr))
{
// Ensure we null terminate the string. Note that this will not overrun the buffer as we only
// wrote a max of 63 characters into the 64 character buffer.
- tmp.str[fetched/sizeof(wchar_t)] = 0;
+ tmp.str[fetched/sizeof(WCHAR)] = 0;
Set::iterator sitr = set.find(tmp);
if (sitr == set.end())
{
@@ -3972,7 +3970,7 @@ private:
if (IsInterrupt())
break;
- Flatten(vitr->str, (unsigned int)wcslen(vitr->str));
+ Flatten(vitr->str, (unsigned int)_wcslen(vitr->str));
out.WriteRow(Decimal(vitr->size), Decimal(vitr->count), vitr->str);
}
#endif // FEATURE_PAL
@@ -4031,7 +4029,7 @@ private:
mDead;
- wchar_t *mType;
+ WCHAR *mType;
private:
#if !defined(FEATURE_PAL)
@@ -4471,7 +4469,7 @@ DECLARE_API(ListNearObj)
candidate.reserve(10);
// since we'll be reading back I'll prime the read cache to a buffer before the current address
- MOVE(taddrCur, max(trngSeg.start, taddrObj-DT_OS_PAGE_SIZE));
+ MOVE(taddrCur, _max(trngSeg.start, taddrObj-DT_OS_PAGE_SIZE));
// ===== Look for a good candidate preceeding taddrObj
@@ -5547,7 +5545,7 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly)
const bool hosted = (ThreadStore.fHostConfig & CLRTASKHOSTED) != 0;
table.ReInit(hosted ? 12 : 11, POINTERSIZE_HEX);
- table.SetWidths(10, 4, 4, 4, max(9, POINTERSIZE_HEX),
+ table.SetWidths(10, 4, 4, 4, _max(9, POINTERSIZE_HEX),
8, 11, 1+POINTERSIZE_HEX*2, POINTERSIZE_HEX,
5, 3, POINTERSIZE_HEX);
@@ -6367,11 +6365,11 @@ public:
//get a pointer to just the filename (the portion after the last backslash)
WCHAR* pModuleFilename = wszNameBuffer;
- WCHAR* pSlash = wcschr(pModuleFilename, DIRECTORY_SEPARATOR_CHAR_W);
+ WCHAR* pSlash = _wcschr(pModuleFilename, DIRECTORY_SEPARATOR_CHAR_W);
while(pSlash != NULL)
{
pModuleFilename = pSlash+1;
- pSlash = wcschr(pModuleFilename, DIRECTORY_SEPARATOR_CHAR_W);
+ pSlash = _wcschr(pModuleFilename, DIRECTORY_SEPARATOR_CHAR_W);
}
ImageInfo ii;
@@ -6417,7 +6415,7 @@ public:
HRESULT Status = S_OK;
IfFailRet(g_sos->GetModule(mod, &module));
- WideCharToMultiByte(CP_ACP, 0, pModuleName, (int) (wcslen(pModuleName) + 1),
+ WideCharToMultiByte(CP_ACP, 0, pModuleName, (int) (_wcslen(pModuleName) + 1),
szName, mdNameLen, NULL, NULL);
ArrayHolder<DWORD_PTR> moduleList = ModuleFromName(szName, &numModule);
@@ -6522,7 +6520,7 @@ private:
{
if (pCur->ModuleMatches(mod) &&
_wcsicmp(pCur->szModuleName, szModule) == 0 &&
- wcscmp(pCur->szFunctionName, szName) == 0)
+ _wcscmp(pCur->szFunctionName, szName) == 0)
{
return TRUE;
}
@@ -8736,7 +8734,7 @@ DECLARE_API (ProcInfo)
WCHAR *pt = buffer;
WCHAR *end = pt;
while (pt < &buffer[DT_OS_PAGE_SIZE/2]) {
- end = wcschr (pt, L'\0');
+ end = _wcschr (pt, L'\0');
if (end == NULL) {
char format[20];
sprintf_s (format,_countof (format), "%dS", &buffer[DT_OS_PAGE_SIZE/2] - pt);
@@ -8983,7 +8981,7 @@ DECLARE_API(Token2EE)
FileNameForModule(dwAddr, FileName);
// We'd like a short form for this output
- LPWSTR pszFilename = wcsrchr (FileName, DIRECTORY_SEPARATOR_CHAR_W);
+ LPWSTR pszFilename = _wcsrchr (FileName, DIRECTORY_SEPARATOR_CHAR_W);
if (pszFilename == NULL)
{
pszFilename = FileName;
@@ -9113,7 +9111,7 @@ DECLARE_API(Name2EE)
FileNameForModule (dwAddr, FileName);
// We'd like a short form for this output
- LPWSTR pszFilename = wcsrchr (FileName, DIRECTORY_SEPARATOR_CHAR_W);
+ LPWSTR pszFilename = _wcsrchr (FileName, DIRECTORY_SEPARATOR_CHAR_W);
if (pszFilename == NULL)
{
pszFilename = FileName;
@@ -9132,7 +9130,6 @@ DECLARE_API(Name2EE)
return Status;
}
-#ifndef FEATURE_PAL
#ifndef FEATURE_PAL
DECLARE_API(PathTo)
@@ -9186,7 +9183,6 @@ DECLARE_API(PathTo)
\**********************************************************************/
DECLARE_API(GCRoot)
{
-#ifndef FEATURE_PAL
INIT_API();
MINIDUMP_NOT_SUPPORTED();
@@ -9200,7 +9196,9 @@ DECLARE_API(GCRoot)
{ // name, vptr, type, hasValue
{"-nostacks", &bNoStacks, COBOOL, FALSE},
{"-all", &all, COBOOL, FALSE},
+#ifndef FEATURE_PAL
{"/d", &dml, COBOOL, FALSE},
+#endif
};
CMDValue arg[] =
@@ -9230,11 +9228,10 @@ DECLARE_API(GCRoot)
ExtOut("Found %d unique roots (run '!GCRoot -all' to see all roots).\n", i);
return Status;
-#else
- return E_NOTIMPL;
-#endif
}
+#ifndef FEATURE_PAL
+
DECLARE_API(GCWhere)
{
INIT_API();
@@ -9707,7 +9704,7 @@ private:
TADDR objAddr = 0;
TADDR mtAddr = 0;
size_t size = 0;
- const wchar_t *mtName = 0;
+ const WCHAR *mtName = 0;
const char *type = 0;
if (FAILED(MOVE(objAddr, data[i].Handle)))
@@ -9869,7 +9866,7 @@ BOOL derivedFrom(CLRDATA_ADDRESS mtObj, __in_z LPWSTR baseString)
break;
}
NameForMT_s (TO_TADDR(walkMT), g_mdName, mdNameLen);
- if (wcscmp (baseString, g_mdName) == 0)
+ if (_wcscmp (baseString, g_mdName) == 0)
{
return TRUE;
}
@@ -9932,7 +9929,7 @@ DECLARE_API(TraceToCode)
// get the MethodDesc name
if ((g_sos->GetMethodDescName(addr, 1024, wszNameBuffer, NULL) == S_OK) &&
- wcsncmp(W("DomainBoundILStubClass"), wszNameBuffer, 22)==0)
+ _wcsncmp(W("DomainBoundILStubClass"), wszNameBuffer, 22)==0)
{
ExtOut("ILStub\n");
codeType = 2;
@@ -10031,7 +10028,7 @@ DECLARE_API(GetCodeTypeFlags)
// get the MethodDesc name
if (g_sos->GetMethodDescName(addr, 1024, wszNameBuffer, NULL) == S_OK &&
- wcsncmp(W("DomainBoundILStubClass"), wszNameBuffer, 22)==0)
+ _wcsncmp(W("DomainBoundILStubClass"), wszNameBuffer, 22)==0)
{
ExtOut("ILStub\n");
codeType = 2;
@@ -10194,7 +10191,7 @@ DECLARE_API(StopOnException)
if (SafeReadMemory(taLTOH, &taMT, sizeof(taMT), NULL))
{
NameForMT_s (taMT, g_mdName, mdNameLen);
- if ((wcscmp(g_mdName,typeNameWide) == 0) ||
+ if ((_wcscmp(g_mdName,typeNameWide) == 0) ||
(fDerived && derivedFrom(taMT, typeNameWide)))
{
sprintf_s(buffer,_countof (buffer),
@@ -10519,11 +10516,11 @@ private:
{
if(currentExpansion == NULL || varToExpand == NULL) return FALSE;
- size_t varToExpandLen = wcslen(varToExpand);
- size_t currentExpansionLen = wcslen(currentExpansion);
+ size_t varToExpandLen = _wcslen(varToExpand);
+ size_t currentExpansionLen = _wcslen(currentExpansion);
if(currentExpansionLen > varToExpandLen) return FALSE;
if(currentExpansionLen < varToExpandLen && varToExpand[currentExpansionLen] != L'.') return FALSE;
- if(wcsncmp(currentExpansion, varToExpand, currentExpansionLen) != 0) return FALSE;
+ if(_wcsncmp(currentExpansion, varToExpand, currentExpansionLen) != 0) return FALSE;
return TRUE;
}
@@ -10542,7 +10539,7 @@ private:
if(FAILED(pType->GetBase(&pBaseType)) || pBaseType == NULL) return FALSE;
if(FAILED(GetTypeOfValue(pBaseType, baseTypeName, mdNameLen))) return FALSE;
- return (wcsncmp(baseTypeName, W("System.Enum"), 11) == 0);
+ return (_wcsncmp(baseTypeName, W("System.Enum"), 11) == 0);
}
static HRESULT AddGenericArgs(ICorDebugType * pType, __inout_ecount(typeNameLen) WCHAR* typeName, ULONG typeNameLen)
{
@@ -10913,7 +10910,7 @@ private:
else ExtOut(" (%d elements)\n", cElements);
if(!ShouldExpandVariable(varToExpand, currentExpansion)) return S_OK;
- size_t currentExpansionLen = wcslen(currentExpansion);
+ size_t currentExpansionLen = _wcslen(currentExpansion);
for (ULONG32 i=0; i < cElements; i++)
{
@@ -11136,7 +11133,7 @@ private:
if(SUCCEEDED(pMD->GetParamForMethodIndex(methodDef, idx, &paramDef)))
pMD->GetParamProps(paramDef, NULL, NULL, paramName, mdNameLen, &paramNameLen, NULL, NULL, NULL, NULL);
}
- if(wcslen(paramName) == 0)
+ if(_wcslen(paramName) == 0)
swprintf_s(paramName, mdNameLen, W("param_%d\0"), i);
ToRelease<ICorDebugValue> pValue;
@@ -11209,7 +11206,7 @@ private:
ULONG cArgsFetched;
Status = pLocalsEnum->Next(1, &pValue, &cArgsFetched);
}
- if(wcslen(paramName) == 0)
+ if(_wcslen(paramName) == 0)
swprintf_s(paramName, mdNameLen, W("local_%d\0"), i);
if (FAILED(Status))
@@ -11257,7 +11254,7 @@ private:
static HRESULT ProcessFields(ICorDebugValue* pInputValue, ICorDebugType* pTypeCast, ICorDebugILFrame * pILFrame, int indent, __in_z WCHAR* varToExpand, __inout_ecount(currentExpansionSize) WCHAR* currentExpansion, DWORD currentExpansionSize, int currentFrame)
{
if(!ShouldExpandVariable(varToExpand, currentExpansion)) return S_OK;
- size_t currentExpansionLen = wcslen(currentExpansion);
+ size_t currentExpansionLen = _wcslen(currentExpansion);
HRESULT Status = S_OK;
@@ -11293,9 +11290,9 @@ private:
ToRelease<ICorDebugType> pBaseType;
if(SUCCEEDED(pType->GetBase(&pBaseType)) && pBaseType != NULL && SUCCEEDED(GetTypeOfValue(pBaseType, baseTypeName, mdNameLen)))
{
- if(wcsncmp(baseTypeName, W("System.Enum"), 11) == 0)
+ if(_wcsncmp(baseTypeName, W("System.Enum"), 11) == 0)
return S_OK;
- else if(wcsncmp(baseTypeName, W("System.Object"), 13) != 0 && wcsncmp(baseTypeName, W("System.ValueType"), 16) != 0)
+ else if(_wcsncmp(baseTypeName, W("System.Object"), 13) != 0 && _wcsncmp(baseTypeName, W("System.ValueType"), 16) != 0)
{
currentExpansion[currentExpansionLen] = W('\0');
wcscat_s(currentExpansion, currentExpansionSize, W(".\0"));
@@ -11559,7 +11556,7 @@ WString BuildRegisterOutput(const SOSStackRefData &ref, bool printObj)
if (ref.HasRegisterInformation)
{
- wchar_t reg[32];
+ WCHAR reg[32];
HRESULT hr = g_sos->GetRegisterName(ref.Register, _countof(reg), reg, NULL);
if (SUCCEEDED(hr))
res = reg;
@@ -11615,7 +11612,7 @@ void PrintRef(const SOSStackRefData &ref, TableOutput &out)
if (ref.Object && (ref.Flags & SOSRefInterior) == 0)
{
- wchar_t type[128];
+ WCHAR type[128];
sos::BuildTypeWithExtraInfo(TO_TADDR(ref.Object), _countof(type), type);
res += WString(W(" - ")) + type;
@@ -12220,7 +12217,7 @@ DECLARE_API(ClrStack)
if(cvariableName.data != NULL && strlen(cvariableName.data) > 0)
swprintf_s(wvariableName, mdNameLen, W("%S\0"), cvariableName.data);
- if(wcslen(wvariableName) > 0)
+ if(_wcslen(wvariableName) > 0)
bParams = bLocals = TRUE;
EnableDMLHolder dmlHolder(TRUE);
@@ -12620,7 +12617,7 @@ static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp,
// returns a module qualified method name
HRESULT hr = g_sos->GetMethodDescName(dwStartAddr, 1024, wszNameBuffer, NULL);
- WCHAR* pwszMethNameBegin = (hr != S_OK ? NULL : wcschr(wszNameBuffer, L'!'));
+ WCHAR* pwszMethNameBegin = (hr != S_OK ? NULL : _wcschr(wszNameBuffer, L'!'));
if (!bModuleNameWorked && hr == S_OK && pwszMethNameBegin != NULL)
{
// if we weren't able to get the module name, but GetMethodName returned
@@ -12986,7 +12983,7 @@ Exit:
}
else
{
- *puiTextLength = wcslen (so.String()) + 1;
+ *puiTextLength = _wcslen (so.String()) + 1;
}
if (puiTransitionContextCount)
@@ -13094,14 +13091,14 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS
UINT Length = 0;
while(1)
{
- if (wcsncmp(pwszPointer, PSZSEP, _countof(PSZSEP)-1) != 0)
+ if (_wcsncmp(pwszPointer, PSZSEP, _countof(PSZSEP)-1) != 0)
{
delete [] pwszBuf;
return bRet;
}
- pwszPointer += wcslen(PSZSEP);
- LPWSTR nextPos = wcsstr(pwszPointer, PSZSEP);
+ pwszPointer += _wcslen(PSZSEP);
+ LPWSTR nextPos = _wcsstr(pwszPointer, PSZSEP);
if (nextPos == NULL)
{
// Done! Note that we are leaving the function before we add the last
@@ -13118,7 +13115,7 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS
// Note that we don't add a newline because we have this embedded in wszLineBuffer
swprintf_s(wszLineBuffer, _countof(wszLineBuffer), W(" %p %p %s"), (void*)(size_t)-1, (void*)(size_t)-1, pwszPointer);
- Length += (UINT)wcslen(wszLineBuffer);
+ Length += (UINT)_wcslen(wszLineBuffer);
if (wszBuffer)
{
@@ -13794,7 +13791,7 @@ _EFN_GetManagedObjectName(
sos::Object obj = TO_TADDR(objAddr);
- if (WideCharToMultiByte(CP_ACP, 0, obj.GetTypeName(), (int) (wcslen(obj.GetTypeName()) + 1),
+ if (WideCharToMultiByte(CP_ACP, 0, obj.GetTypeName(), (int) (_wcslen(obj.GetTypeName()) + 1),
szName, cbName, NULL, NULL) == 0)
{
return E_FAIL;
diff --git a/src/ToolBox/SOS/Strike/strike.h b/src/ToolBox/SOS/Strike/strike.h
index 36312683e2..7530ee39e9 100644
--- a/src/ToolBox/SOS/Strike/strike.h
+++ b/src/ToolBox/SOS/Strike/strike.h
@@ -15,7 +15,6 @@
#define _countof(x) (sizeof(x)/sizeof(x[0]))
#endif
-
#if defined(_MSC_VER)
#pragma warning(disable:4245) // signed/unsigned mismatch
#pragma warning(disable:4100) // unreferenced formal parameter
@@ -24,6 +23,34 @@
#pragma warning(disable:6255) // Prefast: alloca indicates failure by raising a stack overflow exception
#endif
+#ifdef PAL_STDCPP_COMPAT
+#define _iswprint PAL_iswprint
+#define _wcslen PAL_wcslen
+#define _wcsncmp PAL_wcsncmp
+#define _wcsrchr PAL_wcsrchr
+#define _wcscmp PAL_wcscmp
+#define _wcschr PAL_wcschr
+#define _wcscspn PAL_wcscspn
+#define _wcscat PAL_wcscat
+#define _wcsstr PAL_wcsstr
+#else // PAL_STDCPP_COMPAT
+#define _iswprint iswprint
+#define _wcslen wcslen
+#define _wcsncmp wcsncmp
+#define _wcsrchr wcsrchr
+#define _wcscmp wcscmp
+#define _wcschr wcschr
+#define _wcscspn wcscspn
+#define _wcscat wcscat
+#define _wcsstr wcsstr
+#endif // !PAL_STDCPP_COMPAT
+
+#define ___in _SAL1_Source_(__in, (), _In_)
+#define ___out _SAL1_Source_(__out, (), _Out_)
+
+#define _max(a, b) (((a) > (b)) ? (a) : (b))
+#define _min(a, b) (((a) < (b)) ? (a) : (b))
+
#include <winternl.h>
#include <winver.h>
#include <windows.h>
@@ -46,7 +73,9 @@
#include <string.h>
+#ifndef PAL_STDCPP_COMPAT
#include <malloc.h>
+#endif
#include <stddef.h>
#ifndef FEATURE_PAL
diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp
index e1890daa26..8122f790f6 100644
--- a/src/ToolBox/SOS/Strike/util.cpp
+++ b/src/ToolBox/SOS/Strike/util.cpp
@@ -181,7 +181,7 @@ HRESULT CreateInstanceCustomImpl(
if (ppItf == NULL)
return E_POINTER;
- WCHAR wszClsid[64] = L"<CLSID>";
+ WCHAR wszClsid[64] = W("<CLSID>");
// Step 1: Attempt activation using an installed runtime
if ((cciOptions & cciFxMask) != 0)
@@ -249,7 +249,7 @@ HRESULT CreateInstanceCustomImpl(
continue;
}
- ArrayHolder<wchar_t> imgPath = new wchar_t[pathSize+MAX_PATH+1];
+ ArrayHolder<WCHAR> imgPath = new WCHAR[pathSize+MAX_PATH+1];
if (imgPath == NULL)
{
continue;
@@ -262,12 +262,12 @@ HRESULT CreateInstanceCustomImpl(
}
LPWSTR ctx;
- LPCWSTR pathElem = wcstok_s(imgPath, L";", &ctx);
+ LPCWSTR pathElem = wcstok_s(imgPath, W(";"), &ctx);
while (pathElem != NULL)
{
WCHAR fullName[MAX_PATH];
wcscpy_s(fullName, _countof(fullName), pathElem);
- if (wcscat_s(fullName, L"\\") == 0 && wcscat_s(fullName, dllName) == 0)
+ if (wcscat_s(fullName, W("\\")) == 0 && wcscat_s(fullName, dllName) == 0)
{
if (SUCCEEDED(CreateInstanceFromPath(clsid, iid, fullName, ppItf)))
{
@@ -275,7 +275,7 @@ HRESULT CreateInstanceCustomImpl(
}
}
- pathElem = wcstok_s(NULL, L";", &ctx);
+ pathElem = wcstok_s(NULL, W(";"), &ctx);
}
}
@@ -329,7 +329,7 @@ HRESULT ClrCreateInstance(
HMODULE hMscoree = NULL;
// if there's a v4+ shim on the debugger machine
- if (GetProcAddressT("CLRCreateInstance", L"mscoree.dll", &pfnCLRCreateInstance, &hMscoree))
+ if (GetProcAddressT("CLRCreateInstance", W("mscoree.dll"), &pfnCLRCreateInstance, &hMscoree))
{
// attempt to create an ICLRMetaHost instance
ToRelease<ICLRMetaHost> spMH;
@@ -564,15 +564,15 @@ QWORD VerString2Qword(LPCWSTR vStr)
QWORD result = 0;
DWORD v1, v2, v3;
- if (swscanf_s(vStr+1, L"%d.%d.%d", &v1, &v2, &v3) == 3)
+ if (swscanf_s(vStr+1, W("%d.%d.%d"), &v1, &v2, &v3) == 3)
{
result = ((QWORD)v1 << 48) | ((QWORD)v2 << 32) | ((QWORD)v3 << 16);
}
- else if (swscanf_s(vStr+1, L"%d.%d", &v1, &v2) == 2)
+ else if (swscanf_s(vStr+1, W("%d.%d"), &v1, &v2) == 2)
{
result = ((QWORD)v1 << 48) | ((QWORD)v2 << 32);
}
- else if (swscanf_s(vStr+1, L"%d", &v1) == 1)
+ else if (swscanf_s(vStr+1, W("%d"), &v1) == 1)
{
result = ((QWORD)v1 << 48);
}
@@ -596,7 +596,7 @@ BOOL GetPathFromModule(
if (len == 0 || len == cFqPath)
return FALSE;
- WCHAR *pLastSep = wcsrchr(fqPath, DIRECTORY_SEPARATOR_CHAR_W);
+ WCHAR *pLastSep = _wcsrchr(fqPath, DIRECTORY_SEPARATOR_CHAR_W);
if (pLastSep == NULL || pLastSep+1 >= fqPath+cFqPath)
return FALSE;
@@ -647,7 +647,7 @@ HRESULT CreateInstanceCustom(
* windbg. *
* *
\**********************************************************************/
-DWORD_PTR GetValueFromExpression (__in __in_z const char *const instr)
+DWORD_PTR GetValueFromExpression (___in __in_z const char *const instr)
{
ULONG64 dwAddr;
const char *str = instr;
@@ -1515,7 +1515,7 @@ void ComposeName_s(CorElementType Type, __out_ecount(capacity_buffer) LPSTR buff
LPWSTR FormatTypeName (__out_ecount (maxChars) LPWSTR pszName, UINT maxChars)
{
UINT iStart = 0;
- UINT iLen = (int) wcslen(pszName);
+ UINT iLen = (int) _wcslen(pszName);
if (iLen > maxChars)
{
iStart = iLen - maxChars;
@@ -1802,7 +1802,7 @@ int GetObjFieldOffset(CLRDATA_ADDRESS cdaObj, CLRDATA_ADDRESS cdaMT, __in_z LPCW
{
DWORD offset = vFieldDesc.dwOffset + sizeof(BaseObject);
NameForToken_s (TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false);
- if (wcscmp (wszFieldName, g_mdName) == 0)
+ if (_wcscmp (wszFieldName, g_mdName) == 0)
{
return offset;
}
@@ -2141,7 +2141,7 @@ void AssemblyInfo(DacpAssemblyData *pAssembly)
}
else
{
- ExtOut("%S\n", (moduleData.bIsReflection) ? L"Dynamic Module" : L"Unknown Module");
+ ExtOut("%S\n", (moduleData.bIsReflection) ? W("Dynamic Module") : W("Unknown Module"));
}
}
}
@@ -2294,14 +2294,14 @@ BOOL NameForMT_s(DWORD_PTR MTAddr, __out_ecount (capacity_mdName) WCHAR *mdName,
return SUCCEEDED(hr);
}
-wchar_t *CreateMethodTableName(TADDR mt, TADDR cmt)
+WCHAR *CreateMethodTableName(TADDR mt, TADDR cmt)
{
bool array = false;
- wchar_t *res = NULL;
+ WCHAR *res = NULL;
if (mt == sos::MethodTable::GetFreeMT())
{
- res = new wchar_t[5];
+ res = new WCHAR[5];
wcscpy_s(res, 5, W("Free"));
return res;
}
@@ -2319,7 +2319,7 @@ wchar_t *CreateMethodTableName(TADDR mt, TADDR cmt)
if (SUCCEEDED(hr))
{
// +2 for [], if we need it.
- res = new wchar_t[needed+2];
+ res = new WCHAR[needed+2];
hr = g_sos->GetMethodTableName(mt, needed, res, NULL);
if (FAILED(hr))
@@ -2626,7 +2626,7 @@ BOOL IsFusionLoadedModule (LPCSTR fusionName, LPCSTR mName)
return FALSE;
}
-BOOL DebuggerModuleNamesMatch (CLRDATA_ADDRESS PEFileAddr, __in __in_z LPSTR mName)
+BOOL DebuggerModuleNamesMatch (CLRDATA_ADDRESS PEFileAddr, ___in __in_z LPSTR mName)
{
// Another way to see if a module is the same is
// to accept that mName may be the debugger's name for
@@ -2650,11 +2650,7 @@ BOOL DebuggerModuleNamesMatch (CLRDATA_ADDRESS PEFileAddr, __in __in_z LPSTR mNa
if (g_ExtSymbols->GetModuleNames(Index, base, NULL, 0, NULL, ModuleName,
MAX_PATH, NULL, NULL, 0, NULL) == S_OK)
{
-#ifndef FEATURE_PAL
if (_stricmp (ModuleName, mName) == 0)
-#else
- if (strcmp (ModuleName, mName) == 0)
-#endif
{
return TRUE;
}
@@ -2883,8 +2879,8 @@ void GetInfoFromName(DWORD_PTR ModulePtr, const char* name)
mdToken tkEnclose = mdTokenNil;
WCHAR *pName;
WCHAR *pHead = wszName;
- while ( ((pName = wcschr (pHead,L'+')) != NULL) ||
- ((pName = wcschr (pHead,L'/')) != NULL)) {
+ while ( ((pName = _wcschr (pHead,L'+')) != NULL) ||
+ ((pName = _wcschr (pHead,L'/')) != NULL)) {
pName[0] = L'\0';
if (FAILED(pImport->FindTypeDefByName(pHead,tkEnclose,&tkEnclose)))
return;
@@ -2902,7 +2898,7 @@ void GetInfoFromName(DWORD_PTR ModulePtr, const char* name)
// See if it is a method
WCHAR *pwzMethod;
- if ((pwzMethod = wcsrchr(pName, L'.')) == NULL)
+ if ((pwzMethod = _wcsrchr(pName, L'.')) == NULL)
return;
if (pwzMethod[-1] == L'.')
@@ -3673,7 +3669,7 @@ void CharArrayContent(TADDR pos, ULONG num, bool widechar)
if (widechar)
{
- ArrayHolder<wchar_t> data = new wchar_t[num+1];
+ ArrayHolder<WCHAR> data = new WCHAR[num+1];
if (!data)
{
ReportOOM();
@@ -3769,7 +3765,7 @@ void StringObjectContent(size_t obj, BOOL fLiteral, const int length)
ULONG j,k=0;
for (j = 0; j < wcharsRead; j ++)
{
- if (iswprint (buffer[j])) {
+ if (_iswprint (buffer[j])) {
out[k] = buffer[j];
k ++;
}
@@ -4230,8 +4226,8 @@ typedef struct _FindFileCallbackData
// FALSE if the search should stop (the file is good)
BOOL
FindFileInPathCallback(
- __in PCWSTR filename,
- __in PVOID context
+ ___in PCWSTR filename,
+ ___in PVOID context
)
{
HRESULT hr;
@@ -4381,7 +4377,7 @@ public:
}
// if we are looking for the DAC, just load the one windbg already found
- if(wcsncmp(pwszFileName, W("mscordac"), wcslen(W("mscordac")))==0)
+ if(_wcsncmp(pwszFileName, W("mscordac"), _wcslen(W("mscordac")))==0)
{
FindFileInPathCallback(dacPath, &callbackData);
*phModule = callbackData.hModule;
@@ -4412,7 +4408,7 @@ public:
return hr;
}
- ArrayHolder<wchar_t> symbolPath = new wchar_t[pathSize+MAX_PATH+1];
+ ArrayHolder<WCHAR> symbolPath = new WCHAR[pathSize+MAX_PATH+1];
@@ -5259,7 +5255,7 @@ OutputVaList(
char str[1024];
// Try and format our string into a fixed buffer first and see if it fits
- int length = PAL__vsnprintf(str, sizeof(str), format, args);
+ int length = _vsnprintf(str, sizeof(str), format, args);
if (length > 0)
{
return g_ExtControl->Output(mask, "%s", str);
@@ -5474,7 +5470,7 @@ CachedString Output::BuildManagedVarValue(__in_z LPCWSTR expansionName, ULONG fr
numFrameDigits = 1;
}
- size_t totalStringLength = strlen(DMLFormats[type]) + wcslen(expansionName) + numFrameDigits + wcslen(simpleName) + 1;
+ size_t totalStringLength = strlen(DMLFormats[type]) + _wcslen(expansionName) + numFrameDigits + _wcslen(simpleName) + 1;
if (totalStringLength > ret.GetStrLen())
{
ret.Allocate(static_cast<int>(totalStringLength));
@@ -5562,8 +5558,8 @@ NoOutputHolder::~NoOutputHolder()
// containing the addressed passed in "Base".
HRESULT
GetImageFromBase(
- __in ULONG64 Base,
- __out ImageInfo* Image)
+ ___in ULONG64 Base,
+ ___out ImageInfo* Image)
{
ULONG modIdx = 0;
ULONG64 modBase = 0;
@@ -5581,9 +5577,9 @@ GetImageFromBase(
// passed in, and the extent type requested.
HRESULT
GetClrModuleImages(
- __in IXCLRDataModule* Module,
- __in CLRDataModuleExtentType DesiredType,
- __out ImageInfo* FirstAdd)
+ ___in IXCLRDataModule* Module,
+ ___in CLRDataModuleExtentType DesiredType,
+ ___out ImageInfo* FirstAdd)
{
HRESULT Status;
CLRDATA_ENUM EnumExtents;
@@ -5629,8 +5625,8 @@ GetClrModuleImages(
// passed in. First look for NGENed module, second for IL modules.
HRESULT
FindClrModuleImage(
- __in IXCLRDataModule* Module,
- __out ImageInfo* Image)
+ ___in IXCLRDataModule* Module,
+ ___out ImageInfo* Image)
{
HRESULT Status;
@@ -5653,8 +5649,8 @@ FindClrModuleImage(
// passed in native offset.
HRESULT
GetClrMethodInstance(
- __in ULONG64 NativeOffset,
- __out IXCLRDataMethodInstance** Method)
+ ___in ULONG64 NativeOffset,
+ ___out IXCLRDataMethodInstance** Method)
{
HRESULT Status;
CLRDATA_ENUM MethEnum;
@@ -5676,9 +5672,9 @@ GetClrMethodInstance(
// identified by the passed in IXCLRDataMethodInstance* instance.
HRESULT
GetMethodInstanceTokenAndScope(
- __in IXCLRDataMethodInstance* Method,
- __out mdMethodDef* MethodToken,
- __out ImageInfo* Image)
+ ___in IXCLRDataMethodInstance* Method,
+ ___out mdMethodDef* MethodToken,
+ ___out ImageInfo* Image)
{
HRESULT Status;
IXCLRDataModule* Module;
@@ -5699,8 +5695,8 @@ GetMethodInstanceTokenAndScope(
// managed method, and returns the highest non-epilog offset.
HRESULT
GetLastMethodIlOffset(
- __in IXCLRDataMethodInstance* Method,
- __out PULONG32 MethodOffs)
+ ___in IXCLRDataMethodInstance* Method,
+ ___out PULONG32 MethodOffs)
{
HRESULT Status;
CLRDATA_IL_ADDRESS_MAP MapLocal[16];
@@ -5767,11 +5763,11 @@ GetLastMethodIlOffset(
// represent an "IL offset".
HRESULT
ConvertNativeToIlOffset(
- __in ULONG64 Native,
+ ___in ULONG64 Native,
__in_opt IXCLRDataMethodInstance* MethodInst,
- __out ImageInfo* Image,
- __out mdMethodDef* MethodToken,
- __out PULONG32 MethodOffs)
+ ___out ImageInfo* Image,
+ ___out mdMethodDef* MethodToken,
+ ___out PULONG32 MethodOffs)
{
HRESULT Status;
@@ -5829,10 +5825,10 @@ ConvertNativeToIlOffset(
// identifies the corresponding source file name and line number.
HRESULT
GetLineByOffset(
- __in ULONG64 Offset,
- __out ULONG *pLinenum,
+ ___in ULONG64 Offset,
+ ___out ULONG *pLinenum,
__out_ecount(cbFileName) LPSTR lpszFileName,
- __in ULONG cbFileName)
+ ___in ULONG cbFileName)
{
#ifdef FEATURE_PAL
@@ -6229,7 +6225,7 @@ HRESULT SymbolReader::LoadSymbols(IMetaDataImport * pMD, ULONG64 baseAddress, __
return Status;
}
- ArrayHolder<wchar_t> symbolPath = new wchar_t[pathSize];
+ ArrayHolder<WCHAR> symbolPath = new WCHAR[pathSize];
Status = spSym3->GetSymbolPathWide(symbolPath, pathSize, NULL);
if(S_OK != Status)
{
@@ -6371,7 +6367,7 @@ HRESULT SymbolReader::ResolveSequencePoint(__in_z WCHAR* pFilename, ULONG32 line
cDocs = cDocsNeeded;
IfFailRet(m_pSymReader->GetDocuments(cDocs, &cDocsNeeded, &(pDocs[0])));
- ULONG32 filenameLen = (ULONG32) wcslen(pFilename);
+ ULONG32 filenameLen = (ULONG32) _wcslen(pFilename);
for(ULONG32 i = 0; i < cDocs; i++)
{
@@ -6535,7 +6531,7 @@ WString MethodNameFromIP(CLRDATA_ADDRESS ip, BOOL bSuppressLines)
SUCCEEDED(GetLineByOffset(TO_CDADDR(ip), &linenum, filename, MAX_PATH+1)))
{
int len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
- ArrayHolder<wchar_t> wfilename = new wchar_t[len];
+ ArrayHolder<WCHAR> wfilename = new WCHAR[len];
MultiByteToWideChar(CP_ACP, 0, filename, -1, wfilename, len);
methodOutput += WString(W(" [")) + wfilename + W(" @ ") + Decimal(linenum) + W("]");
diff --git a/src/ToolBox/SOS/Strike/util.h b/src/ToolBox/SOS/Strike/util.h
index 904edc074f..fb84f5ca39 100644
--- a/src/ToolBox/SOS/Strike/util.h
+++ b/src/ToolBox/SOS/Strike/util.h
@@ -21,9 +21,9 @@ inline void RestoreSOToleranceState() {}
#include <clrdata.h>
#include <palclr.h>
#include <metahost.h>
+#include <new>
#if !defined(FEATURE_PAL)
-#include <new>
#include <dia2.h>
#endif
@@ -33,13 +33,11 @@ inline void RestoreSOToleranceState() {}
#pragma warning(default:4200)
#endif
#include "data.h"
-
#endif //STRIKE
#include "cordebug.h"
#include "static_assert.h"
-
typedef LPCSTR LPCUTF8;
typedef LPSTR LPUTF8;
@@ -185,7 +183,7 @@ interface ICorDebugProcess;
extern ICorDebugProcess * g_pCorDebugProcess;
// This class is templated for easy modification. We may need to update the CachedString
-// or related classes to use wchar_t instead of char in the future.
+// or related classes to use WCHAR instead of char in the future.
template <class T, int count, int size>
class StaticData
{
@@ -608,7 +606,7 @@ private:
};
typedef BaseString<char, strlen, strcpy_s> String;
-typedef BaseString<wchar_t, wcslen, wcscpy_s> WString;
+typedef BaseString<WCHAR, _wcslen, wcscpy_s> WString;
template<class T>
@@ -785,7 +783,7 @@ namespace Output
const char *cstr = (const char *)str;
int len = MultiByteToWideChar(CP_ACP, 0, cstr, -1, NULL, 0);
- wchar_t *buffer = (wchar_t *)alloca(len*sizeof(wchar_t));
+ WCHAR *buffer = (WCHAR *)alloca(len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, cstr, -1, buffer, len);
@@ -961,15 +959,15 @@ namespace Output
/* Format class for wide char strings.
*/
template <>
- class Format<const wchar_t *>
+ class Format<const WCHAR *>
{
public:
- Format(const wchar_t *value)
+ Format(const WCHAR *value)
: mValue(value)
{
}
- Format(const Format<const wchar_t *> &rhs)
+ Format(const Format<const WCHAR *> &rhs)
: mValue(rhs.mValue)
{
}
@@ -984,7 +982,7 @@ namespace Output
void OutputColumn(Alignment align, int width) const
{
- int precision = (int)wcslen(mValue);
+ int precision = (int)_wcslen(mValue);
if (precision > width)
precision = width;
@@ -997,7 +995,7 @@ namespace Output
}
private:
- const wchar_t *mValue;
+ const WCHAR *mValue;
};
@@ -1288,17 +1286,17 @@ public:
void WriteColumn(int col, const WString &str)
{
- WriteColumn(col, Output::Format<const wchar_t *>(str));
+ WriteColumn(col, Output::Format<const WCHAR *>(str));
}
void WriteColumn(int col, __in_z WCHAR *str)
{
- WriteColumn(col, Output::Format<const wchar_t *>(str));
+ WriteColumn(col, Output::Format<const WCHAR *>(str));
}
void WriteColumn(int col, const WCHAR *str)
{
- WriteColumn(col, Output::Format<const wchar_t *>(str));
+ WriteColumn(col, Output::Format<const WCHAR *>(str));
}
inline void WriteColumn(int col, __in_z char *str)
@@ -1324,9 +1322,9 @@ public:
WriteColumn(col, result);
}
- void WriteColumnFormat(int col, const wchar_t *fmt, ...)
+ void WriteColumnFormat(int col, const WCHAR *fmt, ...)
{
- wchar_t result[128];
+ WCHAR result[128];
va_list list;
va_start(list, fmt);
@@ -1630,10 +1628,10 @@ inline BOOL SafeReadMemory (CLRDATA_ADDRESS offset, PVOID lpBuffer, ULONG cb, PU
BOOL NameForMD_s (DWORD_PTR pMD, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName);
BOOL NameForMT_s (DWORD_PTR MTAddr, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName);
-wchar_t *CreateMethodTableName(TADDR mt, TADDR cmt = NULL);
+WCHAR *CreateMethodTableName(TADDR mt, TADDR cmt = NULL);
void isRetAddr(DWORD_PTR retAddr, DWORD_PTR* whereCalled);
-DWORD_PTR GetValueFromExpression (__in __in_z const char *const str);
+DWORD_PTR GetValueFromExpression (___in __in_z const char *const str);
#ifndef FEATURE_PAL
// ensure we always allocate on the process heap
@@ -2404,10 +2402,10 @@ public:
HRESULT
GetLineByOffset(
- __in ULONG64 IP,
- __out ULONG *pLinenum,
+ ___in ULONG64 IP,
+ ___out ULONG *pLinenum,
__out_ecount(cbFileName) LPSTR lpszFileName,
- __in ULONG cbFileName);
+ ___in ULONG cbFileName);
/// X86 Context
#define X86_SIZE_OF_80387_REGISTERS 80
@@ -2795,7 +2793,6 @@ public:
MoveToPage(start, size);
}
}
-
void ClearStats()
{
@@ -2806,8 +2803,6 @@ public:
#endif
}
-#ifndef FEATURE_PAL
-
void PrintStats(const char *func)
{
#ifdef _DEBUG
@@ -2819,8 +2814,6 @@ public:
#endif
}
-#endif // !FEATURE_PAL
-
private:
/* Sets the cache to the page specified by addr, or false if we could not move to
* that page.
@@ -2857,11 +2850,9 @@ private:
// Methods for creating a database out of the gc heap and it's roots in xml format or CLRProfiler format
//
-#ifndef FEATURE_PAL
#include <unordered_map>
#include <unordered_set>
#include <list>
-#endif
class TypeTree;
enum { FORMAT_XML=0, FORMAT_CLRPROFILER=1 };
@@ -2877,9 +2868,7 @@ private:
bool m_verify;
LinearReadCache mCache;
-#ifndef FEATURE_PAL
std::unordered_map<TADDR, std::list<TADDR>> mDependentHandleMap;
-#endif
public:
HeapTraverser(bool verify);
@@ -2919,7 +2908,6 @@ private:
void TraceHandles();
};
-#ifndef FEATURE_PAL
class GCRootImpl
{
@@ -2927,7 +2915,7 @@ private:
struct MTInfo
{
TADDR MethodTable;
- wchar_t *TypeName;
+ WCHAR *TypeName;
TADDR *Buffer;
CGCDesc *GCDesc;
@@ -2937,13 +2925,13 @@ private:
size_t BaseSize;
size_t ComponentSize;
- const wchar_t *GetTypeName()
+ const WCHAR *GetTypeName()
{
if (!TypeName)
TypeName = CreateMethodTableName(MethodTable);
if (!TypeName)
- return L"<error>";
+ return W("<error>");
return TypeName;
}
@@ -2976,10 +2964,10 @@ private:
RootNode *GCRefs;
- const wchar_t *GetTypeName()
+ const WCHAR *GetTypeName()
{
if (!MTInfo)
- return L"<unknown>";
+ return W("<unknown>");
return MTInfo->GetTypeName();
}
@@ -3119,8 +3107,6 @@ private:
LinearReadCache mCache; // A linear cache which stops us from having to read from the target process more than 1-2 times per object.
};
-#endif // !FEATURE_PAL
-
//
// Helper class used for type-safe bitflags
// T - the enum type specifying the individual bit flags
@@ -3229,7 +3215,7 @@ HRESULT CreateInstanceCustom(
template <typename T>
BOOL
GetProcAddressT(
- __in PCSTR FunctionName,
+ ___in PCSTR FunctionName,
__in_opt PCWSTR DllName,
__inout T* OutFunctionPointer,
__inout HMODULE* InOutDllHandle
@@ -3264,9 +3250,9 @@ struct ImageInfo
HRESULT
GetClrModuleImages(
- __in IXCLRDataModule* Module,
- __in CLRDataModuleExtentType DesiredType,
- __out ImageInfo* FirstAdd);
+ ___in IXCLRDataModule* Module,
+ ___in CLRDataModuleExtentType DesiredType,
+ ___out ImageInfo* FirstAdd);
// Helper class used in ClrStackFromPublicInterface() to keep track of explicit EE Frames
// (i.e., "internal frames") on the stack. Call Init() with the appropriate
diff --git a/src/ToolBox/SOS/Strike/vm.cpp b/src/ToolBox/SOS/Strike/vm.cpp
index b0b9ede328..1cbe527056 100644
--- a/src/ToolBox/SOS/Strike/vm.cpp
+++ b/src/ToolBox/SOS/Strike/vm.cpp
@@ -325,7 +325,7 @@ PrintVmStatsHeader(
VOID
PrintIndividualStat(
- __in __in_z IN PSTR Name,
+ ___in __in_z IN PSTR Name,
IN PINDIVIDUAL_STAT Stat
)
{
@@ -380,7 +380,7 @@ PrintIndividualStat(
VOID
PrintVmStats(
- __in __in_z IN PSTR Name,
+ ___in __in_z IN PSTR Name,
IN PVM_STATS Stats
)
{
diff --git a/src/inc/daccess.h b/src/inc/daccess.h
index b44c895f8c..704a1ea425 100644
--- a/src/inc/daccess.h
+++ b/src/inc/daccess.h
@@ -537,8 +537,12 @@
#define DACCESS_TABLE_RESOURCE "COREXTERNALDATAACCESSRESOURCE"
+#ifdef PAL_STDCPP_COMPAT
+#include <type_traits>
+#else
#include "clr_std/type_traits"
#include "crosscomp.h"
+#endif
// Information stored in the DAC table of interest to the DAC implementation
// Note that this information is shared between all instantiations of ClrDataAccess, so initialize
@@ -1413,14 +1417,14 @@ public:
// Pointer wrapper for 16-bit strings.
template<typename type, ULONG32 maxChars = 32760>
-class __Str16Ptr : public __DPtr<wchar_t>
+class __Str16Ptr : public __DPtr<WCHAR>
{
public:
typedef type _Type;
typedef type* _Ptr;
- __Str16Ptr< type, maxChars >(void) : __DPtr<wchar_t>() {}
- __Str16Ptr< type, maxChars >(TADDR addr) : __DPtr<wchar_t>(addr) {}
+ __Str16Ptr< type, maxChars >(void) : __DPtr<WCHAR>() {}
+ __Str16Ptr< type, maxChars >(TADDR addr) : __DPtr<WCHAR>(addr) {}
explicit __Str16Ptr< type, maxChars >(__TPtrBase addr)
{
m_addr = addr.GetAddr();
@@ -2354,8 +2358,8 @@ typedef S8PTR(char) PTR_STR;
typedef S8PTR(const char) PTR_CSTR;
typedef S8PTR(char) PTR_UTF8;
typedef S8PTR(const char) PTR_CUTF8;
-typedef S16PTR(wchar_t) PTR_WSTR;
-typedef S16PTR(const wchar_t) PTR_CWSTR;
+typedef S16PTR(WCHAR) PTR_WSTR;
+typedef S16PTR(const WCHAR) PTR_CWSTR;
typedef DPTR(T_CONTEXT) PTR_CONTEXT;
typedef DPTR(PTR_CONTEXT) PTR_PTR_CONTEXT;
diff --git a/src/inc/fusionbind.h b/src/inc/fusionbind.h
index c70d06eca1..4b106a3cf6 100644
--- a/src/inc/fusionbind.h
+++ b/src/inc/fusionbind.h
@@ -29,7 +29,11 @@
#include "fusionsetup.h"
#include "sstring.h"
#include "ex.h"
+#ifdef PAL_STDCPP_COMPAT
+#include <type_traits>
+#else
#include "clr_std/type_traits"
+#endif
#include "binderngen.h"
#include "clrprivbinding.h"
diff --git a/src/inc/holder.h b/src/inc/holder.h
index 5021fe16b6..645195e7dd 100644
--- a/src/inc/holder.h
+++ b/src/inc/holder.h
@@ -13,8 +13,14 @@
#include "staticcontract.h"
#include "volatile.h"
#include "palclr.h"
+
+#ifdef PAL_STDCPP_COMPAT
+#include <utility>
+#include <type_traits>
+#else
#include "clr_std/utility"
#include "clr_std/type_traits"
+#endif
#if defined(FEATURE_COMINTEROP) && !defined(STRIKE)
#include <Activation.h>
diff --git a/src/inc/safemath.h b/src/inc/safemath.h
index 4a72d23662..bf441f22f7 100644
--- a/src/inc/safemath.h
+++ b/src/inc/safemath.h
@@ -35,9 +35,9 @@
#ifdef PAL_STDCPP_COMPAT
#include <type_traits>
-#else // PAL_STDCPP_COMPAT
+#else
#include "clr_std/type_traits"
-#endif // PAL_STDCPP_COMPAT
+#endif
//==================================================================
// Semantics: if val can be represented as the exact same value
diff --git a/src/inc/sospriv.idl b/src/inc/sospriv.idl
index d22945a781..9ef6cc2ffa 100644
--- a/src/inc/sospriv.idl
+++ b/src/inc/sospriv.idl
@@ -186,13 +186,13 @@ interface ISOSDacInterface : IUnknown
HRESULT GetAppDomainStoreData(struct DacpAppDomainStoreData *data);
HRESULT GetAppDomainList(unsigned int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
HRESULT GetAppDomainData(CLRDATA_ADDRESS addr, struct DacpAppDomainData *data);
- HRESULT GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, wchar_t *name, unsigned int *pNeeded);
+ HRESULT GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, WCHAR *name, unsigned int *pNeeded);
HRESULT GetDomainFromContext(CLRDATA_ADDRESS context, CLRDATA_ADDRESS *domain);
// Assemblies
HRESULT GetAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], int *pNeeded);
HRESULT GetAssemblyData(CLRDATA_ADDRESS baseDomainPtr, CLRDATA_ADDRESS assembly, struct DacpAssemblyData *data);
- HRESULT GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, wchar_t *name, unsigned int *pNeeded);
+ HRESULT GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded);
// Modules
HRESULT GetModule(CLRDATA_ADDRESS addr, IXCLRDataModule **mod);
@@ -209,7 +209,7 @@ interface ISOSDacInterface : IUnknown
// MethodDescs
HRESULT GetMethodDescData(CLRDATA_ADDRESS methodDesc, CLRDATA_ADDRESS ip, struct DacpMethodDescData *data, ULONG cRevertedRejitVersions, struct DacpReJitData * rgRevertedRejitData, ULONG * pcNeededRevertedRejitData);
HRESULT GetMethodDescPtrFromIP(CLRDATA_ADDRESS ip, CLRDATA_ADDRESS * ppMD);
- HRESULT GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, wchar_t *name, unsigned int *pNeeded);
+ HRESULT GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, WCHAR *name, unsigned int *pNeeded);
HRESULT GetMethodDescPtrFromFrame(CLRDATA_ADDRESS frameAddr, CLRDATA_ADDRESS * ppMD);
HRESULT GetMethodDescFromToken(CLRDATA_ADDRESS moduleAddr, mdToken token, CLRDATA_ADDRESS *methodDesc);
HRESULT GetMethodDescTransparencyData(CLRDATA_ADDRESS methodDesc, struct DacpMethodDescTransparencyData *data);
@@ -227,11 +227,11 @@ interface ISOSDacInterface : IUnknown
// Objects
HRESULT GetObjectData(CLRDATA_ADDRESS objAddr, struct DacpObjectData *data);
- HRESULT GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, wchar_t *stringData, unsigned int *pNeeded);
- HRESULT GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, wchar_t *className, unsigned int *pNeeded);
+ HRESULT GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, WCHAR *stringData, unsigned int *pNeeded);
+ HRESULT GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, WCHAR *className, unsigned int *pNeeded);
// MethodTable
- HRESULT GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, wchar_t *mtName, unsigned int *pNeeded);
+ HRESULT GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, WCHAR *mtName, unsigned int *pNeeded);
HRESULT GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData *data);
HRESULT GetMethodTableSlot(CLRDATA_ADDRESS mt, unsigned int slot, CLRDATA_ADDRESS *value);
HRESULT GetMethodTableFieldData(CLRDATA_ADDRESS mt, struct DacpMethodTableFieldData *data);
@@ -244,12 +244,12 @@ interface ISOSDacInterface : IUnknown
HRESULT GetFieldDescData(CLRDATA_ADDRESS fieldDesc, struct DacpFieldDescData *data);
// Frames
- HRESULT GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, wchar_t *frameName, unsigned int *pNeeded);
+ HRESULT GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, WCHAR *frameName, unsigned int *pNeeded);
// PEFiles
HRESULT GetPEFileBase(CLRDATA_ADDRESS addr, CLRDATA_ADDRESS *base);
- HRESULT GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, wchar_t *fileName, unsigned int *pNeeded);
+ HRESULT GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, WCHAR *fileName, unsigned int *pNeeded);
// GC
HRESULT GetGCHeapData(struct DacpGcHeapData *data);
@@ -310,20 +310,20 @@ interface ISOSDacInterface : IUnknown
* Enumerates all references on a given callstack.
*/
HRESULT GetStackReferences([in] DWORD osThreadID, [out] ISOSStackRefEnum **ppEnum);
- HRESULT GetRegisterName([in] int regName, [in] unsigned int count, [out] wchar_t *buffer, [out] unsigned int *pNeeded);
+ HRESULT GetRegisterName([in] int regName, [in] unsigned int count, [out] WCHAR *buffer, [out] unsigned int *pNeeded);
HRESULT GetThreadAllocData(CLRDATA_ADDRESS thread, struct DacpAllocData *data);
HRESULT GetHeapAllocData(unsigned int count, struct DacpGenerationAllocData *data, unsigned int *pNeeded);
// For BindingDisplay plugin
HRESULT GetFailedAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
- HRESULT GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, wchar_t *paths, unsigned int *pNeeded);
- HRESULT GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, wchar_t *location, unsigned int *pNeeded);
- HRESULT GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count, wchar_t *configFile, unsigned int *pNeeded);
- HRESULT GetApplicationBase(CLRDATA_ADDRESS appDomain, int count, wchar_t *base, unsigned int *pNeeded);
+ HRESULT GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, WCHAR *paths, unsigned int *pNeeded);
+ HRESULT GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, WCHAR *location, unsigned int *pNeeded);
+ HRESULT GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count, WCHAR *configFile, unsigned int *pNeeded);
+ HRESULT GetApplicationBase(CLRDATA_ADDRESS appDomain, int count, WCHAR *base, unsigned int *pNeeded);
HRESULT GetFailedAssemblyData(CLRDATA_ADDRESS assembly, unsigned int *pContext, HRESULT *pResult);
- HRESULT GetFailedAssemblyLocation(CLRDATA_ADDRESS assesmbly, unsigned int count, wchar_t *location, unsigned int *pNeeded);
- HRESULT GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, wchar_t *name, unsigned int *pNeeded);
+ HRESULT GetFailedAssemblyLocation(CLRDATA_ADDRESS assesmbly, unsigned int count, WCHAR *location, unsigned int *pNeeded);
+ HRESULT GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded);
};
[
diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h
index 46667706f7..364b4e17dd 100644
--- a/src/inc/utilcode.h
+++ b/src/inc/utilcode.h
@@ -30,7 +30,12 @@
#include "winnls.h"
#include "check.h"
#include "safemath.h"
+
+#ifdef PAL_STDCPP_COMPAT
+#include <type_traits>
+#else
#include "clr_std/type_traits"
+#endif
#include "contract.h"
#include "entrypoints.h"
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 9c310a5644..48a0844d24 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -45,6 +45,16 @@ Abstract:
#ifndef __PAL_H__
#define __PAL_H__
+#ifdef PAL_STDCPP_COMPAT
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -207,6 +217,8 @@ extern "C" {
#endif
#endif
+#ifndef PAL_STDCPP_COMPAT
+
#ifdef _M_ALPHA
typedef struct {
@@ -314,6 +326,8 @@ typedef char * va_list;
#endif // __GNUC__
+#endif // !PAL_STDCPP_COMPAT
+
/******************* PAL-Specific Entrypoints *****************************/
#define IsDebuggerPresent PAL_IsDebuggerPresent
@@ -366,6 +380,10 @@ PAL_IsDebuggerPresent();
#define _UI32_MAX UINT_MAX
#define _UI32_MIN UINT_MIN
+#ifdef PAL_STDCPP_COMPAT
+#undef NULL
+#endif
+
#ifndef NULL
#if defined(__cplusplus)
#define NULL 0
@@ -386,8 +404,8 @@ typedef __int64 time_t;
#else
typedef long time_t;
#endif
-#endif // !PAL_STDCPP_COMPAT
#define _TIME_T_DEFINED
+#endif // !PAL_STDCPP_COMPAT
#if ENABLE_DOWNLEVEL_FOR_NLS
#define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD )(srtid))) << 16) | \
@@ -5623,10 +5641,11 @@ ReportEventW (
/******************* C Runtime Entrypoints *******************************/
-#if defined(PLATFORM_UNIX) && !defined(PAL_STDCPP_COMPAT)
/* Some C runtime functions needs to be reimplemented by the PAL.
To avoid name collisions, those functions have been renamed using
defines */
+#ifdef PLATFORM_UNIX
+#ifndef PAL_STDCPP_COMPAT
#define exit PAL_exit
#define atexit PAL_atexit
#define printf PAL_printf
@@ -5645,17 +5664,17 @@ ReportEventW (
#define wcsncmp PAL_wcsncmp
#define wcschr PAL_wcschr
#define wcsrchr PAL_wcsrchr
+#define wcsstr PAL_wcsstr
#define swscanf PAL_swscanf
#define wcspbrk PAL_wcspbrk
-#define wcsstr PAL_wcsstr
#define wcscmp PAL_wcscmp
#define wcsncat PAL_wcsncat
#define wcsncpy PAL_wcsncpy
#define wcstok PAL_wcstok
#define wcscspn PAL_wcscspn
+#define iswprint PAL_iswprint
#define iswalpha PAL_iswalpha
#define iswdigit PAL_iswdigit
-#define iswprint PAL_iswprint
#define iswspace PAL_iswspace
#define iswupper PAL_iswupper
#define iswxdigit PAL_iswxdigit
@@ -5724,13 +5743,8 @@ ReportEventW (
#define _mm_setcsr PAL__mm_setcsr
#endif // _AMD64_
-#endif /* PLATFORM_UNIX */
-
-#ifdef PLATFORM_UNIX
- /* Note the TWO underscores. */
-#define _vsnprintf PAL__vsnprintf
-#define _vsnwprintf PAL__wvsnprintf
-#endif /* PLATFORM_UNIX */
+#endif // !PAL_STDCPP_COMPAT
+#endif // PLATFORM_UNIX
#ifndef _CONST_RETURN
#ifdef __cplusplus
@@ -5748,13 +5762,8 @@ ReportEventW (
typedef int errno_t;
-#ifdef PAL_STDCPP_COMPAT
-#include <string.h>
+#ifndef PAL_STDCPP_COMPAT
-PALIMPORT int __cdecl PAL__vsnprintf(char *, size_t, const char *, va_list);
-PALIMPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t);
-PALIMPORT errno_t __cdecl memmove_s(void *, size_t, const void *, size_t);
-#else // PAL_STDCPP_COMPAT
typedef struct {
int quot;
int rem;
@@ -5763,17 +5772,14 @@ typedef struct {
PALIMPORT div_t div(int numer, int denom);
PALIMPORT void * __cdecl memcpy(void *, const void *, size_t);
-PALIMPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t);
PALIMPORT int __cdecl memcmp(const void *, const void *, size_t);
PALIMPORT void * __cdecl memset(void *, int, size_t);
PALIMPORT void * __cdecl memmove(void *, const void *, size_t);
-PALIMPORT errno_t __cdecl memmove_s(void *, size_t, const void *, size_t);
PALIMPORT void * __cdecl memchr(const void *, int, size_t);
PALIMPORT size_t __cdecl strlen(const char *);
PALIMPORT int __cdecl strcmp(const char*, const char *);
PALIMPORT int __cdecl strncmp(const char*, const char *, size_t);
-PALIMPORT int __cdecl _stricmp(const char *, const char *);
PALIMPORT int __cdecl _strnicmp(const char *, const char *, size_t);
PALIMPORT char * __cdecl strcat(char *, const char *);
PALIMPORT char * __cdecl strncat(char *, const char *, size_t);
@@ -5788,8 +5794,6 @@ PALIMPORT size_t __cdecl strspn(const char *, const char *);
PALIMPORT size_t __cdecl strcspn(const char *, const char *);
PALIMPORT int __cdecl sprintf(char *, const char *, ...);
PALIMPORT int __cdecl vsprintf(char *, const char *, va_list);
-PALIMPORT int __cdecl _snprintf(char *, size_t, const char *, ...);
-PALIMPORT int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
PALIMPORT int __cdecl sscanf(const char *, const char *, ...);
PALIMPORT int __cdecl atoi(const char *);
PALIMPORT LONG __cdecl atol(const char *);
@@ -5809,7 +5813,11 @@ PALIMPORT int __cdecl toupper(int);
#endif // PAL_STDCPP_COMPAT
+PALIMPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t);
+PALIMPORT errno_t __cdecl memmove_s(void *, size_t, const void *, size_t);
PALIMPORT char * __cdecl _strlwr(char *);
+PALIMPORT int __cdecl _stricmp(const char *, const char *);
+PALIMPORT int __cdecl _snprintf(char *, size_t, const char *, ...);
PALIMPORT char * __cdecl _gcvt_s(char *, int, double, int);
PALIMPORT char * __cdecl _ecvt(double, int, int *, int *);
PALIMPORT int __cdecl __iscsym(int);
@@ -5819,6 +5827,7 @@ PALIMPORT unsigned char * __cdecl _mbsninc(const unsigned char *, size_t);
PALIMPORT unsigned char * __cdecl _mbsdec(const unsigned char *, const unsigned char *);
PALIMPORT int __cdecl _wcsicmp(const WCHAR *, const WCHAR*);
PALIMPORT int __cdecl _wcsnicmp(const WCHAR *, const WCHAR *, size_t);
+PALIMPORT int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
PALIMPORT int __cdecl _vsnwprintf(WCHAR *, size_t, const WCHAR *, va_list);
PALIMPORT WCHAR * __cdecl _itow(int, WCHAR *, int);
@@ -5882,6 +5891,7 @@ PALIMPORT int __cdecl abs(int);
PALIMPORT double __cdecl fabs(double);
#ifndef PAL_STDCPP_COMPAT
PALIMPORT LONG __cdecl labs(LONG);
+PALIMPORT double __cdecl fabs(double);
#endif // !PAL_STDCPP_COMPAT
// clang complains if this is declared with __int64
PALIMPORT long long __cdecl llabs(long long);
@@ -5905,7 +5915,6 @@ PALIMPORT double __cdecl fmod(double, double);
PALIMPORT float __cdecl fmodf(float, float);
PALIMPORT double __cdecl floor(double);
PALIMPORT double __cdecl ceil(double);
-PALIMPORT double __cdecl fabs(double);
PALIMPORT float __cdecl fabsf(float);
PALIMPORT double __cdecl modf(double, double *);
PALIMPORT float __cdecl modff(float, float *);
@@ -5914,14 +5923,15 @@ PALIMPORT int __cdecl _finite(double);
PALIMPORT int __cdecl _isnan(double);
PALIMPORT double __cdecl _copysign(double, double);
+#ifndef PAL_STDCPP_COMPAT
+
#ifdef __cplusplus
extern "C++" {
-#if !defined(PAL_STDCPP_COMPAT)
inline __int64 abs(__int64 _X) {
return llabs(_X);
}
-#endif // !defined(PAL_STDCPP_COMPAT)
+
}
#endif
@@ -5949,9 +5959,9 @@ PALIMPORT char * __cdecl _strdup(const char *);
#define alloca __builtin_alloca
#endif // __GNUC__
-#ifndef PAL_STDCPP_COMPAT
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
+
#endif // !PAL_STDCPP_COMPAT
PALIMPORT PAL_NORETURN void __cdecl exit(int);
@@ -5991,7 +6001,6 @@ PALIMPORT char * __cdecl ctime(const time_t *);
PALIMPORT int __cdecl _open_osfhandle(INT_PTR, int);
PALIMPORT int __cdecl _close(int);
-
PALIMPORT int __cdecl _flushall();
#ifdef PAL_STDCPP_COMPAT
@@ -6004,8 +6013,6 @@ typedef struct _PAL_FILE PAL_FILE;
struct _FILE;
typedef struct _FILE FILE;
typedef struct _FILE PAL_FILE;
-#endif // PAL_STDCPP_COMPAT
-
#define SEEK_SET 0
#define SEEK_CUR 1
@@ -6023,6 +6030,8 @@ typedef struct _FILE PAL_FILE;
#define _IOLBF 1 /* setvbuf should set line buffered */
#define _IONBF 2 /* setvbuf should set unbuffered */
+#endif // PAL_STDCPP_COMPAT
+
PALIMPORT int __cdecl PAL_fclose(PAL_FILE *);
PALIMPORT void __cdecl PAL_setbuf(PAL_FILE *, char*);
PALIMPORT int __cdecl PAL_fflush(PAL_FILE *);
@@ -6058,10 +6067,12 @@ PALIMPORT PAL_FILE * __cdecl _wfsopen(const WCHAR *, const WCHAR *, int);
/* Maximum value that can be returned by the rand function. */
+#ifndef PAL_STDCPP_COMPAT
#define RAND_MAX 0x7fff
+#endif // !PAL_STDCPP_COMPAT
-PALIMPORT int __cdecl rand(void);
-PALIMPORT void __cdecl srand(unsigned int);
+PALIMPORT int __cdecl rand(void);
+PALIMPORT void __cdecl srand(unsigned int);
PALIMPORT int __cdecl printf(const char *, ...);
PALIMPORT int __cdecl vprintf(const char *, va_list);
@@ -6086,7 +6097,7 @@ PALIMPORT int * __cdecl PAL_errno(int caller);
#define stdout (PAL_get_stdout(PAL_get_caller))
#define stdin (PAL_get_stdin(PAL_get_caller))
#define stderr (PAL_get_stderr(PAL_get_caller))
-#define errno (*PAL_errno(PAL_get_caller))
+#define errno (*PAL_errno(PAL_get_caller))
#endif // PAL_STDCPP_COMPAT
PALIMPORT char * __cdecl getenv(const char *);
diff --git a/src/pal/inc/pal_mstypes.h b/src/pal/inc/pal_mstypes.h
index 3b8065f442..8a50c0ec89 100644
--- a/src/pal/inc/pal_mstypes.h
+++ b/src/pal/inc/pal_mstypes.h
@@ -57,10 +57,12 @@ extern "C" {
#define CDECL __cdecl
#endif
+#ifndef PAL_STDCPP_COMPAT
#undef __fastcall
#define __fastcall __stdcall
#undef _fastcall
#define _fastcall __fastcall
+#endif // PAL_STDCPP_COMPAT
#else // !defined(__i386__)
@@ -69,8 +71,11 @@ extern "C" {
#define __cdecl
#define _cdecl
#define CDECL
+
+#ifndef PAL_STDCPP_COMPAT
#define __fastcall
#define _fastcall
+#endif // PAL_STDCPP_COMPAT
#endif // !defined(__i386__)
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h
index cee51734fa..7f3cdbdc14 100644
--- a/src/pal/inc/rt/palrt.h
+++ b/src/pal/inc/rt/palrt.h
@@ -139,6 +139,7 @@ typedef enum tagEFaultRepRetVal
#include "pal.h"
+#ifndef PAL_STDCPP_COMPAT
#ifdef __cplusplus
#ifndef __PLACEMENT_NEW_INLINE
#define __PLACEMENT_NEW_INLINE
@@ -147,7 +148,8 @@ inline void *__cdecl operator new(size_t, void *_P)
return (_P);
}
#endif // __PLACEMENT_NEW_INLINE
-#endif
+#endif // __cplusplus
+#endif // !PAL_STDCPP_COMPAT
#include <pal_assert.h>
@@ -225,11 +227,15 @@ inline void *__cdecl operator new(size_t, void *_P)
#if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3)
#define FIELD_OFFSET(type, field) __builtin_offsetof(type, field)
+#ifndef offsetof
#define offsetof(type, field) __builtin_offsetof(type, field)
+#endif
#define PAL_safe_offsetof(type, field) __builtin_offsetof(type, field)
#else
#define FIELD_OFFSET(type, field) (((LONG)(LONG_PTR)&(((type *)64)->field)) - 64)
+#ifndef offsetof
#define offsetof(s,m) ((size_t)((ptrdiff_t)&(((s *)64)->m)) - 64)
+#endif
#define PAL_safe_offsetof(s,m) ((size_t)((ptrdiff_t)&(char&)(((s *)64)->m))-64)
#endif
diff --git a/src/pal/inc/rt/sal.h b/src/pal/inc/rt/sal.h
index 3eaca415b9..a4ec0190c6 100644
--- a/src/pal/inc/rt/sal.h
+++ b/src/pal/inc/rt/sal.h
@@ -2654,8 +2654,8 @@ buffer, use the table in the buffer annotations section.
-------------------------------------------------------------------------------
*/
-#ifndef PAL_STDCPP_COMPAT
// These macros conflict with c++ headers.
+#ifndef PAL_STDCPP_COMPAT
#define __in _SAL1_Source_(__in, (), _In_)
#define __out _SAL1_Source_(__out, (), _Out_)
#endif // !PAL_STDCPP_COMPAT
diff --git a/src/pal/inc/rt/specstrings.h b/src/pal/inc/rt/specstrings.h
index 7157c85a81..fb4c55ae2b 100644
--- a/src/pal/inc/rt/specstrings.h
+++ b/src/pal/inc/rt/specstrings.h
@@ -312,8 +312,10 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind));
#define __post_invalid _Post_ __notvalid
/* integer related macros */
#define __allocator __inner_allocator
+#ifndef PAL_STDCPP_COMPAT
#define __deallocate(kind) _Pre_ __notnull __post_invalid
#define __deallocate_opt(kind) _Pre_ __maybenull __post_invalid
+#endif
#define __bound __inner_bound
#define __range(lb,ub) __inner_range(lb,ub)
#define __in_bound _Pre_ __inner_bound
diff --git a/src/pal/inc/strsafe.h b/src/pal/inc/strsafe.h
index 4f296bc635..65fb8b7f74 100644
--- a/src/pal/inc/strsafe.h
+++ b/src/pal/inc/strsafe.h
@@ -5561,7 +5561,7 @@ STRSAFEAPI StringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFo
// leave the last space for the null terminator
cchMax = cchDest - 1;
- iRet = PAL__vsnprintf(pszDest, cchMax, pszFormat, argList);
+ iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
// ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax));
if ((iRet < 0) || (((size_t)iRet) > cchMax))
@@ -5687,7 +5687,7 @@ STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest,
// leave the last space for the null terminator
cchMax = cchDest - 1;
- iRet = PAL__vsnprintf(pszDest, cchMax, pszFormat, argList);
+ iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
// ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax));
if ((iRet < 0) || (((size_t)iRet) > cchMax))
diff --git a/src/pal/prebuilt/inc/sospriv.h b/src/pal/prebuilt/inc/sospriv.h
index 82e74e078f..aa42e44f64 100644
--- a/src/pal/prebuilt/inc/sospriv.h
+++ b/src/pal/prebuilt/inc/sospriv.h
@@ -680,7 +680,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetAppDomainName(
CLRDATA_ADDRESS addr,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDomainFromContext(
@@ -701,7 +701,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetAssemblyName(
CLRDATA_ADDRESS assembly,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetModule(
@@ -758,7 +758,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetMethodDescName(
CLRDATA_ADDRESS methodDesc,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromFrame(
@@ -812,19 +812,19 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetObjectStringData(
CLRDATA_ADDRESS obj,
unsigned int count,
- wchar_t *stringData,
+ WCHAR *stringData,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetObjectClassName(
CLRDATA_ADDRESS obj,
unsigned int count,
- wchar_t *className,
+ WCHAR *className,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMethodTableName(
CLRDATA_ADDRESS mt,
unsigned int count,
- wchar_t *mtName,
+ WCHAR *mtName,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMethodTableData(
@@ -855,7 +855,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetFrameName(
CLRDATA_ADDRESS vtable,
unsigned int count,
- wchar_t *frameName,
+ WCHAR *frameName,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetPEFileBase(
@@ -865,7 +865,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetPEFileName(
CLRDATA_ADDRESS addr,
unsigned int count,
- wchar_t *fileName,
+ WCHAR *fileName,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetGCHeapData(
@@ -1012,7 +1012,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetRegisterName(
/* [in] */ int regName,
/* [in] */ unsigned int count,
- /* [out] */ wchar_t *buffer,
+ /* [out] */ WCHAR *buffer,
/* [out] */ unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetThreadAllocData(
@@ -1033,25 +1033,25 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetPrivateBinPaths(
CLRDATA_ADDRESS appDomain,
int count,
- wchar_t *paths,
+ WCHAR *paths,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation(
CLRDATA_ADDRESS assembly,
int count,
- wchar_t *location,
+ WCHAR *location,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetAppDomainConfigFile(
CLRDATA_ADDRESS appDomain,
int count,
- wchar_t *configFile,
+ WCHAR *configFile,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetApplicationBase(
CLRDATA_ADDRESS appDomain,
int count,
- wchar_t *base,
+ WCHAR *base,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyData(
@@ -1062,13 +1062,13 @@ EXTERN_C const IID IID_ISOSDacInterface;
virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyLocation(
CLRDATA_ADDRESS assesmbly,
unsigned int count,
- wchar_t *location,
+ WCHAR *location,
unsigned int *pNeeded) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyDisplayName(
CLRDATA_ADDRESS assembly,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded) = 0;
};
@@ -1115,7 +1115,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS addr,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetDomainFromContext )(
@@ -1140,7 +1140,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS assembly,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetModule )(
@@ -1208,7 +1208,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS methodDesc,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetMethodDescPtrFromFrame )(
@@ -1274,21 +1274,21 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS obj,
unsigned int count,
- wchar_t *stringData,
+ WCHAR *stringData,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetObjectClassName )(
ISOSDacInterface * This,
CLRDATA_ADDRESS obj,
unsigned int count,
- wchar_t *className,
+ WCHAR *className,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetMethodTableName )(
ISOSDacInterface * This,
CLRDATA_ADDRESS mt,
unsigned int count,
- wchar_t *mtName,
+ WCHAR *mtName,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetMethodTableData )(
@@ -1326,7 +1326,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS vtable,
unsigned int count,
- wchar_t *frameName,
+ WCHAR *frameName,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetPEFileBase )(
@@ -1338,7 +1338,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS addr,
unsigned int count,
- wchar_t *fileName,
+ WCHAR *fileName,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetGCHeapData )(
@@ -1520,7 +1520,7 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
/* [in] */ int regName,
/* [in] */ unsigned int count,
- /* [out] */ wchar_t *buffer,
+ /* [out] */ WCHAR *buffer,
/* [out] */ unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetThreadAllocData )(
@@ -1545,28 +1545,28 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS appDomain,
int count,
- wchar_t *paths,
+ WCHAR *paths,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetAssemblyLocation )(
ISOSDacInterface * This,
CLRDATA_ADDRESS assembly,
int count,
- wchar_t *location,
+ WCHAR *location,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetAppDomainConfigFile )(
ISOSDacInterface * This,
CLRDATA_ADDRESS appDomain,
int count,
- wchar_t *configFile,
+ WCHAR *configFile,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetApplicationBase )(
ISOSDacInterface * This,
CLRDATA_ADDRESS appDomain,
int count,
- wchar_t *base,
+ WCHAR *base,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyData )(
@@ -1579,14 +1579,14 @@ EXTERN_C const IID IID_ISOSDacInterface;
ISOSDacInterface * This,
CLRDATA_ADDRESS assesmbly,
unsigned int count,
- wchar_t *location,
+ WCHAR *location,
unsigned int *pNeeded);
HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyDisplayName )(
ISOSDacInterface * This,
CLRDATA_ADDRESS assembly,
unsigned int count,
- wchar_t *name,
+ WCHAR *name,
unsigned int *pNeeded);
END_INTERFACE
diff --git a/src/pal/src/cruntime/silent_printf.cpp b/src/pal/src/cruntime/silent_printf.cpp
index d45081042b..09de2a6088 100644
--- a/src/pal/src/cruntime/silent_printf.cpp
+++ b/src/pal/src/cruntime/silent_printf.cpp
@@ -26,6 +26,7 @@ Revision History:
#include "pal/palinternal.h"
#include "pal/cruntime.h"
#include "pal/locale.h"
+#include "pal/printfcpp.hpp"
/* clip strings (%s, %S) at this number of characters */
#define MAX_STR_LEN 300