Commit a4d46091 authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

Orderfile: Treat unknown offsets as error

We found that encountering unknown offsets from profile information may
indicate that the data is seriously offset (pun intended). It does not
happen now on the orderfile bot, and we would like to know when it
happens next. Converting this situation to error.

Bug: 893981
Change-Id: Ibabe4b39886afa4e3a228f9e3910df5d0bcf91cf
Reviewed-on: https://chromium-review.googlesource.com/c/1340328Reviewed-by: default avatarMatthew Cary <mattcary@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608810}
parent e4fe8c25
...@@ -232,21 +232,15 @@ class SymbolOffsetProcessor(object): ...@@ -232,21 +232,15 @@ class SymbolOffsetProcessor(object):
""" """
dump_offset_to_symbol_info = self._GetDumpOffsetToSymbolInfo() dump_offset_to_symbol_info = self._GetDumpOffsetToSymbolInfo()
logging.info('Offset to Symbol size = %d', len(dump_offset_to_symbol_info)) logging.info('Offset to Symbol size = %d', len(dump_offset_to_symbol_info))
offsets_not_found = 0
for i in items: for i in items:
dump_offset = get(i) dump_offset = get(i)
idx = dump_offset / 2 idx = dump_offset / 2
assert dump_offset >= 0 and idx < len(dump_offset_to_symbol_info), ( assert dump_offset >= 0 and idx < len(dump_offset_to_symbol_info), (
'Dump offset out of binary range') 'Dump offset out of binary range')
symbol_info = dump_offset_to_symbol_info[idx] symbol_info = dump_offset_to_symbol_info[idx]
if symbol_info is None: assert symbol_info, ('A return address (offset = 0x{:08x}) does not map '
offsets_not_found += 1 'to any symbol'.format(dump_offset))
update(i, None) update(i, symbol_info.offset)
else:
update(i, symbol_info.offset)
if offsets_not_found:
logging.warning('%d return addresses don\'t map to any symbol',
offsets_not_found)
def _GetDumpOffsetToSymbolInfo(self): def _GetDumpOffsetToSymbolInfo(self):
"""Computes an array mapping each word in .text to a symbol. """Computes an array mapping each word in .text to a symbol.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment