================
@@ -4238,6 +4238,60 @@ ProcessGDBRemote::HandleAcceleratorActions(const
AcceleratorActions &actions) {
return error;
}
+ if (actions.connect_info) {
+ if (llvm::Error error = HandleAcceleratorConnection(actions))
+ return error;
+ }
+
+ return llvm::Error::success();
+}
+
+llvm::Error ProcessGDBRemote::HandleAcceleratorConnection(
+ const AcceleratorActions &actions) {
+ const AcceleratorConnectionInfo &connect_info = *actions.connect_info;
+ Debugger &debugger = GetTarget().GetDebugger();
+
+ // Create a new (empty) target for the accelerator and connect to the GDB
+ // server the plugin is serving.
+ std::string exe_path = connect_info.exe_path.value_or("");
+ std::string triple = connect_info.triple.value_or("");
+ TargetSP accelerator_target_sp;
+ Status error = debugger.GetTargetList().CreateTarget(
+ debugger, exe_path, triple, eLoadDependentsNo,
+ /*platform_options=*/nullptr, accelerator_target_sp);
+ if (error.Fail())
+ return error.takeError();
+ if (!accelerator_target_sp)
+ return llvm::createStringError("failed to create accelerator target");
+
+ // The target's platform is only used to drive the connection here; with no
+ // exe or triple it defaults to the host platform, and the accelerator's real
+ // platform is established once it connects and reports its executable, so
+ // there is nothing meaningful to verify about it at this point.
+ PlatformSP platform_sp = accelerator_target_sp->GetPlatform();
----------------
satyajanga wrote:
updated to simply return without an error.
https://github.com/llvm/llvm-project/pull/201449
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits