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
6
* $Id: debuggerdriver.cpp 4909 2008-02-27 13:15:26Z mortenmacfly $
7
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/debuggergdb/debuggerdriver.cpp $
11
#include "debuggerdriver.h"
12
#include "debuggergdb.h"
14
DebuggerDriver::DebuggerDriver(DebuggerGDB* plugin)
16
m_ProgramIsStopped(true),
26
DebuggerDriver::~DebuggerDriver()
32
void DebuggerDriver::Log(const wxString& msg)
37
void DebuggerDriver::DebugLog(const wxString& msg)
39
m_pDBG->DebugLog(msg);
42
void DebuggerDriver::SetDebugWindows(BacktraceDlg* b,
55
void DebuggerDriver::ClearDirectories()
60
void DebuggerDriver::AddDirectory(const wxString& dir)
62
if (m_Dirs.Index(dir) == wxNOT_FOUND)
66
void DebuggerDriver::SetWorkingDirectory(const wxString& dir)
71
void DebuggerDriver::SetArguments(const wxString& args)
76
void DebuggerDriver::NotifyCursorChanged()
78
if (!m_Cursor.changed || m_LastCursorAddress == m_Cursor.address)
80
m_LastCursorAddress = m_Cursor.address;
81
wxCommandEvent event(DEBUGGER_CURSOR_CHANGED);
82
m_pDBG->ProcessEvent(event);
85
void DebuggerDriver::ResetCursor()
87
m_LastCursorAddress.Clear();
88
m_Cursor.address.Clear();
89
m_Cursor.file.Clear();
90
m_Cursor.function.Clear();
92
m_Cursor.changed = false;
95
void DebuggerDriver::QueueCommand(DebuggerCmd* dcmd, QueuePriority prio)
97
// DebugLog(_T("Queueing command: ") + dcmd->m_Cmd);
101
m_DCmds.Insert(dcmd, 0);
105
DebuggerCmd* DebuggerDriver::CurrentCommand()
107
return m_DCmds.GetCount() ? m_DCmds[0] : 0;
110
void DebuggerDriver::RunQueue()
112
if (m_QueueBusy || !m_DCmds.GetCount())
115
// Log(_T("Running command: ") + CurrentCommand()->m_Cmd);
116
// don't send a command if empty; most debuggers repeat the last command this way...
117
if (!CurrentCommand()->m_Cmd.IsEmpty())
120
m_pDBG->SendCommand(CurrentCommand()->m_Cmd);
121
m_ProgramIsStopped = false;
125
CurrentCommand()->Action();
127
// If the command was an action (i.e. no command specified,
128
// remove it from the queue and run the next command.
129
// For other commands, this happens in driver's ParseOutput().
130
if (CurrentCommand()->m_Cmd.IsEmpty())
132
RemoveTopCommand(true);
137
void DebuggerDriver::RemoveTopCommand(bool deleteIt)
139
if (m_QueueBusy || !m_DCmds.GetCount())
142
// Log(_T("Removing command: ") + CurrentCommand()->m_Cmd);
148
void DebuggerDriver::ClearQueue()
151
// if the first command in the queue is running, delete all others
152
// (this will be deleted when done)
153
if (m_QueueBusy && !m_DCmds.GetCount())
155
for (int i = idx; i < (int)m_DCmds.GetCount(); ++i)