KDbg 2.5.5.
[kdbg.git] / kdbg / dbgmainwnd.h
blob9d5531e7a99897049779e0c4c76c536bb8d706e8
1 /*
2 * Copyright Johannes Sixt
3 * This file is licensed under the GNU General Public License Version 2.
4 * See the file COPYING in the toplevel directory of the source directory.
5 */
7 #ifndef DBGMAINWND_H
8 #define DBGMAINWND_H
10 #include <QPointer>
11 #include <QTimer>
12 #include <kxmlguiwindow.h>
13 #include "regwnd.h"
15 class QDockWidget;
16 class QProcess;
17 class KAnimatedButton;
18 class KRecentFilesAction;
19 class KUrl;
20 class WinStack;
21 class QListWidget;
22 class ExprWnd;
23 class BreakpointTable;
24 class ThreadList;
25 class MemoryWindow;
26 class TTYWindow;
27 class WatchWindow;
28 class KDebugger;
29 class DebuggerDriver;
30 struct DbgAddr;
32 class DebuggerMainWnd : public KXmlGuiWindow
34 Q_OBJECT
35 public:
36 DebuggerMainWnd();
37 ~DebuggerMainWnd();
39 bool debugProgram(const QString& exe, const QString& lang);
41 /**
42 * Specifies the file where to write the transcript.
44 void setTranscript(const QString& name);
45 /**
46 * Specifies the process to attach to after the program is loaded.
48 void setAttachPid(const QString& pid);
50 // the following are needed to handle program arguments
51 void setCoreFile(const QString& corefile);
52 void setRemoteDevice(const QString &remoteDevice);
53 void overrideProgramArguments(const QString& args);
55 protected:
56 // session properties
57 virtual void saveProperties(KConfigGroup& cg);
58 virtual void readProperties(const KConfigGroup& cg);
59 // settings
60 void saveSettings(KSharedConfigPtr);
61 void restoreSettings(KSharedConfigPtr);
63 void initAnimation();
64 void initStatusBar();
65 void initKAction();
67 // view windows
68 WinStack* m_filesWindow;
69 QListWidget* m_btWindow;
70 ExprWnd* m_localVariables;
71 WatchWindow* m_watches;
72 RegisterView* m_registers;
73 BreakpointTable* m_bpTable;
74 TTYWindow* m_ttyWindow;
75 ThreadList* m_threads;
76 MemoryWindow* m_memoryWindow;
78 QTimer m_backTimer;
80 // recent execs in File menu
81 QAction* m_closeAction;
82 QAction* m_reloadAction;
83 QAction* m_fileExecAction;
84 KRecentFilesAction* m_recentExecAction;
85 QAction* m_coreDumpAction;
86 QAction* m_settingsAction;
87 QAction* m_findAction;
88 QAction* m_btWindowAction;
89 QAction* m_localVariablesAction;
90 QAction* m_watchesAction;
91 QAction* m_registersAction;
92 QAction* m_bpTableAction;
93 QAction* m_ttyWindowAction;
94 QAction* m_threadsAction;
95 QAction* m_memoryWindowAction;
96 QAction* m_runAction;
97 QAction* m_stepIntoAction;
98 QAction* m_stepOverAction;
99 QAction* m_stepOutAction;
100 QAction* m_toCursorAction;
101 QAction* m_stepIntoIAction;
102 QAction* m_stepOverIAction;
103 QAction* m_execMovePCAction;
104 QAction* m_breakAction;
105 QAction* m_killAction;
106 QAction* m_restartAction;
107 QAction* m_attachAction;
108 QAction* m_argumentsAction;
109 QAction* m_bpSetAction;
110 QAction* m_bpSetTempAction;
111 QAction* m_bpEnableAction;
112 QAction* m_editValueAction;
113 QString m_lastDirectory; /* the dir of the most recently opened file */
115 protected:
116 virtual bool queryClose();
117 QAction* createAction(const QString& text, const char* icon,
118 int shortcut, const QObject* receiver,
119 const char* slot, const char* name);
120 QAction* createAction(const QString& text,
121 int shortcut, const QObject* receiver,
122 const char* slot, const char* name);
124 // the debugger proper
125 QString m_debuggerCmdStr;
126 KDebugger* m_debugger;
127 QString m_transcriptFile; /* where gdb dialog is logged */
130 * Starts to debug the specified program using the specified language
131 * driver.
133 bool startDriver(const QString& executable, QString lang);
134 DebuggerDriver* driverFromLang(QString lang);
136 * Derives a driver name from the contents of the named file.
138 QString driverNameFromFile(const QString& exe);
140 // output window
141 QString m_outputTermCmdStr;
142 QString m_outputTermKeepScript;
143 QProcess* m_outputTermProc;
144 int m_ttyLevel;
146 QString createOutputWindow();
148 bool m_popForeground; /* whether main wnd raises when prog stops */
149 int m_backTimeout; /* when wnd goes back */
150 int m_tabWidth; /* tab width in characters (can be 0) */
151 QString m_sourceFilter;
152 QString m_headerFilter;
153 void setTerminalCmd(const QString& cmd);
154 void setDebuggerCmdStr(const QString& cmd);
156 QDockWidget* createDockWidget(const char* name, const QString& title);
157 QDockWidget* dockParent(QWidget* w);
158 bool isDockVisible(QWidget* w);
159 void makeDefaultLayout();
161 QString makeSourceFilter();
163 // to avoid flicker when the status bar is updated,
164 // we store the last string that we put there
165 QPointer<KAnimatedButton> m_animation;
166 QString m_lastActiveStatusText;
167 bool m_animRunning;
169 // statusbar texts
170 QString m_statusActive;
172 signals:
173 void setTabWidth(int tabWidth);
175 public slots:
176 virtual void updateUI();
177 virtual void updateLineItems();
178 void slotAddWatch();
179 void slotAddWatch(const QString& text);
180 void slotNewFileLoaded();
181 void slotNewStatusMsg();
182 void slotDebuggerStarting();
183 void slotToggleBreak(const QString&, int, const DbgAddr&, bool);
184 void slotEnaDisBreak(const QString&, int, const DbgAddr&);
185 void slotProgramStopped();
186 void slotBackTimer();
187 void slotRecentExec(const KUrl& url);
188 void slotLocalsPopup(const QPoint& pt);
189 void slotLocalsToWatch();
190 void slotEditValue();
192 void slotFileOpen();
193 void slotFileExe();
194 void slotFileCore();
195 void slotFileGlobalSettings();
196 void slotFileProgSettings();
197 void slotViewStatusbar();
198 void slotExecUntil();
199 void slotExecAttach();
200 void slotExecArgs();
201 void intoBackground();
202 void slotConfigureKeys();
205 #endif // DBGMAINWND_H