From 1de3fa51c9662e2b6f79aedb959c62f229bec3f3 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 2 Jun 2021 18:26:33 +0200 Subject: [PATCH] elf_mem_map: decode doubles correctly --- tools/elf_mem_map | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/elf_mem_map b/tools/elf_mem_map index aad957b9..32f178dc 100755 --- a/tools/elf_mem_map +++ b/tools/elf_mem_map @@ -126,7 +126,8 @@ def annotate_refs(grefs, addr, data, width=45, gaps=True): buf_repr += ' I:' + str(int.from_bytes(buf, 'big')).rjust(10) if len(buf) in [4, 8]: # attempt to decode as floats - buf_repr += ' F:' + '{:10.3f}'.format(unpack('f', buf)[0]) + typ = 'f' if len(buf) == 4 else 'd' + buf_repr += ' F:' + '{:10.3f}'.format(unpack(typ, buf)[0]) if gaps and last_end is not None and last_end < pos: # decode gaps