Repository navigation
Make TryGetSymbol cross-os - #135734
Merged
Merged
Make TryGetSymbol cross-os#135734
Conversation
Compile PE, ELF, and Mach-O readers together and select the existing decoder in a separate TryGetSymbol multiplexer. Add the matching ICorDebugDataTarget5 interface used by diagnostics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 48661cdb-9269-437f-86fa-da4ae6de5b8e
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Guard the image readers for Windows, Linux, and macOS, excluding WASM. Return false for symbol lookup on other hosts while retaining shared dbgutil helpers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 48661cdb-9269-437f-86fa-da4ae6de5b8e
rcj1
marked this pull request as ready for review
October 14, 2026 04:20
This was referenced Oct 14, 2026
Closed
steveisok
self-requested a review
October 19, 2026 17:05
steveisok
approved these changes
Oct 19, 2026
Member
|
What is this change needed for? |
Contributor
Author
This is needed in the case that we enter here inspecting a dump, and the target and host OS are different. |
Member
|
@rcj1 sorry I didn't get to this before merging. A few things:
|
steveisok
added a commit
that referenced
this pull request
Oct 23, 2026
## Summary #135734 ("Make TryGetSymbol cross-os") moved `TryGetSymbol` into `src/coreclr/debug/dbgutil/symbol.cpp`. The new dispatcher and the Mach-O and ELF readers are compiled only under ```c #if !defined(HOST_WASM) && (defined(HOST_WINDOWS) || defined(HOST_OSX) || defined(__linux__)) ``` and `dbgutil/CMakeLists.txt` adds the in-tree `inc/llvm` include directory (for `ELF.h`) only for `CLR_CMAKE_HOST_WIN32 OR CLR_CMAKE_HOST_OSX`. Apple mobile hosts (iOS, tvOS, Mac Catalyst) define `HOST_APPLE`, plus `HOST_IOS`, `HOST_TVOS` or `HOST_MACCATALYST`, but **not** `HOST_OSX` (`eng/native/configurecompiler.cmake`). On those hosts `TryGetSymbol` compiles to `return false`. Before #135734, `machoreader.cpp` (with `TryGetSymbol`) was built for every `CLR_CMAKE_TARGET_APPLE`. Consequences for in-app debugging on Apple mobile, where the DBI and DAC run in the app process: - The DAC's `GetDacTableAddress` can't find the DAC table export. `CordbProcess::Init` → `CreateDacDbiInterface` fails with `CORDBG_E_MISSING_DEBUGGER_EXPORTS` (`0x80131C4F`), so `DebugActiveProcess` fails and no debugger events are ever raised. `Debugger.Break()` is a no-op, and the debugger UI shows nothing. The HRESULT isn't surfaced to the user by the IDE. - The DBI and DAC lookups of `DotNetRuntimeContractDescriptor` (`di/process.cpp`, `daccess.cpp`, `enummem.cpp`) also fail, so the cDAC can't be located either. ## Change Use `HOST_APPLE` instead of `HOST_OSX`: - in the reader guards: `symbol.cpp` (×2), `machoreader.cpp`, `elfreader.cpp`; - for the `inc/llvm` include directory in `dbgutil/CMakeLists.txt`. Without it, `elfreader.h`'s `#include <ELF.h>` (already chosen for `HOST_APPLE`) fails to compile once the guards are widened. 5 lines across 4 files; no behavior change for Windows, Linux or macOS hosts. **Alternative for reviewers:** a broader guard such as `!defined(HOST_WASM) && (defined(HOST_WINDOWS) || defined(HOST_UNIX))` would also cover non-Linux Unix hosts (for example FreeBSD and Haiku), which today also hit the `return false` fallback for the contract-descriptor lookup. That would need the include directory and `elfreader.h`'s `<ELF.h>` vs `<elf.h>` selection checked for those hosts. This PR keeps the minimal Apple-only change. ## Validation - iOS Simulator (iossimulator-arm64, Xcode 27): - built with `./build.sh clr+clr.runtime+libs+packs -os iossimulator -arch arm64 -cross -c Release`, with `-cmakeargs "-DCMAKE_CXX_FLAGS=-Wno-error=#warnings"`. That argument is an unrelated local workaround for Xcode 27's libc++ `#warning` about the 13.0 minimum under main's `-Werror`. - The DAC now contains the Mach-O reader (`TryGetMachOSymbol`). - With the locally built runtime pack, the in-app CoreCLR debugger (VS Code, .NET MAUI F5 flow, remote debugger host and target) **stops at `Debugger.Break` and steps again**. Before the fix, the attach failed silently, with `0x80131C4F` from `CordbProcess::Init` confirmed by lldb on the in-app DBI. - The end-to-end debugger validation ran on a build whose source tree is identical to this commit; this exact commit was also rebuilt for iossimulator-arm64 to confirm it builds. - No unit test covers this native, host-configuration-dependent path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure that
TryGetSymbolworks for all architectures and OSes regardless of the host architecture and OS.