Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed PDB file for a few runtime tests on Mono AOT after ilasm bump #46124

Closed
akoeplinger opened this issue Dec 16, 2020 · 7 comments · Fixed by #46250, #46258 or #46289
Closed

Malformed PDB file for a few runtime tests on Mono AOT after ilasm bump #46124

akoeplinger opened this issue Dec 16, 2020 · 7 comments · Fixed by #46250, #46258 or #46289
Labels
area-ILTools-coreclr disabled-test The test is disabled in source code against the issue untriaged New issue has not been triaged by the area owner

Comments

@akoeplinger
Copy link
Member

After the ilasm bump in #45387 a few runtime tests abort on Mono when AOTing with the following message:

 Mono Ahead of Time compiler - compiling assembly /__w/1/s/artifacts/tests/coreclr/Linux.x64.Release/JIT/Generics/ConstrainedCall/vt2_il_r/vt2_il_r.dll
  AOTID 09753CD7-3621-A83E-77F7-915CEF440934
  Method idx 10 is greater than number of rows (10) in PPDB MethodDebugInformation table, for method test:.ctor in '/__w/1/s/artifacts/tests/coreclr/Linux.x64.Release/JIT/Generics/ConstrainedCall/vt2_il_r/vt2_il_r.pdb'. Likely a malformed PDB file.

Affected tests:

JIT/Generics/ConstrainedCall/vt2_il_r/vt2_il_r.dll
JIT/Generics/ConstrainedCall/vt2_il_d/vt2_il_d.dll
JIT/Methodical/Boxing/callconv/_dbginstance_il/_dbginstance_il.dll
JIT/Methodical/Boxing/callconv/_relinstance_il/_relinstance_il.dll
JIT/Methodical/casts/iface/_il_reliface2/_il_reliface2.dll
JIT/Methodical/casts/iface/_il_dbgiface2/_il_dbgiface2.dll
JIT/Methodical/nonvirtualcall/tailcall_r/tailcall_r.dll
JIT/Methodical/nonvirtualcall/tailcall_d/tailcall_d.dll
JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b415164/b415164/b415164.dll
Loader/classloader/MethodImpl/generics_override1/generics_override1.dll

@jkotas would you mind checking whether these PDBs are really malformed or if it is a mono issue?

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Dec 16, 2020
@jkotas
Copy link
Member

jkotas commented Dec 16, 2020

Yes, these PDBs are corrupted.

I have used the Pdb2Xml tool from https://github.com/dotnet/symreader-converter to verify it.

For example, the dump for vt2 test above includes:

    <method containingType="test" name="Main">
      <sequencePoints>
        <entry offset="0x0" startLine="282" startColumn="1" endLine="282" endColumn="2" document="1" />
        <entry offset="0x1" startLine="283" startColumn="1" endLine="283" endColumn="2" document="1" />
        <entry offset="0x6" startLine="284" startColumn="1" endLine="284" endColumn="2" document="1" />
      </sequencePoints>
      <scope startOffset="0x0" endOffset="0xda">
        <local name="V_0" il_index="0" il_start="0x0" il_end="0xda" attributes="0" />
        <local name="V_1" il_index="1" il_start="0x0" il_end="0xda" attributes="0" />
        <local name="V_2" il_index="2" il_start="0x0" il_end="0xda" attributes="0" />
      </scope>
    </method>

However, the Main method is not at lines 282-284 in the sources. The actual method at lines 282-284 in the sources is test::.ctor.

@jkotas
Copy link
Member

jkotas commented Dec 16, 2020

@ivanpovazan Are you interested in this bug?

ViktorHofer pushed a commit that referenced this issue Dec 16, 2020
* Update dependencies from https://github.com/dotnet/runtime build 20201130.7

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20580.7

* Update dependencies from https://github.com/dotnet/runtime build 20201201.3

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20601.3

* Replace obsoleted json serializer option

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.'

* Update dependencies from https://github.com/dotnet/runtime build 20201202.2

runtime.native.System.IO.Ports , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NETCore.ILAsm , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20602.2

* Update dependencies from https://github.com/dotnet/runtime build 20201203.3

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20603.3

* Use PDFMT=PORTABLE option for ilproj

* Update dependencies from https://github.com/dotnet/runtime build 20201203.13

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20603.13

