mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-02 23:26:44 +00:00
GUI: added new debugger command to execute a file line by line
This commit is contained in:
parent
09859f0e34
commit
2d42bcfb62
@ -23,6 +23,7 @@
|
||||
// NB: This is really only necessary if USE_READLINE is defined
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/debug-channels.h"
|
||||
#include "common/system.h"
|
||||
@ -72,6 +73,7 @@ Debugger::Debugger() {
|
||||
registerCmd("md5", WRAP_METHOD(Debugger, cmdMd5));
|
||||
registerCmd("md5mac", WRAP_METHOD(Debugger, cmdMd5Mac));
|
||||
#endif
|
||||
registerCmd("exec", WRAP_METHOD(Debugger, cmdExecFile));
|
||||
|
||||
registerCmd("debuglevel", WRAP_METHOD(Debugger, cmdDebugLevel));
|
||||
registerCmd("debugflag_list", WRAP_METHOD(Debugger, cmdDebugFlagsList));
|
||||
@ -764,6 +766,28 @@ bool Debugger::cmdDebugFlagEnable(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Debugger::cmdExecFile(int argc, const char **argv) {
|
||||
if (argc <= 1) {
|
||||
debugPrintf("Expected to get the file with debug commands\n");
|
||||
return false;
|
||||
}
|
||||
const Common::String filename(argv[1]);
|
||||
Common::File file;
|
||||
if (!file.open(filename)) {
|
||||
debugPrintf("Can't open file %s\n", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
for (;;) {
|
||||
const Common::String &line = file.readLine();
|
||||
if (line.empty()) {
|
||||
break;
|
||||
}
|
||||
parseCommand(line.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Debugger::cmdDebugFlagDisable(int argc, const char **argv) {
|
||||
if (argc < 2) {
|
||||
debugPrintf("debugflag_disable [<flag> | all]\n");
|
||||
|
@ -242,6 +242,7 @@ protected:
|
||||
bool cmdDebugFlagsList(int argc, const char **argv);
|
||||
bool cmdDebugFlagEnable(int argc, const char **argv);
|
||||
bool cmdDebugFlagDisable(int argc, const char **argv);
|
||||
bool cmdExecFile(int argc, const char **argv);
|
||||
|
||||
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user