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

Kostya Serebryany kcc at google.com
Thu Mar 12 14:06:55 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;
+
----------------
ygribov wrote:
> kcc wrote:
> > ygribov wrote:
> > > kcc wrote:
> > > > initialize to nullptr, so that if we forget to call CacheBinaryName we instantly crash 
> > > Yeah, I thought about this. But note that even though we call CacheBinaryName very early, some code has to execute before it. And I'd prefer this code to print something at least to stderr instead of crashing.
> > Sure, use CHECK_NE(foo, nullptr)
> Sorry, I still don't understand - how do you propose to handle failing CHECKs in e.g. InitializeFlags (which is called before CacheBinaryName has a chance to set binary_basename_cache_str)? If we CHECK_NE(binary_basename_cache_str, nullptr) we'll abort without reporting the real error.
Can you then read the binary name earlier? 
Or don't use check and rely on SEGV handler to show you stack trace if binary_basename_cache_str is nullptr.
Or tolerate the binary name biign null?

http://reviews.llvm.org/D7333

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






More information about the llvm-commits mailing list