From: Med Ismail Bennani Date: Fri, 17 Feb 2023 01:34:37 +0000 (-0800) Subject: [lldb] Improve error reporting in ScriptedInterface X-Git-Tag: upstream/17.0.6~15861 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=efc52361ddb7282825f1f813553f322bd119b830;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/lldb/include/lldb/Interpreter/ScriptedInterface.h b/lldb/include/lldb/Interpreter/ScriptedInterface.h index 31064de7..10a9f41 100644 --- a/lldb/include/lldb/Interpreter/ScriptedInterface.h +++ b/lldb/include/lldb/Interpreter/ScriptedInterface.h @@ -40,9 +40,12 @@ public: LLDBLog log_caterogy = LLDBLog::Process) { LLDB_LOGF(GetLog(log_caterogy), "%s ERROR = %s", caller_name.data(), error_msg.data()); - error.SetErrorString(llvm::Twine(caller_name + llvm::Twine(" ERROR = ") + - llvm::Twine(error_msg)) - .str()); + llvm::Twine err = llvm::Twine(caller_name + llvm::Twine(" ERROR = ") + + llvm::Twine(error_msg)); + if (const char *detailed_error = error.AsCString()) + err.concat(llvm::Twine(" (") + llvm::Twine(detailed_error) + + llvm::Twine(")")); + error.SetErrorString(err.str()); return {}; }