forked from OSchip/llvm-project
[sanitizer] Filtering in GetListOfModules.
llvm-svn: 181791
This commit is contained in:
parent
f1efb256f6
commit
4b603e5c50
|
@ -383,7 +383,8 @@ class Symbolizer {
|
|||
modules_ = (LoadedModule*)(symbolizer_allocator.Allocate(
|
||||
kMaxNumberOfModuleContexts * sizeof(LoadedModule)));
|
||||
CHECK(modules_);
|
||||
n_modules_ = GetListOfModules(modules_, kMaxNumberOfModuleContexts);
|
||||
n_modules_ = GetListOfModules(modules_, kMaxNumberOfModuleContexts,
|
||||
/* filter */ 0);
|
||||
// FIXME: Return this check when GetListOfModules is implemented on Mac.
|
||||
// CHECK_GT(n_modules_, 0);
|
||||
CHECK_LT(n_modules_, kMaxNumberOfModuleContexts);
|
||||
|
|
|
@ -107,8 +107,11 @@ bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
|
|||
|
||||
// OS-dependent function that fills array with descriptions of at most
|
||||
// "max_modules" currently loaded modules. Returns the number of
|
||||
// initialized modules.
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules);
|
||||
// initialized modules. If filter is nonzero, ignores modules for which
|
||||
// filter(full_name) is false.
|
||||
typedef bool (*string_predicate_t)(const char *);
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules,
|
||||
string_predicate_t filter);
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ struct DlIteratePhdrData {
|
|||
LoadedModule *modules;
|
||||
uptr current_n;
|
||||
uptr max_n;
|
||||
string_predicate_t filter;
|
||||
};
|
||||
|
||||
static const uptr kMaxPathLength = 512;
|
||||
|
@ -161,6 +162,8 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) {
|
|||
}
|
||||
if (module_name.data()[0] == '\0')
|
||||
return 0;
|
||||
if (data->filter && !data->filter(module_name.data()))
|
||||
return 0;
|
||||
void *mem = &data->modules[data->current_n];
|
||||
LoadedModule *cur_module = new(mem) LoadedModule(module_name.data(),
|
||||
info->dlpi_addr);
|
||||
|
@ -176,9 +179,10 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules,
|
||||
string_predicate_t filter) {
|
||||
CHECK(modules);
|
||||
DlIteratePhdrData data = {modules, 0, max_modules};
|
||||
DlIteratePhdrData data = {modules, 0, max_modules, filter};
|
||||
dl_iterate_phdr(dl_iterate_phdr_cb, &data);
|
||||
return data.current_n;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
|
|||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules,
|
||||
string_predicate_t filter) {
|
||||
// FIXME: Actually implement this on Mac. Just using MemoryMappingLayout
|
||||
// may be enough for this on Mac.
|
||||
return 0;
|
||||
|
|
|
@ -26,7 +26,8 @@ bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
|
|||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
|
||||
uptr GetListOfModules(LoadedModule *modules, uptr max_modules,
|
||||
string_predicate_t filter) {
|
||||
UNIMPLEMENTED();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue