[PATCH] D86170: PrintStackTrace: don't symbolize if LLVM_DISABLE_SYMBOLIZATION is set

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 06:10:57 PDT 2020


aganea added inline comments.


================
Comment at: llvm/utils/not/not.cpp:33
+    // output and avoid potentially slow symbolization.
+    setenv("LLVM_DISABLE_CRASH_REPORT", "1", 0);
+    setenv("LLVM_DISABLE_SYMBOLIZATION", "1", 0);
----------------
`setenv` doesn't work on Windows, you would need to use `SetEnvironmentVariableA`. So you can do something like:
```
#ifdef _WIN32
#include <windows.h>
#endif

static void env(const char *Name, const char *Val) {
#ifdef LLVM_ON_UNIX
  setenv(Name, Val, 0);
#else
  SetEnvironmentVariableA(Name, Val);
#endif
}

int main(int argc, const char **argv) {
...
  env("LLVM_DISABLE_CRASH_REPORT", "1");
}
```
Testing now to see the impact of this change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86170/new/

https://reviews.llvm.org/D86170



More information about the llvm-commits mailing list