From 767c21da3f997f007503fdce9cb19616fd90b6ff Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Fri, 13 Jun 2025 14:18:49 -0700 Subject: [PATCH 1/3] [lldb] Stop demangling all swift symbols --- lldb/source/Symbol/Symtab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 15c9819bfcaa6..9c6b30641a993 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -366,8 +366,8 @@ void Symtab::InitNameIndexes() { else basename_to_index.Append(basename, value); } - continue; } + continue; } #endif // LLDB_ENABLE_SWIFT } From 2830d2f9a22dfd3e443d85eb8d6dcd5ccc91443e Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Sat, 14 Jun 2025 11:38:15 -0700 Subject: [PATCH 2/3] Avoid non-code symbols too --- lldb/source/Symbol/Symtab.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 9c6b30641a993..b8ba6bf775b22 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -373,6 +373,11 @@ void Symtab::InitNameIndexes() { } } +#ifdef LLDB_ENABLE_SWIFT + if (SwiftLanguageRuntime::IsSwiftMangledName(mangled.GetMangledName())) + continue; +#endif + // Symbol name strings that didn't match a Mangled::ManglingScheme, are // stored in the demangled field. SymbolContext sc; From df6325c58e8a953c3136a18f8a3381d6408098b4 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 16 Jun 2025 10:08:23 -0700 Subject: [PATCH 3/3] Add comment to early continue --- lldb/source/Symbol/Symtab.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index b8ba6bf775b22..18715b25ecbfc 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -366,14 +366,18 @@ void Symtab::InitNameIndexes() { else basename_to_index.Append(basename, value); } + continue; } - continue; } #endif // LLDB_ENABLE_SWIFT } } #ifdef LLDB_ENABLE_SWIFT + // Skip demangling of remaining Swift symbols. The preceeding block + // demangles Swift symbols into node trees, to extract method names. The + // subsequent block demangles symbols into strings, and for Swift this + // serves no purpose. if (SwiftLanguageRuntime::IsSwiftMangledName(mangled.GetMangledName())) continue; #endif