[PATCH] [ASan] Add process basename to log name and error message to simplify analysis of sanitized systems logs.

Kostya Serebryany kcc at google.com
Wed Mar 11 15:24:39 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:347
@@ +346,3 @@
+static char binary_name_cache_str[kMaxPathLength];
+static const char *binary_basename_cache_str = binary_name_cache_str;
+
----------------
initialize to nullptr, so that if we forget to call CacheBinaryName we instantly crash 

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:360
@@ +359,3 @@
+  static bool binary_name_initialized;
+  if (LIKELY(binary_name_initialized))
+    return;
----------------
This will not catch a situation where someone calls CacheBinaryName() twice, which should be illegal. 
Instead, do a hard check that this is the first call. 

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:364
@@ +363,3 @@
+  binary_basename_cache_str = StripModuleName(binary_name_cache_str);
+  binary_name_initialized = true;
+}
----------------
You can probably implement this thing w/o an extra static bool, just use binary_basename_cache_str

http://reviews.llvm.org/D7333

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






More information about the llvm-commits mailing list