[all-commits] [llvm/llvm-project] 2cf68b: [lldb/Interpreter] Report scripted hook failures t...
Med Ismail Bennani via All-commits
all-commits at lists.llvm.org
Tue Sep 22 14:29:58 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2cf68b2cc466710badbe560ad6081f71c72ed331
https://github.com/llvm/llvm-project/commit/2cf68b2cc466710badbe560ad6081f71c72ed331
Author: Med Ismail Bennani <ismail at bennani.ma>
Date: 2026-09-22 (Tue, 22 Sep 2026)
Changed paths:
M lldb/include/lldb/Interpreter/Interfaces/ScriptedHookInterface.h
M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedHookPythonInterface.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedHookPythonInterface.h
M lldb/source/Target/Target.cpp
M lldb/test/API/functionalities/scripted_extensions/TestScriptedExtensionsDiagnostics.py
M lldb/test/API/functionalities/scripted_extensions/malformed_scripted_extensions.py
Log Message:
-----------
[lldb/Interpreter] Report scripted hook failures to the user (#225292)
A scripted hook whose Python implementation failed reported nothing. The
error exists: `Dispatch` has returned it since #224988, but none of the
three call sites put it anywhere the user could see it:
- `Target::StopHookScripted::HandleStop` logged to LLDBLog::Target,
which is off unless you already know to `log enable lldb target`.
- `Target::HookScripted::HandleStop` consumed the `Expected` with no log
at all.
- `HandleModuleLoaded`/`HandleModuleUnloaded` had no error channel, so
the Python interface could only log and carry on.
This gives the two module callbacks an `llvm::Error` return, and route
all three through `ReportScriptedHookError`, which formats via a
`CommandReturnObject` whose immediate streams both point at the hook's
output stream, the same thing `StopHookCommandLine::HandleStop` already
does for a failing command. That gets the standard `error: ` prefix and
keeps the message interleaved with whatever the hook printed.
A stop hook whose `handle_stop` raises `AttributeError` used to print
only:
- Hook 1 (a_out.CoreFileStopHook)
and now prints:
- Hook 1 (a_out.CoreFileStopHook) error: stop hook 1 failed: python
exception in a_out.CoreFileStopHook method 'handle_stop': Traceback
(most recent call last): File ".../a_out.py", line 25, in handle_stop
print(f"error {self.process}") AttributeError: 'CoreFileStopHook' object
has no attribute 'process'
rdar://183458400
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
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