[PATCH] D13452: [asan] On OS X, log reports to syslog and os_trace (version 2)

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 16:03:15 PDT 2015


samsonov added inline comments.

================
Comment at: lib/asan/asan_report.cc:47
@@ -46,2 +46,3 @@
 static ReportData report_data = {};
+static BlockingMutex append_to_error_buf;
 
----------------
glider wrote:
> filcab wrote:
> > I'd prefer this to have "mutex" or "lock" (or a variation of one) in the name.
> Which variables does this mutex protect?
> I suspect |error_message_buffer| belongs to those, therefore you need to acquire this mutex every time you access |error_message_buffer|.
> I also suggest you declare the mutex next to error_message_xxx declarations (and change the name as proposed by Filipe)
Agree. Note that currently there is a race between setting `error_report_callback` from `__asan_set_error_report_callback` and invoking it when the report is printed. We may use this mutex to fix the problem.

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:310
@@ +309,3 @@
+    if (*s == '\033' && *(s + 1) == '[') {
+      while (*s != 'm' && *s != '\0') {
+        s++;
----------------
s = internal_strchrnul(s, 'm');

================
Comment at: lib/sanitizer_common/tests/sanitizer_common_test.cc:212
@@ +211,3 @@
+TEST(SanitizerCommon, RemoveANSIEscapeSequencesFromString) {
+  RemoveANSIEscapeSequencesFromString(0);
+  const char *buffs[20] = {
----------------
s/0/nullptr

================
Comment at: lib/sanitizer_common/tests/sanitizer_common_test.cc:227
@@ +226,3 @@
+  for (size_t i = 0; i < ARRAY_SIZE(buffs); i+=2) {
+  char *buffer_copy = internal_strdup(buffs[i]);
+    RemoveANSIEscapeSequencesFromString(buffer_copy);
----------------
indentation went off


http://reviews.llvm.org/D13452





More information about the llvm-commits mailing list