summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2016-02-22 18:52:51 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2016-02-22 18:52:51 +0000
commit8e3cbde27d471ed207275cc3106f59c8d3cfa284 (patch)
treebc9fc762cf00c73097c943c18f38ff2ae4dd4d8d /compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
parent8c03c542002258ccf0197908904d5cb9767f2394 (diff)
downloadbcm5719-llvm-8e3cbde27d471ed207275cc3106f59c8d3cfa284.tar.gz
bcm5719-llvm-8e3cbde27d471ed207275cc3106f59c8d3cfa284.zip
[Sanitizer] Introduce ListOfModules object and use it to replace GetListOfModules().
Summary: This removes the hard limit on the number of loaded modules (used to be 16K), and makes it easier to use LoadedModules w/o causing a memory leak: ListOfModules owns the modules, and makes sure to properly clean them in destructor. Remove filtering functionality that is only needed in one place (LSan). Reviewers: aizatsky Subscribers: llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D17470 llvm-svn: 261554
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
index 9a9ec558a61..3477b065b06 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
@@ -72,16 +72,13 @@ void CovUpdateMapping(const char *coverage_dir, uptr caller_pc) {
InternalScopedString text(kMaxTextSize);
{
- InternalScopedBuffer<LoadedModule> modules(kMaxNumberOfModules);
- CHECK(modules.data());
- int n_modules = GetListOfModules(modules.data(), kMaxNumberOfModules,
- /* filter */ nullptr);
-
text.append("%d\n", sizeof(uptr) * 8);
- for (int i = 0; i < n_modules; ++i) {
- const char *module_name = StripModuleName(modules[i].full_name());
- uptr base = modules[i].base_address();
- for (const auto &range : modules[i].ranges()) {
+ ListOfModules modules;
+ modules.init();
+ for (const LoadedModule &module : modules) {
+ const char *module_name = StripModuleName(module.full_name());
+ uptr base = module.base_address();
+ for (const auto &range : module.ranges()) {
if (range.executable) {
uptr start = range.beg;
uptr end = range.end;
@@ -90,7 +87,6 @@ void CovUpdateMapping(const char *coverage_dir, uptr caller_pc) {
cached_mapping.SetModuleRange(start, end);
}
}
- modules[i].clear();
}
}
OpenPOWER on IntegriCloud