================
@@ -494,17 +494,20 @@ uint32_t Module::ResolveSymbolContextForAddress(
         !(resolved_flags & eSymbolContextSymbol)) {
       Symtab *symtab = symfile->GetSymtab();
       if (symtab && so_addr.IsSectionOffset()) {
-        Symbol *matching_symbol = nullptr;
-
-        symtab->ForEachSymbolContainingFileAddress(
-            so_addr.GetFileAddress(),
-            [&matching_symbol](Symbol *symbol) -> bool {
-              if (symbol->GetType() != eSymbolTypeInvalid) {
-                matching_symbol = symbol;
-                return false; // Stop iterating
-              }
-              return true; // Keep iterating
-            });
+        addr_t file_address = so_addr.GetFileAddress();
+        Symbol *matching_symbol = 
symtab->FindSymbolAtFileAddress(file_address);
+
+        if (!matching_symbol ||
----------------
jimingham wrote:

This isn't just this patch, but it seems like everywhere we are scanning the 
symbol tables, if we find a symbol that matches with eSymbolTypeInvalid, we 
just skip over it.
It seems like having the default "find symbols" return invalid symbols is just 
asking for code to forget to ignore them.
It might be better to have the Find and ForEach skip those symbols for you 
(maybe you'd need a variant that doesn't do that though I didn't see anywhere 
in lldb where we would actually use that...

https://github.com/llvm/llvm-project/pull/172055
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to