[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:17 PST 2023


================
@@ -427,8 +427,17 @@ class CommandObjectTargetCreate : public CommandObjectParsed {
         core_file_dir.SetDirectory(core_file.GetDirectory());
         target_sp->AppendExecutableSearchPaths(core_file_dir);
 
+        auto file = FileSystem::Instance().Open(
+            core_file, lldb_private::File::eOpenOptionReadOnly);
+        if (!file) {
+          result.AppendErrorWithFormatv(
+              "Failed to open the core file '{0}': '{1}.'\n",
+              core_file.GetPath(), llvm::toString(file.takeError()));
+        }
+
         ProcessSP process_sp(target_sp->CreateProcess(
-            GetDebugger().GetListener(), llvm::StringRef(), &core_file, false));
+            GetDebugger().GetListener(), llvm::StringRef(),
+            std::move(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