Code::Blocks  SVN r11506
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GDB_driver Class Reference

#include <gdb_driver.h>

Inheritance diagram for GDB_driver:
Collaboration diagram for GDB_driver:

Public Member Functions

 GDB_driver (DebuggerGDB *plugin)
 
virtual ~GDB_driver ()
 
virtual wxString GetCommandLine (const wxString &debugger, const wxString &debuggee, const wxString &userArguments)
 Get the command-line to launch the debugger. More...
 
virtual wxString GetCommandLine (const wxString &debugger, int pid, const wxString &userArguments)
 Get the command-line to launch the debugger. More...
 
virtual void SetTarget (ProjectBuildTarget *target)
 Sets the target. More...
 
virtual void Prepare (bool isConsole, int printElements)
 Prepares the debugging process by setting up search dirs etc. More...
 
virtual void Start (bool breakOnEntry)
 Begin the debugging process by launching a program. More...
 
virtual void Stop ()
 Stop debugging. More...
 
virtual void Continue ()
 
virtual void Step ()
 
virtual void StepInstruction ()
 
virtual void StepIntoInstruction ()
 
virtual void StepIn ()
 
virtual void StepOut ()
 
virtual void SetNextStatement (const wxString &filename, int line)
 
virtual void Backtrace ()
 
virtual void Disassemble ()
 
virtual void CPURegisters ()
 
virtual void SwitchToFrame (size_t number)
 
virtual void SetVarValue (const wxString &var, const wxString &value)
 
virtual void MemoryDump ()
 
virtual void Attach (int pid)
 Attach to process. More...
 
virtual void Detach ()
 Detach from running process. More...
 
virtual void RunningThreads ()
 
void InfoFrame ()
 
void InfoDLL ()
 
void InfoFiles ()
 
void InfoFPU ()
 
void InfoSignals ()
 
void EnableCatchingThrow (bool enable)
 
virtual void SwitchThread (size_t threadIndex)
 Request to switch to another thread. More...
 
virtual void AddBreakpoint (cb::shared_ptr< DebuggerBreakpoint > bp)
 Add a breakpoint. More...
 
virtual void RemoveBreakpoint (cb::shared_ptr< DebuggerBreakpoint > bp)
 Remove a breakpoint. More...
 
virtual void EvaluateSymbol (const wxString &symbol, const wxRect &tipRect)
 Evaluate a symbol. More...
 
virtual void UpdateWatches (cb::shared_ptr< GDBWatch > localsWatch, cb::shared_ptr< GDBWatch > funcArgsWatch, WatchesContainer &watches)
 Update watches. More...
 
virtual void UpdateWatch (const cb::shared_ptr< GDBWatch > &watch)
 
virtual void UpdateWatchLocalsArgs (cb::shared_ptr< GDBWatch > const &watch, bool locals)
 
virtual void ParseOutput (const wxString &output)
 Parse debugger's output. More...
 
virtual bool IsDebuggingStarted () const
 Is debugging started. More...
 
virtual void DetermineLanguage ()
 Determine language is debugged. More...
 
virtual bool UseDebugBreakProcess ()
 Ask the driver if the debugger should be interrupted with DebugBreakProcess or Ctrl+C event. More...
 
virtual wxString GetDisassemblyFlavour (void)
 
wxString AsmFlavour ()
 
- Public Member Functions inherited from DebuggerDriver
 DebuggerDriver (DebuggerGDB *plugin)
 
virtual ~DebuggerDriver ()
 
void Log (const wxString &msg)
 
void DebugLog (const wxString &msg)
 
DebuggerGDBGetDebugger ()
 
virtual void AddDirectory (const wxString &dir)
 Add a directory in search list. More...
 
virtual void ClearDirectories ()
 Clear directories search list. More...
 
virtual void SetWorkingDirectory (const wxString &dir)
 Set the working directory. More...
 
virtual void SetArguments (const wxString &args)
 Set the execution arguments. More...
 
bool IsProgramStopped () const
 Is the program stopped? More...
 
void MarkProgramStopped (bool stopped)
 
