Skip to content

Commit

Permalink
fixed symbols not getting displaued if symbol size is 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
hardik05 committed Jul 25, 2019
1 parent 9fa63aa commit 01d7218
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion winappdbg/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,25 @@ def resolve_symbol(self, symbol, bCaseSensitive = False):
if symbol == SymbolName.lower():
return SymbolAddress

def get_symbol_from_list(self,address):
found = None
SymList = {}
SortedSymList = {}

for (SymbolName, SymbolAddress, SymbolSize) in self.iter_symbols():
SymList[SymbolAddress] = SymbolName
SortedSymList = sorted(SymList.items())
for SymbolAddress,SymbolName in SortedSymList:
if SymbolAddress < address:
SymbolStartAddress = SymbolAddress
SymbolStartName = SymbolName
else:
continue
found = (SymbolStartName, SymbolStartAddress, 0)
return found



def get_symbol_at_address(self, address):
"""
Tries to find the closest matching symbol for the given address.
Expand All @@ -601,13 +620,15 @@ def get_symbol_at_address(self, address):
"""
found = None
for (SymbolName, SymbolAddress, SymbolSize) in self.iter_symbols():

if SymbolAddress > address:
continue
if SymbolAddress + SymbolSize > address:
if not found or found[1] < SymbolAddress:
found = (SymbolName, SymbolAddress, SymbolSize)
if found == None:
found = self.get_symbol_from_list(address)
return found

#------------------------------------------------------------------------------

def get_label(self, function = None, offset = None):
Expand Down

0 comments on commit 01d7218

Please sign in to comment.