Skip to content

Commit

Permalink
Fallback to the callconv(*) format in ILDasm
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronRobinsonMSFT committed Jul 2, 2020
1 parent 5b0b0f2 commit 56ad025
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
10 changes: 0 additions & 10 deletions src/coreclr/src/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3475,20 +3475,10 @@ BOOL DumpMethod(mdToken FuncToken, const char *pszClassName, DWORD dwEntryPointT
bool bRet = FALSE;

PAL_CPP_TRY {
if((*pComSig & IMAGE_CEE_CS_CALLCONV_MASK) > IMAGE_CEE_CS_CALLCONV_VARARG
&& (*pComSig & IMAGE_CEE_CS_CALLCONV_MASK) != IMAGE_CEE_CS_CALLCONV_UNMANAGED)
{
sprintf_s(szString,SZSTRING_SIZE,"%sERROR: signature of method '%s' has invalid calling convention 0x%2.2X",g_szAsmCodeIndent,pszMemberName,*pComSig);
printError(GUICookie,ERRORMSG(szString));
bRet = TRUE;
goto lDone;
}

g_tkMVarOwner = FuncToken;
szString[0] = 0;
DumpGenericPars(szString,FuncToken); //,NULL,FALSE);
pszMemberSig = PrettyPrintSig(pComSig, cComSig, szString, &qbMemberSig, g_pImport,NULL);
lDone: ;
} PAL_CPP_CATCH_ALL {
printError(GUICookie,"INVALID DATA ADDRESS");
bRet = TRUE;
Expand Down
30 changes: 24 additions & 6 deletions src/coreclr/src/inc/formattype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,37 @@ PCCOR_SIGNATURE PrettyPrintSignature(
}
else
{
static const char* const callConvNames[10] = {
const char* const callConvUndefined = (const char*)-1;
static const char* const callConvNames[16] = {
"",
"unmanaged cdecl ",
"unmanaged stdcall ",
"unmanaged thiscall ",
"unmanaged fastcall ",
"vararg ",
"<error> ", // field
"<error> ", // local sig
"<error> ", // property
"unmanaged "
callConvUndefined, // field
callConvUndefined, // local sig
callConvUndefined, // property
"unmanaged ",
callConvUndefined,
callConvUndefined,
callConvUndefined,
callConvUndefined,
callConvUndefined,
callConvUndefined
};
appendStr(out, KEYWORD(callConvNames[callConv & 0xf]));
static_assert_no_msg(COUNTOF(callConvNames) == (IMAGE_CEE_CS_CALLCONV_MASK + 1));

char tmp[32];
unsigned callConvIdx = callConv & IMAGE_CEE_CS_CALLCONV_MASK;
const char* name_cc = callConvNames[callConvIdx];
if (name_cc == callConvUndefined)
{
sprintf_s(tmp, COUNTOF(tmp), "callconv(%u) ", callConvIdx);
name_cc = tmp;
}

appendStr(out, KEYWORD(name_cc));
}

if (callConv & IMAGE_CEE_CS_CALLCONV_GENERIC)
Expand Down

0 comments on commit 56ad025

Please sign in to comment.