debugger.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Kutumov Alexey                                  *
00003  *   ru.pixel@gmail.com                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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

Generated on Thu Mar 5 22:36:42 2009 for gpucalc by  doxygen 1.5.6