Code::Blocks  SVN r11506
gdb_driver.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 GDB_DRIVER_H
7 #define GDB_DRIVER_H
8 
9 #include "debuggerdriver.h"
10 #include "remotedebugging.h"
11 #include <wx/regex.h>
12 
13 class GDB_driver : public DebuggerDriver
14 {
15  public:
16  GDB_driver(DebuggerGDB* plugin);
17  virtual ~GDB_driver();
18 
19  virtual wxString GetCommandLine(const wxString& debugger,
20  const wxString& debuggee,
21  const wxString &userArguments);
22  virtual wxString GetCommandLine(const wxString& debugger, int pid, const wxString &userArguments);
23  virtual void SetTarget(ProjectBuildTarget* target);
24  virtual void Prepare(bool isConsole, int printElements);
25  virtual void Start(bool breakOnEntry);
26  virtual void Stop();
27 
28  virtual void Continue();
29  virtual void Step();
30  virtual void StepInstruction();
31  virtual void StepIntoInstruction();
32  virtual void StepIn();
33  virtual void StepOut();
34  virtual void SetNextStatement(const wxString& filename, int line);
35  virtual void Backtrace();
36  virtual void Disassemble();
37  virtual void CPURegisters();
38  virtual void SwitchToFrame(size_t number);
39  virtual void SetVarValue(const wxString& var, const wxString& value);
40  virtual void MemoryDump();
41  virtual void Attach(int pid);
42  virtual void Detach();
43  virtual void RunningThreads();
44 
45  void InfoFrame();
46  void InfoDLL();
47  void InfoFiles();
48  void InfoFPU();
49  void InfoSignals();
50 
51  void EnableCatchingThrow(bool enable);
52 
53  virtual void SwitchThread(size_t threadIndex);
54 
55  virtual void AddBreakpoint(cb::shared_ptr<DebuggerBreakpoint> bp);
56  virtual void RemoveBreakpoint(cb::shared_ptr<DebuggerBreakpoint> bp);
57  virtual void EvaluateSymbol(const wxString& symbol, const wxRect& tipRect);
58  virtual void UpdateWatches(cb::shared_ptr<GDBWatch> localsWatch, cb::shared_ptr<GDBWatch> funcArgsWatch,
59  WatchesContainer &watches);
60  virtual void UpdateWatch(const cb::shared_ptr<GDBWatch> &watch);
61  virtual void UpdateWatchLocalsArgs(cb::shared_ptr<GDBWatch> const &watch, bool locals);
62  virtual void ParseOutput(const wxString& output);
63  virtual bool IsDebuggingStarted() const { return m_IsStarted; }
64 
65  virtual void DetermineLanguage();
66 #ifdef __WXMSW__
67  virtual bool UseDebugBreakProcess();
68 #endif
69  virtual wxString GetDisassemblyFlavour(void);
70 
72  protected:
73  private:
74  void HandleMainBreakPoint(const wxRegEx& reBreak, wxString line);
75 
76  // win/Cygwin platform checking
77  void DetectCygwinMount(void);
78  void CorrectCygwinPath(wxString& path);
79 
80  // remote debugging
82 
85 
86  // Seems to be intended to allow step before program has started.
87  // Was always false. HC changed to take value from DebuggerGDB::m_BreakOnEntry.
89 
90  // Seems to be used to issue a InfoProgram command, then continue
91  // True after first "Start()", until first break
93 
94  // Program is "running": after a "run" or a "start", and before "kill" or a "quit"
96 
97  // cursor update flags
100 
101  // GDB version
105 
107 
108  // for remote debugging usage (mainly)
110 
111  // merged remote debugging (project-level + target-level)
113 
115 
116 }; // GDB_driver
117 
118 #endif // GDB_DRIVER_H
virtual void StepIntoInstruction()
Definition: gdb_driver.cpp:468
virtual void Start(bool breakOnEntry)
Begin the debugging process by launching a program.
Definition: gdb_driver.cpp:391
virtual void Detach()
Detach from running process.
Definition: gdb_driver.cpp:686
virtual void Attach(int pid)
Attach to process.
Definition: gdb_driver.cpp:678
wxString m_CygdrivePrefix
Definition: gdb_driver.h:84
virtual void RunningThreads()
Definition: gdb_driver.cpp:531
void CorrectCygwinPath(wxString &path)
Definition: gdb_driver.cpp:328
std::vector< cb::shared_ptr< GDBWatch > > WatchesContainer
RemoteDebugging m_MergedRDInfo
Definition: gdb_driver.h:112
long m_GDBVersionMinor
Definition: gdb_driver.h:103
virtual void SwitchThread(size_t threadIndex)
Request to switch to another thread.
Definition: gdb_driver.cpp:576
virtual void EvaluateSymbol(const wxString &symbol, const wxRect &tipRect)
Evaluate a symbol.
Definition: gdb_driver.cpp:623
bool m_BreakOnEntry
Definition: gdb_driver.h:88
int m_catchThrowIndex
Definition: gdb_driver.h:114
virtual void SwitchToFrame(size_t number)
Definition: gdb_driver.cpp:514
virtual void Backtrace()
Definition: gdb_driver.cpp:493
wxString flavour
Definition: gdb_driver.h:104
virtual void SetNextStatement(const wxString &filename, int line)
Definition: gdb_driver.cpp:486
virtual void CPURegisters()
Definition: gdb_driver.cpp:506
void DetectCygwinMount(void)
Definition: gdb_driver.cpp:272
static wxRegEx reBreak(_T("\2*([A-Za-z]*[:]*)([^:]+):([0-9]+):[0-9]+:[begmidl]+:(0x[0-9A-Fa-f]+)"))
long m_GDBVersionMajor
Definition: gdb_driver.h:102
virtual void MemoryDump()
Definition: gdb_driver.cpp:526
bool m_IsStarted
Definition: gdb_driver.h:95
virtual bool IsDebuggingStarted() const
Is debugging started.
Definition: gdb_driver.h:63
virtual wxString GetCommandLine(const wxString &debugger, const wxString &debuggee, const wxString &userArguments)
Get the command-line to launch the debugger.
Definition: gdb_driver.cpp:101
void InfoFPU()
Definition: gdb_driver.cpp:555
virtual void StepIn()
Definition: gdb_driver.cpp:474
RemoteDebugging * GetRemoteDebuggingInfo()
Definition: gdb_driver.cpp:249
virtual void StepInstruction()
Definition: gdb_driver.cpp:462
virtual void ParseOutput(const wxString &output)
Parse debugger&#39;s output.
Definition: gdb_driver.cpp:691
void EnableCatchingThrow(bool enable)
Definition: gdb_driver.cpp:565
void InfoSignals()
Definition: gdb_driver.cpp:560
virtual void AddBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp)
Add a breakpoint.
Definition: gdb_driver.cpp:584
bool m_attachedToProcess
Definition: gdb_driver.h:106
virtual void Disassemble()
Definition: gdb_driver.cpp:498
wxString AsmFlavour()
Definition: gdb_driver.h:71
void InfoFrame()
Definition: gdb_driver.cpp:537
virtual void Prepare(bool isConsole, int printElements)
Prepares the debugging process by setting up search dirs etc.
Definition: gdb_driver.cpp:132
bool m_needsUpdate
Definition: gdb_driver.h:98
void InfoDLL()
Definition: gdb_driver.cpp:542
virtual void UpdateWatchLocalsArgs(cb::shared_ptr< GDBWatch > const &watch, bool locals)
Definition: gdb_driver.cpp:672
virtual void Continue()
Definition: gdb_driver.cpp:436
bool m_forceUpdate
Definition: gdb_driver.h:99
virtual void StepOut()
Definition: gdb_driver.cpp:480
virtual void Step()
Definition: gdb_driver.cpp:456
GDB_driver(DebuggerGDB *plugin)
Definition: gdb_driver.cpp:80
virtual bool UseDebugBreakProcess()
Ask the driver if the debugger should be interrupted with DebugBreakProcess or Ctrl+C event...
Definition: gdb_driver.cpp:376
virtual wxString GetDisassemblyFlavour(void)
Definition: gdb_driver.cpp:384
bool m_ManualBreakOnEntry
Definition: gdb_driver.h:92
virtual void RemoveBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp)
Remove a breakpoint.
Definition: gdb_driver.cpp:617
bool m_CygwinPresent
Definition: gdb_driver.h:83
Represents a Code::Blocks project build target.
virtual void UpdateWatches(cb::shared_ptr< GDBWatch > localsWatch, cb::shared_ptr< GDBWatch > funcArgsWatch, WatchesContainer &watches)
Update watches.
Definition: gdb_driver.cpp:628
virtual void SetVarValue(const wxString &var, const wxString &value)
Definition: gdb_driver.cpp:520
virtual void DetermineLanguage()
Determine language is debugged.
ProjectBuildTarget * m_pTarget
Definition: gdb_driver.h:109
virtual ~GDB_driver()
Definition: gdb_driver.cpp:96
virtual void SetTarget(ProjectBuildTarget *target)
Sets the target.
Definition: gdb_driver.cpp:126
void HandleMainBreakPoint(const wxRegEx &reBreak, wxString line)
virtual void Stop()
Stop debugging.
Definition: gdb_driver.cpp:426
void InfoFiles()
Definition: gdb_driver.cpp:550
virtual void UpdateWatch(const cb::shared_ptr< GDBWatch > &watch)
Definition: gdb_driver.cpp:666