Skip to content

Conversation

Michael137
Copy link
Member

@Michael137 Michael137 commented Nov 7, 2024

Alternative to #114529

rdar://104968288

@Michael137 Michael137 changed the title [WIP [WIP][lldb] Alternative implementation of more reliable function call infrastructure Nov 7, 2024
@Michael137 Michael137 force-pushed the lldb/abi-tag-structors-prototype-v2 branch from f8087e9 to 63ca211 Compare April 4, 2025 11:38
Copy link

github-actions bot commented Apr 4, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- clang/lib/AST/Mangle.cpp clang/lib/Sema/SemaDeclAttr.cpp libcxxabi/src/demangle/ItaniumDemangle.h lldb/source/Expression/IRExecutionUnit.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp llvm/include/llvm/Demangle/Demangle.h llvm/include/llvm/Demangle/ItaniumDemangle.h llvm/lib/Demangle/ItaniumDemangle.cpp
View the diff from clang-format here.
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 1056195b1..f864b0f38 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -892,43 +892,44 @@ static std::string FindStructorLinkageName(DWARFDIE die,
   return {};
 }
 
-static lldb::addr_t FindSpecialLinkageName(
-        LoadAddressResolver &resolver,ConstString name, llvm::StringRef symbol) {
+static lldb::addr_t FindSpecialLinkageName(LoadAddressResolver &resolver,
+                                           ConstString name,
+                                           llvm::StringRef symbol) {
   uintptr_t module_ptr;
   if (symbol.consumeInteger(0, module_ptr))
     return LLDB_INVALID_ADDRESS;
-  
+
   if (module_ptr == 0) {
     // TODO: log this case. We should ever be putting a null module pointer
     // here
     return LLDB_INVALID_ADDRESS;
   }
-  
+
   auto *mod = (lldb_private::Module *)module_ptr;
   assert(mod);
   auto *sym = mod->GetSymbolFile();
   assert(sym);
-  
+
   if (!symbol.consume_front(":"))
     return LLDB_INVALID_ADDRESS;
-  
+
   lldb::user_id_t die_id;
   if (symbol.consumeInteger(10, die_id))
     return LLDB_INVALID_ADDRESS;
-  
+
   auto *dwarf = llvm::dyn_cast<plugin::dwarf::SymbolFileDWARF>(sym);
   if (!dwarf)
     return LLDB_INVALID_ADDRESS;
-  
+
   auto die = dwarf->GetDIE(die_id);
   if (!die.IsValid())
     return LLDB_INVALID_ADDRESS;
-  
+
   // TODO: account for MS-ABI (where there are no ctor variants in the
   // mangling)
   if (!symbol.consume_front(":"))
     return LLDB_INVALID_ADDRESS;
-  
+
   auto structor_variant_or_err = MakeStructorVariant(symbol);
   if (!structor_variant_or_err) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions),
@@ -937,13 +938,12 @@ static lldb::addr_t FindSpecialLinkageName(
                    name.GetStringRef());
     return LLDB_INVALID_ADDRESS;
   }
-  
-  ConstString mangled(
-      FindStructorLinkageName(die, *structor_variant_or_err));
-  
-  Module::LookupInfo lookup_info(
-      mangled, lldb::FunctionNameType::eFunctionNameTypeAny,
-      lldb::LanguageType::eLanguageTypeC_plus_plus);
+
+  ConstString mangled(FindStructorLinkageName(die, *structor_variant_or_err));
+
+  Module::LookupInfo lookup_info(mangled,
+                                 lldb::FunctionNameType::eFunctionNameTypeAny,
+                                 lldb::LanguageType::eLanguageTypeC_plus_plus);
   SymbolContextList sc_list;
   dwarf->FindFunctions(lookup_info, {}, false, sc_list);
   if (auto load_addr = resolver.Resolve(sc_list))

@Michael137
Copy link
Member Author

Landed in #148877

@Michael137 Michael137 closed this Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant