Code::Blocks  SVN r11506
debugger_defs.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #ifndef DEBUGGER_DEFS_H
7 #define DEBUGGER_DEFS_H
8 
9 #include <wx/string.h>
10 #include <wx/dynarray.h>
11 #include <deque>
12 #include <vector>
13 
14 #include "debuggermanager.h"
15 
16 class DebuggerDriver;
17 
18 extern const int DEBUGGER_CURSOR_CHANGED;
19 extern const int DEBUGGER_SHOW_FILE_LINE;
20 
26 struct Cursor
27 {
28  Cursor() : line(-1), changed(false) {}
31  wxString function;
32  long int line;
33  bool changed;
34 };
35 
50 {
51  public:
52  DebuggerCmd(DebuggerDriver* driver, const wxString& cmd = _T(""), bool logToNormalLog = false);
53  virtual ~DebuggerCmd(){}
54 
63  virtual void Action(){}
64 
69  virtual void ParseOutput(const wxString& output);
70 
75  virtual bool IsContinueCommand() const { return false; }
76 
78  protected:
81 };
82 
88 {
89  public:
90  DebuggerInfoCmd(DebuggerDriver* driver, const wxString& cmd, const wxString& title)
91  : DebuggerCmd(driver, cmd),
92  m_Title(title)
93  {
94  m_Cmd = cmd;
95  }
96  virtual ~DebuggerInfoCmd(){}
97 
98  virtual void ParseOutput(const wxString& output);
100 };
101 
104 {
105  public:
106  DebuggerContinueBaseCmd(DebuggerDriver* driver, const wxString& cmd = _T(""), bool logToNormalLog = false) :
107  DebuggerCmd(driver, cmd, logToNormalLog)
108  {
109  }
110 
111  bool IsContinueCommand() const { return true; }
112 };
113 
116 {
117  public:
120  virtual void Action();
121 };
122 
129 {
131  {
132  bptCode = 0,
134  bptData
135  };
136 
141  : type(bptCode),
142  line(0),
143  index(-1),
144  temporary(false),
145  enabled(true),
146  active(true),
147  useIgnoreCount(false),
148  ignoreCount(0),
149  useCondition(false),
150  wantsCondition(false),
151  address(0),
152  alreadySet(false),
153  breakOnRead(false),
154  breakOnWrite(true),
155  userData(0)
156  {}
157 
158  // from cbBreakpoint
159  virtual void SetEnabled(bool flag);
160  virtual wxString GetLocation() const;
161  virtual int GetLine() const;
162  virtual wxString GetLineString() const;
163  virtual wxString GetType() const;
164  virtual wxString GetInfo() const;
165  virtual bool IsEnabled() const;
166  virtual bool IsVisibleInEditor() const;
167  virtual bool IsTemporary() const;
168 
172  int line;
173  long int index;
174  bool temporary;
175  bool enabled;
176  bool active;
183  unsigned long int address;
184  bool alreadySet;
187  bool breakOnRead;
189  void* userData;
190 };
191 typedef std::deque<cb::shared_ptr<DebuggerBreakpoint> > BreakpointsList;
192 
198 {
199  Undefined = 0,
202  Hex,
206 
207  // do not remove these
210 };
211 
212 class GDBWatch : public cbWatch
213 {
214  public:
215  GDBWatch(wxString const &symbol);
216  virtual ~GDBWatch();
217  public:
218 
219  virtual void GetSymbol(wxString &symbol) const;
220  virtual void GetValue(wxString &value) const;
221  virtual bool SetValue(const wxString &value);
222  virtual void GetFullWatchString(wxString &full_watch) const;
223  virtual void GetType(wxString &type) const;
224  virtual void SetType(const wxString &type);
225 
226  virtual wxString const & GetDebugString() const;
227 
228  wxString MakeSymbolToAddress() const override;
229  bool IsPointerType() const override;
230  public:
231  void SetDebugValue(wxString const &value);
232  void SetSymbol(const wxString& symbol);
233 
234  void SetFormat(WatchFormat format);
235  WatchFormat GetFormat() const;
236 
237  void SetArray(bool flag);
238  bool IsArray() const;
239  void SetArrayParams(int start, int count);
240  int GetArrayStart() const;
241  int GetArrayCount() const;
242 
243  void SetForTooltip(bool flag = true);
244  bool GetForTooltip() const;
245 
246  protected:
247  virtual void DoDestroy();
248 
249  private:
259  };
260 
261 typedef std::vector<cb::shared_ptr<GDBWatch> > WatchesContainer;
262 
263 bool IsPointerType(wxString type);
265 
267 {
268  dl_Cpp = 0,
270 };
271 
273 
274 
275 #endif // DEBUGGER_DEFS_H
virtual bool IsContinueCommand() const
Tells if the command is a continue type command (continue, step, next and run to cursor commands shou...
Definition: debugger_defs.h:75
C++ or C language.
virtual ~DbgCmd_UpdateWatchesTree()
Variable should be displayed as decimal.
int ignoreCount
The number of passes before this breakpoint should hit. useIgnoreCount must be true.
bool wantsCondition
Evaluate condition for pending breakpoints at first stop !
wxString condition
The condition that must be met for the breakpoint to hit. useCondition must be true.
Format is undefined (whatever the debugger uses by default).
int m_array_start
wxString CleanStringValue(wxString value)
wxString m_raw_value
wxString m_Title
Definition: debugger_defs.h:99
bool breakOnWrite
Valid only for type==bptData: break when memory is written to.
Base class for all Continue type of commands.
Variable should be displayed as a single character (e.g. &#39;x&#39;).
WatchFormat
Watch variable format.
wxString lineText
Optionally, the breakpoint line&#39;s text (used by GDB for setting breapoints on ctors/dtors).
wxString m_symbol
Debugger breakpoint interface.
std::vector< cb::shared_ptr< GDBWatch > > WatchesContainer
bool m_is_array
BreakpointType type
The type of this breakpoint.
const int DEBUGGER_SHOW_FILE_LINE
wxCommandEvent ID fired to display a file/line (w/out changing the cursor)
wxString m_Cmd
the actual command
Definition: debugger_defs.h:77
DebuggerContinueBaseCmd(DebuggerDriver *driver, const wxString &cmd=_T(""), bool logToNormalLog=false)
#define _T(string)
void * userData
Custom user data.
void SetValue(WatchesProperty *prop)
Definition: watchesdlg.cpp:515
long int index
The breakpoint number. Set automatically. Don&#39;t write to it.
Variable should be displayed as floating point number (e.g. 14.35)
bool IsPointerType(wxString type)
virtual ~DebuggerInfoCmd()
Definition: debugger_defs.h:96
long int line
If -1, no line info.
Definition: debugger_defs.h:32
Action-only debugger command to signal the watches tree to update.
bool active
Is the breakpoint active? (currently unused)
std::deque< cb::shared_ptr< DebuggerBreakpoint > > BreakpointsList
wxString filename
The filename for the breakpoint (kept as relative).
wxString func
The function to set the breakpoint. If this is set, it is preferred over the filename/line combinatio...
int line
The line for the breakpoint.
bool useIgnoreCount
Should this breakpoint be ignored for the first X passes? (x == ignoreCount)
virtual ~DebuggerCmd()
Definition: debugger_defs.h:53
bool changed
Definition: debugger_defs.h:33
bool m_LogToNormalLog
if true, log to normal log, else the debug log
Definition: debugger_defs.h:80
DebuggerLanguage g_DebugLanguage
Variable should be displayed as hexadecimal (e.g. 0xFFFFFFFF).
WatchFormat m_format
DebuggerInfoCmd(DebuggerDriver *driver, const wxString &cmd, const wxString &title)
Definition: debugger_defs.h:90
Variable should be displayed as unsigned.
This command is similar to DebuggerCmd The only difference is that instead of logging its output in t...
Definition: debugger_defs.h:87
bool useCondition
Should this breakpoint hit only if a specific condition is met?
Fortran language.
Function signature breakpoint.
const int DEBUGGER_CURSOR_CHANGED
wxCommandEvent ID fired when the cursor has changed.
wxString m_debug_value
Variable should be displayed as binary (e.g. 00011001).
unsigned long int address
The actual breakpoint address. This is read back from the debugger. Don&#39;t write to it...
used for iterations
Debugger cursor info.
Definition: debugger_defs.h:26
used for watches searches
bool m_forTooltip
wxString filenameAsPassed
The filename for the breakpoint as passed to the debugger (i.e. full filename).
bool enabled
Is the breakpoint enabled?
DebuggerDriver * m_pDriver
the driver
Definition: debugger_defs.h:79
wxString file
Definition: debugger_defs.h:29
wxString m_type
int m_array_count
DebuggerLanguage
wxString address
Definition: debugger_defs.h:30
DebuggerBreakpoint()
Constructor.
bool IsContinueCommand() const
Tells if the command is a continue type command (continue, step, next and run to cursor commands shou...
Basic interface for debugger commands.
Definition: debugger_defs.h:49
bool alreadySet
Is this already set? Used to mark temporary breakpoints for removal.
virtual void Action()
Executes an action.
Definition: debugger_defs.h:63
wxString breakAddress
Valid only for type==bptData: address to break when read/written.
bool temporary
Is this a temporary (one-shot) breakpoint?
bool breakOnRead
Valid only for type==bptData: break when memory is read from.