[all-commits] [llvm/llvm-project] 97f6e5: [lldb] Support CommandInterpreter print callbacks ...
Jonas Devlieghere via All-commits
all-commits at lists.llvm.org
Tue Feb 4 09:01:31 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 97f6e533865c66ea08840be78154099180293094
https://github.com/llvm/llvm-project/commit/97f6e533865c66ea08840be78154099180293094
Author: Jonas Devlieghere <jonas at devlieghere.com>
Date: 2025-02-04 (Tue, 04 Feb 2025)
Changed paths:
M lldb/bindings/python/python-swigsafecast.swig
M lldb/bindings/python/python-typemaps.swig
M lldb/bindings/python/python-wrapper.swig
M lldb/include/lldb/API/SBCommandInterpreter.h
M lldb/include/lldb/API/SBDefines.h
M lldb/include/lldb/Interpreter/CommandInterpreter.h
M lldb/include/lldb/lldb-enumerations.h
M lldb/source/API/SBCommandInterpreter.cpp
M lldb/source/Interpreter/CommandInterpreter.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
A lldb/test/API/python_api/interpreter_callback/Makefile
A lldb/test/API/python_api/interpreter_callback/TestCommandInterepterPrintCallback.py
A lldb/test/API/python_api/interpreter_callback/main.c
Log Message:
-----------
[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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list