~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/debuggergdb/debuggergdb.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 DEBUGGERGDB_H
 
7
#define DEBUGGERGDB_H
 
8
 
 
9
#include <map>
 
10
 
 
11
#include <settings.h> // much of the SDK is here
 
12
#include <sdk_events.h>
 
13
#include <cbplugin.h>
 
14
#include <loggers.h>
 
15
#include <pipedprocess.h>
 
16
#include <wx/regex.h>
 
17
 
 
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"
 
26
 
 
27
extern const wxString g_EscapeChar;
 
28
 
 
29
class cbProject;
 
30
class TiXmlElement;
 
31
class DebuggerDriver;
 
32
class DebuggerCmd;
 
33
class Compiler;
 
34
 
 
35
class DebuggerTree;
 
36
class DisassemblyDlg;
 
37
class CPURegistersDlg;
 
38
class BacktraceDlg;
 
39
class BreakpointsDlg;
 
40
class ExamineMemoryDlg;
 
41
class ThreadsDlg;
 
42
 
 
43
class DebuggerGDB : public cbDebuggerPlugin
 
44
{
 
45
        DebuggerState m_State;
 
46
    public:
 
47
        DebuggerGDB();
 
48
        ~DebuggerGDB();
 
49
        int Configure();
 
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
 
59
 
 
60
        void RunCommand(int cmd);
 
61
        void Disassemble();
 
62
        void Registers();
 
63
        void Backtrace();
 
64
        void MemoryDump();
 
65
        void RunningThreads();
 
66
 
 
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);
 
72
 
 
73
        void EditorLinesAddedOrRemoved(cbEditor* editor, int startline, int lines);
 
74
 
 
75
        int Debug();
 
76
        void Continue();
 
77
        void Next();
 
78
        void NextInstr();
 
79
        void Step();
 
80
        void StepOut();
 
81
        void RunToCursor();
 
82
        void ToggleBreakpoint();
 
83
        void Break();
 
84
        void Stop();
 
85
        bool Validate(const wxString& line, const char cb);
 
86
        bool IsRunning() const { return m_pProcess; }
 
87
        int GetExitCode() const { return m_LastExitCode; }
 
88
 
 
89
        void SyncEditor(const wxString& filename, int line, bool setMarker = true);
 
90
 
 
91
        void Log(const wxString& msg);
 
92
        void DebugLog(const wxString& msg);
 
93
        void SendCommand(const wxString& cmd);
 
94
 
 
95
        DebuggerState& GetState(){ return m_State; }
 
96
 
 
97
        void BringAppToFront();
 
98
        void RefreshConfiguration();
 
99
 
 
100
        wxArrayString& GetSearchDirs(cbProject* prj);
 
101
        RemoteDebuggingMap& GetRemoteDebuggingMap(cbProject* project = 0);
 
102
 
 
103
        void OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading);
 
104
 
 
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);
 
109
    protected:
 
110
        void AddSourceDir(const wxString& dir);
 
111
    private:
 
112
        void DoSwitchToDebuggingLayout();
 
113
        void DoSwitchToPreviousLayout();
 
114
        void ParseOutput(const wxString& output);
 
115
        void ClearActiveMarkFromAllEditors();
 
116
        void DoWatches();
 
117
        wxString GetEditorWordAtCaret();
 
118
        wxString FindDebuggerExecutable(Compiler* compiler);
 
119
        int LaunchProcess(const wxString& cmd, const wxString& cwd);
 
120
        wxString GetDebuggee(ProjectBuildTarget* target);
 
121
        bool IsStopped();
 
122
        void AddDataBreakpoint();
 
123
        bool EnsureBuildUpToDate();
 
124
        int DoDebug();
 
125
 
 
126
        int RunNixConsole();
 
127
        wxString GetConsoleTty(int ConsolePid);
 
128
 
 
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);
 
172
 
 
173
        void OnDebugWindows(wxCommandEvent& event);
 
174
        void OnToolInfo(wxCommandEvent& event);
 
175
 
 
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);
 
181
 
 
182
        wxMenu* m_pMenu;
 
183
        TextCtrlLogger* m_pLog;
 
184
        TextCtrlLogger* m_pDbgLog;
 
185
        PipedProcess* m_pProcess;
 
186
        wxToolBar* m_pTbar;
 
187
        int m_PageIndex;
 
188
        int m_DbgPageIndex;
 
189
        wxRegEx reSource;
 
190
        wxString m_LastCmd;
 
191
        wxString m_Variable;
 
192
        cbCompilerPlugin* m_pCompiler;
 
193
        bool m_LastExitCode;
 
194
        int m_Pid;
 
195
        int m_PidToAttach; // for "attach to process"
 
196
        wxString m_LastEval;
 
197
        wxRect m_EvalRect;
 
198
        wxTimer m_TimerPollDebugger;
 
199
        bool m_NoDebugInfo;
 
200
 
 
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
 
203
        bool m_BreakOnEntry;
 
204
 
 
205
        int m_HaltAtLine;
 
206
        bool m_HasDebugLog;
 
207
        bool m_StoppedOnSignal;
 
208
 
 
209
        // current frame info
 
210
        StackFrame m_CurrentFrame;
 
211
 
 
212
        // extra dialogs
 
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;
 
220
 
 
221
        cbProject* m_pProject; // keep the currently debugged project handy
 
222
        wxString m_ActiveBuildTarget;
 
223
 
 
224
        // per-project debugger search-dirs
 
225
        typedef std::map<cbProject*, wxArrayString> SearchDirsMap;
 
226
        SearchDirsMap m_SearchDirs;
 
227
 
 
228
                typedef std::map<cbProject*, RemoteDebuggingMap> ProjectRemoteDebuggingMap;
 
229
        ProjectRemoteDebuggingMap m_RemoteDebugging;
 
230
 
 
231
        int m_HookId; // project loader hook ID
 
232
 
 
233
        // Linux console support
 
234
        bool     m_bIsConsole;
 
235
        int      m_nConsolePid;
 
236
        wxString m_ConsoleTty;
 
237
 
 
238
        bool m_WaitingCompilerToFinish;
 
239
        bool m_Canceled; // flag to avoid re-entering DoDebug when we shouldn't
 
240
 
 
241
        wxString m_PreviousLayout;
 
242
 
 
243
        DECLARE_EVENT_TABLE()
 
244
};
 
245
 
 
246
#endif // DEBUGGERGDB_H
 
247