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

Side by Side Diff: tools/disasm.py

Issue 2834853002: [grokdump] Include -z flag to make objdump disassemble all-zero sections (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2011 the V8 project authors. All rights reserved. 3 # Copyright 2011 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 import re 31 import re
32 import subprocess 32 import subprocess
33 import tempfile 33 import tempfile
34 34
35 35
36 # Avoid using the slow (google-specific) wrapper around objdump. 36 # Avoid using the slow (google-specific) wrapper around objdump.
37 OBJDUMP_BIN = "/usr/bin/objdump" 37 OBJDUMP_BIN = "/usr/bin/objdump"
38 if not os.path.exists(OBJDUMP_BIN): 38 if not os.path.exists(OBJDUMP_BIN):
39 OBJDUMP_BIN = "objdump" 39 OBJDUMP_BIN = "objdump"
40 40
41 41 # -M intel-mnemonic selects Intel syntax.
42 _COMMON_DISASM_OPTIONS = ["-M", "intel-mnemonic", "-C"] 42 # -C demangles.
43 # -z disables skipping over sections of zeroes.
44 _COMMON_DISASM_OPTIONS = ["-M", "intel-mnemonic", "-C", "-z"]
43 45
44 _DISASM_HEADER_RE = re.compile(r"[a-f0-9]+\s+<.*:$") 46 _DISASM_HEADER_RE = re.compile(r"[a-f0-9]+\s+<.*:$")
45 _DISASM_LINE_RE = re.compile(r"\s*([a-f0-9]+):\s*(\S.*)") 47 _DISASM_LINE_RE = re.compile(r"\s*([a-f0-9]+):\s*(\S.*)")
46 48
47 # Keys must match constants in Logger::LogCodeInfo. 49 # Keys must match constants in Logger::LogCodeInfo.
48 _ARCH_MAP = { 50 _ARCH_MAP = {
49 "ia32": "-m i386", 51 "ia32": "-m i386",
50 "x64": "-m i386 -M x86-64", 52 "x64": "-m i386 -M x86-64",
51 "arm": "-m arm", # Not supported by our objdump build. 53 "arm": "-m arm", # Not supported by our objdump build.
52 "mips": "-m mips", # Not supported by our objdump build. 54 "mips": "-m mips", # Not supported by our objdump build.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 break 89 break
88 if tmp_name: 90 if tmp_name:
89 os.unlink(tmp_name) 91 os.unlink(tmp_name)
90 split_lines = [] 92 split_lines = []
91 for line in lines[header_line + 1:]: 93 for line in lines[header_line + 1:]:
92 match = _DISASM_LINE_RE.match(line) 94 match = _DISASM_LINE_RE.match(line)
93 if match: 95 if match:
94 line_address = int(match.group(1), 16) 96 line_address = int(match.group(1), 16)
95 split_lines.append((line_address, match.group(2))) 97 split_lines.append((line_address, match.group(2)))
96 return split_lines 98 return split_lines
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698