[PATCH] D46546: add suffix to report file name

Bill Torpey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 13:31:45 PDT 2018


WallStProg created this revision.
WallStProg added reviewers: Sanitizers, kcc.
Herald added subscribers: llvm-commits, kubamracek.

For those using a GUI, it can be very helpful to have a particular suffix appended to the report file name, so it can be opened with a double-click.

(see also: https://github.com/google/sanitizers/issues/951)


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D46546

Files:
  projects/compiler-rt/lib/sanitizer_common/sanitizer_file.cc
  projects/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc


Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- projects/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
+++ projects/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
@@ -56,6 +56,9 @@
     "Mention name of executable when reporting error and "
     "append executable name to logs (as in \"log_path.exe_name.pid\").")
 COMMON_FLAG(
+    const char *, log_suffix, nullptr,
+    "String to append to log file name, e.g. \".txt\".")
+COMMON_FLAG(
     bool, log_to_syslog, SANITIZER_ANDROID || SANITIZER_MAC,
     "Write all sanitizer output to syslog in addition to other means of "
     "logging.")
Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_file.cc
===================================================================
--- projects/compiler-rt/lib/sanitizer_common/sanitizer_file.cc
+++ projects/compiler-rt/lib/sanitizer_common/sanitizer_file.cc
@@ -59,6 +59,9 @@
   } else {
     internal_snprintf(full_path, kMaxPathLength, "%s.%zu", path_prefix, pid);
   }
+  if (common_flags()->log_suffix) {
+     internal_strlcat(full_path, common_flags()->log_suffix, kMaxPathLength);
+  }
   fd = OpenFile(full_path, WrOnly);
   if (fd == kInvalidFd) {
     const char *ErrorMsgPrefix = "ERROR: Can't open file: ";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46546.145527.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/8ca9d9f9/attachment.bin>


More information about the llvm-commits mailing list