search for: thestrm

Displaying 7 results from an estimated 7 matches for "thestrm".

2009 Dec 19
0
[LLVMdev] [PATCH] Implement dbgs()
...itialized = false; > + if (!initialized) { > + initialized = true; This isn't thread safe. A way to fix this is to do something like: static struct dbgstream { circular_raw_ostream strm; dbgstream() : strm(errs(), DebugBufferSize) { your one time init stuff here. } } thestrm; return thestrm.strm; Please commit with the appropriate fixes when we settle on the stream design. -Chris
2009 Dec 19
3
[LLVMdev] [PATCH] Implement dbgs()
...> + initialized = true; > > This isn't thread safe. A way to fix this is to do something like: > > static struct dbgstream { > circular_raw_ostream strm; > > dbgstream() : strm(errs(), DebugBufferSize) { > your one time init stuff here. > } > } thestrm; > > return thestrm.strm; Ok. > Please commit with the appropriate fixes when we settle on the stream > design. All right. -Dave
2009 Dec 18
2
[LLVMdev] [PATCH] Implement dbgs()
Here's the patch to provide dbgs(). By default it works just like errs(). When -debug-buffer-size=N (N > 0) is set, it buffers output sent to it and dumps it at program termination via a signal handler. Please review. Thanks! -Dave Index: include/llvm/Support/Debug.h =================================================================== ---
2009 Dec 21
2
[LLVMdev] [PATCH] Implement dbgs()
...safe way. + static struct dbgstream { + circular_raw_ostream strm; + + dbgstream() : strm(errs(), DebugBufferSize) { + sys::AddSignalHandler(&debug_user_sig_handler, 0); + // TODO: Add a handler for SIGUSER1-type signals so the user can + // force a debug dump. + } + } thestrm; + + return thestrm.strm; +} + #else // Avoid "has no symbols" warning. namespace llvm { -int Debug_dummy = 0; + /// dbgs - Return dbgs(). + raw_ostream &dbgs() { + return dbgs(); + } } + #endif
2009 Dec 19
0
[LLVMdev] [PATCH] Implement dbgs()
On Dec 18, 2009, at 6:36 PM, David Greene wrote: >>> +// Signal handlers - dump debug output on termination. >>> +static void debug_user_sig_handler(void *Cookie) >>> +{ >>> + llvm::circular_raw_ostream *logout = >>> + dynamic_cast<llvm::circular_raw_ostream *>(&llvm::dbgs()); >> >> Please do not use dynamic_cast, we're
2009 Dec 21
0
[LLVMdev] [PATCH] Implement dbgs()
On 2009-12-21 18:06, David Greene wrote: > On Saturday 19 December 2009 00:16, Chris Lattner wrote: > > >>> Or I think I can just assume (Yikes!) that if the signal handler is >>> invoked it will really be a circular_raw_ostream since the handler >>> should (!) only be set up in debug mode. >>> >>> That scares me a bit, though. >>>
2009 Dec 21
2
[LLVMdev] [PATCH] Implement dbgs()
...!= 0) + // TODO: Add a handler for SIGUSER1-type signals so the user can + // force a debug dump. + sys::AddSignalHandler(&debug_user_sig_handler, 0); + // Otherwise we've already set the debug stream buffer size to + // zero, disabling buffering. + } + } thestrm; + + return thestrm.strm; +} + #else // Avoid "has no symbols" warning. namespace llvm { -int Debug_dummy = 0; + /// dbgs - Return dbgs(). + raw_ostream &dbgs() { + return dbgs(); + } } + #endif