			XTrace & XDebugServer V0.99

Overview
========

This package contains the components required to format and send debug string messages from an XBox application under development to a target PC.  These components include:


1. XTrace Source

This is a code that you include in your XBox project that implements the XTRACE macro.  This macro allows for printf style formatting to be used similar to the MFC TRACE() macro. For example:

	...

	UINT nErrorNum = SomeFuntion();
	XTRACE( "Error number %u: %s\n", nErrorNum, GetErrorString( nErrorNum ) );

	...

By setting the appropriate #defines the XTRACE macro can:

	1. Do nothing. Macro expands into a ';'.
	2. Call OutputDebugString() with a printf formatted string.
	3. Send the formatted string to another computer.

2. XDebugServer

This is a program that runs as a service on your PC.  Remote devices can send debug string messages to this service and it will forward these messages to the local debug monitor.

3. DebugView

This is a freely available windows program that implements a full featured debug log viewer. You can get a copy from www.sysinternals.com.


When properly configured the debug message flow is as follows:

	XBoxApp -->  XDebugServer --> DebugView


How To Setup
============

1. On the PC put XDebug.exe somewhere and then from the command line run: "XDebug -i". This will install the service.  For more command line options see the source.

2. Go to the service manager and start the "Xbox Debug Message Server" service we just installed.

3. Add XTrace.h, XTraceClient.h, XTraceClient.cpp, and XCriticalSection.h to your XBox developement project.

4. Modify XTrace.h with and enable debug and error tracing:

	#define USE_XTRACE 1
	#define USE_XERROR 1

5. Add a call to your applications init routine to enable the XTRACE client:

	#include "XTrace.h"

	XDEBUGINIT( "172.28.1.10", 7654 );

5. Add a call to XDEBUGCLEANUP() in your application exit routine:

	XDEBUGCLEANUP();

6. Use the XTRACE macro wherever you want to see debug output.  Use the XERROR macro for failure case trace output.


Thats it.  At this point when you execute your XBox app the XTRACE output should appear in the DebugView application on your PC.

Acknowledgements
================

The most excellent classes for making an application run as a NT service in under 10 minutes came from Joerg Koenig (Joerg.Koenig@rhein-neckar.de).  I got the source from http://www.codeguru.com.

Some of this design is based on another XBox debug application (author unknown).  This is available from www.xbox-scene.com.

The rest of the stuff in MyLib is stuff that I (Blackbelt) wrote.