debugger.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00033 #ifndef __debugger__header__
00034 #define __debugger__header__
00035
00036 #include "gpucalc/task.h"
00037 #include "gpucalc/string_util.h"
00038
00039 #include "gpucalc/debugger/code_instructor.h"
00040
00041 namespace gpucalc
00042 {
00043
00044 namespace debugger
00045 {
00046
00047
00048 const char _DebuggerName [] = "debugger::Debugger";
00049
00050
00054 class _GpuCalcExport Debugger: public Singleton<Debugger>
00055 {
00056
00057
00058 OBJ_DISABLE_COPY(Debugger)
00059
00060
00061
00062 public:
00063 Debugger();
00064
00065
00066 ~Debugger();
00067
00068
00069 void addCodeInstructor(CodeInstructor * CodeInst);
00070
00071
00072 void setTask(Task * task);
00073
00074
00075 Task * getTask() const
00076 {
00077 return mTask;
00078 }
00079
00080
00081 std::string getOriginalSource() const
00082 {
00083 return mOriginalSource;
00084 }
00085
00086
00090 void setBreakPoint(size_t line);
00091
00092
00096 void print(const std::string & expression);
00097
00098
00105 static void doPrintingData(const Data & data, size_t xcomp, size_t ycomp = 0, size_t zcomp = 0);
00106
00107
00108 void stepInto();
00109
00110
00111 void stepOver();
00112
00113
00117 void stop();
00118
00119
00120 bool isDebugging() const
00121 {
00122 return mIsDebug;
00123 }
00124
00125
00129 static Debugger * getSingletonPtr();
00130
00131
00135 static Debugger & getSingleton();
00136
00137
00138 private:
00139 typedef std::map<std::string, CodeInstructor *> CodeInstructorMap;
00140 CodeInstructorMap mCodeInstructorMap;
00141
00142
00143 CodeInstructor * mActiveCodeInstructor;
00144
00145
00146 bool mIsDebug;
00147
00148
00149 Task * mTask;
00150
00151
00152 std::string mOriginalSource;
00153
00154
00155 std::string mExpression;
00156
00157
00158 size_t mLine;
00159
00160
00161 const Data & process();
00162
00163
00164
00165 template <typename T> static void elseOnePrintingData(const Data & data, size_t xcomp, size_t ycomp = 0, size_t zcomp = 0);
00166
00167 };
00168
00169 }
00170 }
00171
00172
00173 #endif