================
@@ -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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to