From f13e9deb714367917e27f505c7fea6d2d98d8cfe Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Fri, 9 Aug 2019 13:09:05 +0200 Subject: [PATCH] Format address as a hex string when resolution fails --- .../tracetools_analysis/processor/__init__.py | 5 +++++ tracetools_analysis/tracetools_analysis/processor/profile.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tracetools_analysis/tracetools_analysis/processor/__init__.py b/tracetools_analysis/tracetools_analysis/processor/__init__.py index 3dd958d..a6913a8 100644 --- a/tracetools_analysis/tracetools_analysis/processor/__init__.py +++ b/tracetools_analysis/tracetools_analysis/processor/__init__.py @@ -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': """ diff --git a/tracetools_analysis/tracetools_analysis/processor/profile.py b/tracetools_analysis/tracetools_analysis/processor/profile.py index a92443b..c1ec63f 100644 --- a/tracetools_analysis/tracetools_analysis/processor/profile.py +++ b/tracetools_analysis/tracetools_analysis/processor/profile.py @@ -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(