[Lldb-commits] [lldb] r334186 - DebugNamesDWARFIndex: add namespace lookup support

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 7 03:56:17 PDT 2018


Author: labath
Date: Thu Jun  7 03:56:16 2018
New Revision: 334186

URL: http://llvm.org/viewvc/llvm-project?rev=334186&view=rev
Log:
DebugNamesDWARFIndex: add namespace lookup support

Modified:
    lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.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-namespace.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp?rev=334186&r1=334185&r2=334186&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp Thu Jun  7 03:56:16 2018
@@ -17,6 +17,16 @@
 // RUN: lldb-test symbols --name=not_there --find=namespace %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=namespace %t | \
+// RUN:   FileCheck --check-prefix=FOO %s
+// RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=namespace %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
+
 // FOO: Found namespace: foo
 
 // CONTEXT: Found namespace: bar::foo

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=334186&r1=334185&r2=334186&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp Thu Jun  7 03:56:16 2018
@@ -98,6 +98,16 @@ void DebugNamesDWARFIndex::GetGlobalVari
   }
 }
 
+void DebugNamesDWARFIndex::GetNamespaces(ConstString name, DIEArray &offsets) {
+  m_fallback.GetNamespaces(name, offsets);
+
+  for (const DebugNames::Entry &entry :
+       m_debug_names_up->equal_range(name.GetStringRef())) {
+    if (entry.tag() == DW_TAG_namespace)
+      Append(entry, offsets);
+  }
+}
+
 void DebugNamesDWARFIndex::Dump(Stream &s) {
   m_fallback.Dump(s);
 

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=334186&r1=334185&r2=334186&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h Thu Jun  7 03:56:16 2018
@@ -34,7 +34,7 @@ public:
                             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 GetNamespaces(ConstString name, DIEArray &offsets) override;
   void GetFunctions(ConstString name, DWARFDebugInfo &info,
                     const CompilerDeclContext &parent_decl_ctx,
                     uint32_t name_type_mask,




More information about the lldb-commits mailing list