?
Solved

TRACE output overflow?

Posted on 2003-03-28
4
Medium Priority
?
993 Views
Last Modified: 2013-11-20
Hi everybody,

I use MS VC++ 6.0 SP 5.

I encountered a problem with MFC TRACE macro:

When I need to trace a lot of messages in short time
there seems to be an internal buffer overflow which
leads to missing messages in the output window.

This can be simply reproduced with this code:

...
for ( int i = 0; i < 5000; i++ )
{
 TRACE( "Tracing a huge amount of traces in a short time ... this is line %d of 100000\n", i );
}
...

In the output window then I find messages like:
...
Tracing a huge amount of traces in a short time ... this is line 387 of 100000
Tracing a huge amount of traces in a short time ... this is line 388 of 100000
Tracing a huge amount of traces in a short time ... this is line 845 of 100000 (!)
Tracing a huge amount of traces in a short time ... this is line 846 of 100000
...
Tracing a huge amount of traces in a short time ... this is line 882 of 100000
Tracing a huge amount of traces in a short time ... this is line 883 of 100000
Tracing a huge amount of traces in a short time ... this is line 1837 of 100000 (!)
Tracing a huge amount of traces in a short time ... this is line 1838 of 100000
...

The same doesn't happen if you add i.e. a breakpoint which holds execution i.e.
ever 300 loops ... then the output is ok.

The same happens if I use ::AfxTrace directly and even with OutputDebugString.


I already find out that I can redirect TRACE in a file using something like:

...
CStdioFile file;
if ( file.Open( "dump.txt", CFile::modeCreate | CFile::modeWrite ) )
 afxDump.m_pFile = &file;

for ( int i = 0; i < 5000; i++ )
{
 TRACE( "Tracing a huge amount of traces in a short time ... this is line %d of 100000\n", i );
}

afxDump.m_pFile = NULL;
...

but it's sometimes really annoying to have the need to do this everytime I find messages are
missing (sometimes even the bigger problem is to find that messages are missing).


Is there anyone who knows a workaroung for this problem?

Thanks in advance,

ZOPPO
0
Comment
Question by:Zoppo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 800 total points
ID: 8224970
Have you verified this with e.g. DebugView (http://www.sysinternals.com/ntw2k/freeware/debugview.shtml)? It might just be a VS problem...
0
 
LVL 31

Author Comment

by:Zoppo
ID: 8225083
Sorry, jkr, I didn't mention before that I already suspected it may
be a VS problem ... now I could ensure this using the DebugView
(thanks for the link ... interesting tool).

With this tool it's easier ... I don't need to modify my code
as in my question described.

Only little problem is that unfortunateley I can't get the
messages in DebugView while I debug in VS ...

Unless someone else can help me avoiding the problem
with VS the next some days the points will be yours, ok?

Have a nice weekend...
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 8225805
This is a known bug reported in Microsoft Knowledge Base Article - 218007: PRB: IDE May Skip Some TRACE Statements Sent in Quick Succession. See this link for more information:

http://support.microsoft.com/default.aspx?scid=kb;en-us;218007
0
 
LVL 31

Author Comment

by:Zoppo
ID: 8259909
ok ... no more info ... so I accept jkr's answer...

SteveGTR, I placed a 100 point question for you:
https://secure.experts-exchange.com/Programming/Programming_Languages/MFC/Q_20572710.html

Thanks,

have a nice daym

regards,

ZOPPO
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question