bool IsQueueBusy () const
 Is the driver processing some commands? More...
 
void SetChildPID (long pid)
 Set child PID (debuggee's). More...
 
long GetChildPID () const
 Get the child's (debuggee's) PID. More...
 
wxString GetDebuggersWorkingDirectory () const
 
void ShowFile (const wxString &file, int line)
 Show a file/line without changing the cursor. More...
 
void QueueCommand (DebuggerCmd *dcmd, QueuePriority prio=Low)
 add a command in the queue. The DebuggerCmd will be deleted automatically when finished. More...
 
DebuggerCmdCurrentCommand ()
 returns the currently executing command More...
 
void RunQueue ()
 runs the next command in the queue, if it is idle More...
 
void RemoveTopCommand (bool deleteIt=true)
 removes the top command (it has finished) More...
 
const StackFrameContainerGetStackFrames () const
 returns the container with the current backtrace More...
 
StackFrameContainerGetStackFrames ()
 returns the container with the current backtrace More...
 
const ThreadsContainerGetThreads () const
 returns the thread container with the current list of threads More...
 
ThreadsContainerGetThreads ()
 returns the thread container with the current list of threads More...
 
const CursorGetCursor () const
 Get debugger's cursor. More...
 
void SetCursor (const Cursor &cursor)
 Set debugger's cursor. More...
 
void ResetCurrentFrame ()
 
int GetCurrentFrame () const
 
int GetUserSelectedFrame () const
 
void SetCurrentFrame (int number, bool user_selected)
 
void NotifyDebuggeeContinued ()
 
void NotifyCursorChanged ()
 Called by implementations to notify cursor changes. More...
 

Private Member Functions

void HandleMainBreakPoint (const wxRegEx &reBreak, wxString line)
 
void DetectCygwinMount (void)
 
void CorrectCygwinPath (wxString &path)
 
RemoteDebuggingGetRemoteDebuggingInfo ()
 

Private Attributes

bool m_CygwinPresent
 
wxString m_CygdrivePrefix
 
bool m_BreakOnEntry
 
bool m_ManualBreakOnEntry
 
bool m_IsStarted
 
bool m_needsUpdate
 
bool m_forceUpdate
 
long m_GDBVersionMajor
 
long m_GDBVersionMinor
 
wxString flavour
 
bool m_attachedToProcess
 
ProjectBuildTargetm_pTarget
 
RemoteDebugging m_MergedRDInfo
 
int m_catchThrowIndex
 

Additional Inherited Members

- Public Types inherited from DebuggerDriver
enum  QueuePriority { Low = 0, High }
 The priority used when adding a command in the queue. More...
 
typedef std::vector< cb::shared_ptr< cbStackFrame > > StackFrameContainer
 
typedef std::vector< cb::shared_ptr< cbThread > > ThreadsContainer
 
- Protected Member Functions inherited from DebuggerDriver
void ResetCursor ()
 Called by implementations to reset the cursor. More...
 
- Protected Attributes inherited from DebuggerDriver
DebuggerGDBm_pDBG
 
wxArrayString m_Dirs
 
wxString m_WorkingDir
 
wxString m_Args
 
bool m_ProgramIsStopped
 
wxString m_LastCursorAddress
 
Cursor m_Cursor
 
long m_ChildPID
 
DebuggerCommands m_DCmds
 
bool m_QueueBusy
 
StackFrameContainer m_backtrace
 
ThreadsContainer m_threads
 
int m_currentFrameNo
 
int m_userSelectedFrameNo
 
wxString m_FileName
 

Detailed Description

Definition at line 13 of file gdb_driver.h.

Constructor & Destructor Documentation

◆ GDB_driver()

GDB_driver::GDB_driver ( DebuggerGDB plugin)

Definition at line 80 of file gdb_driver.cpp.

References m_forceUpdate, and m_needsUpdate.

◆ ~GDB_driver()

GDB_driver::~GDB_driver ( )
virtual

Definition at line 96 of file gdb_driver.cpp.

Member Function Documentation

◆ AddBreakpoint()

void GDB_driver::AddBreakpoint ( cb::shared_ptr< DebuggerBreakpoint bp)
virtual

