Host SOS in a standalone LLDB driver - #5999
Open
steveisok wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new sos-lldb driver currently doesn’t reliably surface command failures to callers in --batch mode (exit code remains 0), which can break scripting/CI usage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/SOS/lldbplugin/driver.cpp — The standalone driver currently can't propagate LLDB command success/failure to the caller because… |
What changed in this PR
This PR introduces a standalone macOS sos-lldb executable to host SOS via Apple LLDB, while also tightening LLDB command output routing and rejecting invalid CLRMA OS-thread IDs to avoid mis-resolving threads.
Changes:
- Add a macOS-only
sos-lldbLLDB driver executable and install it alongsidelibsosplugin. - Replace manual
SetCurrentResult/ClearCurrentResultwith a re-entrant RAII scope that restores the priorSBCommandReturnObject. - Reject CLRMA thread lookups that resolve to invalid OS thread IDs (
0or-1).
| File | Description |
|---|---|
| src/SOS/Strike/clrma/managedanalysis.cpp | Rejects invalid OS thread IDs before delegating to CLRMA service or building a ClrmaThread. |
| src/SOS/lldbplugin/soscommand.cpp | Uses scoped result routing for SOS command execution so output targets the correct command result. |
| src/SOS/lldbplugin/services.h | Adds LLDBServices::CurrentResultScope RAII guard and removes the previous setter/clearer helpers. |
| src/SOS/lldbplugin/services.cpp | Applies scoped result routing in extension command execution and LLDBServices::ExecuteCommand. |
| src/SOS/lldbplugin/driver.cpp | Adds the new standalone sos-lldb driver program for LLDB command hosting. |
| src/SOS/lldbplugin/CMakeLists.txt | Builds and installs sos-lldb on macOS. |
Suppressed comments (1)
src/SOS/lldbplugin/driver.cpp:83
- In
--batchmode, failures from-ocommands should typically produce a non-zero process exit code (and often stop executing further commands). As written, the driver always returns 0, which can cause scripts to miss command failures.
lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter();
bool keepRunning = true;
for (const std::string& command : startupCommands)
{
if (!ExecuteCommand(interpreter, command))
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This was referenced Sep 3, 2026
This was referenced Sep 3, 2026
Open
noahfalk
reviewed
Sep 3, 2026
This was referenced Sep 3, 2026
steveisok
force-pushed
the
steveisok-sos-lldb-driver-layer
branch
from
September 4, 2026 01:57
666b424 to
a14844f
Compare
steveisok
changed the base branch from
main
to
steveisok-reapply-sos-test-harness
September 4, 2026 02:15
noahfalk
approved these changes
Sep 4, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the temporary driver under native test helpers, propagate invalid LLDB thread IDs as failures, and return nonzero for failed batch commands. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9a6e90d9-5cd5-4ff1-a05b-11830076408d
steveisok
force-pushed
the
steveisok-sos-lldb-driver-layer
branch
from
September 4, 2026 12:21
a14844f to
409c70f
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9a6e90d9-5cd5-4ff1-a05b-11830076408d
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.

Summary
sos-lldbexecutable on macOS to host SOS through Apple LLDB reliablyE_UNEXPECTEDCLRMA backstopWhy this layer is separate
This PR contains only the standalone LLDB test-host layer from #5981. Keeping it separate from Helix sharding, harness, documentation, and dependency work makes the temporary host independently reviewable and provides the bottom layer for subsequent stacked changes.
The executable is test infrastructure, is not included in SOS packages, and is temporary until the .NET 11 SDK contains the runtime fix that makes this Apple LLDB workaround unnecessary.
Validation
./build.sh -skipmanaged(macOS arm64 Debug)sos-lldb --no-lldbinit --batch -o versionreturns01and prevents later-ocommands from running2libsosplugin.dylibthroughsos-lldband ransoshelp, confirming plugin command output is routed through the scoped result