[Lldb-commits] [PATCH] D92729: [LLDB] fix error message for one-line breakpoint scripts
Pedro Tammela via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 7 03:23:43 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG280ae10774ab: [LLDB] fix error message for one-line breakpoint scripts (authored by tammela).
Changed prior to commit:
https://reviews.llvm.org/D92729?vs=309765&id=309858#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92729/new/
https://reviews.llvm.org/D92729
Files:
lldb/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
lldb/test/Shell/ScriptInterpreter/Lua/fail_breakpoint_oneline.test
lldb/test/Shell/ScriptInterpreter/Python/fail_breakpoint_oneline.test
Index: lldb/test/Shell/ScriptInterpreter/Python/fail_breakpoint_oneline.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/fail_breakpoint_oneline.test
@@ -0,0 +1,7 @@
+# REQUIRES: python
+# UNSUPPORTED: lldb-repro
+#
+# RUN: %lldb -s %s --script-language python 2>&1 | FileCheck %s
+b main
+breakpoint command add -s python -o "1234_foo"
+# CHECK: error: SyntaxError({{.*}})
Index: lldb/test/Shell/ScriptInterpreter/Lua/fail_breakpoint_oneline.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Lua/fail_breakpoint_oneline.test
@@ -0,0 +1,5 @@
+# REQUIRES: lua
+# RUN: %lldb -s %s --script-language lua 2>&1 | FileCheck %s
+b main
+breakpoint command add -s lua -o '1234_foo'
+# CHECK: error: {{.*}} unexpected symbol near '1234'
Index: lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
@@ -86,7 +86,7 @@
std::string func_str = llvm::formatv(fmt_str, body).str();
if (luaL_dostring(m_lua_state, func_str.c_str()) != LUA_OK) {
llvm::Error e = llvm::make_error<llvm::StringError>(
- llvm::formatv("{0}\n", lua_tostring(m_lua_state, -1)),
+ llvm::formatv("{0}", lua_tostring(m_lua_state, -1)),
llvm::inconvertibleErrorCode());
// Pop error message from the stack.
lua_pop(m_lua_state, 2);
Index: lldb/source/Commands/CommandObjectBreakpointCommand.cpp
===================================================================
--- lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -414,22 +414,23 @@
// to set or collect command callback. Otherwise, call the methods
// associated with this object.
if (m_options.m_use_script_language) {
+ Status error;
ScriptInterpreter *script_interp = GetDebugger().GetScriptInterpreter(
/*can_create=*/true, m_options.m_script_language);
// Special handling for one-liner specified inline.
if (m_options.m_use_one_liner) {
- script_interp->SetBreakpointCommandCallback(
+ error = script_interp->SetBreakpointCommandCallback(
m_bp_options_vec, m_options.m_one_liner.c_str());
} else if (!m_func_options.GetName().empty()) {
- Status error = script_interp->SetBreakpointCommandCallbackFunction(
+ error = script_interp->SetBreakpointCommandCallbackFunction(
m_bp_options_vec, m_func_options.GetName().c_str(),
m_func_options.GetStructuredData());
- if (!error.Success())
- result.SetError(error);
} else {
script_interp->CollectDataForBreakpointCommandCallback(
m_bp_options_vec, result);
}
+ if (!error.Success())
+ result.SetError(error);
} else {
// Special handling for one-liner specified inline.
if (m_options.m_use_one_liner)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92729.309858.patch
Type: text/x-patch
Size: 3168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201207/6505f0b2/attachment.bin>
More information about the lldb-commits
mailing list