* Update dependencies from https://github.com/dotnet/runtime build 20201204.10

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20604.10

* Update dependencies from https://github.com/dotnet/runtime build 20201205.2

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20605.2

* Update dependencies from https://github.com/dotnet/runtime build 20201206.6

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20606.6

* Update dependencies from https://github.com/dotnet/runtime build 20201208.2

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20608.2

* Update dependencies from https://github.com/dotnet/runtime build 20201209.2

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20609.2

* Update dependencies from https://github.com/dotnet/runtime build 20201209.15

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20609.15

* Add workaround for #45908

* Update dependencies from https://github.com/dotnet/runtime build 20201211.2

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20611.2

* Update dependencies from https://github.com/dotnet/runtime build 20201211.23

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20611.23

* Update dependencies from https://github.com/dotnet/runtime build 20201212.4

runtime.native.System.IO.Ports , Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHost , System.Text.Json
 From Version 5.0.0-alpha.1.19563.3 -> To Version 6.0.0-alpha.1.20612.4

* Update versions

* Remove PDBFMT option

* Apply ilasm .locals workaround for more files

See #45908

* Revert "Apply ilasm .locals workaround for more files"

This reverts commit 54eb3ee.

* Revert "Add workaround for #45908"

This reverts commit 2906310.

* Update versions

* Disable tests that fail on Mono due to #46124

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@ivanpovazan
Copy link
Member

@jkotas Sure, I can take a look later today

ivanpovazan pushed a commit to ivanpovazan/runtime that referenced this issue Dec 19, 2020
…thodDebugInformation tables have the same number of rows (dotnet#46124)
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Dec 19, 2020
jkotas pushed a commit that referenced this issue Dec 20, 2020
…thods (#46250)

* Fix malformed portable PDB generation for methods with empty body (#46124)

* Adding a test case for ilasm which verifies that the MethodDef and MethodDebugInformation tables have the same number of rows (#46124)
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Dec 20, 2020
@jkotas
Copy link
Member

jkotas commented Dec 20, 2020

Keeping this open to re-enable disabled test once the ilasm is updated in the toolset.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Dec 20, 2020
@jkotas jkotas reopened this Dec 20, 2020
@jkotas jkotas added the disabled-test The test is disabled in source code against the issue label Dec 20, 2020
@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Dec 20, 2020
@jkotas
Copy link
Member

jkotas commented Dec 20, 2020

@ivanpovazan Unfortunately, the fix does not seem to be complete. Would you mind taking another look?

Here is how you can reproduce the problem (substitute ... with paths on your system):

git clone https://github.com/dotnet/symreader-converter
cd  symreader-converter
rem This will build pdb2xml tool used below
build.cmd

rem run this in dotnet/runtime clone
cd src\tests\JIT\Generics\ConstrainedCall
...\ilasm /DEBUG vt2.il
...\symreader-converter\artifacts\bin\Pdb2Xml\Debug\net472\Pdb2Xml.exe vt2.exe

The Pdb2Xml.exe tool will fail with Invalid compressed integer. error. The problem happens at this callstack:

System_Reflection_Metadata!System.Reflection.Throw.InvalidCompressedInteger()+0x48 [/_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Throw.cs @ 222] 
System_Reflection_Metadata!System.Reflection.Metadata.BlobReader.ReadCompressedInteger()+0x19 [/_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs @ 484] 
System_Reflection_Metadata!System.Reflection.Metadata.SequencePointCollection+Enumerator.MoveNext()+0x70 [/_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/SequencePointCollection.cs @ 60] 

@ivanpovazan
Copy link
Member

@jkotas ah too bad.. I will take a look tomorrow.
Thanks for the explanation of how to reproduce the problem.

@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Dec 20, 2020
@jkotas jkotas reopened this Dec 20, 2020
ivanpovazan pushed a commit to ivanpovazan/runtime that referenced this issue Dec 21, 2020
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Dec 21, 2020
jkotas pushed a commit that referenced this issue Dec 21, 2020
…ds (#46124) (#46289)

Co-authored-by: Ivan Povazan <ivan@raincode.com>
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Dec 21, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ILTools-coreclr disabled-test The test is disabled in source code against the issue untriaged New issue has not been triaged by the area owner
Projects
None yet
4 participants