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

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 18 10:16:44 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:

Ohh you are right, my bad, I had misinterpreted your original comment.

So, to summarize, the current implementation is technically correct but not correct in its original intent, i.e. it will be slow in the presence of AT_specification/AT_abstract_origin. 

There are two improvements we need to do here:

1. Avoid going through the DWARFDIE class when AT_specification/AT_abstract_origin are references inside the same unit
2. Figure out if we can also be fast when ref_addr is used.

I will explore those today and come back here

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


More information about the lldb-commits mailing list