staticSymbolAt method
Reverse lookup of the static symbol that contains the given virtual address. Returns null if no static symbol matching the address is found.
Implementation
@override
Symbol? staticSymbolAt(int address) {
Symbol? bestSym;
for (final section in namedSections('.symtab')) {
final table = section as SymbolTable;
for (final symbol in table.values) {
final start = symbol.value;
if (start > address) continue;
// If given a non-zero extent of a symbol, make sure the address is
// within the extent.
if (symbol.size > 0 && (start + symbol.size <= address)) continue;
// Pick the symbol with a start closest to the given address.
if (bestSym == null || (bestSym.value < start)) {
bestSym = symbol;
}
}
}
return bestSym;
}