Small refactor.
- Move all ScopedDisableDebugCalls into the debug_XXX calls. This avoids
any issues that might arise where every part of the code needs to properly
guard anything that might allocate. Instead everything is already guarded.
- Add a pointer to debug_data in all of the XXData classes. This avoids
calling individual functions passing in the debug_data pointer.
- Flip the NO_HEADER_OPTIONS to an explicit HEADER_OPTIONS list since fewer
options actually require a header.
- Move the extern of g_debug to the DebugData.h header.
Change-Id: Ia213a391b4a44d9ce122a709d09fe4f1b5426f36
diff --git a/libc/malloc_debug/TrackData.h b/libc/malloc_debug/TrackData.h
index 1234316..fcd8f2a 100644
--- a/libc/malloc_debug/TrackData.h
+++ b/libc/malloc_debug/TrackData.h
@@ -37,14 +37,16 @@
#include <private/bionic_macros.h>
+#include "OptionData.h"
+
// Forward declarations.
struct Header;
struct Config;
class DebugData;
-class TrackData {
+class TrackData : public OptionData {
public:
- TrackData() = default;
+ TrackData(DebugData* debug_data);
virtual ~TrackData() = default;
void GetList(std::vector<const Header*>* list);
@@ -55,10 +57,10 @@
bool Contains(const Header *header);
- void GetInfo(DebugData& debug, uint8_t** info, size_t* overall_size,
- size_t* info_size, size_t* total_memory, size_t* backtrace_size);
+ void GetInfo(uint8_t** info, size_t* overall_size, size_t* info_size,
+ size_t* total_memory, size_t* backtrace_size);
- void DisplayLeaks(DebugData& debug);
+ void DisplayLeaks();
void PrepareFork() { pthread_mutex_lock(&mutex_); }
void PostForkParent() { pthread_mutex_unlock(&mutex_); }