Index: lib/sanitizer_common/sanitizer_common.h =================================================================== --- lib/sanitizer_common/sanitizer_common.h +++ lib/sanitizer_common/sanitizer_common.h @@ -128,6 +128,14 @@ void RunMallocHooks(const void *ptr, uptr size); void RunFreeHooks(const void *ptr); +typedef void (*fill_profile_f)(uptr start, uptr rss, bool file, + /*out*/uptr *stats, uptr stats_size); + +// Parse the contents of /proc/self/smaps and generate a memory profile. +// |cb| is a tool-specific callback that fills the |stats| array containing +// |stats_size| elements. +void GetMemoryProfile(fill_profile_f cb, uptr *stats, uptr stats_size); + // InternalScopedBuffer can be used instead of large stack arrays to // keep frame size low. // FIXME: use InternalAlloc instead of MmapOrDie once Index: lib/sanitizer_common/sanitizer_fuchsia.h =================================================================== --- lib/sanitizer_common/sanitizer_fuchsia.h +++ lib/sanitizer_common/sanitizer_fuchsia.h @@ -25,10 +25,6 @@ extern uptr MainThreadStackBase, MainThreadStackSize; extern sanitizer_shadow_bounds_t ShadowBounds; -// TODO(fjricci) Remove this struct by refactoring common functions -// out of sanitizer_procmaps.h -struct MemoryMappingLayoutData {}; - } // namespace __sanitizer #endif // SANITIZER_FUCHSIA Index: lib/sanitizer_common/sanitizer_fuchsia.cc =================================================================== --- lib/sanitizer_common/sanitizer_fuchsia.cc +++ lib/sanitizer_common/sanitizer_fuchsia.cc @@ -18,7 +18,6 @@ #include "sanitizer_common.h" #include "sanitizer_libc.h" #include "sanitizer_mutex.h" -#include "sanitizer_procmaps.h" #include "sanitizer_stacktrace.h" #include Index: lib/sanitizer_common/sanitizer_procmaps.h =================================================================== --- lib/sanitizer_common/sanitizer_procmaps.h +++ lib/sanitizer_common/sanitizer_procmaps.h @@ -14,13 +14,13 @@ #ifndef SANITIZER_PROCMAPS_H #define SANITIZER_PROCMAPS_H +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC + #include "sanitizer_common.h" #include "sanitizer_internal_defs.h" -#include "sanitizer_fuchsia.h" #include "sanitizer_linux.h" #include "sanitizer_mac.h" #include "sanitizer_mutex.h" -#include "sanitizer_win.h" namespace __sanitizer { @@ -79,19 +79,9 @@ private: void LoadFromCache(); - // FIXME: Hide implementation details for different platforms in - // platform-specific files. MemoryMappingLayoutData data_; }; -typedef void (*fill_profile_f)(uptr start, uptr rss, bool file, - /*out*/uptr *stats, uptr stats_size); - -// Parse the contents of /proc/self/smaps and generate a memory profile. -// |cb| is a tool-specific callback that fills the |stats| array containing -// |stats_size| elements. -void GetMemoryProfile(fill_profile_f cb, uptr *stats, uptr stats_size); - // Returns code range for the specified module. bool GetCodeRangeForFile(const char *module, uptr *start, uptr *end); @@ -102,4 +92,5 @@ } // namespace __sanitizer +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC #endif // SANITIZER_PROCMAPS_H Index: lib/sanitizer_common/sanitizer_win.h =================================================================== --- lib/sanitizer_common/sanitizer_win.h +++ lib/sanitizer_common/sanitizer_win.h @@ -20,7 +20,6 @@ namespace __sanitizer { // Check based on flags if we should handle the exception. bool IsHandledDeadlyException(DWORD exceptionCode); -struct MemoryMappingLayoutData {}; } // namespace __sanitizer #endif // SANITIZER_WINDOWS Index: lib/sanitizer_common/sanitizer_win.cc =================================================================== --- lib/sanitizer_common/sanitizer_win.cc +++ lib/sanitizer_common/sanitizer_win.cc @@ -28,7 +28,6 @@ #include "sanitizer_libc.h" #include "sanitizer_mutex.h" #include "sanitizer_placement_new.h" -#include "sanitizer_procmaps.h" #include "sanitizer_stacktrace.h" #include "sanitizer_symbolizer.h" #include "sanitizer_win_defs.h"