goldshtn / msos

Command-line environment a-la WinDbg for executing SOS commands without having SOS available.
Other
96 stars 21 forks source link

Disassemble command improvements #71

Closed adamsitnik closed 7 years ago

adamsitnik commented 7 years ago

Hi!

I have been using part of the code of msos to display the disassembly code for BenchmarkDotNet and I have realized, that always the last line of source code was printed.

The bug fix was trivial: when you find smaller distance, set the current distance to it. So far the value of distance was always int.Max, so the value of if (dist < distance) was always true, so the loop was going to the end, and returning the last line.

I also added more defensive way of looking for the source lines in the file, which can handle "nop" (clrmd reports some another magic number for it)

image

I implemented the support for printing epilogue. It looks like always the first element of method.ILOffsetMap with ILOffset == -2 is prolog, and the last one with ILOffset == -3 is epilogue.

goldshtn commented 7 years ago

Very cool; thanks for this!