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

Question: Locally built runtime & getting JitDisasm #342

Closed
yahorsi opened this issue Nov 27, 2019 · 10 comments
Closed

Question: Locally built runtime & getting JitDisasm #342

yahorsi opened this issue Nov 27, 2019 · 10 comments
Labels
area-Infrastructure-libraries untriaged New issue has not been triaged by the area owner

Comments

@yahorsi
Copy link

yahorsi commented Nov 27, 2019

Hi Guys,

Today I decided to get my hands dirty, I cloned dotnet/runtime and successfully compiled (the only problem I got is with "DIA SDK" ).

As the next step, I wanted to get disasm generated by Jit for the very simple console app.
I found instruction in the old coreclr repo (https://github.com/dotnet/coreclr/blob/master/Documentation/building/viewing-jit-dumps.md)

Doc seems a bit outdated and not clear in some places.
E.g.

# Windows
robocopy /e <coreclr path>\bin\Product\Windows_NT.<arch>.Release <app root>\bin\Release\netcoreapp3.0\<rid>\publish > NUL
copy /y <coreclr path>\bin\Product\Windows_NT.<arch>.Debug\clrjit.dll <app root>\bin\Release\netcoreapp3.0\<rid>\publish > NUL

So, 2 copy commands
1st states I need to copy from the Windows_NT..Release to the publish folder --- Is that correct? I mean should it be really release folder? As I understand when I run build.cmd by default I get just debug build. If it is correct how could I compile in the release and debug modes?

2ns states to copy just clrjit.dll, without it PBD's to the publish folder, again Is that correct?

What I did is that after I just copied all from

...\runtime\artifacts\bin\runtime\netcoreapp-Windows_NT-Debug-x64 

to the my app \publish folder. The app seems to be OK and starts, the only problem is that I do not see anything dumped in my stdout. As I said the app is a console app and compiled as Exe, so to run it I have created simple CMD file like

dotnet publish -c Release -r win-x64
copy C:\Dev\.NET\runtime\artifacts\bin\runtime\netcoreapp-Windows_NT-Debug-x64\* Bin\Release\netcoreapp3.0\win-x64\Publish\*
set COMPlus_JitDump=Main
set COMPlus_JitDisasm=Main
SET COMPLUS_LogEnable=1
SET COMPLUS_LogToFile=1
SET COMPLUS_LogFacility=02000000
SET COMPLUS_LogLevel=A

Bin\Release\netcoreapp3.0\win-x64\Publish\InterfaceCalls.exe

Thank you for your help

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Nov 27, 2019
@yahorsi yahorsi changed the title Question: Local built runtime & getting JitDisasm Question: Locally built runtime & getting JitDisasm Nov 27, 2019
@Symbai
Copy link

Symbai commented Nov 27, 2019

If you want to get the dism of the jit I would recommend using JitDasm. It is easy to use and give nice results by showing not only the dism but also per C# line of code: https://github.com/0xd4d/JitDasm

If that is not an option for you please ignore my message.

@huoyaoyuan
Copy link
Member

Another useful tool designed for coreclr developer is https://github.com/EgorBo/Disasmo .
Tools needs some time to be up to date with the new repo layout.

@yahorsi
Copy link
Author

yahorsi commented Nov 27, 2019

In my case I would ideally want to get disasm directly from the Jit

@4creators
Copy link
Contributor

@yahorsi
Copy link
Author

yahorsi commented Nov 27, 2019

@yahorsi You can use the following instructions to get it done https://github.com/dotnet/runtime/blob/fd9969e88819b26fe7efae70b817b10d11469d56/docs/workflow/testing/viewing-jit-dumps.md

Thank you, I used the same instruction but from the coreclr repo and it didn't work for me. I then highlighted some questions in the initial post. E.g., the instruction says to copy from the Release build and then from the debug build - is that correct? And 1st path to copy from does not look correct, at least for the runtime repo

# Windows
robocopy /e <runtime-repo path>\artifacts\bin\coreclr\Windows_NT.<arch>.Release <app root>\bin\Release\netcoreapp5.0\<rid>\publish > NUL
copy /y <runtime-repo path>\artifacts\bin\coreclr\Windows_NT.<arch>.Debug\clrjit.dll <app root>\bin\Release\netcoreapp5.0\<rid>\publish > NUL

@mikedn
Copy link
Contributor

mikedn commented Nov 27, 2019

the instruction says to copy from the Release build and then from the debug build - is that correct

Yes, though I would use the checked and not the debug build. It's rare for the extra checks that the debug build may have to be useful and it can be very slow in some case because it is compiled with optimizations disabled. In any case, the idea is that the release JIT build does not have the disassembler code built in so you need the JIT from a debug or checked build. And it has to be the same version as the runtime so you usually need to copy the runtime as well, the one published with the app may be incompatible with the locally built JIT. I don't think the runtime you copy must be a release build, debug/checked should work too.

And 1st path to copy from does not look correct, at least for the runtime repo

What exactly is incorrect? Seems fine to me but FWIW I never paid attention to this doc as I prefer to just use corerun instead of bothering with the dotnet bloat.

@ViktorHofer
Copy link
Member

It would be great if somebody could update the instructions in the doc. I'm sure it's outdated, the docs are currently in a messy state.

@maryamariyan
Copy link
Member

Related to: #304

@ViktorHofer
Copy link
Member

@yahorsi are you still blocked by this or can we close the issue now? The docs should be updated by now.

@yahorsi
Copy link
Author

yahorsi commented Apr 17, 2020

@ViktorHofer Please close. Thank you

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-libraries untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

8 participants