Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: tools/memory_inspector/memory_inspector/backends/android/memdump_parser.py

Issue 550093003: [Android] Add 64-bit support to memdump (and memory_inspector parser) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/memory_inspector/memory_inspector/backends/android/memdump_parser.py
diff --git a/tools/memory_inspector/memory_inspector/backends/android/memdump_parser.py b/tools/memory_inspector/memory_inspector/backends/android/memdump_parser.py
index 0bb7004a54ac321a298287ce89620a871531377b..a60ea2503ffdbfa9686b86ee2ff7056746edd511 100644
--- a/tools/memory_inspector/memory_inspector/backends/android/memdump_parser.py
+++ b/tools/memory_inspector/memory_inspector/backends/android/memdump_parser.py
@@ -42,7 +42,8 @@ def Parse(lines):
An instance of |memory_map.Map|.
"""
RE = (r'^([0-9a-f]+)-([0-9a-f]+)\s+'
- r'([rwxps-]{4})\s*.*?'
+ r'([rwxps-]{4})\s+'
+ r'([0-9a-f]+)\s+'
r'private_unevictable=(\d+) private=(\d+) '
r'shared_app=(.*?) '
r'shared_other_unevictable=(\d+) shared_other=(\d+) '
@@ -64,20 +65,23 @@ def Parse(lines):
logging.warning('Skipping unrecognized memdump line "%s"' % line)
continue
- # TODO(primiano): proper offset handling requires a change in memdump. In
- # the meanwhile, it should pretty safe assuming zero-offset for libs (for
- # symbolization). Also, offsets for other mappings don't really matter.
+ start = int(m.group(1), 16)
+ end = int(m.group(2), 16) - 1 # end addr is inclusive in memdump output.
+ if (start > end):
+ # Sadly, this actually happened. Probably a kernel bug, see b/17402069.
+ logging.warning('Skipping unfeasible mmap "%s"' % line)
+ continue
entry = memory_map.MapEntry(
- start=int(m.group(1), 16),
- end=int(m.group(2), 16) - 1, # end addr is inclusive in memdump output.
+ start=start,
+ end=end,
prot_flags=m.group(3),
- mapped_file=m.group(9),
- mapped_offset=0)
- entry.priv_dirty_bytes = int(m.group(4))
- entry.priv_clean_bytes = int(m.group(5)) - entry.priv_dirty_bytes
- entry.shared_dirty_bytes = int(m.group(7))
- entry.shared_clean_bytes = int(m.group(8)) - entry.shared_dirty_bytes
- entry.resident_pages = [ord(c) for c in base64.b64decode(m.group(10))]
+ mapped_file=m.group(10),
+ mapped_offset=int(m.group(4), 16))
+ entry.priv_dirty_bytes = int(m.group(5))
+ entry.priv_clean_bytes = int(m.group(6)) - entry.priv_dirty_bytes
+ entry.shared_dirty_bytes = int(m.group(8))
+ entry.shared_clean_bytes = int(m.group(9)) - entry.shared_dirty_bytes
+ entry.resident_pages = [ord(c) for c in base64.b64decode(m.group(11))]
maps.Add(entry)
return maps

Powered by Google App Engine
This is Rietveld 408576698