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

Zequan Wu via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 6 10:53:52 PDT 2022


zequanwu added inline comments.


================
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);
----------------
labath wrote:
> 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?
For namespace, I don't see any symbol record for it. All members of namespace, functions or variables, just have namespace string as a prefix for their names, like `N1::N2::func`. 
@rnk  Do you know any other ways to get the namespace string of a symbol rather than using mangled names?


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