GOB: Add a console command to dump the whole variable space

This commit is contained in:
Sven Hesse 2011-08-26 11:49:44 +02:00
parent 21fd6a2e90
commit 5bcb89852f
2 changed files with 19 additions and 0 deletions

View File

@ -29,6 +29,7 @@ namespace Gob {
GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("varSize", WRAP_METHOD(GobConsole, cmd_varSize));
DCmd_Register("dumpVars", WRAP_METHOD(GobConsole, cmd_dumpVars));
DCmd_Register("var8", WRAP_METHOD(GobConsole, cmd_var8));
DCmd_Register("var16", WRAP_METHOD(GobConsole, cmd_var16));
DCmd_Register("var32", WRAP_METHOD(GobConsole, cmd_var32));
@ -44,6 +45,23 @@ bool GobConsole::cmd_varSize(int argc, const char **argv) {
return true;
}
bool GobConsole::cmd_dumpVars(int argc, const char **argv) {
if (!_vm->_inter->_variables)
return true;
Common::DumpFile file;
if (!file.open("variables.dmp"))
return true;
file.write(_vm->_inter->_variables->getAddressOff8(0), _vm->_inter->_variables->getSize());
file.flush();
file.close();
return true;
}
bool GobConsole::cmd_var8(int argc, const char **argv) {
if (argc == 1) {
DebugPrintf("Usage: var8 <var offset> (<value>)\n");

View File

@ -38,6 +38,7 @@ private:
GobEngine *_vm;
bool cmd_varSize(int argc, const char **argv);
bool cmd_dumpVars(int argc, const char **argv);
bool cmd_var8(int argc, const char **argv);
bool cmd_var16(int argc, const char **argv);
bool cmd_var32(int argc, const char **argv);