[clang] [clang-tools-extra] [lldb] [llvm] Add new API in SBTarget for loading core from SBFile (PR #71769)

Greg Clayton via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 11:24:14 PST 2023


================
@@ -3174,8 +3174,17 @@ class TargetCreateFormDelegate : public FormDelegate {
     core_file_directory_spec.SetDirectory(core_file_spec.GetDirectory());
     target_sp->AppendExecutableSearchPaths(core_file_directory_spec);
 
-    ProcessSP process_sp(target_sp->CreateProcess(
-        m_debugger.GetListener(), llvm::StringRef(), &core_file_spec, false));
+    auto core_file = FileSystem::Instance().Open(
+        core_file_spec, lldb_private::File::eOpenOptionReadOnly);
+
+    if (!core_file) {
+      SetError(llvm::toString(core_file.takeError()).c_str());
+      return;
+    }
+
+    ProcessSP process_sp(
+        target_sp->CreateProcess(m_debugger.GetListener(), llvm::StringRef(),
+                                 std::move(core_file.get()), false));
----------------
clayborg wrote:

All of this goes away if we leave the original Target::CreateProcess overload as mentioned above.

https://github.com/llvm/llvm-project/pull/71769


More information about the cfe-commits mailing list