[PATCH] D16176: Introduce stats and stats_client libraries.

Ivan Krasin via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 11:30:08 PST 2016


krasin1 added a subscriber: krasin1.

================
Comment at: lib/sanitizer_common/sanitizer_flags.cc:51
@@ -50,1 +50,3 @@
+// %p = pid
+void SubstituteForFlagValue(const char *s, char *out, uptr out_size) {
   char *out_end = out + out_size;
----------------
Are we restricted to use C++ strings here? The function is super scary right now.

================
Comment at: lib/sanitizer_common/sanitizer_flags.cc:98
@@ -71,3 +97,3 @@
       char *buf = (char *)MmapOrDie(kMaxPathLength, "FlagHandlerInclude");
-      SubstituteBinaryName(value, buf, kMaxPathLength);
+      SubstituteForFlagValue(value, buf, kMaxPathLength);
       bool res = parser_->ParseFile(buf, ignore_missing_);
----------------
I don't think that the flag value is limited by kMaxPathLength. Can you please choose a better limit? Or somehow check that the value fits the buffer?

================
Comment at: lib/stats/stats.cc:39
@@ +38,3 @@
+  char chars[sizeof(uptr)];
+  for (unsigned i = 0; i != sizeof(uptr); ++i) {
+    chars[i] = val >> (i * 8);
----------------
s/unsigned/size_t/ maybe?

================
Comment at: lib/stats/stats.cc:46
@@ +45,3 @@
+void WriteModuleReport(StatInfo *start, StatInfo *stop) {
+  const char *path_env = GetEnv("SANITIZER_STATS_PATH");
+  if (!path_env || stats_fd == kInvalidFd)
----------------
Probably, it makes sense to check that start != NULL to fail cleanly if WriteModuleReport is called on an unregistered module.


http://reviews.llvm.org/D16176





More information about the llvm-commits mailing list