[Lldb-commits] [lldb] 356b4eb - [LLDB][FreeBSD] Fix file not exists detection (#235358)

via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 24 15:51:00 PDT 2026


Author: aokblast
Date: 2026-10-24T22:50:56Z
New Revision: 356b4eb28c6d67f266157d98e18d2fa2703956d9

URL: https://github.com/llvm/llvm-project/commit/356b4eb28c6d67f266157d98e18d2fa2703956d9
DIFF: https://github.com/llvm/llvm-project/commit/356b4eb28c6d67f266157d98e18d2fa2703956d9.diff

LOG: [LLDB][FreeBSD] Fix file not exists detection (#235358)

A process can outlive the exact running binary inside. As a result, a
file fails to query should set unknow by default.

Added: 
    

Modified: 
    lldb/source/Host/freebsd/Host.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp
index 900d047258155a..afa0f576d312cf 100644
--- a/lldb/source/Host/freebsd/Host.cpp
+++ b/lldb/source/Host/freebsd/Host.cpp
@@ -97,16 +97,13 @@ GetFreeBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
     proc_args.AppendArgument(llvm::StringRef(cstr));
   }
 
-  auto buffer_sp = FileSystem::Instance().CreateDataBuffer(pathname, 0x20, 0);
-  if (!buffer_sp) {
-    process_info.Clear();
-    return true;
-  }
-  uint8_t exe_class =
-      llvm::object::getElfArchType(
-          {reinterpret_cast<const char *>(buffer_sp->GetBytes()),
-           size_t(buffer_sp->GetByteSize())})
-          .first;
+  uint8_t exe_class = llvm::ELF::ELFCLASSNONE;
+  if (auto buffer_sp = FileSystem::Instance().CreateDataBuffer(
+          process_info.GetExecutableFile(), 0x20, 0))
+    exe_class = llvm::object::getElfArchType(
+                    {reinterpret_cast<const char *>(buffer_sp->GetBytes()),
+                     size_t(buffer_sp->GetByteSize())})
+                    .first;
 
   switch (exe_class) {
   case llvm::ELF::ELFCLASS32:


        


More information about the lldb-commits mailing list