[llvm-commits] [compiler-rt] r158490 - in /compiler-rt/trunk/lib: asan/asan_internal.h asan/asan_posix.cc asan/asan_rtl.cc asan/asan_win.cc sanitizer_common/sanitizer_common.h sanitizer_common/sanitizer_posix.cc sanitizer_common/sanitizer_win.cc
Alexey Samsonov
samsonov at google.com
Thu Jun 14 23:08:19 PDT 2012
Author: samsonov
Date: Fri Jun 15 01:08:19 2012
New Revision: 158490
URL: http://llvm.org/viewvc/llvm-project?rev=158490&view=rev
Log:
[Sanitizer] move DumpProcessMap and DisableCoreDumper to common runtime
Modified:
compiler-rt/trunk/lib/asan/asan_internal.h
compiler-rt/trunk/lib/asan/asan_posix.cc
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/asan/asan_win.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=158490&r1=158489&r2=158490&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Fri Jun 15 01:08:19 2012
@@ -122,9 +122,7 @@
// asan_linux.cc / asan_mac.cc / asan_win.cc
void *AsanDoesNotSupportStaticLinkage();
bool AsanShadowRangeIsAvailable();
-void AsanDumpProcessMap();
-void AsanDisableCoreDumper();
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp);
bool AsanInterceptsSignal(int signum);
Modified: compiler-rt/trunk/lib/asan/asan_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_posix.cc?rev=158490&r1=158489&r2=158490&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_posix.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_posix.cc Fri Jun 15 01:08:19 2012
@@ -134,26 +134,6 @@
MaybeInstallSigaction(SIGBUS, ASAN_OnSIGSEGV);
}
-void AsanDisableCoreDumper() {
- struct rlimit nocore;
- nocore.rlim_cur = 0;
- nocore.rlim_max = 0;
- setrlimit(RLIMIT_CORE, &nocore);
-}
-
-void AsanDumpProcessMap() {
- ProcessMaps proc_maps;
- uptr start, end;
- const sptr kBufSize = 4095;
- char filename[kBufSize];
- Report("Process memory map follows:\n");
- while (proc_maps.Next(&start, &end, /* file_offset */0,
- filename, kBufSize)) {
- Printf("\t%p-%p\t%s\n", (void*)start, (void*)end, filename);
- }
- Report("End of process memory map.\n");
-}
-
uptr GetThreadSelf() {
return (uptr)pthread_self();
}
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=158490&r1=158489&r2=158490&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Fri Jun 15 01:08:19 2012
@@ -536,7 +536,7 @@
}
if (FLAG_disable_core) {
- AsanDisableCoreDumper();
+ DisableCoreDumper();
}
if (AsanShadowRangeIsAvailable()) {
@@ -552,7 +552,7 @@
} else {
Report("Shadow memory range interleaves with an existing memory mapping. "
"ASan cannot proceed correctly. ABORTING.\n");
- AsanDumpProcessMap();
+ DumpProcessMap();
Die();
}
Modified: compiler-rt/trunk/lib/asan/asan_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win.cc?rev=158490&r1=158489&r2=158490&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win.cc Fri Jun 15 01:08:19 2012
@@ -192,10 +192,6 @@
return t;
}
-void AsanDumpProcessMap() {
- UNIMPLEMENTED();
-}
-
uptr GetThreadSelf() {
return GetCurrentThreadId();
}
@@ -212,10 +208,6 @@
// FIXME: Decide what to do on Windows.
}
-void AsanDisableCoreDumper() {
- UNIMPLEMENTED();
-}
-
void SleepForSeconds(int seconds) {
Sleep(seconds * 1000);
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=158490&r1=158489&r2=158490&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Fri Jun 15 01:08:19 2012
@@ -55,6 +55,10 @@
uptr *buff_size, uptr max_len);
const char *GetEnv(const char *name);
+// Other
+void DisableCoreDumper();
+void DumpProcessMap();
+
// Bit twiddling.
inline bool IsPowerOfTwo(uptr x) {
return (x & (x - 1)) == 0;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=158490&r1=158489&r2=158490&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc Fri Jun 15 01:08:19 2012
@@ -15,15 +15,20 @@
#include "sanitizer_common.h"
#include "sanitizer_libc.h"
+#include "sanitizer_procmaps.h"
#include <stdarg.h>
#include <stdio.h>
#include <sys/mman.h>
+#include <sys/resource.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
namespace __sanitizer {
+// ------------- sanitizer_common.h
+
int GetPid() {
return getpid();
}
@@ -65,6 +70,28 @@
0, 0);
}
+void DumpProcessMap() {
+ ProcessMaps proc_maps;
+ uptr start, end;
+ const sptr kBufSize = 4095;
+ char filename[kBufSize];
+ Report("Process memory map follows:\n");
+ while (proc_maps.Next(&start, &end, /* file_offset */0,
+ filename, kBufSize)) {
+ Printf("\t%p-%p\t%s\n", (void*)start, (void*)end, filename);
+ }
+ Report("End of process memory map.\n");
+}
+
+void DisableCoreDumper() {
+ struct rlimit nocore;
+ nocore.rlim_cur = 0;
+ nocore.rlim_max = 0;
+ setrlimit(RLIMIT_CORE, &nocore);
+}
+
+// -------------- sanitizer_libc.h
+
int internal_sscanf(const char *str, const char *format, ...) {
va_list args;
va_start(args, format);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=158490&r1=158489&r2=158490&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Fri Jun 15 01:08:19 2012
@@ -82,6 +82,14 @@
return 0;
}
+void DumpProcessMap() {
+ UNIMPLEMENTED();
+}
+
+void DisableCoreDumper() {
+ UNIMPLEMENTED();
+}
+
// ------------------ sanitizer_libc.h
void *internal_mmap(void *addr, uptr length, int prot, int flags,
int fd, u64 offset) {
More information about the llvm-commits
mailing list