38 #include <llvm/ADT/Twine.h>
39 #include <llvm/Support/raw_ostream.h>
48 static bool debugging(StringRef Name) {
59 const char *rawEnv = getenv(
"TESLA_DEBUG");
64 std::string env(rawEnv);
69 if (Name.size() > env.length()
70 and Name.startswith(env)
71 and Name[env.length()] ==
'.')
75 return (fnmatch(env.c_str(), Name.str().c_str(), 0) == 0);
79 report_fatal_error(
"TESLA: " + Message, PrintStackTrace);
84 if (debugging(DebugModuleName)) {
85 static raw_ostream& ErrStream = llvm::errs();
90 static raw_null_ostream NullStream;
95 #include <llvm/Support/Signals.h>
99 class StaticDebugInit {
102 sys::PrintStackTraceOnErrorSignal();