ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <debugger.h>

Inheritance diagram for GUI::Debugger:
Collaboration diagram for GUI::Debugger:

List of all members.

Classes

struct  Var

Public Member Functions

 Debugger ()
virtual ~Debugger ()
int getCharsPerLine ()
int debugPrintf (const char *format,...) GCC_PRINTF(2
int void debugPrintColumns (const Common::StringArray &list)
virtual void onFrame ()
 The onFrame() method should be invoked by the engine at regular intervals (usually once per main loop iteration) whenever the debugger is attached.
virtual void attach (const char *entry=0)
 'Attach' the debugger.
bool isActive () const
 Return true if the debugger is currently active (i.e.

Protected Types

enum  VarType {
  DVAR_BYTE, DVAR_INT, DVAR_BOOL, DVAR_INTARRAY,
  DVAR_STRING
}
typedef Common::Functor2< int,
const char **, bool > 
Debuglet

Protected Member Functions

void registerVar (const Common::String &varname, byte *variable)
void registerVar (const Common::String &varname, int *variable)
void registerVar (const Common::String &varname, bool *variable)
void registerVar (const Common::String &varname, int32 **variable, int arraySize)
void registerVar (const Common::String &varname, Common::String *variable)
void registerCmd (const Common::String &cmdname, Debuglet *debuglet)
virtual void preEnter ()
 Hook for subclasses which is called just before enter() is run.
virtual void postEnter ()
 Hook for subclasses which is called just after enter() was run.
void detach ()
 Subclasses should invoke the detach() method in their cmdFOO methods if that command will resume execution of the program (as opposed to executing, say, a "single step through code" command).
bool cmdExit (int argc, const char **argv)
bool cmdHelp (int argc, const char **argv)
bool cmdOpenLog (int argc, const char **argv)
bool cmdMd5 (int argc, const char **argv)
bool cmdMd5Mac (int argc, const char **argv)
bool cmdDebugLevel (int argc, const char **argv)
bool cmdDebugFlagsList (int argc, const char **argv)
bool cmdDebugFlagEnable (int argc, const char **argv)
bool cmdDebugFlagDisable (int argc, const char **argv)

Private Types

typedef Common::HashMap
< Common::String,
Common::SharedPtr< Debuglet >
, Common::IgnoreCase_Hash,
Common::IgnoreCase_EqualTo
CommandsMap

Private Member Functions

void registerVar (const Common::String &varname, void *variable, VarType type, int arraySize)
 Register a variable with the debugger.
void enter ()
void splitCommand (Common::String &input, int &argc, const char **argv)
 Splits up the input into individual parameters.
bool parseCommand (const char *input)
bool tabComplete (const char *input, Common::String &completion) const
virtual bool handleCommand (int argc, const char **argv, bool &keepRunning)
 Process the given command line.

Static Private Member Functions

static bool debuggerInputCallback (GUI::ConsoleDialog *console, const char *input, void *refCon)
static bool debuggerCompletionCallback (GUI::ConsoleDialog *console, const char *input, Common::String &completion, void *refCon)

Private Attributes

uint _frameCountdown
 The frame countdown specifies a number of frames that must pass until the console will show up.
Common::Array< Var_vars
CommandsMap _cmds
bool _isActive
 True if the debugger is currently active (i.e.
Common::String _errStr
bool _firstTime
 Initially true, set to false when Debugger::enter is called the first time.
GUI::ConsoleDialog_debuggerDialog

Detailed Description

Definition at line 40 of file debugger.h.


Member Typedef Documentation

typedef Common::Functor2<int, const char **, bool> GUI::Debugger::Debuglet [protected]

Definition at line 77 of file debugger.h.


Member Enumeration Documentation

enum GUI::Debugger::VarType [protected]
Enumerator:
DVAR_BYTE 
DVAR_INT 
DVAR_BOOL 
DVAR_INTARRAY 
DVAR_STRING 

Definition at line 90 of file debugger.h.


Constructor & Destructor Documentation

GUI::Debugger::Debugger (  ) 

Reimplemented in Grim::Debugger.

Definition at line 51 of file debugger.cpp.

GUI::Debugger::~Debugger (  )  [virtual]

Reimplemented in Grim::Debugger.

Definition at line 82 of file debugger.cpp.


Member Function Documentation

void GUI::Debugger::attach ( const char *  entry = 0  )  [virtual]

'Attach' the debugger.

This ensures that the next time onFrame() is invoked, the debugger will activate and accept user input.

Definition at line 157 of file debugger.cpp.

bool GUI::Debugger::cmdDebugFlagDisable ( int  argc,
const char **  argv 
) [protected]

Definition at line 761 of file debugger.cpp.

bool GUI::Debugger::cmdDebugFlagEnable ( int  argc,
const char **  argv 
) [protected]

Definition at line 745 of file debugger.cpp.

bool GUI::Debugger::cmdDebugFlagsList ( int  argc,
const char **  argv 
) [protected]

Definition at line 727 of file debugger.cpp.

bool GUI::Debugger::cmdDebugLevel ( int  argc,
const char **  argv 
) [protected]

Definition at line 708 of file debugger.cpp.

bool GUI::Debugger::cmdExit ( int  argc,
const char **  argv 
) [protected]

Definition at line 543 of file debugger.cpp.

bool GUI::Debugger::cmdHelp ( int  argc,
const char **  argv 
) [protected]

Definition at line 550 of file debugger.cpp.

bool GUI::Debugger::cmdMd5 ( int  argc,
const char **  argv 
) [protected]

Definition at line 616 of file debugger.cpp.

bool GUI::Debugger::cmdMd5Mac ( int  argc,
const char **  argv 
) [protected]

Definition at line 656 of file debugger.cpp.

bool GUI::Debugger::cmdOpenLog ( int  argc,
const char **  argv 
) [protected]

Definition at line 601 of file debugger.cpp.

bool GUI::Debugger::debuggerCompletionCallback ( GUI::ConsoleDialog console,
const char *  input,
Common::String completion,
void *  refCon 
) [static, private]

Definition at line 786 of file debugger.cpp.

bool GUI::Debugger::debuggerInputCallback ( GUI::ConsoleDialog console,
const char *  input,
void *  refCon 
) [static, private]

Definition at line 779 of file debugger.cpp.

void GUI::Debugger::debugPrintColumns ( const Common::StringArray list  ) 

Definition at line 118 of file debugger.cpp.

int GUI::Debugger::debugPrintf ( const char *  format,
  ... 
)

Definition at line 103 of file debugger.cpp.

void GUI::Debugger::detach (  )  [protected]

Subclasses should invoke the detach() method in their cmdFOO methods if that command will resume execution of the program (as opposed to executing, say, a "single step through code" command).

This currently only hides the virtual keyboard, if any.

Definition at line 167 of file debugger.cpp.

void GUI::Debugger::enter (  )  [private]

Definition at line 214 of file debugger.cpp.

int GUI::Debugger::getCharsPerLine (  ) 

Definition at line 90 of file debugger.cpp.

bool GUI::Debugger::handleCommand ( int  argc,
const char **  argv,
bool &  keepRunning 
) [private, virtual]

Process the given command line.

Returns true if and only if argv[0] is a known command and was handled, false otherwise.

Definition at line 276 of file debugger.cpp.

bool GUI::Debugger::isActive (  )  const [inline]

Return true if the debugger is currently active (i.e.

executing a command or waiting for use input).

Definition at line 74 of file debugger.h.

void GUI::Debugger::onFrame (  )  [virtual]

The onFrame() method should be invoked by the engine at regular intervals (usually once per main loop iteration) whenever the debugger is attached.

This will open up the console and accept user input if certain preconditions are met, such as the frame countdown having reached zero.

Subclasses can override this to e.g. check for breakpoints being triggered.

Definition at line 172 of file debugger.cpp.

bool GUI::Debugger::parseCommand ( const char *  input  )  [private]

Definition at line 289 of file debugger.cpp.

void GUI::Debugger::postEnter (  )  [protected, virtual]

Hook for subclasses which is called just after enter() was run.

A typical usage example is resuming music and sound effects.

The default implementation invokes Engine::pauseEngine(false).

Definition at line 153 of file debugger.cpp.

void GUI::Debugger::preEnter (  )  [protected, virtual]

Hook for subclasses which is called just before enter() is run.

A typical usage example is pausing music and sound effects.

The default implementation invokes Engine::pauseEngine(true).

Definition at line 149 of file debugger.cpp.

void GUI::Debugger::registerCmd ( const Common::String cmdname,
Debuglet debuglet 
) [protected]

Definition at line 536 of file debugger.cpp.

void GUI::Debugger::registerVar ( const Common::String varname,
byte variable 
) [inline, protected]

Definition at line 117 of file debugger.h.

void GUI::Debugger::registerVar ( const Common::String varname,
Common::String variable 
) [inline, protected]

Definition at line 133 of file debugger.h.

void GUI::Debugger::registerVar ( const Common::String varname,
int32 **  variable,
int  arraySize 
) [inline, protected]

Definition at line 129 of file debugger.h.

void GUI::Debugger::registerVar ( const Common::String varname,
int *  variable 
) [inline, protected]

Definition at line 121 of file debugger.h.

void GUI::Debugger::registerVar ( const Common::String varname,
bool *  variable 
) [inline, protected]

Definition at line 125 of file debugger.h.

void GUI::Debugger::registerVar ( const Common::String varname,
void *  variable,
VarType  type,
int  arraySize 
) [private]

Register a variable with the debugger.

This allows the user to read and modify this variable.

Parameters:
varname the identifier with which the user may access the variable
variable pointer to the actual storage of the variable
type the type of the variable (byte, int, bool, ...)
arraySize for type DVAR_INTARRAY this specifies the size of the array

Definition at line 521 of file debugger.cpp.

void GUI::Debugger::splitCommand ( Common::String input,
int &  argc,
const char **  argv 
) [private]

Splits up the input into individual parameters.

Remarks:
Adapted from code provided by torek on StackOverflow

Definition at line 396 of file debugger.cpp.

bool GUI::Debugger::tabComplete ( const char *  input,
Common::String completion 
) const [private]

Definition at line 449 of file debugger.cpp.


Member Data Documentation

Definition at line 157 of file debugger.h.

Definition at line 176 of file debugger.h.

Definition at line 165 of file debugger.h.

bool GUI::Debugger::_firstTime [private]

Initially true, set to false when Debugger::enter is called the first time.

We use this flag to show a greeting message to the user once, when he opens the debugger for the first time.

Definition at line 173 of file debugger.h.

The frame countdown specifies a number of frames that must pass until the console will show up.

This value is decremented by one each time onFrame() is called, until it reaches 0, at which point onFrame() will open the console and handle input into it.

The user can modify this value using the debug_countdown command.

Note: The console must be in *attached* state, otherwise, it won't show up (and the countdown won't count down either).

Definition at line 152 of file debugger.h.

bool GUI::Debugger::_isActive [private]

True if the debugger is currently active (i.e.

executing a command or waiting for use input).

Definition at line 163 of file debugger.h.

Definition at line 154 of file debugger.h.


The documentation for this class was generated from the following files:


Generated on Sat Jul 20 2019 05:03:06 for ResidualVM by doxygen 1.7.1
curved edge   curved edge