bloat.py: support for 16bit and 64bit architectures
The parse_nm() function assumed that symbol sizes were 8 hex
characters, this only holds true on 32 bit architectures, on 64 bit
they're 16, and 4 on 16 bit.
Just use + in the regex instead of {8}. Due to the surrounding spaces
this won't falsely match anything, but it'll add support for 16 and 64
bit.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
diff --git a/bloat.py b/bloat.py
index e9d58f6..d7fc126 100755
--- a/bloat.py
+++ b/bloat.py
@@ -41,12 +41,12 @@
"""
# Match lines with size + symbol + optional filename.
- sym_re = re.compile(r'^[0-9a-f]{8} ([0-9a-f]{8}) (.) ([^\t]+)(?:\t(.*):\d+)?$')
+ sym_re = re.compile(r'^[0-9a-f]+ ([0-9a-f]+) (.) ([^\t]+)(?:\t(.*):\d+)?$')
# Match lines with addr but no size.
- addr_re = re.compile(r'^[0-9a-f]{8} (.) ([^\t]+)(?:\t.*)?$')
+ addr_re = re.compile(r'^[0-9a-f]+ (.) ([^\t]+)(?:\t.*)?$')
# Match lines that don't have an address at all -- typically external symbols.
- noaddr_re = re.compile(r'^ {8} (.) (.*)$')
+ noaddr_re = re.compile(r'^ + (.) (.*)$')
for line in input:
line = line.rstrip()