Format address as a hex string when resolution fails

This commit is contained in:
Christophe Bedard 2019-08-09 13:09:05 +02:00
parent 4a41c2bd61
commit f13e9deb71
2 changed files with 6 additions and 1 deletions

View file

@ -139,6 +139,11 @@ class EventHandler(Dependant):
"""Register processor with this `EventHandler` so that it can query other handlers."""
self.processor = processor
@staticmethod
def _int_to_hex_str(addr: int) -> str:
"""Format an `int` into an hex `str`."""
return f'0x{addr:X}'
@classmethod
def process(cls, events: List[DictEvent], **kwargs) -> 'EventHandler':
"""

View file

@ -157,7 +157,7 @@ class ProfileHandler(EventHandler):
address = get_field(event, 'addr')
resolution = self._resolve_function_address(address)
if resolution is None:
resolution = str(address)
resolution = self._int_to_hex_str(address)
return resolution
def _resolve_function_address(