KDevelop API Documentation

breakpoint.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     begin                : Tue May 13 2003
00003     copyright            : (C) 2003 by John Birch
00004     email                : jbb@kdevelop.org
00005  ***************************************************************************/
00006 
00007 /***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 #ifndef _BREAKPOINT_H_
00017 #define _BREAKPOINT_H_
00018 
00019 #include <klocale.h>
00020 
00021 #include <qstring.h>
00022 
00023 /***************************************************************************/
00024 /***************************************************************************/
00025 /***************************************************************************/
00026 
00027 namespace GDBDebugger
00028 {
00029 
00030 enum BP_TYPES
00031 {
00032     BP_TYPE_Invalid,
00033     BP_TYPE_FilePos,
00034     BP_TYPE_Watchpoint,
00035     BP_TYPE_Address,
00036     BP_TYPE_Function
00037 };
00038 
00039 class Breakpoint
00040 {
00041 public:
00042     Breakpoint(bool temporary=false, bool enabled=true);
00043     virtual ~Breakpoint();
00044 
00045     virtual QString dbgSetCommand() const                 = 0;
00046     virtual QString dbgRemoveCommand() const;
00047     virtual bool match(const Breakpoint* brkpt) const     = 0;
00048     virtual void reset();
00049 
00050     void setActive(int active, int id);
00051     bool isActive(int active) const                 { return (active_ == active) ||
00052                                                         (s_pending_ && !s_actionClear_); }
00053     void setEnabled(bool enabled)                   { s_changedEnable_ = (s_enabled_ != enabled);
00054                                                       s_enabled_ = enabled; }
00055     bool isEnabled() const                          { return s_enabled_; }
00056     void setTemporary(bool temporary)               { s_temporary_ = temporary; }
00057     bool isTemporary() const                        { return s_temporary_; }
00058     void setHardwareBP(bool hardwareBP)             { s_hardwareBP_ = hardwareBP; }
00059     bool isHardwareBP() const                       { return s_hardwareBP_; }
00060     void setIgnoreCount(int ignoreCount)            { s_changedIgnoreCount_ =
00061                                                           (ignoreCount_ != ignoreCount);
00062                                                       ignoreCount_ = ignoreCount; }
00063     int ignoreCount() const                         { return ignoreCount_; }
00064     void setAddress(const QString &address)         { address_ = address; }
00065     QString address() const                         { return address_; }
00066     void setConditional(const QString &condition)   { s_changedCondition_ =
00067                                                           (condition_ != condition);
00068                                                       condition_ = condition; }
00069     QString conditional() const                     { return condition_; }
00070 
00071     bool changedCondition() const                   { return s_changedCondition_; }
00072     bool changedIgnoreCount() const                 { return s_changedIgnoreCount_; }
00073     bool changedEnable() const                      { return s_changedEnable_; }
00074 
00075     void setPending(bool pending)                   { s_pending_ = pending; }
00076     bool isPending() const                          { return s_pending_; }
00077     void setActionAdd(bool actionAdd)               { s_actionDie_ = false;
00078                                                       s_actionAdd_ = actionAdd; }
00079     bool isActionAdd() const                        { return s_actionAdd_; }
00080     void setActionClear(bool actionClear)           { s_actionClear_ = actionClear; }
00081     bool isActionClear() const                      { return s_actionClear_; }
00082     void setActionModify(bool actionModify)         { s_actionDie_ = false;
00083                                                       s_actionModify_ = actionModify; }
00084     bool isActionModify() const                     { return s_actionModify_; }
00085     void setDbgProcessing(bool dbgProcessing)       { s_dbgProcessing_ = dbgProcessing; }
00086     bool isDbgProcessing() const                    { return s_dbgProcessing_; }
00087     void setActionDie()                             { s_actionDie_ = true;
00088                                                       s_actionClear_ = false; }
00089     bool isActionDie() const                        { return s_actionDie_; }
00090 
00091     int key() const                                 { return key_; }
00092     void setDbgId(int dbgId)                        { dbgId_ = dbgId; }
00093     int  dbgId() const                              { return dbgId_; }
00094     void setHits(int hits)                          { hits_ = hits; }
00095     int  hits() const                               { return hits_; }
00096 
00097     virtual QString statusDisplay(int activeFlag) const;
00098     virtual BP_TYPES type() const                   { return BP_TYPE_Invalid; }
00099     virtual QString displayType() const             { return i18n( "Invalid" ); }
00100 
00101     virtual QString location(bool compact=true)     = 0;
00102     virtual void setLocation(const QString& )       = 0;
00103     virtual bool isValid() const                    = 0;
00104 
00105 private:
00106     bool s_pending_             :1;
00107     bool s_actionAdd_           :1;
00108     bool s_actionClear_         :1;
00109     bool s_actionModify_        :1;
00110     bool s_actionDie_           :1;
00111     bool s_dbgProcessing_       :1;
00112     bool s_enabled_             :1;
00113     bool s_temporary_           :1;
00114     bool s_changedCondition_    :1;
00115     bool s_changedIgnoreCount_  :1;
00116     bool s_changedEnable_       :1;
00117     bool s_hardwareBP_          :1;     // assigned by gdb
00118 
00119     int dbgId_;                         // assigned by gdb
00120     int hits_;                          // assigned by gdb
00121 
00122     int key_;                           // internal unique key
00123     int active_;                        // counter incremented on receipt of all BP's
00124 
00125     int ignoreCount_;
00126     QString address_;
00127     QString condition_;
00128 //    QString type_;
00129 };
00130 
00131 /***************************************************************************/
00132 /***************************************************************************/
00133 /***************************************************************************/
00134 class FilePosBreakpoint : public Breakpoint
00135 {
00136 public:
00137     FilePosBreakpoint(const QString &fileName, int lineNum,
00138                       bool temporary=false, bool enabled=true);
00139     virtual ~FilePosBreakpoint();
00140     virtual QString dbgSetCommand() const;
00141     virtual bool match(const Breakpoint *brkpt) const;
00142 
00143     BP_TYPES type () const                      { return BP_TYPE_FilePos; }
00144     QString displayType() const                 { return i18n( "File:line" ); }
00145     void setFileName(const QString& fileName)   { fileName_ = fileName; }
00146     QString fileName() const                    { return fileName_; }
00147     void setLineNum(int lineNum)                { lineNo_ = lineNum; }
00148     int lineNum() const                         { return lineNo_; }
00149     QString location(bool compact=true);
00150     void setLocation(const QString& location);
00151     bool isValid() const                        { return lineNo_>0 && !fileName_.isEmpty(); }
00152 
00153 private:
00154     QString fileName_;
00155     int lineNo_;
00156 };
00157 /***************************************************************************/
00158 /***************************************************************************/
00159 /***************************************************************************/
00160 //class RegExpBreakpoint : public Breakpoint
00161 //{
00162 //public:
00163 //  RegExpBreakpoint(bool temporary=false, bool enabled=true);
00164 //  virtual ~RegExpBreakpoint();
00165 //  virtual QString dbgSetCommand() const;
00166 //};
00167 /***************************************************************************/
00168 /***************************************************************************/
00169 /***************************************************************************/
00170 //class CatchBreakpoint : public Breakpoint
00171 //{
00172 //public:
00173 //  CatchBreakpoint(bool temporary=false, bool enabled=true);
00174 //  virtual ~CatchBreakpoint();
00175 //  virtual QString dbgSetCommand() const;
00176 //  virtual CatchBreakpoint& operator=(const CatchBreakpoint& rhs);
00177 //};
00178 /***************************************************************************/
00179 /***************************************************************************/
00180 /***************************************************************************/
00181 //class ExitBreakpoint : public Breakpoint
00182 //{
00183 //public:
00184 //  ExitBreakpoint(bool temporary=false, bool enabled=true);
00185 //  virtual ~ExitBreakpoint();
00186 //  virtual QString dbgSetCommand() const;
00187 //  bool match(const Breakpoint* brkpt) const;
00188 //  virtual void configureDisplay();
00189 //};
00190 /***************************************************************************/
00191 /***************************************************************************/
00192 /***************************************************************************/
00193 class Watchpoint : public Breakpoint
00194 {
00195 public:
00196     Watchpoint(const QString &varName, bool temporary=false, bool enabled=true);
00197     virtual ~Watchpoint();
00198     virtual QString dbgSetCommand() const;
00199     bool match(const Breakpoint *brkpt) const;
00200 
00201     BP_TYPES type () const                      { return BP_TYPE_Watchpoint; }
00202     QString displayType() const                 { return i18n("Watchpoint"); }
00203     void setVarName(const QString& varName)     { varName_ = varName; }
00204     QString varName() const                     { return varName_; }
00205     QString location(bool)                      { return varName_; }
00206     void setLocation(const QString& location)   { varName_ = location; }
00207     bool isValid() const                        { return !varName_.isEmpty(); }
00208 
00209 private:
00210     QString varName_;
00211 };
00212 /***************************************************************************/
00213 /***************************************************************************/
00214 /***************************************************************************/
00215 class AddressBreakpoint : public Breakpoint
00216 {
00217 public:
00218     AddressBreakpoint(const QString &breakAddress, bool temporary=false, bool enabled=true);
00219     virtual ~AddressBreakpoint();
00220     virtual QString dbgSetCommand() const;
00221     bool match(const Breakpoint *brkpt) const;
00222 
00223     BP_TYPES type () const                              { return BP_TYPE_Address; }
00224     QString displayType() const                         { return i18n("Address"); }
00225     void setBreakAddress(const QString& breakAddress)   { m_breakAddress = breakAddress; }
00226     QString breakAddress() const                        { return m_breakAddress; }
00227     QString location(bool)                              { return m_breakAddress; };
00228     void setLocation(const QString& location)           { m_breakAddress = location; }
00229     bool isValid() const                                { return !m_breakAddress.isEmpty(); }
00230 
00231 private:
00232     QString m_breakAddress;
00233 };
00234 /***************************************************************************/
00235 /***************************************************************************/
00236 /***************************************************************************/
00237 class FunctionBreakpoint : public Breakpoint
00238 {
00239 public:
00240     FunctionBreakpoint(const QString &functionName, bool temporary=false, bool enabled=true);
00241     virtual ~FunctionBreakpoint();
00242     virtual QString dbgSetCommand() const;
00243     bool match(const Breakpoint *brkpt) const;
00244 
00245     BP_TYPES type () const                              { return BP_TYPE_Function; }
00246     QString displayType() const                         { return i18n("Method()"); }
00247     void setfunctionName(const QString& functionName)   { m_functionName = functionName; }
00248     QString functionName() const                        { return m_functionName; }
00249     QString location(bool)                              { return m_functionName; };
00250     void setLocation(const QString& location)           { m_functionName = location; }
00251     bool isValid() const                                { return !m_functionName.isEmpty(); }
00252 
00253 private:
00254     QString m_functionName;
00255 };
00256 /***************************************************************************/
00257 /***************************************************************************/
00258 /***************************************************************************/
00259 
00260 }
00261 
00262 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:46 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003