Add a breakpoint.

Parameters
bpThe breakpoint to add.
editorThe editor this breakpoint is set (might be NULL).

Implements DebuggerDriver.

Definition at line 584 of file gdb_driver.cpp.

References _T, DebuggerBreakpoint::bptData, wxRegEx::GetMatch(), wxString::IsSameAs(), wxRegEx::Matches(), DebuggerDriver::NotifyCursorChanged(), and DebuggerDriver::QueueCommand().

◆ AsmFlavour()

wxString GDB_driver::AsmFlavour ( )
inline

◆ Attach()

void GDB_driver::Attach ( int  pid)
virtual

Attach to process.

Implements DebuggerDriver.

Definition at line 678 of file gdb_driver.cpp.

References m_attachedToProcess, m_IsStarted, DebuggerDriver::QueueCommand(), and DebuggerDriver::SetChildPID().

◆ Backtrace()

void GDB_driver::Backtrace ( )
virtual

Implements DebuggerDriver.

Definition at line 493 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

◆ Continue()

void GDB_driver::Continue ( )
virtual

◆ CorrectCygwinPath()

void GDB_driver::CorrectCygwinPath ( wxString path)
private

◆ CPURegisters()

void GDB_driver::CPURegisters ( )
virtual

Implements DebuggerDriver.

Definition at line 506 of file gdb_driver.cpp.

References flavour, and DebuggerDriver::QueueCommand().

◆ Detach()

void GDB_driver::Detach ( )
virtual

Detach from running process.

Implements DebuggerDriver.

Definition at line 686 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

◆ DetectCygwinMount()

void GDB_driver::DetectCygwinMount ( void  )
private

Definition at line 272 of file gdb_driver.cpp.

References BUFSIZE, m_CygdrivePrefix, m_CygwinPresent, and NULL.

Referenced by AsmFlavour(), CorrectCygwinPath(), and Prepare().

◆ DetermineLanguage()

void GDB_driver::DetermineLanguage ( )
virtual

Determine language is debugged.

Reimplemented from DebuggerDriver.

Definition at line 1128 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

Referenced by IsDebuggingStarted().

◆ Disassemble()

void GDB_driver::Disassemble ( )
virtual

Implements DebuggerDriver.

Definition at line 498 of file gdb_driver.cpp.

References flavour, and DebuggerDriver::QueueCommand().

◆ EnableCatchingThrow()

void GDB_driver::EnableCatchingThrow ( bool  enable)
virtual

Implements DebuggerDriver.

Definition at line 565 of file gdb_driver.cpp.

References wxString::Format(), m_catchThrowIndex, DebuggerDriver::QueueCommand(), and wxT.

◆ EvaluateSymbol()

void GDB_driver::EvaluateSymbol ( const wxString symbol,
const wxRect tipRect 
)
virtual

Evaluate a symbol.

Parameters
symbolThe symbol to evaluate.
tipRectThe rect to use for the tip window.

Implements DebuggerDriver.

Definition at line 623 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

◆ GetCommandLine() [1/2]

wxString GDB_driver::GetCommandLine ( const wxString debugger,
const wxString debuggee,
const wxString userArguments 
)
virtual

Get the command-line to launch the debugger.

Implements DebuggerDriver.

Definition at line 101 of file gdb_driver.cpp.

References _T, DebuggerConfiguration::DisableInit, DebuggerGDB::GetActiveConfigEx(), DebuggerConfiguration::GetFlag(), DebuggerDriver::m_pDBG, and wxT.

◆ GetCommandLine() [2/2]

virtual wxString GDB_driver::GetCommandLine ( const wxString debugger,
int  pid,
const wxString userArguments 
)
virtual

Get the command-line to launch the debugger.

Implements DebuggerDriver.

◆ GetDisassemblyFlavour()

wxString GDB_driver::GetDisassemblyFlavour ( void  )
virtual

Definition at line 384 of file gdb_driver.cpp.

References flavour.

Referenced by IsDebuggingStarted().

◆ GetRemoteDebuggingInfo()

