Skip to content

Commit 8824c52

Browse files
committed
[lldb] Improve error reporting in ScriptedInterface
This patch improve error reporting in the Scripted Interface. Previously, it would only log the content of the Status object and overwrite it with the error_msg function parameter. This patch changes that to append the Status object content to the `error_msg` string. Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent f4758d8 commit 8824c52

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lldb/include/lldb/Interpreter/ScriptedInterface.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ class ScriptedInterface {
4040
LLDBLog log_caterogy = LLDBLog::Process) {
4141
LLDB_LOGF(GetLog(log_caterogy), "%s ERROR = %s", caller_name.data(),
4242
error_msg.data());
43-
error.SetErrorString(llvm::Twine(caller_name + llvm::Twine(" ERROR = ") +
44-
llvm::Twine(error_msg))
45-
.str());
43+
llvm::Twine err = llvm::Twine(caller_name + llvm::Twine(" ERROR = ") +
44+
llvm::Twine(error_msg));
45+
if (const char *detailed_error = error.AsCString())
46+
err.concat(llvm::Twine(" (") + llvm::Twine(detailed_error) +
47+
llvm::Twine(")"));
48+
error.SetErrorString(err.str());
4649
return {};
4750
}
4851

0 commit comments

Comments
 (0)