jeDebug

jeDebug is a runtime error tracing utility, useful for verifying input to functions
etc.


How it works :
Perhaps you are familiar with the ASSERT macro ? jeDebug adds is a bunch of
similar macros that you can use to verify your data. Example:
int ReadFromOpenedFile(FILE *fp)
{
NEEDVALUE(fp);
while (fgets(... etc ...
}
If this function is called with a null pointer instead of a valid file handle, the
NEEDVALUE(fp) macro will start the jeDebug application (see image 1), and send a message
to it that will be displayed in a list. (see image 2). The execution of your application
will not be halted, as it is when using the ASSERT macro. If JESYS_DEBUG is not defined,
the NEEDVALUE macro will be completely ignored, and will have no impact on your code.
Downloading :
Go to the Downloads page to download the lastest
version of jeDebug.
Files in the zip archive :
jeDebugSetup.exe - the program that will install the jeDebug.exe app and set up
the necessary registry entries.
jeDebug.h - header file for the client app (your application)
jeDebug.cpp - source file for the client app.
How to install jeDebug :
Run the jeDebugSetup.exe program, it will install the jeDebug.exe application and
set up some registry info (like the path to jeDebug.exe so that your app can start the
program if an error is generated). The first time it is run it will ask for a destination
directory, but only the first time. If a newer version is installed, it will be done
silently, automatically using the old directory.
How to add jeDebug functionality to your application :
Add the jeDebug.h and jeDebug.cpp files to your project.
Define JESYS_DEBUG when compiling the jeDebug version of your application.
You are now set to go!
Description of the macros :
NEEDVALUE(x) |
use to verify that x is not zero |
NEEDVALUES(x,y) |
use to verify that both x and y has values other than zero (just a short
for using two NEEDVALUE) |
NEEDCLEAR(x) |
use to verify that x is indeed zero and not some other value |
NEEDSAME(x,y) |
use to verify that x and y are equal |
NEEDDIFF(x,y) |
use to verify that x and y are not equal but different |
NEEDSTRING(x) |
use to verify that x has a value and that the first character is not zero,
ie an empty string is invalid |
NEEDLESS(x,y) |
use to verify that x is less than y |
NEEDMORE(x,y) |
use to verify that x is more than y |
DEBUGOUT(x) |
use to output a custom string x |
REPORTWIN32ERROR(x) |
use to output a report of the Win32 standard error code x |
REPORTLASTWIN32ERROR |
use to output a report of the last Win32 error (no need to supply a code) |
REPORTDIRECTDRAWERROR(x) |
use to output a report of the DirectDraw error code x |
REPORTDIRECTINPUTERROR(x) |
use to output a report of the DirectInput error code x |
Also, you can use the jeDebug::StringOutF method to output a string using printf
formatting style, however I have not yet found a way to create a handy macro for it, so
you'll have to do it like this :
#ifdef JESYS_DEBUG
jeDebug::StringOutF(__FILE__,__LINE__,"the coordinates are
(%d,%d)",coords.x,coords.y);
#endif
Features :
 | There will only be one instance of the jeDebug app, it will collect error messages from
any number of apps. |
 | The jeDebug app will be started if, and only when, needed. |
 | Enable/Disable debug output at runtime |
 | Configurable max number of entries (useful if you're being flooded a lot, often only the
first message is important) |
 | The message listctrl has sortable columns. |
 | Not MFC-dependant. |
 | Built-in support for Win32, DirectDraw and DirectInput errors (more to come) |