================
@@ -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();
----------------
dmpots wrote:

We already have these constants in the llvm Dwarf.h header

```
const uint32_t DW_CIE_ID = UINT32_MAX;
const uint64_t DW64_CIE_ID = UINT64_MAX;
```

We can use them from there
https://github.com/dmpots/llvm-project/blob/main/llvm/include/llvm/BinaryFormat/Dwarf.h#L97

https://github.com/llvm/llvm-project/pull/158350
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to