[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 11:52:21 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:

> One option here is to check if all of the DIEs have been already parsed in the DWARFUnit and if so, grab the existing DIE, and if it hasn't been parsed do this.

Correct me if I am wrong, but even if we take an already parsed DIE, won't we be doing the exact same thing? It eventually calls `DWARFDebugInfoEntry::GetAttributeValue`, which is a more complicated way of doing the above (but it still creates the extractor, etc...)


> This approach doesn't take care of cases where the current DIE doesn't have a DW_AT_name, but it has a DW_AT_specification or DW_AT_abstract_origin

Oh great point, we need this for sure! I will update the implementation and add tests for it




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


More information about the lldb-commits mailing list