[PATCH] D90120: [sanitizer] Print errno for report file open failure
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 29 08:47:50 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG81f7b96ed0a2: [sanitizer] Print errno for report file open failure (authored by tejohnson).
Changed prior to commit:
https://reviews.llvm.org/D90120?vs=300541&id=301642#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90120/new/
https://reviews.llvm.org/D90120
Files:
compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
compiler-rt/test/memprof/TestCases/log_path_test.cpp
Index: compiler-rt/test/memprof/TestCases/log_path_test.cpp
===================================================================
--- compiler-rt/test/memprof/TestCases/log_path_test.cpp
+++ compiler-rt/test/memprof/TestCases/log_path_test.cpp
@@ -19,11 +19,10 @@
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-LONG --dump-input=always
// Specifying the log name via the __memprof_profile_filename variable.
-// TODO: Temporarily disabled due to llvm-avr-linux bot failure
-// %clangxx_memprof %s -o %t -DPROFILE_NAME_VAR="%t.log2"
-// rm -f %t.log2.*
-// %run %t
-// FileCheck %s --check-prefix=CHECK-GOOD --dump-input=always < %t.log2.*
+// RUN: %clangxx_memprof %s -o %t -DPROFILE_NAME_VAR="%t.log2"
+// RUN: rm -f %t.log2.*
+// RUN: %run %t
+// RUN: FileCheck %s --check-prefix=CHECK-GOOD --dump-input=always < %t.log2.*
#ifdef PROFILE_NAME_VAR
#define xstr(s) str(s)
Index: compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
+++ compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
@@ -58,11 +58,15 @@
} else {
internal_snprintf(full_path, kMaxPathLength, "%s.%zu", path_prefix, pid);
}
- fd = OpenFile(full_path, WrOnly);
+ error_t err;
+ fd = OpenFile(full_path, WrOnly, &err);
if (fd == kInvalidFd) {
const char *ErrorMsgPrefix = "ERROR: Can't open file: ";
WriteToFile(kStderrFd, ErrorMsgPrefix, internal_strlen(ErrorMsgPrefix));
WriteToFile(kStderrFd, full_path, internal_strlen(full_path));
+ char errmsg[100];
+ internal_snprintf(errmsg, sizeof(errmsg), " (reason: %d)", err);
+ WriteToFile(kStderrFd, errmsg, internal_strlen(errmsg));
Die();
}
fd_pid = pid;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90120.301642.patch
Type: text/x-patch
Size: 1771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201029/a7f3b5c2/attachment.bin>
More information about the llvm-commits
mailing list