mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 23:51:56 +00:00
[lldb] Fix dwim-print error message for missing expr
This commit is contained in:
parent
71a5958406
commit
4d18d97b59
@ -61,14 +61,16 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
|
||||
OptionsWithRaw args{command};
|
||||
StringRef expr = args.GetRawPart();
|
||||
|
||||
if (expr.empty()) {
|
||||
result.AppendErrorWithFormatv("'{0}' takes a variable or expression",
|
||||
m_cmd_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.HasArgs()) {
|
||||
if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group,
|
||||
m_exe_ctx))
|
||||
return false;
|
||||
} else if (command.empty()) {
|
||||
result.AppendErrorWithFormatv("'{0}' takes a variable or expression",
|
||||
m_cmd_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the user has not specified, default to disabling persistent results.
|
||||
|
@ -107,3 +107,10 @@ class TestCase(TestBase):
|
||||
lldbutil.run_to_name_breakpoint(self, "main")
|
||||
self._expect_cmd(f"dwim-print -l c++ -- argc", "frame variable")
|
||||
self._expect_cmd(f"dwim-print -l c++ -- argc + 1", "expression")
|
||||
|
||||
def test_empty_expression(self):
|
||||
self.build()
|
||||
lldbutil.run_to_name_breakpoint(self, "main")
|
||||
error_msg = "error: 'dwim-print' takes a variable or expression"
|
||||
self.expect(f"dwim-print", error=True, startstr=error_msg)
|
||||
self.expect(f"dwim-print -- ", error=True, startstr=error_msg)
|
||||
|
Loading…
Reference in New Issue
Block a user