[Lldb-commits] [lldb] [lldb] Prefer exact address match when looking up symbol by address (PR #172055)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 12 15:57:31 PST 2025
================
@@ -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:
Sounds reasonable.
https://github.com/llvm/llvm-project/pull/172055
More information about the lldb-commits
mailing list