some debug tracing mods

All code submission.
Locked
MootPoint
Posts: 58
Joined: Fri Sep 24, 2010 7:44 am

some debug tracing mods

Post by MootPoint »

1) swap out the pattern of

Code: Select all

#if defined (WIN32) || defined (LINUX)
  char    buf[4096], *p = buf;
  sprintf(buf, "Some debug message showing  variables %i and %i\n", variableA, variableB);
  OutputDebugString(buf);
#endif
new paradigm:

Code: Select all

DebugTrace("Some debug message showing variables " << variableA <<" and " << variableB);
No more dealing with formatting sprintf crepes, just stream out variables. Also, DebugTrace washes out in release automatically. (TODO, need to sweep through the rest of the app to apply the changes to all the cases where OutputDebugString() is being called)

2) added two traces to follow adding/resolving things on the stack;

3) changed the uninformative "stack object" string that was the default for base class interrupts to use typeinfo(*this).name() so that you can actually see the derived class in the trace output. Here's a sample of what my trace output looks like now:
  • Action added to stack: Devoted Hero
    Resolving Action on stack: Devoted Hero
    Action added to stack: class NextGamePhase
    Resolving Action on stack: class NextGamePhase
    Action added to stack: class NextGamePhase
    Resolving Action on stack: class NextGamePhase
    Action added to stack: class StackAbility
    Resolving Action on stack: class StackAbility
    Action added to stack: class DrawAction
    Resolving Action on stack: class DrawAction
4) replaced some hardcoded 0 / -1 values with their proper enums.
Attachments

[The extension zip has been deactivated and can no longer be displayed.]

wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: some debug tracing mods

Post by wololo »

awesome!
Locked