RemoteDebugging * GDB_driver::GetRemoteDebuggingInfo ( )
private

◆ HandleMainBreakPoint()

void GDB_driver::HandleMainBreakPoint ( const wxRegEx reBreak,
wxString  line 
)
private

◆ InfoDLL()

void GDB_driver::InfoDLL ( )
virtual

Implements DebuggerDriver.

Definition at line 542 of file gdb_driver.cpp.

References _(), _T, and DebuggerDriver::QueueCommand().

◆ InfoFiles()

void GDB_driver::InfoFiles ( )
virtual

Implements DebuggerDriver.

Definition at line 550 of file gdb_driver.cpp.

References _(), _T, and DebuggerDriver::QueueCommand().

◆ InfoFPU()

void GDB_driver::InfoFPU ( )
virtual

Implements DebuggerDriver.

Definition at line 555 of file gdb_driver.cpp.

References _(), _T, and DebuggerDriver::QueueCommand().

◆ InfoFrame()

void GDB_driver::InfoFrame ( )
virtual

Implements DebuggerDriver.

Definition at line 537 of file gdb_driver.cpp.

References _(), _T, and DebuggerDriver::QueueCommand().

◆ InfoSignals()

void GDB_driver::InfoSignals ( )
virtual

Implements DebuggerDriver.

Definition at line 560 of file gdb_driver.cpp.

References _(), _T, and DebuggerDriver::QueueCommand().

◆ IsDebuggingStarted()

virtual bool GDB_driver::IsDebuggingStarted ( ) const
inlinevirtual

Is debugging started.

Implements DebuggerDriver.

Definition at line 63 of file gdb_driver.h.

References DetermineLanguage(), GetDisassemblyFlavour(), m_IsStarted, and UseDebugBreakProcess().

◆ MemoryDump()

void GDB_driver::MemoryDump ( )
virtual

Implements DebuggerDriver.

Definition at line 526 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

◆ ParseOutput()

void GDB_driver::ParseOutput ( const wxString output)
virtual

Parse debugger's output.

Implements DebuggerDriver.

Definition at line 691 of file gdb_driver.cpp.

References _(), _T, GdbCmd_ChangeFrame::AddrChgMode(), Cursor::address, wxString::AfterFirst(), wxString::BeforeFirst(), cbDebuggerPlugin::BringCBToFront(), Cursor::changed, wxString::Clear(), wxString::clear(), CorrectCygwinPath(), DebuggerDriver::CurrentCommand(), cbDebuggerPlugin::DebugLog(), InfoWindow::Display(), wxString::empty(), Cursor::file, wxString::First(), wxString::Format(), Cursor::function, g_EscapeChar, GDB_PROMPT, Manager::Get(), GetArrayFromString(), DebuggerState::GetBreakpoint(), DebuggerState::GetBreakpointByNumber(), DebuggerManager::GetBreakpointDialog(), wxArrayString::GetCount(), Manager::GetDebuggerManager(), wxRegEx::GetMatch(), DebuggerGDB::GetState(), HandleMainBreakPoint(), DebuggerState::HasBreakpoint(), wxArrayString::Item(), wxString::Last(), wxString::Left(), Cursor::line, DebuggerDriver::Log(), cbDebuggerPlugin::Log(), DebuggerDriver::m_ChildPID, DebuggerDriver::m_Cursor, m_CygwinPresent, DebuggerDriver::m_DCmds, m_forceUpdate, m_GDBVersionMajor, m_GDBVersionMinor, m_IsStarted, m_needsUpdate, DebuggerDriver::m_pDBG, DebuggerDriver::m_ProgramIsStopped, DebuggerDriver::m_QueueBusy, wxRegEx::Matches(), DebuggerDriver::NotifyCursorChanged(), DebuggerCmd::ParseOutput(), DebuggerDriver::QueueCommand(), reBreak, reBreak2, reBreak3, reCatchThrow, reCatchThrowNoFile, reChildPid1, reChildPid2, reInferiorExited, reInferiorExitedWithCode, cbBreakpointsDlg::Reload(), wxString::Remove(), DebuggerState::RemoveBreakpoint(), wxString::RemoveLast(), DebuggerDriver::RemoveTopCommand(), rePendingFound, rePendingFound1, reTempBreakFound, reThreadSwitch, reThreadSwitch2, DebuggerDriver::RunQueue(), DebuggerDriver::SetChildPID(), wxString::StartsWith(), wxString::ToLong(), UnixFilename(), wxEmptyString, wxNOT_FOUND, and wxT.

