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
11
#include <settings.h> // much of the SDK is here
12
#include <sdk_events.h>
15
#include <pipedprocess.h>
18
#include "remotedebugging.h"
19
#include "debuggerstate.h"
20
#include "debugger_defs.h"
21
#include "backtracedlg.h"
22
#include "disassemblydlg.h"
23
#include "cpuregistersdlg.h"
24
#include "breakpointsdlg.h"
25
#include "threadsdlg.h"
27
extern const wxString g_EscapeChar;
37
class CPURegistersDlg;
40
class ExamineMemoryDlg;
43
class DebuggerGDB : public cbDebuggerPlugin
45
DebuggerState m_State;
50
int GetConfigurationPriority() const { return 0; }
51
int GetConfigurationGroup() const { return cgDebugger; }
52
cbConfigurationPanel* GetConfigurationPanel(wxWindow* parent);
53
cbConfigurationPanel* GetProjectConfigurationPanel(wxWindow* parent, cbProject* project);
54
void BuildMenu(wxMenuBar* menuBar);
55
void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = 0);
56
bool BuildToolBar(wxToolBar* toolBar);
57
void OnAttach(); // fires when the plugin is attached to the application
58
void OnRelease(bool appShutDown); // fires when the plugin is released from the application
60
void RunCommand(int cmd);
65
void RunningThreads();
67
bool AddBreakpoint(const wxString& file, int line);
68
bool AddBreakpoint(const wxString& functionSignature);
69
bool RemoveBreakpoint(const wxString& file, int line);
70
bool RemoveBreakpoint(const wxString& functionSignature);
71
bool RemoveAllBreakpoints(const wxString& file = wxEmptyString);
73
void EditorLinesAddedOrRemoved(cbEditor* editor, int startline, int lines);
82
void ToggleBreakpoint();
85
bool Validate(const wxString& line, const char cb);
86
bool IsRunning() const { return m_pProcess; }
87
int GetExitCode() const { return m_LastExitCode; }
89
void SyncEditor(const wxString& filename, int line, bool setMarker = true);
91
void Log(const wxString& msg);
92
void DebugLog(const wxString& msg);
93
void SendCommand(const wxString& cmd);
95
DebuggerState& GetState(){ return m_State; }
97
void BringAppToFront();
98
void RefreshConfiguration();
100
wxArrayString& GetSearchDirs(cbProject* prj);
101
RemoteDebuggingMap& GetRemoteDebuggingMap(cbProject* project = 0);
103
void OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading);
105
static void ConvertToGDBFriendly(wxString& str);
106
static void ConvertToGDBFile(wxString& str);
107
static void ConvertToGDBDirectory(wxString& str, wxString base = _T(""), bool relative = true);
108
static void StripQuotes(wxString& str);
110
void AddSourceDir(const wxString& dir);
112
void DoSwitchToDebuggingLayout();
113
void DoSwitchToPreviousLayout();
114
void ParseOutput(const wxString& output);
115
void ClearActiveMarkFromAllEditors();
117
wxString GetEditorWordAtCaret();
118
wxString FindDebuggerExecutable(Compiler* compiler);
119
int LaunchProcess(const wxString& cmd, const wxString& cwd);
120
wxString GetDebuggee(ProjectBuildTarget* target);
122
void AddDataBreakpoint();
123
bool EnsureBuildUpToDate();
127
wxString GetConsoleTty(int ConsolePid);
129
void OnUpdateUI(wxUpdateUIEvent& event);
130
void OnDebug(wxCommandEvent& event);
131
void OnStop(wxCommandEvent& event);
132
void OnSendCommandToGDB(wxCommandEvent& event);
133
void OnAddSymbolFile(wxCommandEvent& event);
134
void OnBacktrace(wxCommandEvent& event);
135
void OnDisassemble(wxCommandEvent& event);
136
void OnRegisters(wxCommandEvent& event);
137
void OnViewWatches(wxCommandEvent& event);
138
void OnBreakpoints(wxCommandEvent& event);
139
void OnEditWatches(wxCommandEvent& event);
140
void OnContinue(wxCommandEvent& event);
141
void OnNext(wxCommandEvent& event);
142
void OnNextInstr(wxCommandEvent& event);
143
void OnStep(wxCommandEvent& event);
144
void OnStepOut(wxCommandEvent& event);
145
void OnToggleBreakpoint(wxCommandEvent& event);
146
void OnRemoveAllBreakpoints(wxCommandEvent& event);
147
void OnAddDataBreakpoint(wxCommandEvent& event);
148
void OnRunToCursor(wxCommandEvent& event);
149
void OnBreakpointAdd(CodeBlocksEvent& event);
150
void OnBreakpointEdit(CodeBlocksEvent& event);
151
void OnBreakpointDelete(CodeBlocksEvent& event);
152
void OnValueTooltip(CodeBlocksEvent& event);
153
void OnEditorOpened(CodeBlocksEvent& event);
154
void OnProjectActivated(CodeBlocksEvent& event);
155
void OnProjectClosed(CodeBlocksEvent& event);
156
void OnCompilerStarted(CodeBlocksEvent& event);
157
void OnCompilerFinished(CodeBlocksEvent& event);
158
void OnBuildTargetSelected(CodeBlocksEvent& event);
159
void OnGDBOutput(wxCommandEvent& event);
160
void OnGDBError(wxCommandEvent& event);
161
void OnGDBTerminated(wxCommandEvent& event);
162
void OnIdle(wxIdleEvent& event);
163
void OnTimer(wxTimerEvent& event);
164
void OnWatchesChanged(wxCommandEvent& event);
165
void OnCursorChanged(wxCommandEvent& event);
166
void OnAddWatch(wxCommandEvent& event);
167
void OnAttachToProcess(wxCommandEvent& event);
168
void OnDetach(wxCommandEvent& event);
169
void OnSettings(wxCommandEvent& event);
170
void OnExamineMemory(wxCommandEvent& event);
171
void OnRunningThreads(wxCommandEvent& event);
173
void OnDebugWindows(wxCommandEvent& event);
174
void OnToolInfo(wxCommandEvent& event);
176
void OnInfoFrame(wxCommandEvent& event);
177
void OnInfoDLL(wxCommandEvent& event);
178
void OnInfoFiles(wxCommandEvent& event);
179
void OnInfoFPU(wxCommandEvent& event);
180
void OnInfoSignals(wxCommandEvent& event);
183
TextCtrlLogger* m_pLog;
184
TextCtrlLogger* m_pDbgLog;
185
PipedProcess* m_pProcess;
192
cbCompilerPlugin* m_pCompiler;
195
int m_PidToAttach; // for "attach to process"
198
wxTimer m_TimerPollDebugger;
201
// Set, but was never used. HC changed to pass to "Start()"
202
// Looks like was meant to allow initial step into first instruction of program start
207
bool m_StoppedOnSignal;
209
// current frame info
210
StackFrame m_CurrentFrame;
213
DebuggerTree* m_pTree;
214
DisassemblyDlg* m_pDisassembly;
215
CPURegistersDlg* m_pCPURegisters;
216
BacktraceDlg* m_pBacktrace;
217
BreakpointsDlg* m_pBreakpointsWindow;
218
ExamineMemoryDlg* m_pExamineMemoryDlg;
219
ThreadsDlg* m_pThreadsDlg;
221
cbProject* m_pProject; // keep the currently debugged project handy
222
wxString m_ActiveBuildTarget;
224
// per-project debugger search-dirs
225
typedef std::map<cbProject*, wxArrayString> SearchDirsMap;
226
SearchDirsMap m_SearchDirs;
228
typedef std::map<cbProject*, RemoteDebuggingMap> ProjectRemoteDebuggingMap;
229
ProjectRemoteDebuggingMap m_RemoteDebugging;
231
int m_HookId; // project loader hook ID
233
// Linux console support
236
wxString m_ConsoleTty;
238
bool m_WaitingCompilerToFinish;
239
bool m_Canceled; // flag to avoid re-entering DoDebug when we shouldn't
241
wxString m_PreviousLayout;
243
DECLARE_EVENT_TABLE()
246
#endif // DEBUGGERGDB_H