[Lldb-commits] [lldb] Reland "[LLDB][NativePDB] Create functions with mangled name" (PR #161678)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 2 14:43:29 PDT 2025


================
@@ -1118,3 +1118,21 @@ size_t lldb_private::npdb::GetSizeOfType(PdbTypeSymId id,
   }
   return 0;
 }
+
+llvm::StringRef lldb_private::npdb::StripCDeclPrefix(llvm::StringRef mangled) {
+  // See
+  // https://learn.microsoft.com/en-us/cpp/build/reference/decorated-names#FormatC
+  if (!mangled.starts_with('_'))
+    return mangled;
+
+  // make sure this isn't __stdcall (`_{name}@{sizeof(params)}`) or __vectorcall
+  // (`{name}@@{sizeof(params)}`).
+  size_t last_at_pos = mangled.find_last_of('@');
+  if (last_at_pos != llvm::StringRef::npos &&
+      last_at_pos < mangled.size() - 1 &&
+      llvm::all_of(mangled.slice(last_at_pos + 1, mangled.size()),
+                   llvm::isDigit))
+    return mangled;
----------------
Michael137 wrote:

Is there nothing in the debug-info that could tell us this? DWARF, e.g., encodes a function's calling convention

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


More information about the lldb-commits mailing list