Skip to content

Assertions are no longer logged or detected in the default scenario #326

Open
@tannergooding

Description

@tannergooding

Issue

The assertion detecting logic in PMIDriver (

if (idx == -1)
{
//File.WriteAllText(pi.assemblyName + ".prepall", szOutput);
idx = szOutput.IndexOf("]): Assertion failed '");
if (idx != -1)
{
temp.assert = true;
//Assert failure(PID 440 [0x000001b8], Thread: 3220 [0xc94]): Assertion failed 'genActualType(tree->gtType) == TYP_INT || genActualType(tree->gtType) == TYP_I_IMPL || genActualType(tree->gtType) == TYP_REF || tree->gtType == TYP_BYREF' in 'ELP.Program:Main(ref):int'
//File: c:\dd\arm_1\src\ndp\clr\src\jit\il\codegen.cpp, Line: 945 Image:
int idx2 = szOutput.IndexOf("Image:", idx);
string szTemp = szOutput.Substring(idx, idx2 - idx);
//]): Assertion failed 'genActualType(tree->gtType) == TYP_INT || genActualType(tree->gtType) == TYP_I_IMPL || genActualType(tree->gtType) == TYP_REF || tree->gtType == TYP_BYREF' in 'ELP.Program:Main(ref):int'
//File: c:\dd\arm_1\src\ndp\clr\src\jit\il\codegen.cpp, Line: 945 Image:
string[] szTemp2 = szTemp.Split('\'');
temp.errorMessage = szTemp2[1];
temp.errorDetail = szTemp2[3];
temp.assemblyName = pi.assemblyName;
}
else
{
idx = szOutput.IndexOf("Assert failure(PID ");
if (idx != -1)
{
temp.assert = true;
//Assert failure(PID 12020 [0x00002ef4], Thread: 13276 [0x33dc]): (entry == NULL) || (entry == GetSlot(numGenericArgs,i)) || IsCompilationProcess()
//CLR! Dictionary::PrepopulateDictionary + 0x135 (0x603435b8)
//CLR! MethodCallGraphPreparer::PrepareMethods + 0x24B (0x602e7e45)
//CLR! MethodCallGraphPreparer::Run + 0x45E (0x602e7308)
//CLR! PrepareMethodDesc + 0x11B (0x602e9559)
//CLR! ReflectionInvocation::PrepareMethod + 0x596 (0x60494ac0)
//MSCORLIB.NI! <no symbol> + 0x0 (0x5e4aff9d)
//<no module>! <no symbol> + 0x0 (0x005821b7)
//CLR! CallDescrWorkerInternal + 0x34 (0x5fddcb2d)
//CLR! CallDescrWorker + 0xD5 (0x600da980)
//CLR! CallDescrWorkerWithHandler + 0x1B9 (0x600daba1)
// File: c:\clr2\src\ndp\clr\src\vm\genericdict.cpp, Line: 933 Image:
//c:\pmi\pmi.exe
idx = szOutput.IndexOf("]): ", idx);
int idx2 = szOutput.IndexOf("\r\n", idx);
string szTemp = szOutput.Substring(idx + 4, idx2 - idx - 4);
//(entry == NULL) || (entry == GetSlot(numGenericArgs,i)) || IsCompilationProcess()
temp.errorMessage = szTemp;
//temp.errorDetail = szTemp2[3];
temp.assemblyName = pi.assemblyName;
}
else
{
Console.WriteLine("Failed PREPALL on {0}", pi.assemblyName);
temp.errorMessage = "General error, no assert seen.";
}
}
}
) is no longer correct for what the JIT currently outputs.

Additionally, due to other changes in the JIT, assertions are never logged in the default scenario.

Repro

  1. Clone dotnet/runtime
  2. Build the repo in all required configurations
  3. Clone dotnet/jitutils
  4. Build the repo using .\bootstrap.cmd
  5. In the dotnet/runtime root, run jit-diff.bat diff --diff --pmi

Observe that the command fails due to dotnet/runtime#51728. However, System.Private.Corelib.err reports: General error, no assert seen.

Analysis

assertAbort (https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/error.cpp#L277-L323) currently fails to log anything because COMPlus_JitFuncInfoLogFile is not set and because the default CoreCLR.dll (VM) for the PMI diffs is release which means CEEInfo::doAssert does not actually print anything: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/jitinterface.cpp#L10897-L10925

Additionally, even if the assertions are printed, they currently resemble:

Encoding:GetCharsWithFallback(long,int,long,int,int,int):int:this - Assertion failed (C:\Users\tagoo\Source\repos\runtime_base\src\coreclr\jit\emitxarch.cpp:11739 - ((regMask & emitThisGCrefRegs) && (ins == INS_add)) || ((regMask & emitThisByrefRegs) && (ins == INS_add || ins == INS_sub))) during Emit code

While the PMIDriver is currently looking for ]): Assertion failed ' and Assert failure(PID , neither of which are used by this failure path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions