From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jonathan Pryor" To: egcs@cygnus.com Cc: Subject: Re: Windows TRACE message Date: Mon, 12 Jul 1999 05:52:00 -0000 Message-id: <06fe01becc65$543d76b0$e63d2509@raleigh.ibm.com> References: <199907090647.BAA29870@mercury.xraylith.wisc.edu> X-SW-Source: 1999-07/msg00237.html Mumit, kenneth Brubaker has released something similar to your "debugout" class, and he outlined it in the May 1999 issue of _C++ Report_. The source is available as two listings; the source is at: < http://archive.creport.com/9905/html/from_pages/code.shtml > It's by no means perfect, but it provides printf()-style functions (called dprintf()) and IO-streams classes (through the `dout' class) that send output to the Windows' OutputDebugStream API, which can be captured with the sysinternals' program previously mentioned on the list. The original code, unfortunately, is rather MSVC-specific, as it requires the newer template-based IO-streams library, plus the requirement of the OutputDebugString API. However, I've been hacking on the source to allow redirection to stdout/stderr (or any other FILE*), and it currently works on Linux without too many problems. I'll probably put the source out after I deal with some multi-threading initialization issues (which consist of a total lack of threading support). - Jon ----- Original Message ----- From: Mumit Khan To: Cc: Sent: Friday, July 09, 1999 2:47 AM Subject: Re: Windows TRACE message > "Lars Gregersen" writes: > > > > I prefer to use the API function OutputDebugString. It isn't as > > powerful as the printf type of commands, but it sends a string to a > > seperate debug window. This also has the great effect that I'f you're > > testing multiple programmes at the same time you get the output in > > order in the same window. It works for GUI and console programmes. > > > > You can get a debug string viewer (for free) at www.sysinternals.com > > > > Lars, > > Thanks for the very useful pointer. > > I tend to use a debugging stream (most of my code is C++) that has > a subclass for win32 that opens a scrolled window and just dumps > everything there. Very simple, and you can use iostream style > formatting. > > debugout << __FILE__ << ": " __LINE << ": " > << "error message here ...." << endl; > > The default class simply dumps to cerr. > > One of these days I'll clean up the copyright and release it. it's > part of a commercial package, but since I own it, I can probably > convince our commercial arm to make it freely available. > > The trick is to make sure that the global constructor for the > debug stream is initialized before anything else, but right > after iostreams is initialized. > > Regards, > Mumit > > > -- > Want to unsubscribe from this list? > Send a message to cygwin-unsubscribe@sourceware.cygnus.com > -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jonathan Pryor" To: egcs@cygnus.com Cc: Subject: Re: Windows TRACE message Date: Sat, 31 Jul 1999 18:34:00 -0000 Message-ID: <06fe01becc65$543d76b0$e63d2509@raleigh.ibm.com> References: <199907090647.BAA29870@mercury.xraylith.wisc.edu> X-SW-Source: 1999-07n/msg00237.html Message-ID: <19990731183400.RmiKlSIg0DSuJFEu0ZuNfDdc6or3zUinX6bx17WeGs0@z> Mumit, kenneth Brubaker has released something similar to your "debugout" class, and he outlined it in the May 1999 issue of _C++ Report_. The source is available as two listings; the source is at: < http://archive.creport.com/9905/html/from_pages/code.shtml > It's by no means perfect, but it provides printf()-style functions (called dprintf()) and IO-streams classes (through the `dout' class) that send output to the Windows' OutputDebugStream API, which can be captured with the sysinternals' program previously mentioned on the list. The original code, unfortunately, is rather MSVC-specific, as it requires the newer template-based IO-streams library, plus the requirement of the OutputDebugString API. However, I've been hacking on the source to allow redirection to stdout/stderr (or any other FILE*), and it currently works on Linux without too many problems. I'll probably put the source out after I deal with some multi-threading initialization issues (which consist of a total lack of threading support). - Jon ----- Original Message ----- From: Mumit Khan To: Cc: Sent: Friday, July 09, 1999 2:47 AM Subject: Re: Windows TRACE message > "Lars Gregersen" writes: > > > > I prefer to use the API function OutputDebugString. It isn't as > > powerful as the printf type of commands, but it sends a string to a > > seperate debug window. This also has the great effect that I'f you're > > testing multiple programmes at the same time you get the output in > > order in the same window. It works for GUI and console programmes. > > > > You can get a debug string viewer (for free) at www.sysinternals.com > > > > Lars, > > Thanks for the very useful pointer. > > I tend to use a debugging stream (most of my code is C++) that has > a subclass for win32 that opens a scrolled window and just dumps > everything there. Very simple, and you can use iostream style > formatting. > > debugout << __FILE__ << ": " __LINE << ": " > << "error message here ...." << endl; > > The default class simply dumps to cerr. > > One of these days I'll clean up the copyright and release it. it's > part of a commercial package, but since I own it, I can probably > convince our commercial arm to make it freely available. > > The trick is to make sure that the global constructor for the > debug stream is initialized before anything else, but right > after iostreams is initialized. > > Regards, > Mumit > > > -- > Want to unsubscribe from this list? > Send a message to cygwin-unsubscribe@sourceware.cygnus.com > -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com