◆ Prepare()

void GDB_driver::Prepare ( bool  isConsole,
int  printElements 
)
virtual

◆ RemoveBreakpoint()

void GDB_driver::RemoveBreakpoint ( cb::shared_ptr< DebuggerBreakpoint bp)
virtual

Remove a breakpoint.

Parameters
bpThe breakpoint to remove. If NULL, all reakpoints are removed.

Implements DebuggerDriver.

Definition at line 617 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

◆ RunningThreads()

void GDB_driver::RunningThreads ( )
virtual

Implements DebuggerDriver.

Definition at line 531 of file gdb_driver.cpp.

References Manager::Get(), and DebuggerDriver::QueueCommand().

◆ SetNextStatement()

void GDB_driver::SetNextStatement ( const wxString filename,
int  line 
)
virtual

◆ SetTarget()

void GDB_driver::SetTarget ( ProjectBuildTarget target)
virtual

Sets the target.

Implements DebuggerDriver.

Definition at line 126 of file gdb_driver.cpp.

References m_pTarget.

◆ SetVarValue()

void GDB_driver::SetVarValue ( const wxString var,
const wxString value 
)
virtual

◆ Start()

void GDB_driver::Start ( bool  breakOnEntry)
virtual

◆ Step()

void GDB_driver::Step ( )
virtual

Implements DebuggerDriver.

Definition at line 456 of file gdb_driver.cpp.

References _T, DebuggerDriver::QueueCommand(), and DebuggerDriver::ResetCursor().

◆ StepIn()

void GDB_driver::StepIn ( )
virtual

Implements DebuggerDriver.

Definition at line 474 of file gdb_driver.cpp.

References _T, DebuggerDriver::QueueCommand(), and DebuggerDriver::ResetCursor().

◆ StepInstruction()

void GDB_driver::StepInstruction ( )
virtual

Implements DebuggerDriver.

Definition at line 462 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand(), and DebuggerDriver::ResetCursor().

◆ StepIntoInstruction()

void GDB_driver::StepIntoInstruction ( )
virtual

Implements DebuggerDriver.

Definition at line 468 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand(), and DebuggerDriver::ResetCursor().

◆ StepOut()

void GDB_driver::StepOut ( )
virtual

Implements DebuggerDriver.

Definition at line 480 of file gdb_driver.cpp.

References _T, DebuggerDriver::QueueCommand(), and DebuggerDriver::ResetCursor().

◆ Stop()

void GDB_driver::Stop ( )
virtual

◆ SwitchThread()

void GDB_driver::SwitchThread ( size_t  threadIndex)
virtual

Request to switch to another thread.

Implements DebuggerDriver.

Definition at line 576 of file gdb_driver.cpp.

References _T, wxString::Format(), Manager::Get(), DebuggerDriver::QueueCommand(), and DebuggerDriver::ResetCursor().

◆ SwitchToFrame()

void GDB_driver::SwitchToFrame ( size_t  number)
virtual

Implements DebuggerDriver.

Definition at line 514 of file gdb_driver.cpp.

References _T, DebuggerDriver::QueueCommand(), and DebuggerDriver::ResetCursor().

◆ UpdateWatch()

void GDB_driver::UpdateWatch ( const cb::shared_ptr< GDBWatch > &  watch)
virtual

Implements DebuggerDriver.

Definition at line 666 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

◆ UpdateWatches()

void GDB_driver::UpdateWatches ( cb::shared_ptr< GDBWatch localsWatch,
cb::shared_ptr< GDBWatch funcArgsWatch,
WatchesContainer watches 
)
virtual

Update watches.

Parameters
doLocalsDisplay values of local variables.
doArgsDisplay values of function arguments.
treeThe watches tree control.

