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 DIRECTOR_DEBUGGER_H
23 #define DIRECTOR_DEBUGGER_H
24 
25 #include "common/array.h"
26 #include "common/file.h"
27 #include "common/str.h"
28 #include "gui/debugger.h"
29 
30 namespace Director {
31 
32 struct Symbol;
33 
34 enum BreakpointType {
35  kBreakpointTypeNull = 0,
36  kBreakpointFunction = 1,
37  kBreakpointMovie = 2,
38  kBreakpointMovieFrame = 3,
39  kBreakpointVariable = 4,
40  kBreakpointEntity = 5,
41  kBreakpointEvent = 6,
42  kBreakpointProperty = 7,
43 };
44 
45 struct Breakpoint {
46  bool enabled = true;
47  BreakpointType type = kBreakpointTypeNull;
48  int id = 0;
49 
50  uint16 scriptId = 0;
51  Common::String funcName;
52  uint funcOffset = 0;
53  Common::String moviePath;
54  uint frameOffset = 0;
55  Common::String varName;
56  LEvent eventId = kEventNone;
57  int entity = 0;
58  int field = 0;
59  bool varRead = false;
60  bool varWrite = false;
61 
62  Common::String format() const;
63 };
64 
65 
66 class Debugger : public GUI::Debugger {
67 public:
68  Debugger();
69  ~Debugger();
70  void debugLogFile(Common::String logs, bool prompt);
71  void stepHook();
72  void frameHook();
73  void movieHook();
74  void eventHook(LEvent eventId);
75  void pushContextHook();
76  void popContextHook();
77  void builtinHook(const Symbol &funcSym);
78  void propReadHook(const Common::String &varName);
79  void propWriteHook(const Common::String &varName);
80  void varReadHook(const Common::String &varName);
81  void varWriteHook(const Common::String &varName);
82  void entityReadHook(int entity, int field);
83  void entityWriteHook(int entity, int field);
84 
85 private:
86  bool cmdHelp(int argc, const char **argv);
87 
88  bool cmdVersion(int argc, const char **argv);
89  bool cmdInfo(int argc, const char **argv);
90  bool cmdMovie(int argc, const char **argv);
91  bool cmdFrame(int argc, const char **argv);
92  bool cmdChannels(int argc, const char **argv);
93  bool cmdCast(int argc, const char **argv);
94  bool cmdNextFrame(int argc, const char **argv);
95  bool cmdNextMovie(int argc, const char **argv);
96  bool cmdPrint(int argc, const char **argv);
97  bool cmdRepl(int argc, const char **argv);
98  bool cmdBacktrace(int argc, const char **argv);
99  bool cmdDisasm(int argc, const char **argv);
100  bool cmdStack(int argc, const char **argv);
101  bool cmdScriptFrame(int argc, const char **argv);
102  bool cmdFuncs(int argc, const char **argv);
103  bool cmdActions(int argc, const char **argv);
104  bool cmdVar(int argc, const char **argv);
105  bool cmdMarkers(int argc, const char **argv);
106  bool cmdStep(int argc, const char **argv);
107  bool cmdNext(int argc, const char **argv);
108  bool cmdFinish(int argc, const char **argv);
109 
110  bool cmdBpSet(int argc, const char **argv);
111  bool cmdBpMovie(int argc, const char **argv);
112  bool cmdBpFrame(int argc, const char **argv);
113  bool cmdBpEntity(int argc, const char **argv);
114  bool cmdBpProp(int argc, const char **argv);
115  bool cmdBpVar(int argc, const char **argv);
116  bool cmdBpEvent(int argc, const char **argv);
117  bool cmdBpDel(int argc, const char **argv);
118  bool cmdBpEnable(int argc, const char **argv);
119  bool cmdBpDisable(int argc, const char **argv);
120  bool cmdBpList(int argc, const char **argv);
121 
122  bool cmdDraw(int argc, const char **argv);
123  bool cmdForceRedraw(int argc, const char **argv);
124 
125  void bpUpdateState();
126  void bpTest(bool forceCheck = false);
127 
128  bool lingoCommandProcessor(const char *inputOrig);
129  bool lingoEval(const char *inputOrig);
130 
131 
132  Common::DumpFile _out;
133  Common::Path _outName;
134 
135  bool _nextFrame;
136  int _nextFrameCounter;
137  bool _nextMovie;
138  bool _step;
139  int _stepCounter;
140  bool _finish;
141  int _finishCounter;
142  bool _next;
143  int _nextCounter;
144  bool _lingoEval;
145  bool _lingoReplMode;
146 
147  bool _bpCheckFunc = false;
148  bool _bpCheckMoviePath = false;
149  bool _bpNextMovieMatch = false;
150  Common::String _bpMatchFuncName;
151  uint _bpMatchScriptId = 0;
152  Common::String _bpMatchMoviePath;
153  Common::HashMap<uint, void *> _bpMatchFuncOffsets;
154  Common::HashMap<uint, void *> _bpMatchFrameOffsets;
155  bool _bpCheckPropRead = false;
156  bool _bpCheckPropWrite = false;
157  bool _bpCheckVarRead = false;
158  bool _bpCheckVarWrite = false;
159  bool _bpCheckEntityRead = false;
160  bool _bpCheckEntityWrite = false;
161  bool _bpCheckEvent = false;
162 };
163 
164 
165 } // End of namespace Director
166 
167 #endif
Definition: lingo.h:81
Definition: str.h:59
Definition: debugger.h:41
Definition: path.h:52
Definition: debugger.h:66
Definition: file.h:145
Definition: archive.h:35
Definition: hashmap.h:85
Definition: debugger.h:45