[Lldb-commits] [lldb] [lldb] Use the source name when the linkage name is not mangled (PR #205701)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 25 09:13:45 PDT 2026


================
@@ -2478,7 +2478,15 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(
                                decl_line, decl_column, call_file, call_line,
                                call_column, &frame_base)) {
     Mangled func_name;
-    if (mangled)
+    if (mangled && name &&
+        Mangled::GetManglingScheme(mangled) == Mangled::eManglingSchemeNone) {
+      // The linkage name is present but is not actually a mangled name (e.g.
+      // wasi-libc renames `main` to its `__main_argc_argv` argv-passing
+      // wrapper). Display the source name (DW_AT_name) and keep the linkage
+      // name as the symbol so lookups by either name still resolve.
+      func_name.SetDemangledName(ConstString(name));
+      func_name.SetMangledName(ConstString(mangled));
+    } else if (mangled)
       func_name.SetValue(ConstString(mangled));
     else if ((die.GetParent().Tag() == DW_TAG_compile_unit ||
----------------
Michael137 wrote:

```suggestion
    } else if (mangled) {
      func_name.SetValue(ConstString(mangled));
    } else if ((die.GetParent().Tag() == DW_TAG_compile_unit ||
```

Per https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

> Inconsistent bracing within if/else if/else chains (if one block requires braces, all must)

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


More information about the lldb-commits mailing list