Implements DebuggerDriver.

Definition at line 628 of file gdb_driver.cpp.

References DebuggerGDB::DetermineLanguage(), Cursor::file, wxString::IsSameAs(), DebuggerDriver::m_Cursor, DebuggerDriver::m_FileName, DebuggerDriver::m_pDBG, and DebuggerDriver::QueueCommand().

◆ UpdateWatchLocalsArgs()

void GDB_driver::UpdateWatchLocalsArgs ( cb::shared_ptr< GDBWatch > const &  watch,
bool  locals 
)
virtual

Implements DebuggerDriver.

Definition at line 672 of file gdb_driver.cpp.

References DebuggerDriver::QueueCommand().

◆ UseDebugBreakProcess()

bool GDB_driver::UseDebugBreakProcess ( )
virtual

Ask the driver if the debugger should be interrupted with DebugBreakProcess or Ctrl+C event.

Implements DebuggerDriver.

Definition at line 376 of file gdb_driver.cpp.

References GetRemoteDebuggingInfo(), and RemoteDebugging::IsOk().

Referenced by IsDebuggingStarted().

Member Data Documentation

◆ flavour

wxString GDB_driver::flavour
private

Definition at line 104 of file gdb_driver.h.

Referenced by AsmFlavour(), CPURegisters(), Disassemble(), GetDisassemblyFlavour(), and Prepare().

◆ m_attachedToProcess

bool GDB_driver::m_attachedToProcess
private

Definition at line 106 of file gdb_driver.h.

Referenced by Attach(), Continue(), Start(), and Stop().

◆ m_BreakOnEntry

bool GDB_driver::m_BreakOnEntry
private

Definition at line 88 of file gdb_driver.h.

Referenced by HandleMainBreakPoint(), and Start().

◆ m_catchThrowIndex

int GDB_driver::m_catchThrowIndex
private

Definition at line 114 of file gdb_driver.h.

Referenced by EnableCatchingThrow(), and Prepare().

◆ m_CygdrivePrefix

wxString GDB_driver::m_CygdrivePrefix
private

Definition at line 84 of file gdb_driver.h.

Referenced by CorrectCygwinPath(), and DetectCygwinMount().

◆ m_CygwinPresent

bool GDB_driver::m_CygwinPresent
private

Definition at line 83 of file gdb_driver.h.

Referenced by DetectCygwinMount(), and ParseOutput().

◆ m_forceUpdate

bool GDB_driver::m_forceUpdate
private

Definition at line 99 of file gdb_driver.h.

Referenced by GDB_driver(), and ParseOutput().

◆ m_GDBVersionMajor

long GDB_driver::m_GDBVersionMajor
private

Definition at line 102 of file gdb_driver.h.

Referenced by ParseOutput().

◆ m_GDBVersionMinor

long GDB_driver::m_GDBVersionMinor
private

Definition at line 103 of file gdb_driver.h.

Referenced by ParseOutput().

◆ m_IsStarted

bool GDB_driver::m_IsStarted
private

Definition at line 95 of file gdb_driver.h.

Referenced by Attach(), Continue(), IsDebuggingStarted(), ParseOutput(), Start(), and Stop().

◆ m_ManualBreakOnEntry

bool GDB_driver::m_ManualBreakOnEntry
private

Definition at line 92 of file gdb_driver.h.

Referenced by Continue(), HandleMainBreakPoint(), and Start().

◆ m_MergedRDInfo

RemoteDebugging GDB_driver::m_MergedRDInfo
private

Definition at line 112 of file gdb_driver.h.

Referenced by GetRemoteDebuggingInfo().

◆ m_needsUpdate

bool GDB_driver::m_needsUpdate
private

Definition at line 98 of file gdb_driver.h.

Referenced by GDB_driver(), HandleMainBreakPoint(), and ParseOutput().

◆ m_pTarget

ProjectBuildTarget* GDB_driver::m_pTarget
private

Definition at line 109 of file gdb_driver.h.

Referenced by GetRemoteDebuggingInfo(), and SetTarget().


The documentation for this class was generated from the following files: