[PATCH] Sanitizers: Implement `GetRSS` on Mac OS X

Dmitry Vyukov dvyukov at google.com
Sun May 10 01:06:55 PDT 2015


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:341
@@ +340,3 @@
+
+  count = TASK_BASIC_INFO_COUNT;
+  result =
----------------
We don't use C89 declaration style, so please do:
unsigned count = ...
and the same for the other variables.

================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:345
@@ +344,3 @@
+  if (UNLIKELY(result != KERN_SUCCESS)) {
+    Report("Could not get task info - RSS value will not be available. "
+           "Error: %d\n", result);
----------------
Is it really can happen? Or it is more like "this should never happen"?
If it the latter, then make it fatal by calling Die(). Otherwise print only in verbose more (I think we now have VPrintf(1, "..."). Whenever we print something in normal operation mode, some programs fail. Consider a generator program, this output will become part of generated output and will necessary fail the rest of the test.

================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:347
@@ +346,3 @@
+           "Error: %d\n", result);
+    return 0U;
+  }
----------------
s/0U/0/ please
0 should convert to uptr just fine. This code is compiled with -Wall by two compilers clean, that should catch any conversion bugs.

http://reviews.llvm.org/D9636

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






More information about the llvm-commits mailing list