Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: quickdebugger.h 1.1.4 edited 2006-02-23T15:39:57$ 00003 ** 00004 ** Copyright (C) 2001-2006 Trolltech AS. All rights reserved. 00005 ** 00006 ** This file is part of the Qt Script for Applications framework (QSA). 00007 ** 00008 ** This file may be distributed and/or modified under the terms of the 00009 ** GNU General Public License version 2 as published by the Free Software 00010 ** Foundation and appearing in the file LICENSE.GPL included in the 00011 ** packaging of this file. 00012 ** 00013 ** Licensees holding a valid Qt Script for Applications license may use 00014 ** this file in accordance with the Qt Script for Applications License 00015 ** Agreement provided with the Software. 00016 ** 00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00019 ** 00020 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00021 ** information about QSA Commercial License Agreements. 00022 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00023 ** 00024 ** Contact info@trolltech.com if any conditions of this licensing are 00025 ** not clear to you. 00026 ** 00027 *****************************************************************************/ 00028 00029 #ifndef QUICKDEBUGGER_H 00030 #define QUICKDEBUGGER_H 00031 00032 #ifdef QSDEBUGGER 00033 00034 #ifndef QT_H 00035 #include <qobject.h> 00036 #include <qvaluelist.h> 00037 #include <qvaluestack.h> 00038 #include "dlldefs.h" 00039 #endif // QT_H 00040 00041 #include <qsdebugger.h> 00042 00043 struct QUICKCORE_EXPORT QuickDebuggerStackFrame { 00044 QuickDebuggerStackFrame(const QString &fn = QString::null, 00045 int ln = -1, int sid = -1) : 00046 function(fn), line(ln), sourceId(sid) {} 00047 QString function; 00048 int line; 00049 int sourceId; 00050 ScopeChain scope; 00051 00052 bool operator==(const QuickDebuggerStackFrame &other) const { 00053 return function == other.function && 00054 line == other.line && 00055 sourceId == other.sourceId; 00056 } 00057 }; 00058 00059 #if defined(Q_TEMPLATEDLL) 00060 // MOC_SKIP_BEGIN 00061 template class QUICKCORE_EXPORT QValueList<QuickDebuggerStackFrame>; 00062 template class QUICKCORE_EXPORT QValueStack<bool>; 00063 // MOC_SKIP_END 00064 #endif 00065 00066 00067 class QUICKCORE_EXPORT QuickDebugger : public QObject, public Debugger 00068 { 00069 Q_OBJECT 00070 00071 public: 00072 QuickDebugger(QSEngine *e); 00073 00074 int freeSourceId(); 00075 bool watch(const QString &var, QString &type, QString &value) const; 00076 bool setVariable(const QString &var, const QString &val); 00077 void clear(); 00078 QValueList<QuickDebuggerStackFrame> backtrace(); 00079 void storeExceptionStack(); 00080 void setMode(Mode m); 00081 00082 void setScopeLevel(int level) { 00083 scopeLvl = level; 00084 } 00085 int scopeLevel() const { 00086 return scopeLvl; 00087 } 00088 00089 signals: 00090 void stopped(bool &ret); 00091 void modeChanged(int m); 00092 00093 protected: 00094 bool stopEvent(); 00095 void callEvent(const QString &fn, const QString &s); 00096 void returnEvent(); 00097 QString varInfo(const QString &ident) const; 00098 QString varInfoScope(const QString &ident) const; 00099 00100 private: 00101 QValueList<QuickDebuggerStackFrame> cStack; 00102 QValueList<QuickDebuggerStackFrame> exceptionStack; 00103 ScopeChain exceptionScope; 00104 QValueStack<bool> tmpCStack; 00105 00106 uint hadError: 1; 00107 int scopeLvl; 00108 }; 00109 00110 #endif 00111 00112 #endif