Create SOS SymbolReader managed project and change SOS to use it. #6783
|
@adityamandaleeka @noahfalk this is the new PR for the SOS work. It address the previous code review feedback and moves the managed code from the corefx/runtime assembly to a new project in the coreclr repo. Could you guys take a look again? |
|
/cc @tmat |
|
@dotnet-bot test FreeBSD x64 Checked Build |
| + methodToken = 0; | ||
| + ilOffset = 0; | ||
| + | ||
| + GCHandle gch = GCHandle.FromIntPtr(symbolReaderHandle); | ||
| + MetadataReader reader = ((OpenedReader)gch.Target).Reader; | ||
| + | ||
| + try | ||
| + { | ||
| + foreach (MethodDebugInformationHandle methodDebugInformationHandle in reader.MethodDebugInformation) | ||
| + { | ||
| + MethodDebugInformation methodDebugInfo = reader.GetMethodDebugInformation(methodDebugInformationHandle); | ||
| + SequencePointCollection sequencePoints = methodDebugInfo.GetSequencePoints(); | ||
| + foreach (SequencePoint point in sequencePoints) | ||
| + { | ||
| + string sourceName = reader.GetString(reader.GetDocument(point.Document).Name); | ||
| + if (Path.GetFileName(sourceName) == Path.GetFileName(fileName) && point.StartLine == lineNumber) |
|
tmat
Perhaps hoist
adityamandaleeka
Would it make sense to do the line number check before the filename check since it should be cheaper and the chances of a collision would probably be lower? BTW, I may be off base here, but if we see that one sequence point in a methodDebugInfo has a filename that doesn't match what we're looking for, do we need to go through the remaining sequence points in that methodDebugInfo?
mikem8361
I’ll check the line number first. I don’t know if we should assume that every sequence point in a method will be in the same source file even though that make sense on the surface. |
| + localVarName = reader.GetString(localVar.Name); | ||
| + return true; | ||
| + } | ||
| + } | ||
| + } | ||
| + } | ||
| + catch | ||
| + { | ||
| + } | ||
| + return false; | ||
| + } | ||
| + | ||
| + /// <summary> | ||
| + /// Returns source name, line numbers and IL offsets for given method token. | ||
| + /// </summary> | ||
| + /// <param name="assemblyPath">file name of the assembly</param> |
|
|
The portable PDB helper code for SOS source/line support has been moved from
System.Diagnostics.Debug.SymbolReader to a new managed SOS project in the coreclr
repo called SOS.NETCore.
The public APIs have now been made internal.
Plumb through the loaded PE address to the managed SymbolReader functions so it can be used as a key.
Fixed a stack trashing/overflow when a unresolved managed breakpoint is resolved because one of the
module name buffers was too small (MAX_PATH_FNAME). Changed it (and others) to MAXLONGPATH.
SOS now works with Portable PDBs on Windows.
New dac private get module data request. Used to get the necessary info for portable PDBs.
SOS now supports in-memory PE's on xplat and Windows. Needed to get and plumb though the in-memory
PE layout where it is file based or loaded.
Better Windows GetLineByILOffset support. Uses the SymbolReader and now works with in-memory PEs.
Misc code formatting and general cleanup.