Code::Blocks  SVN r11506
debuggerstate.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 DEBUGGERSTATE_H
7 #define DEBUGGERSTATE_H
8 
9 #include <wx/string.h>
10 #include "debugger_defs.h"
11 
12 class DebuggerGDB;
13 class ProjectBuildTarget;
14 class cbProject;
15 
17 {
18  public:
19  DebuggerState(DebuggerGDB* plugin);
21 
22  BreakpointsList const & GetBreakpoints() const { return m_Breakpoints; }
23 
24  bool StartDriver(ProjectBuildTarget* target);
25  void StopDriver();
26 
28  bool HasDriver() const;
29 
31  // (to fix multiple bugs in use of GetDriver without checking return value)
33  const DebuggerDriver* GetDriver() const;
34 
35  void CleanUp();
36 
37  int AddBreakpoint(cb::shared_ptr<DebuggerBreakpoint> bp); // returns -1 if not found
38  cb::shared_ptr<DebuggerBreakpoint> AddBreakpoint(const wxString& file, int line, bool temp = false,
39  const wxString& lineText = wxEmptyString);
40  cb::shared_ptr<DebuggerBreakpoint> AddBreakpoint(const wxString& dataAddr, bool onRead = false,
41  bool onWrite = true);
42  void RemoveBreakpoint(int idx, bool removeFromDriver = true);
43  void RemoveBreakpoint(cb::shared_ptr<DebuggerBreakpoint> bp, bool removeFromDriver = true);
44  void RemoveAllBreakpoints();
46 
47  // helpers to keep in sync with the editors
48  void ShiftBreakpoint(cb::shared_ptr<DebuggerBreakpoint> bp, int nroflines);
49 
50  int HasBreakpoint(const wxString& file, int line, bool temp); // returns -1 if not found
51  cb::shared_ptr<DebuggerBreakpoint> GetBreakpoint(int idx);
52  cb::shared_ptr<DebuggerBreakpoint> GetBreakpointByNumber(int num);
53  const cb::shared_ptr<DebuggerBreakpoint> GetBreakpointByNumber(int num) const;
54  void ResetBreakpoint(cb::shared_ptr<DebuggerBreakpoint> bp);
55  void ApplyBreakpoints();
56  protected:
57  wxString ConvertToValidFilename(const wxString& filename);
58 
62 };
63 
64 #endif // DEBUGGERSTATE_H
int AddBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp)
void ShiftBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp, int nroflines)
DebuggerGDB * m_pPlugin
Definition: debuggerstate.h:59
bool StartDriver(ProjectBuildTarget *target)
void RemoveBreakpoint(int idx, bool removeFromDriver=true)
std::deque< cb::shared_ptr< DebuggerBreakpoint > > BreakpointsList
void RemoveAllBreakpoints()
DebuggerState(DebuggerGDB *plugin)
DebuggerDriver * m_pDriver
Definition: debuggerstate.h:60
Represents a Code::Blocks project.
Definition: cbproject.h:96
cb::shared_ptr< DebuggerBreakpoint > GetBreakpointByNumber(int num)
wxString ConvertToValidFilename(const wxString &filename)
int HasBreakpoint(const wxString &file, int line, bool temp)
wxString wxEmptyString
void RemoveAllProjectBreakpoints(cbProject *prj)
DebuggerDriver * GetDriver()
Will always return a driver, or throw a code assertion error.
void ApplyBreakpoints()
BreakpointsList m_Breakpoints
Definition: debuggerstate.h:61
BreakpointsList const & GetBreakpoints() const
Definition: debuggerstate.h:22
Represents a Code::Blocks project build target.
void ResetBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp)
bool HasDriver() const
Check so see if Driver exists before getting it.
cb::shared_ptr< DebuggerBreakpoint > GetBreakpoint(int idx)