Repository navigation
Fix managed PE image mapping under LLDB - #6039
Conversation
b7c4284 to
567aea9
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Add the requested LLDB managed-module regression test.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Scopes LLDB’s PE-probing exclusion to debugger-service modules, allowing managed modules to use image mapping while preserving native handling.
Changes:
- Adds configurable PE probing to
ModuleService. - Disables probing only for LLDB debugger-service modules.
- Preserves native ELF/Mach-O behavior.
File summaries
| File | Reviewed change |
|---|---|
src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs |
Applies the LLDB-specific exclusion; add regression coverage for managed-module probing. |
src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs |
Adds the configurable PE-probing capability. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
While this solves the issue for ImageMappingMemoryService, MetadataMappingMemoryService still has it: its _moduleService is a ModuleServiceFromDebuggerServices, which still reports !IsPEModuleProbeSupported, so GetMetaData() returns empty. It's silly, because the _memoryService it wraps is the mapping one and would be able to succeed. In practice the fallback hides most of this - ReadMemory delegates to _memoryService after the region walk, so when lldb fails or short-reads, the image mapper handles it. What's left is the case the metadata class was written for: lldb returning successful all-zero reads for memory that isn't in the dump. There bytesRequested == bytesRead, so ImageMappingMemoryService never consults its module cache and the zeros propagate to the caller. The metadata service is the only layer that can intercept that, and it's still disabled. This can't be expressed through the class hierarchy, because at the ModuleServiceFromDebuggerServices level there are callers that can succeed here and callers that can't - the same instance produces both lldb-enumerated native modules and ClrMD-sourced managed PEs from CreateModule(-1, ClrModule). The gate should live on module creation (a CreateModule overload, or a flag on ModuleFromAddress) so it follows where the module came from rather than which service built it. |
Co-authored-by: Copilot <[email protected]> Copilot-Session: b013d849-0633-4b39-87ad-36002a21ae4f
Co-authored-by: Copilot <[email protected]> Copilot-Session: b013d849-0633-4b39-87ad-36002a21ae4f
Updated gate to live on the |
5613877 to
8ef7c76
Compare
hoyosjs
left a comment
There was a problem hiding this comment.
In concept looks good now:
- I think we shouldn't drop the comment, it gives good context (the
None of the modules that lldb (on either Linux/MacOS) provides are PEs) - I don't know if
MemoryDumper_MapsOmittedManagedModuleDataruns against lldb?
|
Co-authored-by: Copilot <[email protected]> Copilot-Session: b013d849-0633-4b39-87ad-36002a21ae4f
|
/ba-g CI passed before doc only change |
Summary
Linux Heap core dumps can omit file-backed pages from managed PE images. Under LLDB,
ImageMappingMemoryServiceenumerates managed modules through ClrMD, but the host-wide LLDB exclusion prevented those modules from being probed as PE images. This moves the exclusion toModuleServiceFromDebuggerServices, where the original assumption applies.Validation
Build.cmdMicrosoft.Diagnostics.DebugServices.UnitTests: 43 passed, excluding two pre-existingClrmaTeststheory-data failures