[Lldb-commits] [lldb] [LLDB] Fix 64 bit support for CIE and FDE handling in DWARFCallFrameInfo (PR #158350)
    Greg Clayton via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Mon Sep 15 14:13:16 PDT 2025
    
    
  
================
@@ -147,6 +149,27 @@ GetGNUEHPointer(const DataExtractor &DE, lldb::offset_t *offset_ptr,
   return baseAddress + addressValue;
 }
 
+// Check if the given cie_id value indicates a CIE (Common Information Entry)
+// as opposed to an FDE (Frame Description Entry).
+//
+// For eh_frame sections: CIE is marked with cie_id == 0
+// For debug_frame sections:
+//   - DWARF32: CIE is marked with cie_id ==
+//   std::numeric_limits<uint32_t>::max()
+//   - DWARF64: CIE is marked with cie_id ==
+//   std::numeric_limits<uint64_t>::max()
+static bool IsCIEMarker(uint64_t cie_id, bool is_64bit,
+                        DWARFCallFrameInfo::Type type) {
+  if (type == DWARFCallFrameInfo::EH)
+    return cie_id == 0;
+
+  // DWARF type
+  if (is_64bit)
+    return cie_id == std::numeric_limits<uint64_t>::max();
+
+  return cie_id == std::numeric_limits<uint32_t>::max();
----------------
clayborg wrote:
Do we want to make a `constexpr` with variable names for this instead of using magic numbers? I was thinking something like:
```
static constexpr uint32_t kCIEMarker32 = std::numeric_limits<uint32_t>::max();
static constexpr uint64_t kCIEMarker64 = std::numeric_limits<uint64_t>::max();
```
And then use these everywhere that we were using magic numbers?
https://github.com/llvm/llvm-project/pull/158350
    
    
More information about the lldb-commits
mailing list