================
@@ -223,6 +225,79 @@ bool 
GDBRemoteCommunicationClient::GetMultiBreakpointSupported() {
   return m_supports_multi_breakpoint == eLazyBoolYes;
 }
 
+bool GDBRemoteCommunicationClient::GetAcceleratorPluginsSupported() {
+  if (m_supports_accelerator_plugins == eLazyBoolCalculate)
+    GetRemoteQSupported();
+  return m_supports_accelerator_plugins == eLazyBoolYes;
+}
+
+std::optional<std::vector<AcceleratorActions>>
+GDBRemoteCommunicationClient::GetAcceleratorInitializeActions() {
+  // Get the initial actions (e.g. breakpoints to set) requested by any
+  // accelerator plugins using the "jAcceleratorPluginInitialize" packet. This
+  // is sent once when a native process is launched or attached.
+  if (!GetAcceleratorPluginsSupported())
+    return std::nullopt;
+
+  StringExtractorGDBRemote response;
+  response.SetResponseValidatorToJSON();
+  if (SendPacketAndWaitForResponse("jAcceleratorPluginInitialize", response) !=
+      PacketResult::Success)
+    return std::nullopt;
+
+  if (response.IsUnsupportedResponse())
+    return std::nullopt;
+
+  if (response.IsErrorResponse()) {
+    Debugger::ReportError(response.GetStatus().AsCString());
----------------
DavidSpickett wrote:

Did you consider using `expected` and having the caller(s) report the error? 
Because if you want all errors from this call tree to be reported to the user, 
that's one way to ensure that.

Though you do have the situation where no error occurs and you get no actions. 
So in theory it's `expected<optional<vector<AcceleratorActions....`. But if you 
don't mind modelling the empty state as an empty vector, 
`expected<vector<AcceleratorActions...` is worth considering.

https://github.com/llvm/llvm-project/pull/201489
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to