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

Unified Diff: tracing/bin/symbolize_trace

Issue 2698543003: Use absolute pcs and load locations to symbolize on macOS. (Closed)
Patch Set: Extract load address of a binary from otool. Created 3 years, 10 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: tracing/bin/symbolize_trace
diff --git a/tracing/bin/symbolize_trace b/tracing/bin/symbolize_trace
index adb26739cce3c75165c50ab153e0cb2cde19d0c3..9bc003efe2917b137356a8ea6433cb25b7d3e01d 100755
--- a/tracing/bin/symbolize_trace
+++ b/tracing/bin/symbolize_trace
@@ -23,6 +23,7 @@ sys.path.append(_SYMBOLS_PATH)
import symbols.elf_symbolizer as elf_symbolizer
import symbolize_trace_atos_regex
+import symbolize_trace_macho_reader
# Relevant trace event phases from Chromium's
@@ -95,8 +96,13 @@ class Symbolizer(object):
# 16 for the address, 2 for "0x", 1 for the space
chars_per_address = 19
+ region_start_address = (symbolize_trace_macho_reader.
DmitrySkiba 2017/02/16 21:19:45 Let's call this load_address ?
erikchen 2017/02/16 21:32:18 Done.
+ ReadMachOTextLoadAddress(symfile.symbolizable_path))
+ assert region_start_address is not None
+
cmd_base = [self.symbolizer_path, '-arch', 'x86_64', '-l',
- '0x0', '-o' , symfile.symbolizable_path]
+ '0x%x' % region_start_address, '-o',
+ symfile.symbolizable_path]
chars_for_other_arguments = len(' '.join(cmd_base)) + 1
# The maximum number of inputs that can be processed at once is limited by
@@ -110,10 +116,12 @@ class Symbolizer(object):
keys_to_process = all_keys[0:input_count]
cmd = list(cmd_base)
- cmd.extend([hex(int(x)) for x in keys_to_process])
+ cmd.extend([hex(int(x) + region_start_address)
DmitrySkiba 2017/02/16 21:19:45 This change seems to be noop, why are you making i
erikchen 2017/02/16 21:32:18 I don't understand your question. old code: hex(i
DmitrySkiba 2017/02/16 21:38:48 Oops, sorry, this line is fine. But the next line
erikchen 2017/02/16 21:43:21 previous version exceeded 80 column length
+ for x in keys_to_process])
output_array = subprocess.check_output(cmd).split('\n')
for i in range(len(keys_to_process)):
- for frame in symfile.frames_by_address.values()[i + processed_keys_count]:
+ for frame in (symfile.frames_by_address.values()
+ [i + processed_keys_count]):
frame.name = self._matcher.Match(output_array[i])
processed_keys_count += len(keys_to_process)
all_keys = all_keys[input_count:]
« no previous file with comments | « no previous file | tracing/bin/symbolize_trace_macho_reader.py » ('j') | tracing/bin/symbolize_trace_macho_reader.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698