LLVM: lib/Support/Debug.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
32
34
35#undef isCurrentDebugType
36#undef setCurrentDebugType
37#undef setCurrentDebugTypes
38
39using namespace llvm;
40
41
42
43namespace llvm {
44
46
48
49
50
51
54 return true;
55
56
58 if (d == DebugType)
59 return true;
60 }
61 return false;
62}
63
64
65
66
67
69
72}
73
76 for (size_t T = 0; T < Count; ++T)
78}
79}
80
81
82#ifndef NDEBUG
83
84namespace {
85struct CreateDebug {
86 static void *call() {
89 }
90};
91
92
93
94struct CreateDebugBufferSize {
95 static void *call() {
97 "debug-buffer-size",
98 cl::desc("Buffer the last N characters of debug output "
99 "until program termination. "
100 "[default 0 -- immediate print-out]"),
102 }
103};
104}
105
106
107
110
111namespace {
112
113struct DebugOnlyOpt {
114 void operator=(const std::string &Val) const {
115 if (Val.empty())
116 return;
120 for (auto dbgType : dbgTypes)
122 }
123};
124}
125
127
128namespace {
129struct CreateDebugOnly {
130 static void *call() {
132 "debug-only",
133 cl::desc("Enable a specific type of debug output (comma separated list "
134 "of types)"),
137 }
138};
139}
140
142 CreateDebugOnly>
144
149}
150
151
153
154
155
156
160}
161
162
164
165 static struct dbgstream {
167
168 dbgstream()
169 : strm(errs(), "*** Debug Log Output ***\n",
172
173
175
176
177 }
178 } thestrm;
179
180 return thestrm.strm;
181}
182
183#else
184
185namespace llvm {
186
188 return errs();
189 }
190}
192#endif
193
194
195
static ManagedStatic< cl::opt< bool, true >, CreateDebug > Debug
static void debug_user_sig_handler(void *Cookie)
static ManagedStatic< cl::opt< unsigned >, CreateDebugBufferSize > DebugBufferSize
static ManagedStatic< cl::opt< DebugOnlyOpt, true, cl::parser< std::string > >, CreateDebugOnly > DebugOnly
static DebugOnlyOpt DebugOnlyOptLoc
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
The instances of the Type class are immutable: once they are created, they are never changed.
circular_raw_ostream - A raw_ostream which can save its data to a circular buffer,...
void flushBufferWithBanner()
flushBufferWithBanner - Force output of the buffer along with a small header.
This class implements an extremely fast bulk output stream that can only output to a stream.
initializer< Ty > init(const Ty &Val)
LocationClass< Ty > location(Ty &L)
void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie)
Add a function to be called when an abort/kill signal is delivered to the process.
This is an optimization pass for GlobalISel generic memory operations.
bool EnableDebugBuffering
EnableDebugBuffering - This defaults to false.
bool DebugFlag
This boolean is set to true if the '-debug' command line option is specified.
void setCurrentDebugTypes(const char **Types, unsigned Count)
setCurrentDebugTypes - Set the current debug type, as if the -debug-only=X,Y,Z option were specified.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void setCurrentDebugType(const char *Type)
setCurrentDebugType - Set the current debug type, as if the -debug-only=X option were specified.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
bool isCurrentDebugType(const char *Type)
isCurrentDebugType - Return true if the specified string is the debug type specified on the command l...
static ManagedStatic< std::vector< std::string > > CurrentDebugType