diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2025-02-04 09:01:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-04 09:01:08 -0800 |
commit | 97f6e533865c66ea08840be78154099180293094 (patch) | |
tree | 29e902686a5dc88103dbbe938a3c82b045851ebc /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 21560fe6b9c73133fd86723071877c55106df010 (diff) | |
download | llvm-97f6e533865c66ea08840be78154099180293094.zip llvm-97f6e533865c66ea08840be78154099180293094.tar.gz llvm-97f6e533865c66ea08840be78154099180293094.tar.bz2 |
[lldb] Support CommandInterpreter print callbacks (#125006)
Xcode uses a pseudoterminal for the debugger console.
- The upside of this apporach is that it means that it can rely on
LLDB's IOHandlers for multiline and script input.
- The downside of this approach is that the command output is printed to
the PTY and you don't get a SBCommandReturnObject. Adrian added support
for inline diagnostics (#110901) and we'd like to access those from the
IDE.
This patch adds support for registering a callback in the command
interpreter that gives access to the `(SB)CommandReturnObject` right
before it will be printed. The callback implementation can choose
whether it likes to handle printing the result or defer to lldb. If the
callback indicated it handled the result, the command interpreter will
skip printing the result.
We considered a few other alternatives to solve this problem:
- The most obvious one is using `HandleCommand`, which returns a
`SBCommandReturnObject`. The problem with this approach is the multiline
input mentioned above. We would need a way to tell the IDE that it
should expect multiline input, which isn't known until LLDB starts
handling the command.
- To address the multiline issue,we considered exposing (some of the)
IOHandler machinery through the SB API. To solve this particular issue,
that would require reimplementing a ton of logic that already exists
today in the CommandInterpeter. Furthermore that seems like overkill
compared to the proposed solution.
rdar://141254310
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions