summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_common.h
diff options
context:
space:
mode:
authorKuba Mracek <mracek@apple.com>2017-01-06 19:34:54 +0000
committerKuba Mracek <mracek@apple.com>2017-01-06 19:34:54 +0000
commit0aad13bae1d86febf022d0c9b0299183e1d00f34 (patch)
treeaeaecb4e2e090ea3fcbe93677588a682f75a6081 /lib/sanitizer_common/sanitizer_common.h
parentd615dc8ac1e6e04b593eb7409b6ff609bc529761 (diff)
[sanitizer] Track which modules are instrumented in LoadedModule objects
This patch adds tracking which modules are instrumented and which are not. On macOS, instrumented modules link against the ASan/TSan/... dylib, so we can just check if such a load command exists or not. Differential Revision: https://reviews.llvm.org/D28263 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291268 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_common.h')
-rw-r--r--lib/sanitizer_common/sanitizer_common.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sanitizer_common/sanitizer_common.h b/lib/sanitizer_common/sanitizer_common.h
index 66c2d26fa..fee642f3e 100644
--- a/lib/sanitizer_common/sanitizer_common.h
+++ b/lib/sanitizer_common/sanitizer_common.h
@@ -672,13 +672,16 @@ const uptr kModuleUUIDSize = 16;
class LoadedModule {
public:
LoadedModule()
- : full_name_(nullptr), base_address_(0), arch_(kModuleArchUnknown) {
+ : full_name_(nullptr),
+ base_address_(0),
+ arch_(kModuleArchUnknown),
+ instrumented_(false) {
internal_memset(uuid_, 0, kModuleUUIDSize);
ranges_.clear();
}
void set(const char *module_name, uptr base_address);
void set(const char *module_name, uptr base_address, ModuleArch arch,
- u8 uuid[kModuleUUIDSize]);
+ u8 uuid[kModuleUUIDSize], bool instrumented);
void clear();
void addAddressRange(uptr beg, uptr end, bool executable);
bool containsAddress(uptr address) const;
@@ -687,6 +690,7 @@ class LoadedModule {
uptr base_address() const { return base_address_; }
ModuleArch arch() const { return arch_; }
const u8 *uuid() const { return uuid_; }
+ bool instrumented() const { return instrumented_; }
struct AddressRange {
AddressRange *next;
@@ -705,6 +709,7 @@ class LoadedModule {
uptr base_address_;
ModuleArch arch_;
u8 uuid_[kModuleUUIDSize];
+ bool instrumented_;
IntrusiveList<AddressRange> ranges_;
};