[llvm-commits] [compiler-rt] r173347 - /compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc

Alexey Samsonov samsonov at google.com
Thu Jan 24 06:01:59 PST 2013


Author: samsonov
Date: Thu Jan 24 08:01:59 2013
New Revision: 173347

URL: http://llvm.org/viewvc/llvm-project?rev=173347&view=rev
Log:
[Sanitizer] use stub InternalSymbolizer on platforms where we don't have weak hooks

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc?rev=173347&r1=173346&r2=173347&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc Thu Jan 24 08:01:59 2013
@@ -185,28 +185,23 @@
 bool __sanitizer_symbolize_data(const char *ModuleName, u64 ModuleOffset,
                                 char *Buffer, int MaxLength);
 }  // extern "C"
-#endif  // SANITIZER_SUPPORTS_WEAK_HOOKS
 
 class InternalSymbolizer {
  public:
   typedef bool (*SanitizerSymbolizeFn)(const char*, u64, char*, int);
   static InternalSymbolizer *get() {
-#if SANITIZER_SUPPORTS_WEAK_HOOKS
     if (__sanitizer_symbolize_code != 0 &&
         __sanitizer_symbolize_data != 0) {
       void *mem = symbolizer_allocator.Allocate(sizeof(InternalSymbolizer));
       return new(mem) InternalSymbolizer();
     }
-#endif  // SANITIZER_SUPPORTS_WEAK_HOOKS
     return 0;
   }
   char *SendCommand(bool is_data, const char *module_name, uptr module_offset) {
-#if SANITIZER_SUPPORTS_WEAK_HOOKS
     SanitizerSymbolizeFn symbolize_fn = is_data ? __sanitizer_symbolize_data
                                                 : __sanitizer_symbolize_code;
     if (symbolize_fn(module_name, module_offset, buffer_, kBufferSize))
       return buffer_;
-#endif  // SANITIZER_SUPPORTS_WEAK_HOOKS
     return 0;
   }
 
@@ -216,6 +211,17 @@
   static const int kBufferSize = 16 * 1024;
   char buffer_[kBufferSize];
 };
+#else  // SANITIZER_SUPPORTS_WEAK_HOOKS
+
+class InternalSymbolizer {
+ public:
+  static InternalSymbolizer *get() { return 0; }
+  char *SendCommand(bool is_data, const char *module_name, uptr module_offset) {
+    return 0;
+  }
+};
+
+#endif  // SANITIZER_SUPPORTS_WEAK_HOOKS
 
 class Symbolizer {
  public:





More information about the llvm-commits mailing list