From e3503620cd37970ff65258c7035253934c0e262f Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 3 Aug 2018 13:20:14 -0700 Subject: [PATCH] Fix GetMappingFromOffset Fixed backward calculation of mapping offset. Added logic to page align the data offset for uncompressed shared objects. This fixes symbolization. Bug: 111268230 Test: inspect native heap dump for the Camera app Change-Id: If1af41e7265f017c1a691008309c8a002d5f588e --- scripts/native_heapdump_viewer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/native_heapdump_viewer.py b/scripts/native_heapdump_viewer.py index b5fad3e25..05df0a6bc 100755 --- a/scripts/native_heapdump_viewer.py +++ b/scripts/native_heapdump_viewer.py @@ -198,8 +198,12 @@ def GetMappingFromOffset(mapping, app_symboldir): + len(file_info.comment)) end_offset = data_offset + file_info.file_size if mapping.offset >= data_offset and mapping.offset < end_offset: + # Round up the data_offset to the nearest page since the .so must be aligned. + so_file_alignment = 4096 + data_offset += so_file_alignment - 1; + data_offset -= data_offset % so_file_alignment; mapping.name = file_info.filename - mapping.offset = data_offset - mapping.offset + mapping.offset -= data_offset break return mapping