Page 1 of 1

some debug tracing mods

Posted: Tue Oct 05, 2010 9:41 am
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.

Re: some debug tracing mods

Posted: Tue Oct 05, 2010 10:31 am
by wololo
awesome!