From 629786931e9579241aa5295a8628270efd51d323 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 17 Apr 2022 11:14:03 +0200 Subject: [PATCH] fixed address translation error for sections without symbols --- riscemu/MMU.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/riscemu/MMU.py b/riscemu/MMU.py index a455bd8..d44db2c 100644 --- a/riscemu/MMU.py +++ b/riscemu/MMU.py @@ -163,7 +163,7 @@ class MMU: name, val = x return address - val - best_fit = iter(sorted(filter(lambda x: x[1] <= address, sec.context.labels.items()), key=key)) + best_fit = sorted(filter(lambda x: x[1] <= address, sec.context.labels.items()), key=key) best = ('', float('inf')) for name, val in best_fit: @@ -178,7 +178,10 @@ class MMU: name, val = best if not name: - return "unknown at 0x{:0x}".format(address) + return "{}:{} + 0x{:x} (0x{:x})".format( + sec.owner, sec.name, + address - sec.base, address + ) return str('{}:{} at {} (0x{:0x}) + 0x{:0x}'.format( sec.owner, sec.name, name, val, address - val