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

Unified Diff: tools/cygprofile/symbol_extractor.py

Issue 947073003: Improve symbol_extractor.CreateNameToSymbolInfo handling of duplicate symbols. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cygprofile/symbol_extractor.py
diff --git a/tools/cygprofile/symbol_extractor.py b/tools/cygprofile/symbol_extractor.py
index 81c6e66d8fbca2805ba8b7c673d12eb18a3d8d14..fa8c45065b73a29afcf6f8629a48f8a4a28949d8 100755
--- a/tools/cygprofile/symbol_extractor.py
+++ b/tools/cygprofile/symbol_extractor.py
@@ -6,6 +6,7 @@
"""Utilities to get and manipulate symbols from a binary."""
import collections
+import logging
import os
import re
import subprocess
@@ -116,4 +117,21 @@ def CreateNameToSymbolInfo(symbol_infos):
Returns:
a dict {name: symbol_info, ...}
"""
- return {symbol_info.name: symbol_info for symbol_info in symbol_infos}
+ symbol_infos_by_name = {}
Benoit L 2015/02/23 14:09:49 This function no longer does what it says in its d
azarchs 2015/02/23 15:39:37 I'd say it's functionality relative the documentat
+ duplicated_symbols = set()
pasko 2015/02/23 14:28:13 They rather 'collided' than were 'duplicated'. So
azarchs 2015/02/23 15:39:37 Done.
+ for symbol_info in symbol_infos:
+ if symbol_info.name in symbol_infos_by_name:
+ # If a symbol appears at multiple offsets, keep the lowest offset.
+ duplicated_symbols.add(symbol_info.name)
+ if symbol_infos_by_name[symbol_info.name].offset > symbol_info.offset:
+ symbol_infos_by_name[symbol_info.name] = symbol_info
+ else:
+ symbol_infos_by_name[symbol_info.name] = symbol_info
+ if len(duplicated_symbols) > 0:
+ logging.warning('%d symbols were found at more than one offset.' %
+ len(duplicated_symbols))
+ duplicated_symbols_to_show = min(50, len(duplicated_symbols))
+ logging.warning('First %d duplicated symbols:\n%s' % (
pasko 2015/02/23 14:28:13 I would prefer warning level on the level of check
azarchs 2015/02/23 15:39:38 Done.
+ duplicated_symbols_to_show,
+ '\n'.join(list(duplicated_symbols)[:duplicated_symbols_to_show])))
+ return symbol_infos_by_name
« 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