[PATCH] [Sanitizer] Fix report_path functionality:

Alexey Samsonov vonosmas at gmail.com
Thu Dec 11 10:22:25 PST 2014


================
Comment at: lib/sanitizer_common/sanitizer_common.h:133
@@ -135,2 +132,3 @@
 bool ColorizeReports();
+
 void Printf(const char *format, ...);
----------------
glider wrote:
> Spare newline?
Fixed

================
Comment at: lib/sanitizer_common/sanitizer_common.h:158
@@ +157,3 @@
+  // kInvalidFd, in which case new file will be opened when necessary.
+  fd_t fd;
+  // Path prefix of report file, set via __sanitizer_set_report_path.
----------------
glider wrote:
> Are you planning to access these fields from outside ReportFile?
> Looks like they can be made private now.
I can't make them private, because I need aggregate initialization for global ReportFile object (we're not allowed to have global constructors in the runtime). I'll leave a comment about that.

================
Comment at: lib/sanitizer_common/sanitizer_win.cc:495
@@ -494,10 +494,3 @@
 
-void MaybeOpenReportFile() {
-  // Windows doesn't have native fork, and we don't support Cygwin or other
-  // environments that try to fake it, so the initial report_fd will always be
-  // correct.
-}
-
-void RawWrite(const char *buffer) {
-  uptr length = (uptr)internal_strlen(buffer);
-  if (length != internal_write(report_fd, buffer, length)) {
+void ReportFile::WriteOrDie(const char *buffer, uptr length) {
+  SpinMutexLock l(mu);
----------------
glider wrote:
> Isn't this function supposed to die?
Alright, seems that closed fd is a normal situation on the Windows. Renamed this function.

http://reviews.llvm.org/D6595

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






More information about the llvm-commits mailing list