summaryrefslogtreecommitdiffstats
path: root/tools/find_runtime_symbols
diff options
context:
space:
mode:
authordmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-10 04:42:03 +0000
committerdmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-10 04:42:03 +0000
commite55a12baa69f48e955981366cb90bf6ef41ed976 (patch)
treec3ade4745d0c53fe6192a19ecf8392c936ab718d /tools/find_runtime_symbols
parentedb25feb5bbec764aa88f50105f120e593fbb34b (diff)
downloadchromium_src-e55a12baa69f48e955981366cb90bf6ef41ed976.zip
chromium_src-e55a12baa69f48e955981366cb90bf6ef41ed976.tar.gz
chromium_src-e55a12baa69f48e955981366cb90bf6ef41ed976.tar.bz2
Add hash values in preparing symbol information.
BUG=172837 NOTRY=True Review URL: https://chromiumcodereview.appspot.com/12096034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/find_runtime_symbols')
-rwxr-xr-xtools/find_runtime_symbols/prepare_symbol_info.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/find_runtime_symbols/prepare_symbol_info.py b/tools/find_runtime_symbols/prepare_symbol_info.py
index 2e82876..1693288 100755
--- a/tools/find_runtime_symbols/prepare_symbol_info.py
+++ b/tools/find_runtime_symbols/prepare_symbol_info.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import hashlib
import json
import logging
import os
@@ -175,6 +176,19 @@ def prepare_symbol_info(maps_path,
files[entry.name]['readelf-debug-decodedline-file'] = {
'file': os.path.basename(readelf_debug_decodedline_file)}
+ files[entry.name]['size'] = os.stat(entry.name).st_size
+
+ with open(entry.name, 'rb') as entry_f:
+ md5 = hashlib.md5()
+ sha1 = hashlib.sha1()
+ chunk = entry_f.read(1024 * 1024)
+ while chunk:
+ md5.update(chunk)
+ sha1.update(chunk)
+ chunk = entry_f.read(1024 * 1024)
+ files[entry.name]['sha1'] = sha1.hexdigest()
+ files[entry.name]['md5'] = md5.hexdigest()
+
with open(os.path.join(output_dir_path, 'files.json'), 'w') as f:
json.dump(files, f, indent=2, sort_keys=True)