From aa33c8e96a1ad3aaaedebeb33c2f6a9d797440e6 Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 2 Dec 2016 10:45:45 -0600 Subject: [PATCH] Improve python probe listing. * python/stap-resolve-module-function.py (_find_wildcarded_modules): Just ignore C builtin modules and C extensions instead of raising errors. (resolve_patterns): Don't clear the returned list of matches between wildcards. --- python/stap-resolve-module-function.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python/stap-resolve-module-function.py b/python/stap-resolve-module-function.py index bbb433b8c..e686ef731 100644 --- a/python/stap-resolve-module-function.py +++ b/python/stap-resolve-module-function.py @@ -207,10 +207,11 @@ def _find_wildcarded_modules(modpattern, path=None): # since the loop above should only return full paths. raise ImportError('Unhandled package directory ' + fm) elif descr[2] == imp.C_BUILTIN: - raise ImportError('No python source for builtin module ' + fm) + # Just ignore + continue elif descr[2] == imp.C_EXTENSION: - raise ImportError('No python source for C extension module ' - + fm) + # Just ignore + continue else: raise ImportError('Unknown descr: %d for module' % descr[2], fm) @@ -349,6 +350,9 @@ def resolve_patterns(module_pattern, function_pattern): if _verbose: _eprint("modpattern_list: %s" % modpattern_list) + ret_list = [] + ret_list_format = '%s %s@%s:%d' + ret_list_flag_format = '%s %s@%s:%d %s' for (mp, p) in modpattern_list: # Try to load the source for the module(s). if _verbose: @@ -356,9 +360,6 @@ def resolve_patterns(module_pattern, function_pattern): results = _find_wildcarded_modules(mp, p) if _verbose: _eprint('_find_wildcarded_modules() returned %s' % results) - ret_list = [] - ret_list_format = '%s %s@%s:%d' - ret_list_flag_format = '%s %s@%s:%d %s' for (module, f, filename, descr) in results: if _verbose: _eprint("Loading source for module '%s'" % module) -- 2.43.5