summaryrefslogtreecommitdiffstats
path: root/tools/binary_size
diff options
context:
space:
mode:
authorbratell <bratell@opera.com>2016-01-29 08:49:04 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-29 16:50:39 +0000
commit9a8e892c20f14492af3cade9c6444de4e1267c1a (patch)
tree45677d34eba86c49f5ee1976d511e16198331c6c /tools/binary_size
parent274e3892f28f3728168a22cccdbb43e3f35e2de8 (diff)
downloadchromium_src-9a8e892c20f14492af3cade9c6444de4e1267c1a.zip
chromium_src-9a8e892c20f14492af3cade9c6444de4e1267c1a.tar.gz
chromium_src-9a8e892c20f14492af3cade9c6444de4e1267c1a.tar.bz2
[BinarySize] Filter duplicate lines in nm output.
nm just outputs the symbols it finds in the debug sections of the binary and sometimes the same symbol appears more than once, with the exact same data. The binary_size tool would think that it was two different symbols that shared the same address so it would get the numbers right, but the output would be confusing since the memory would be split in two halves. BUG= Review URL: https://codereview.chromium.org/1645843004 Cr-Commit-Position: refs/heads/master@{#372359}
Diffstat (limited to 'tools/binary_size')
-rw-r--r--tools/binary_size/OWNERS3
-rw-r--r--tools/binary_size/binary_size_utils.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/tools/binary_size/OWNERS b/tools/binary_size/OWNERS
new file mode 100644
index 0000000..c598cde
--- /dev/null
+++ b/tools/binary_size/OWNERS
@@ -0,0 +1,3 @@
+andrewhayden@chromium.org
+bratell@opera.com
+primiano@chromium.org
diff --git a/tools/binary_size/binary_size_utils.py b/tools/binary_size/binary_size_utils.py
index 5521ba7..67335c2 100644
--- a/tools/binary_size/binary_size_utils.py
+++ b/tools/binary_size/binary_size_utils.py
@@ -35,8 +35,14 @@ def ParseNm(nm_lines):
# Match lines with no symbol name, only addr and type
addr_only_re = re.compile(r'^[0-9a-f]{8,} (.)$')
+ seen_lines = set()
for line in nm_lines:
line = line.rstrip()
+ if line in seen_lines:
+ # nm outputs identical lines at times. We don't want to treat
+ # those as distinct symbols because that would make no sense.
+ continue
+ seen_lines.add(line)
match = sym_re.match(line)
if match:
address, size, sym_type, sym = match.groups()[0:4]