Skip to content

Commit

Permalink
android: Fix tools/android/native_lib_memory/extract_symbols.py.
Browse files Browse the repository at this point in the history
https://chromium-review.googlesource.com/c/chromium/src/+/897563 broke
the script, by removing a toplevel function in cyglog_to_orderfile.py.
Putting it back on.

Change-Id: Iee508e5752e209c380da2d1a35e89fcff6bc6400
Reviewed-on: https://chromium-review.googlesource.com/951603
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541126}
  • Loading branch information
Benoit Lize authored and Commit Bot committed Mar 6, 2018
1 parent f9f3bc0 commit d6bc18f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tools/android/native_lib_memory/extract_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def GetSymbolNameToFilename(build_directory):
of the output_directory part.
"""
path = os.path.join(build_directory, 'obj')
object_filenames = cyglog_to_orderfile.GetObjectFileNames(path)
object_filenames = cyglog_to_orderfile.GetObjectFilenames(path)
pool = multiprocessing.Pool()
symbol_infos_filename = zip(
pool.map(symbol_extractor.SymbolInfosFromBinary, object_filenames),
Expand Down
19 changes: 12 additions & 7 deletions tools/cygprofile/cyglog_to_orderfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ def __str__(self):
return repr(self.value)


def GetObjectFilenames(obj_dir):
"""Returns all a list of .o files in a given directory tree."""
obj_files = []
# Scan _obj_dir recursively for .o files.
for (dirpath, _, filenames) in os.walk(obj_dir):
for file_name in filenames:
if file_name.endswith('.o'):
obj_files.append(os.path.join(dirpath, file_name))
return obj_files


class ObjectFileProcessor(object):
"""Processes symbols found in the object file tree.
Expand Down Expand Up @@ -107,13 +118,7 @@ def _SameCtorOrDtorNames(cls, symbol1, symbol2):
symbol_extractor.DemangleSymbol(symbol2))

def _GetAllSymbolInfos(self):
obj_files = []
# Scan _obj_dir recursively for .o files.
for (dirpath, _, filenames) in os.walk(self._obj_dir):
for file_name in filenames:
if file_name.endswith('.o'):
obj_files.append(os.path.join(dirpath, file_name))

obj_files = GetObjectFilenames(self._obj_dir)
pool = multiprocessing.Pool()
# Hopefully the object files are in the page cache at this point as
# typically the library has just been built before the object files are
Expand Down

0 comments on commit d6bc18f

Please sign in to comment.