[Lldb-commits] [lldb] [LLDB][ProcessFreeBSDKernelCore] Report error when creating kernel image (PR #191397)

Minsoo Choo via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 10 04:53:50 PDT 2026


================
@@ -130,15 +80,16 @@ lldb::ProcessSP ProcessFreeBSDKernelCore::CreateInstance(
     lldb::TargetSP target_sp, ListenerSP listener_sp,
     const FileSpec *crash_file, bool can_connect) {
   ModuleSP executable = target_sp->GetExecutableModule();
+  char errbuf[_POSIX2_LINE_MAX];
   if (crash_file && !can_connect && executable) {
     kvm_t *kvm =
         kvm_open2(executable->GetFileSpec().GetPath().c_str(),
-                  crash_file->GetPath().c_str(), O_RDONLY, nullptr, nullptr);
-    if (kvm) {
-      kvm_close(kvm);
+                  crash_file->GetPath().c_str(), O_RDONLY, errbuf, nullptr);
+    if (kvm)
       return std::make_shared<ProcessFreeBSDKernelCore>(target_sp, listener_sp,
-                                                        *crash_file);
-    }
+                                                        kvm, *crash_file);
+    else
+      LLDB_LOGF(GetLog(LLDBLog::Object), "FreeBSD-Kernel-Core: %s", errbuf);
----------------
mchoo7 wrote:

I had the same question for
https://github.com/llvm/llvm-project/blob/524525e13668d024abadf70995993dbbc605bed5/lldb/source/Plugins/Process/FreeBSD-Kernel-Core/ProcessFreeBSDKernelCore.cpp#L543

but why `LLDBLog::Object` over `LLDBLog::Process`?

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


More information about the lldb-commits mailing list