1
0
Fork 0

Add support for enumerating a range of symbols

This commit is contained in:
Duncan Ogilvie 2023-03-10 12:18:51 +01:00
parent 7e17c2ccd2
commit ee5aa0a264
3 changed files with 23 additions and 5 deletions

View File

@ -145,7 +145,7 @@ public:
}
// only call if isOpen && !isLoading
virtual void enumSymbols(const CbEnumSymbol & cbEnum)
virtual void enumSymbols(const CbEnumSymbol & cbEnum, duint beginRva = 0, duint endRva = -1)
{
// Stub
}

View File

@ -470,14 +470,32 @@ bool SymbolSourceDIA::findSymbolExactOrLower(duint rva, SymbolInfo & symInfo)
return false;
}
void SymbolSourceDIA::enumSymbols(const CbEnumSymbol & cbEnum)
void SymbolSourceDIA::enumSymbols(const CbEnumSymbol & cbEnum, duint beginRva, duint endRva)
{
if(!_symbolsLoaded)
return;
for(auto & it : _symAddrMap)
if(_symAddrMap.empty())
return;
if(beginRva > endRva)
return;
AddrIndex find;
find.addr = beginRva;
find.index = -1;
auto it = std::lower_bound(_symAddrMap.begin(), _symAddrMap.end(), find);
if(it == _symAddrMap.end())
return;
for(; it != _symAddrMap.end(); it++)
{
const SymbolInfo & sym = _symData[it.index];
const SymbolInfo & sym = _symData[it->index];
if(sym.rva > endRva)
{
break;
}
if(!cbEnum(sym))
{
break;

View File

@ -116,7 +116,7 @@ public:
virtual bool findSymbolExactOrLower(duint rva, SymbolInfo & symInfo) override;
virtual void enumSymbols(const CbEnumSymbol & cbEnum) override;
virtual void enumSymbols(const CbEnumSymbol & cbEnum, uint64_t beginRva, uint64_t endRva) override;
virtual bool findSourceLineInfo(duint rva, LineInfo & lineInfo) override;