Move the contents of AsanProcMaps::Dump() into AsanDumpProcessMaps() for Posix systems.

Define AsanDumpProcessMaps as unimplemented on Windows.

This should fix the Windows build.

llvm-svn: 151147
This commit is contained in:
Alexander Potapenko 2012-02-22 09:11:55 +00:00
parent e7c31a9a22
commit 2c0ed61c7a
5 changed files with 20 additions and 16 deletions

View File

@ -130,6 +130,7 @@ void *AsanDoesNotSupportStaticLinkage();
bool AsanShadowRangeIsAvailable();
int AsanOpenReadonly(const char* filename);
const char *AsanGetEnv(const char *name);
void AsanDumpProcessMap();
void *AsanMmapFixedNoReserve(uintptr_t fixed_addr, size_t size);
void *AsanMmapFixedReserve(uintptr_t fixed_addr, size_t size);

View File

@ -15,6 +15,7 @@
#include "asan_internal.h"
#include "asan_interceptors.h"
#include "asan_procmaps.h"
#include "asan_stack.h"
#include "asan_thread_registry.h"
@ -69,6 +70,19 @@ void AsanDisableCoreDumper() {
setrlimit(RLIMIT_CORE, &nocore);
}
void AsanDumpProcessMap() {
AsanProcMaps proc_maps;
uintptr_t start, end;
const intptr_t kBufSize = 4095;
char filename[kBufSize];
Report("Process memory map follows:\n");
while (proc_maps.Next(&start, &end, /* file_offset */NULL,
filename, kBufSize)) {
Printf("\t%p-%p\t%s\n", (void*)start, (void*)end, filename);
}
Report("End of process memory map.\n");
}
int GetPid() {
return getpid();
}

View File

@ -28,19 +28,6 @@ class AsanProcMaps {
// address 'addr'. Returns true on success.
bool GetObjectNameAndOffset(uintptr_t addr, uintptr_t *offset,
char filename[], size_t filename_size);
void Dump() {
Reset();
uintptr_t start, end;
const intptr_t kBufSize = 4095;
char filename[kBufSize];
Report("Process memory map follows:\n");
while (Next(&start, &end, /* file_offset */NULL,
filename, kBufSize)) {
Printf("\t%p-%p\t%s\n", (void*)start, (void*)end, filename);
}
Report("End of process memory map.\n");
}
~AsanProcMaps();
private:
// Default implementation of GetObjectNameAndOffset.

View File

@ -17,7 +17,6 @@
#include "asan_internal.h"
#include "asan_lock.h"
#include "asan_mapping.h"
#include "asan_procmaps.h"
#include "asan_stack.h"
#include "asan_stats.h"
#include "asan_thread.h"
@ -490,8 +489,7 @@ void __asan_init() {
} else {
Report("Shadow memory range interleaves with an existing memory mapping. "
"ASan cannot proceed correctly. ABORTING.\n");
AsanProcMaps proc_maps;
proc_maps.Dump();
AsanDumpProcessMap();
AsanDie();
}

View File

@ -232,6 +232,10 @@ const char* AsanGetEnv(const char* name) {
return NULL;
}
void AsanDumpProcessMap() {
UNIMPLEMENTED();
}
int GetPid() {
return GetProcessId(GetCurrentProcess());
}