I'm a relative newcomer to WinDbg. I'm trying to use it to debug the mscorlib source code in CoreCLR, but I seem to be having some problems getting SOS to highlight the source line for C# code (like WinDbg does for C/C++ code).
Here are the steps I've taken so far (I'm trying to debug the string.IndexOf(char, int, int)
function here):
0. Clone CoreCLR and build the repo, via build skiptests release
Open WinDbg and run
corerun MyNetCoreApp.exe
- Symbol files will be in
coreclr\bin\Product\Windows_NT.x64.Release\PDB
- Symbol files will be in
bp /1 coreclr!EEStartup ".loadby sos coreclr"
to break at theEEStartup
and load the SOS extensionbp /1 @$ra; g
to set a breakpoint at the end of theEEStartup
method and run, by which everything should be initialized/mscorlib will be loaded and the SOS commands will work!name2ee System_Private_CoreLib_ni!System.String
1 to get the EEClass address,!dumpclass
to reveal the MethodTable address, and!dumpmt -md
to list all of the methods in String along with their addresses.!bpmd -md 00007ffd7d039618
(the MethodDesc of the method) to set a breakpoint at the start
Unfortunately, when I hit the managed breakpoint, it looks like WinDbg doesn't immediately open the file for me, or highlight the breakpoint, like it does with C/C++. Even when I open the file in the editor via .open
and navigate to it, nothing is highlighted. I think WinDbg should be picking up on the PDB symbols, since when I do a lm
, System_Private_CoreLib_ni
1 is listed as one of the modules with (pdb symbols)
next to it.
Perhaps I gave a bit more info than necessary for the sake of a repro, but is it possible to highlight the breakpoints in the source file with managed code/SOS and WinDbg? Thanks.
1 mscorlib has recently been renamed to System.Private.CoreLib in .NET Core. ni is the pre-jitted native image assembly.