ScummVM API documentation
debugger.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef WINTERMUTE_DEBUGGER_H
23 #define WINTERMUTE_DEBUGGER_H
24 
25 #define EXTENDED_DEBUGGER_ENABLED 1
26 
27 #include "gui/debugger.h"
28 
29 #if EXTENDED_DEBUGGER_ENABLED
30 #include "engines/wintermute/base/scriptables/debuggable/debuggable_script.h"
31 #else
32 #include "engines/wintermute/base/scriptables/script.h"
33 #endif
34 
35 #define DEFAULT_SOURCE_PADDING 5
36 
37 
38 #define STEP_CMD "step"
39 #define CONTINUE_CMD "continue"
40 #define FINISH_CMD "finish"
41 #define WATCH_CMD "watch"
42 #define BREAK_CMD "break"
43 #define LIST_CMD "list"
44 #define REMOVE_BREAKPOINT_CMD "del"
45 #define DISABLE_BREAKPOINT_CMD "disable"
46 #define ENABLE_BREAKPOINT_CMD "enable"
47 #define REMOVE_WATCH_CMD "delw"
48 #define DISABLE_WATCH_CMD "disablew"
49 #define ENABLE_WATCH_CMD "enablew"
50 #define INFO_CMD "info"
51 #define SET_CMD "set"
52 #define PRINT_CMD "print"
53 #define SET_PATH_CMD "set_path"
54 #define TOP_CMD "top"
55 
56 namespace Wintermute {
57 class WintermuteEngine;
58 class Adapter;
59 class DebuggerController;
60 class Error;
61 
62 class Console : public GUI::Debugger {
63 public:
65  ~Console() override;
66  /*
67  * Debug commands
68  */
69  bool Cmd_Help(int argc, const char **argv);
70  bool Cmd_ShowFps(int argc, const char **argv);
71  bool Cmd_DumpFile(int argc, const char **argv);
72 
73 #if EXTENDED_DEBUGGER_ENABLED
74 
77  bool Cmd_Step(int argc, const char **argv);
81  bool Cmd_Continue(int argc, const char **argv);
86  bool Cmd_Finish(int argc, const char **argv);
87  bool Cmd_Print(int argc, const char **argv);
88  bool Cmd_Set(int argc, const char **argv);
89  // Breakpoints
90  bool Cmd_AddBreakpoint(int argc, const char **argv);
91  bool Cmd_RemoveBreakpoint(int argc, const char **argv);
92  bool Cmd_EnableBreakpoint(int argc, const char **argv);
93  bool Cmd_DisableBreakpoint(int argc, const char **argv);
101  bool Cmd_Watch(int argc, const char **argv);
102  bool Cmd_RemoveWatch(int argc, const char **argv);
103  bool Cmd_EnableWatch(int argc, const char **argv);
104  bool Cmd_DisableWatch(int argc, const char **argv);
109  bool Cmd_Info(int argc, const char **argv);
113  bool Cmd_List(int argc, const char **argv);
127  bool Cmd_SourcePath(int argc, const char **argv);
128 
132  bool Cmd_Top(int argc, const char **argv);
133 
134  Error printSource(int n = DEFAULT_SOURCE_PADDING);
135 
139  void notifyBreakpoint(const char *filename, int line);
140  void notifyStep(const char *filename, int line);
146  void notifyWatch(const char *filename, const char *symbol, const char *newValue);
147 #endif
148 
149 private:
150  const WintermuteEngine *_engineRef;
151  void printError(const Common::String &command, Error error);
152  void printUsage(const Common::String &command);
153 };
154 
155 }
156 
157 #endif // WINTERMUTE_DEBUGGER_H
bool Cmd_SourcePath(int argc, const char **argv)
Definition: str.h:59
Definition: debugger.h:62
bool Cmd_List(int argc, const char **argv)
Definition: debugger.h:41
void notifyWatch(const char *filename, const char *symbol, const char *newValue)
bool Cmd_Info(int argc, const char **argv)
void notifyBreakpoint(const char *filename, int line)
Definition: wintermute.h:51
bool Cmd_Watch(int argc, const char **argv)
bool Cmd_Step(int argc, const char **argv)
bool Cmd_Top(int argc, const char **argv)
Definition: error.h:54
bool Cmd_Finish(int argc, const char **argv)
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
bool Cmd_Continue(int argc, const char **argv)
Definition: achievements_tables.h:27