[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 12 13:32:19 PST 2023
================
@@ -33,18 +39,59 @@ void RunLLDBCommands(llvm::StringRef prefix,
const char *error = result.GetError();
strm << error;
}
+ };
+
+ lldb::SBCommandInterpreter interp = g_dap.debugger.GetCommandInterpreter();
+ for (llvm::StringRef command : commands) {
+ lldb::SBCommandReturnObject result;
+ bool quiet_on_success = false;
+ bool check_error = false;
+
+ while (parse_command_directives) {
+ if (command.starts_with("?")) {
+ command = command.drop_front();
+ quiet_on_success = true;
+ } else if (command.starts_with("!")) {
+ command = command.drop_front();
+ check_error = true;
+ } else {
+ break;
+ }
+ }
+
+ interp.HandleCommand(command.str().c_str(), result);
+ const bool got_error = !result.Succeeded();
+ // The if statement below is assuming we always print out `!` prefixed
+ // lines. The only time we don't print is when we have `quiet_on_success ==
+ // true` and we don't have an error.
+ if (quiet_on_success ? got_error : true)
+ print_result(command, result, strm);
----------------
clayborg wrote:
only one place we call `print_result` now, so inline it inside this if statement
https://github.com/llvm/llvm-project/pull/74808
More information about the lldb-commits
mailing list