[PATCH] [Sanitizer RT] Put the module name string ownership in Symbolizer in order

Alexey Samsonov vonosmas at gmail.com
Mon Mar 30 13:19:31 PDT 2015


I think this change is reasonable. Timur, please make sure that (after this goes in) you audit the calls to Symbolizer::GetModuleNameAndOffsetForPC() and Symbolizer::GetModuleNameForPc() and remove internal_strdup() that could encounter at call sites: now we don't have to take ownership of these strings, as they are always owned by the Symbolizer.


================
Comment at: sanitizer_symbolizer.cc:153
@@ -134,3 +152,3 @@
   BlockingMutexLock l(&mu_);
-  return PlatformFindModuleNameAndOffsetForAddress(pc, module_name,
-                                                   module_address);
+  const char *internal_module_name = 0;
+  if (!PlatformFindModuleNameAndOffsetForAddress(pc, &internal_module_name,
----------------
nullptr

================
Comment at: sanitizer_symbolizer.h:124
@@ +123,3 @@
+   public:
+    ModuleNameOwner() : storage_(1000), last_match_(nullptr) {}
+    const char *GetOwnedCopy(const char *str);
----------------
Please use a named constant.

================
Comment at: sanitizer_symbolizer.h:128
@@ +127,3 @@
+   private:
+    InternalMmapVector<char*> storage_;
+    char *last_match_;
----------------
const char *

================
Comment at: sanitizer_symbolizer.h:129
@@ +128,3 @@
+    InternalMmapVector<char*> storage_;
+    char *last_match_;
+  } module_names_;
----------------
Why is this not a const char * ?

http://reviews.llvm.org/D8666

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list