Chromium Code Reviews| Index: tools/ll_prof.py |
| diff --git a/tools/ll_prof.py b/tools/ll_prof.py |
| index 409b39691775ff898d4f93ecb3fd2283976a051e..3fcf4174fc09edd5c28f6456fc8d5242d82754f9 100755 |
| --- a/tools/ll_prof.py |
| +++ b/tools/ll_prof.py |
| @@ -711,6 +711,22 @@ class LibraryRepo(object): |
| self.names = set() |
| self.ticks = {} |
| + |
| + def HasDynamicSymbols(self, filename): |
| + if filename.endswith(".ko"): return False |
| + process = subprocess.Popen( |
| + "%s -h %s" % (OBJDUMP_BIN, filename), |
| + shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| + pipe = process.stdout |
| + try: |
| + for line in pipe: |
| + match = OBJDUMP_SECTION_HEADER_RE.match(line) |
| + if match and match.group(1) == 'dynsym': return True |
| + finally: |
| + pipe.close() |
| + assert process.wait() == 0, "Failed to objdump -h %s" % filename |
|
ulan
2015/03/16 08:58:05
Let's make the result explicit instead of returnin
|
| + |
| + |
| def Load(self, mmap_info, code_map, options): |
| # Skip kernel mmaps when requested using the fact that their tid |
| # is 0. |
| @@ -730,10 +746,10 @@ class LibraryRepo(object): |
| # Unfortunately, section headers span two lines, so we have to |
| # keep the just seen section name (from the first line in each |
| # section header) in the after_section variable. |
| - if mmap_info.filename.endswith(".ko"): |
| - dynamic_symbols = "" |
| - else: |
| + if self.HasDynamicSymbols(mmap_info.filename): |
| dynamic_symbols = "-T" |
| + else: |
| + dynamic_symbols = "" |
| process = subprocess.Popen( |
| "%s -h -t %s -C %s" % (OBJDUMP_BIN, dynamic_symbols, mmap_info.filename), |
| shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |