diff options
author | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-21 08:28:14 +0000 |
---|---|---|
committer | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-21 08:28:14 +0000 |
commit | bc6427c7309617bad39bd591fb9f37f701d3aa43 (patch) | |
tree | 71671dd69794dcfa466847f1a8a82e16ad51bb23 | |
parent | 2d996c29935912366c2e30863c5547eae17599b1 (diff) | |
download | chromium_src-bc6427c7309617bad39bd591fb9f37f701d3aa43.zip chromium_src-bc6427c7309617bad39bd591fb9f37f701d3aa43.tar.gz chromium_src-bc6427c7309617bad39bd591fb9f37f701d3aa43.tar.bz2 |
Make find_runtime_tools available for non-Chrome executables.
BUG=123750
TEST=None
NOTRY=True
Review URL: https://codereview.chromium.org/299753007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271872 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | tools/find_runtime_symbols/prepare_symbol_info.py | 3 | ||||
-rwxr-xr-x | tools/linux/procfs.py | 17 | ||||
-rwxr-xr-x | tools/linux/tests/procfs_tests.py | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/tools/find_runtime_symbols/prepare_symbol_info.py b/tools/find_runtime_symbols/prepare_symbol_info.py index 9bce545..17d34de 100755 --- a/tools/find_runtime_symbols/prepare_symbol_info.py +++ b/tools/find_runtime_symbols/prepare_symbol_info.py @@ -154,6 +154,9 @@ def prepare_symbol_info(maps_path, for target_path, host_path in alternative_dirs.iteritems(): if entry.name.startswith(target_path): binary_path = entry.name.replace(target_path, host_path, 1) + if not (ProcMaps.EXECUTABLE_PATTERN.match(binary_path) or + (os.path.isfile(binary_path) and os.access(binary_path, os.X_OK))): + continue nm_filename = _dump_command_result( 'nm -n --format bsd %s | c++filt' % binary_path, output_dir_path, os.path.basename(binary_path), '.nm') diff --git a/tools/linux/procfs.py b/tools/linux/procfs.py index 3451001..ef19b25 100755 --- a/tools/linux/procfs.py +++ b/tools/linux/procfs.py @@ -310,6 +310,9 @@ class ProcMaps(object): r'^([a-f0-9]+)-([a-f0-9]+)\s+(.)(.)(.)(.)\s+([a-f0-9]+)\s+(\S+):(\S+)\s+' r'(\d+)\s*(.*)$', re.IGNORECASE) + EXECUTABLE_PATTERN = re.compile( + r'\S+\.(so|dll|dylib|bundle)((\.\d+)+\w*(\.\d+){0,3})?') + def __init__(self): self._sorted_indexes = [] self._dictionary = {} @@ -373,22 +376,16 @@ class ProcMaps(object): @staticmethod def constants(entry): - return (entry.writable == '-' and entry.executable == '-' and re.match( - '\S+(\.(so|dll|dylib|bundle)|chrome)((\.\d+)+\w*(\.\d+){0,3})?', - entry.name)) + return entry.writable == '-' and entry.executable == '-' @staticmethod def executable(entry): - return (entry.executable == 'x' and re.match( - '\S+(\.(so|dll|dylib|bundle)|chrome)((\.\d+)+\w*(\.\d+){0,3})?', - entry.name)) + return entry.executable == 'x' @staticmethod def executable_and_constants(entry): - return (((entry.writable == '-' and entry.executable == '-') or - entry.executable == 'x') and re.match( - '\S+(\.(so|dll|dylib|bundle)|chrome)((\.\d+)+\w*(\.\d+){0,3})?', - entry.name)) + return ((entry.writable == '-' and entry.executable == '-') or + entry.executable == 'x') def _append_entry(self, entry): if self._sorted_indexes and self._sorted_indexes[-1] > entry.begin: diff --git a/tools/linux/tests/procfs_tests.py b/tools/linux/tests/procfs_tests.py index e1e837a..c829199 100755 --- a/tools/linux/tests/procfs_tests.py +++ b/tools/linux/tests/procfs_tests.py @@ -83,21 +83,21 @@ class ProcMapsTest(unittest.TestCase): def test_constants(self): maps = ProcMaps.load_file(cStringIO.StringIO(self._TEST_PROCMAPS)) - selected = [4, 7] + selected = [0, 2, 4, 7] for index, entry in enumerate(maps.iter(ProcMaps.constants)): self.assertEqual(entry.as_dict(), self._expected_as_dict(selected[index])) def test_executable(self): maps = ProcMaps.load_file(cStringIO.StringIO(self._TEST_PROCMAPS)) - selected = [3, 6] + selected = [1, 3, 6, 9] for index, entry in enumerate(maps.iter(ProcMaps.executable)): self.assertEqual(entry.as_dict(), self._expected_as_dict(selected[index])) def test_executable_and_constants(self): maps = ProcMaps.load_file(cStringIO.StringIO(self._TEST_PROCMAPS)) - selected = [3, 4, 6, 7] + selected = [0, 1, 2, 3, 4, 6, 7, 9] for index, entry in enumerate(maps.iter(ProcMaps.executable_and_constants)): self.assertEqual(entry.as_dict(), self._expected_as_dict(selected[index])) |