summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/DebugData.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-04-05 19:13:03 -0700
committerChristopher Ferris <cferris@google.com>2017-04-06 15:30:42 -0700
commit2b2b25b87827102671cdd4b25c01aa22a9971a63 (patch)
treed318825c7548379a307beee5b78580e51ce97a52 /libc/malloc_debug/DebugData.cpp
parente06c69d07324f3da67aa063202e698dedd831365 (diff)
Refactor Config from a struct to a class.
This should make it easier to add new options, and to add options that are complex. For example, I want to modify the behavior of record_allocs_file so that it also enables record_allocs to a default state. Test: All unit tests pass. Test: Enable the backtrace option and restart. Change-Id: Idf5cdeed06ade3bc2c8ae39d228734bf65209b4f
Diffstat (limited to 'libc/malloc_debug/DebugData.cpp')
-rw-r--r--libc/malloc_debug/DebugData.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/libc/malloc_debug/DebugData.cpp b/libc/malloc_debug/DebugData.cpp
index 339efdf1b..e9974d7c3 100644
--- a/libc/malloc_debug/DebugData.cpp
+++ b/libc/malloc_debug/DebugData.cpp
@@ -38,54 +38,54 @@
#include "TrackData.h"
bool DebugData::Initialize(const char* options) {
- if (!config_.Set(options)) {
+ if (!config_.Init(options)) {
return false;
}
// Check to see if the options that require a header are enabled.
- if (config_.options & HEADER_OPTIONS) {
+ if (config_.options() & HEADER_OPTIONS) {
need_header_ = true;
// Initialize all of the static header offsets.
pointer_offset_ = BIONIC_ALIGN(sizeof(Header), MINIMUM_ALIGNMENT_BYTES);
- if (config_.options & BACKTRACE) {
+ if (config_.options() & BACKTRACE) {
backtrace.reset(new BacktraceData(this, config_, &pointer_offset_));
if (!backtrace->Initialize(config_)) {
return false;
}
}
- if (config_.options & FRONT_GUARD) {
+ if (config_.options() & FRONT_GUARD) {
front_guard.reset(new FrontGuardData(this, config_, &pointer_offset_));
}
extra_bytes_ = pointer_offset_;
// Initialize all of the non-header data.
- if (config_.options & REAR_GUARD) {
+ if (config_.options() & REAR_GUARD) {
rear_guard.reset(new RearGuardData(this, config_));
- extra_bytes_ += config_.rear_guard_bytes;
+ extra_bytes_ += config_.rear_guard_bytes();
}
- if (config_.options & FREE_TRACK) {
+ if (config_.options() & FREE_TRACK) {
free_track.reset(new FreeTrackData(this, config_));
}
- if (config_.options & TRACK_ALLOCS) {
+ if (config_.options() & TRACK_ALLOCS) {
track.reset(new TrackData(this));
}
}
- if (config_.options & RECORD_ALLOCS) {
+ if (config_.options() & RECORD_ALLOCS) {
record.reset(new RecordData());
if (!record->Initialize(config_)) {
return false;
}
}
- if (config_.options & EXPAND_ALLOC) {
- extra_bytes_ += config_.expand_alloc_bytes;
+ if (config_.options() & EXPAND_ALLOC) {
+ extra_bytes_ += config_.expand_alloc_bytes();
}
return true;
}