[Lldb-commits] [lldb] [lldb][DWARFUnit] Implement PeekDIEName query (PR #78486)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 17 12:46:22 PST 2024


================
@@ -663,6 +663,14 @@ DWARFUnit::GetDIE(dw_offset_t die_offset) {
   return DWARFDIE(); // Not found
 }
 
+llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) {
+  const DWARFDataExtractor &data = GetData();
+  DWARFDebugInfoEntry die;
+  if (!die.Extract(data, this, &die_offset))
+    return llvm::StringRef();
+  return die.GetName(this);
+}
----------------
felipepiovezan wrote:

Actually, the current approach should take care of that already; we call `DWARFDebugInfoEntry::GetName`, whose implementation is:

```
const char *DWARFDebugInfoEntry::GetName(const DWARFUnit *cu) const {
  return GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
}
```

This is going to look through AT_specification and AT_abstract_origin.

I should still add a  test to verify this though!

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


More information about the lldb-commits mailing list