Click here to Skip to main content
Click here to Skip to main content

Runtime Trace

By , 30 Mar 2003
 

Sample Image

Purpose

Developing complex applications involves a large amount of time spent on bug crushing. Even after you think that everything is ok - and pass to the final release - the soft might throw some surprise errors, invisible while debugging. I present here an application designated to receive TRACE messages from runtime throwers, and two alternatives of sending such messages.

The receiver

This aim is to display trace messages received from several running applications. It will associate to each application, its own trace child window and will identify it by a string like this:

machine [application description]

where machine is the computer where the sending application is running and application description is a short description of the application itself. All you have to do is to start this application and to set the port where you want to listen from senders. The implicit value is 7777 and it's not recommended to modify it, unless it's already used.

The sender

Using the COM

You may instantiate it by Version Independent ID Tracing.RuntimeTrace, or by importing directly from tracing.dll, which can be found in the system directory. It depends on the developing instrument you are using. The interface has several methods and a property:

BOOL SetTarget (Name[, IP[, Port]] )
  • Name - the string to identify the current application
  • IP - the IP of the machine running the receiver. Default: "127.0.0.1"
  • Port - the port the receiver is listening. Must be the same value the receiver is listening

Attempts to connect the server and assigns a name to the sender application. Returns TRUE if successful, otherwise FALSE.

BOOL IsConnected ()

Returns TRUE if connected, otherwise FALSE.

BOOL Add (Var)
  • Var - The parameter to be added to the list

Adds a variable to the list to be traced. The order of calls must fit the order of the format text passed to the next Trace call. Returns TRUE if successful, otherwise FALSE.

VOID Drop()

Drops the content of the actual parameters list.

BOOL Trace(Format)
  • Format - the format text to be displayed by the receiver. Must be in printf (C function) style

Trace the list previously created with Add. Returns TRUE if successful, otherwise FALSE.

VOID Trace10(Format[, v1[, v2[...[, v10]]...])
  • Format - the format text to be displayed by the receiver
  • v1-v10 - at most 10 parameters to be traced

Trace the variables provided. Must be in printf (C function) style.

ErrorReason

A text containing the reason of the last error

Using RTClass.h (C++/MFC) or RTClassC.h (C++/non MFC)

Contains a class with the equivalent members of the COM interface above.

The protocol

machine "application" text

where machine is the IP of the sender machine, application is the name chosen for the application and text is the text the sender wishes to send. Notice the use of " as syntax element.

Updated

  • March 31, 2003

    Unicode support added.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Bogdan Rechi
Software Developer (Senior)
Europe Europe
Member
Working on a dream...

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionwell done! what about search feature?membermatro28 Jul '03 - 8:09 
AnswerRe: well done! what about search feature?memberBogdan Rechi29 Jul '03 - 2:54 
GeneralRe: well done! what about search feature?membermatro31 Jul '03 - 22:16 
take your vacation... then come back and work on it! Smile | :) I'm actually using it and it's very useful. here is a bullet list of what I'd like to see on next Runtime Trace release:
 
- search feature;
- synchronized scrolling of tiled windows;
- option to use fixed fonts;
- option to enhance/mark specified strings.
 
that's all for next release. keep up the good work!
 
----
matro Smile | :)
 
www.realpopup.it

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 31 Mar 2003
Article Copyright 2002 by Bogdan Rechi
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid