================
@@ -244,9 +245,38 @@ SBProcess SBTarget::LoadCore(const char *core_file, 
lldb::SBError &error) {
   TargetSP target_sp(GetSP());
   if (target_sp) {
     FileSpec filespec(core_file);
-    FileSystem::Instance().Resolve(filespec);
+    auto file = FileSystem::Instance().Open(
+        filespec, lldb_private::File::eOpenOptionReadOnly);
+    if (!file) {
+      error.SetErrorStringWithFormat("Failed to open the core file: %s",
+                                     llvm::toString(file.takeError()).c_str());
+      return sb_process;
+    }
+    ProcessSP process_sp(
+        target_sp->CreateProcess(target_sp->GetDebugger().GetListener(), "",
+                                 std::move(file.get()), false));
+    if (process_sp) {
+      error.SetError(process_sp->LoadCore());
+      if (error.Success())
+        sb_process.SetSP(process_sp);
+    } else {
+      error.SetErrorString("Failed to create the process");
+    }
+  } else {
+    error.SetErrorString("SBTarget is invalid");
+  }
----------------
clayborg wrote:

If we leave the Target::CreateProcess overload as suggested above, this entire 
change goes away.

https://github.com/llvm/llvm-project/pull/71769
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to