[Lldb-commits] [PATCH] D133243: [LLDB][NativePDB] Fix PdbAstBuilder::GetParentDeclContextForSymbol when ICF happens.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 5 05:02:25 PDT 2022


labath added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp:631
+    if (name_components.empty() ||
+        base_name != name_components.back()->toString())
+      continue;
----------------
What if the two symbols have the same address (same code) and the same base name (but are e.g. in different namespaces)?


================
Comment at: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp:634-659
+    name_components = name_components.drop_back();
+    if (!name_components.empty()) {
+      // Render the current list of scope nodes as a fully qualified name, and
+      // look it up in the debug info as a type name.  If we find something,
+      // this is a type (which may itself be prefixed by a namespace).  If we
+      // don't, this is a list of namespaces.
+      std::string qname = RenderScopeList(name_components);
----------------
I know you didn't write this, but I still have to express my surprise at the existence of this code. My don't have anything like that -- using demangled names to look up things --  in the DWARF plugin. There, you can find the containing context by just going "up" in the DIE tree. I don't know if that is possible in PDB, but the current implementation seems fairly fragile, and I suspect it could be broken if the user overrides a mangled name of a symbol (`void f() asm("my_linkage_name");`).
Are you sure it's not possible to do this in some other way?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133243/new/

https://reviews.llvm.org/D133243



More information about the lldb-commits mailing list