[Lldb-commits] [lldb] r334190 - DebugNamesDWARFIndex: Add type lookup suport

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 7 05:26:19 PDT 2018


Author: labath
Date: Thu Jun  7 05:26:18 2018
New Revision: 334190

URL: http://llvm.org/viewvc/llvm-project?rev=334190&view=rev
Log:
DebugNamesDWARFIndex: Add type lookup suport

This implements just one of the GetTypes overloads. The other is not
testable from lldb-test so I'm leaving it unimplemented until I figure
out what to do with testing.

Modified:
    lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h

Modified: lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp?rev=334190&r1=334189&r2=334190&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp Thu Jun  7 05:26:18 2018
@@ -17,6 +17,16 @@
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
+// RUN: clang %s -g -c -emit-llvm -o - --target=x86_64-pc-linux | \
+// RUN:   llc -accel-tables=Dwarf -filetype=obj -o %t.o
+// RUN: ld.lld %t.o -o %t
+// RUN: lldb-test symbols --name=foo --find=type %t | \
+// RUN:   FileCheck --check-prefix=NAME %s
+// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=type %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
+
 // EMPTY: Found 0 types:
 // NAME: Found 4 types:
 // CONTEXT: Found 1 types:

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp?rev=334190&r1=334189&r2=334190&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp Thu Jun  7 05:26:18 2018
@@ -98,6 +98,16 @@ void DebugNamesDWARFIndex::GetGlobalVari
   }
 }
 
+void DebugNamesDWARFIndex::GetTypes(ConstString name, DIEArray &offsets) {
+  m_fallback.GetTypes(name, offsets);
+
+  for (const DebugNames::Entry &entry :
+       m_debug_names_up->equal_range(name.GetStringRef())) {
+    if (isType(entry.tag()))
+      Append(entry, offsets);
+  }
+}
+
 void DebugNamesDWARFIndex::GetNamespaces(ConstString name, DIEArray &offsets) {
   m_fallback.GetNamespaces(name, offsets);
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h?rev=334190&r1=334189&r2=334190&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h Thu Jun  7 05:26:18 2018
@@ -32,7 +32,7 @@ public:
   void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
   void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
                             DIEArray &offsets) override {}
-  void GetTypes(ConstString name, DIEArray &offsets) override {}
+  void GetTypes(ConstString name, DIEArray &offsets) override;
   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override {}
   void GetNamespaces(ConstString name, DIEArray &offsets) override;
   void GetFunctions(ConstString name, DWARFDebugInfo &info,




More information about the lldb-commits mailing list