58 #define implement_debugger_toolbar 61 #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) 63 typedef BOOL WINAPI (*DebugBreakProcessApiCall) (HANDLE);
64 typedef HANDLE WINAPI (*CreateToolhelp32SnapshotApiCall)(DWORD dwFlags, DWORD th32ProcessID);
65 typedef BOOL WINAPI (*Process32FirstApiCall) (HANDLE hSnapshot, LPPROCESSENTRY32W lppe);
66 typedef BOOL WINAPI (*Process32NextApiCall) (HANDLE hSnapshot, LPPROCESSENTRY32W lppe);
68 DebugBreakProcessApiCall DebugBreakProcessFunc = 0;
69 CreateToolhelp32SnapshotApiCall CreateToolhelp32SnapshotFunc = 0;
70 Process32FirstApiCall Process32FirstFunc = 0;
71 Process32NextApiCall Process32NextFunc = 0;
73 HINSTANCE kernelLib = 0;
106 long idMenuInfoFrame =
wxNewId();
107 long idMenuInfoDLL =
wxNewId();
108 long idMenuInfoFiles =
wxNewId();
109 long idMenuInfoFPU =
wxNewId();
110 long idMenuInfoSignals =
wxNewId();
112 long idMenuInfoPrintElementsUnlimited =
wxNewId();
113 long idMenuInfoPrintElements20 =
wxNewId();
114 long idMenuInfoPrintElements50 =
wxNewId();
115 long idMenuInfoPrintElements100 =
wxNewId();
116 long idMenuInfoPrintElements200 =
wxNewId();
118 long idMenuInfoCatchThrow =
wxNewId();
121 long idTimerPollDebugger =
wxNewId();
123 long idMenuWatchDereference =
wxNewId();
171 m_NoDebugInfo(false),
172 m_StoppedOnSignal(false),
175 m_stopDebuggerConsoleClosed(false),
177 m_TemporaryBreak(false),
186 #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) 190 DebugBreakProcessFunc = (DebugBreakProcessApiCall)GetProcAddress(kernelLib,
"DebugBreakProcess");
192 CreateToolhelp32SnapshotFunc = (CreateToolhelp32SnapshotApiCall)GetProcAddress(kernelLib,
"CreateToolhelp32Snapshot");
193 Process32FirstFunc = (Process32FirstApiCall)GetProcAddress(kernelLib,
"Process32First");
194 Process32NextFunc = (Process32NextApiCall)GetProcAddress(kernelLib,
"Process32Next");
201 #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) 203 FreeLibrary(kernelLib);
363 TiXmlElement* conf = elem->FirstChildElement(
"debugger");
366 TiXmlElement* pathsElem = conf->FirstChildElement(
"search_path");
369 if (pathsElem->Attribute(
"add"))
376 pathsElem = pathsElem->NextSiblingElement(
"search_path");
379 TiXmlElement* rdElem = conf->FirstChildElement(
"remote_debugging");
385 TiXmlElement* rdOpt = rdElem->FirstChildElement(
"options");
391 if (rdOpt->Attribute(
"conn_type"))
393 if (rdOpt->Attribute(
"serial_port"))
395 if (rdOpt->Attribute(
"serial_baud"))
397 if (rdOpt->Attribute(
"ip_address"))
398 rd.
ip =
cbC2U(rdOpt->Attribute(
"ip_address"));
399 if (rdOpt->Attribute(
"ip_port"))
401 if (rdOpt->Attribute(
"additional_cmds"))
403 if (rdOpt->Attribute(
"additional_cmds_before"))
405 if (rdOpt->Attribute(
"skip_ld_path"))
407 if (rdOpt->Attribute(
"extended_remote"))
409 if (rdOpt->Attribute(
"additional_shell_cmds_after"))
411 if (rdOpt->Attribute(
"additional_shell_cmds_before"))
414 rdprj.
insert(rdprj.end(), std::make_pair(bt, rd));
417 rdElem = rdElem->NextSiblingElement(
"remote_debugging");
430 TiXmlElement* node = elem->FirstChildElement(
"debugger");
432 node = elem->InsertEndChild(TiXmlElement(
"debugger"))->ToElement();
437 for (
size_t i = 0; i < pdirs.
GetCount(); ++i)
439 TiXmlElement* path = node->InsertEndChild(TiXmlElement(
"search_path"))->ToElement();
440 path->SetAttribute(
"add",
cbU2C(pdirs[i]));
446 for (RemoteDebuggingMap::iterator it = rdprj.begin(); it != rdprj.end(); ++it)
462 TiXmlElement* rdnode = node->InsertEndChild(TiXmlElement(
"remote_debugging"))->ToElement();
464 rdnode->SetAttribute(
"target",
cbU2C(it->first->GetTitle()));
466 TiXmlElement* tgtnode = rdnode->InsertEndChild(TiXmlElement(
"options"))->ToElement();
467 tgtnode->SetAttribute(
"conn_type", (
int)rd.
connType);
473 tgtnode->SetAttribute(
"ip_address",
cbU2C(rd.
ip));
475 tgtnode->SetAttribute(
"ip_port",
cbU2C(rd.
ipPort));
481 tgtnode->SetAttribute(
"skip_ld_path",
"1");
483 tgtnode->SetAttribute(
"extended_remote",
"1");
533 if (platform::windows)
551 #if wxCHECK_VERSION(3, 0, 0) 559 execEnv.
env[
"SHELL"] = shell;
570 #endif // !wxCHECK_VERSION(3, 0, 0) 580 Log(
_(
"Starting debugger: ") + cmd);
589 pid_t mypid = getpid();
598 psCmd <<
wxT(
"/bin/ps -o ppid,pid,command");
602 mypidStr << wxT(
" ");
604 for (
int i = 0; i < psOutput.
GetCount(); ++i)
611 if (pidStr.
ToLong(&pspid))
619 for (
int i = 0; i < psErrors.
GetCount(); ++i)
701 return DoDebug(breakOnEntry) == 0;
721 Log(
_(
"Selecting target: "));
740 cbMessageBox(
_(
"The selected target is only running pre/post build step commands\n" 757 msg.
Printf(
_(
"This %s is configured to use an invalid debugger.\nThe operation failed..."), target ?
_(
"target") :
_(
"project"));
770 Log(
_(
"ERROR: You need to specify a debugger program in the debuggers's settings."),
Logger::error);
772 if (platform::windows)
774 Log(
_(
"(For MinGW compilers, it's 'gdb.exe' (without the quotes))"),
Logger::error);
775 Log(
_(
"(For MSVC compilers, it's 'cdb.exe' (without the quotes))"),
Logger::error);
798 int nRet = evt.GetInt();
802 Log(
_(
"Aborted by plugin"));
821 for (
unsigned int i = 0; i < projects->GetCount(); ++i)
833 for (
size_t i = 0; i < pdirs.GetCount(); ++i)
856 Log(
_(
"Changing directory to: ") + path);
871 RemoteDebuggingMap::iterator it = rdprj.find(target);
872 if (it != rdprj.end())
878 wxGetEnv(CB_LIBRARY_ENVVAR, &oldLibPath);
881 if (actualCompiler && target)
884 const wxString libPathSep = platform::windows ?
_T(
";") : _T(
":");
885 newLibPath << _T(
".") << libPathSep;
891 if (newLibPath.
Mid(newLibPath.
Length() - 1, 1) != libPathSep)
892 newLibPath << libPathSep;
893 newLibPath << oldLibPath;
894 wxSetEnv(CB_LIBRARY_ENVVAR, newLibPath);
895 Log(
wxString(
_(
"Set variable: ")) + CB_LIBRARY_ENVVAR
wxT(
"=") + newLibPath);
903 SetConsoleTitleA(
"Codeblocks debug console - DO NOT CLOSE!");
907 HWND windowHandle = GetConsoleWindow();
909 ShowWindow(windowHandle, SW_HIDE);
923 wxSetEnv(CB_LIBRARY_ENVVAR, oldLibPath);
966 gdbTtyCmd <<
wxT(
"tty ") << consoleTty;
971 #endif//ndef __WXMSW__ 992 Log(
_(
"Adding source dir: ") + filename);
1016 str =
_T(
"\"") + str +
_T(
"\"");
1023 str = fname.
GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
1045 if (platform::windows)
1047 int ColonLocation = str.
Find(
_T(
':'));
1048 bool convert_path_83 =
false;
1050 convert_path_83 =
true;
1062 convert_path_83 =
true;
1066 if (convert_path_83 && str.
Contains(
_T(
' ')))
1085 if (platform::windows)
1115 str =
_T(
"../") + str;
1127 Log(
_T(
"> ") + cleandCmd);
1187 Log(
_(
"Continuing..."));
1208 if (!
Manager::Get()->GetDebuggerManager()->UpdateDisassembly())
1225 if (!
Manager::Get()->GetDebuggerManager()->UpdateDisassembly())
1329 if (
Manager::Get()->GetDebuggerManager()->UpdateBacktrace())
1359 for (DebuggerDriver::ThreadsContainer::const_iterator it = threads.begin(); it != threads.end(); ++it)
1361 if ((*it)->GetNumber() == thread_number)
1363 if (!(*it)->IsActive())
1374 if (debuggerIsRunning)
1379 if (debuggerIsRunning)
1393 cb::shared_ptr<DebuggerBreakpoint> bp =
m_State.
AddBreakpoint(newDataExpression, sel != 1, sel != 0);
1397 return cb::shared_ptr<cbBreakpoint>();
1408 std::advance(it, index);
1416 std::advance(it, index);
1424 BreakpointsList::const_iterator it = std::find(breakpoints.begin(), breakpoints.end(), breakpoint);
1425 if (it == breakpoints.end())
1427 cb::shared_ptr<DebuggerBreakpoint> bp = cb::static_pointer_cast<
DebuggerBreakpoint>(breakpoint);
1445 if (bp->breakOnRead && bp->breakOnWrite)
1447 else if (!bp->breakOnRead && bp->breakOnWrite)
1453 bp->enabled = dlg.IsEnabled();
1469 if (debuggerIsRunning)
1474 if (debuggerIsRunning)
1482 if (debuggerIsRunning)
1487 if (debuggerIsRunning)
1494 if (debuggerIsRunning)
1498 if (debuggerIsRunning)
1505 BreakpointsList::iterator it = breakpoints.begin();
1506 std::advance(it, index);
1507 if (it != breakpoints.end())
1515 if (debuggerIsRunning)
1518 cb::shared_ptr<DebuggerBreakpoint> bp = cb::static_pointer_cast<
DebuggerBreakpoint>(breakpoint);
1522 if (debuggerIsRunning)
1558 bool bResult =
false;
1560 int bep = line.
Find(cb)+1;
1561 int scs = line.
Find(
_T(
'\''))+1;
1562 int sce = line.
Find(
_T(
'\''),
true)+1;
1563 int dcs = line.
Find(
_T(
'"'))+1;
1564 int dce = line.
Find(
_T(
'"'),
true)+1;
1566 if (!scs && !sce && !dcs && !dce) bResult =
true;
1568 if (!(sce-scs) && !(dce-dcs)) bResult =
true;
1570 if ((sce-scs) && ((bep < scs)||(bep >sce))) bResult =
true;
1572 if ((dce-dcs) && ((bep < dcs)||(bep >dce))) bResult =
true;
1598 return Debug(
false);
1623 long pid = childPid;
1640 Log(
F(
_(
"Trying to interrupt process with pid: %ld; child pid: %ld gdb pid: %ld"),
1641 pid, childPid, static_cast<long>(
m_Pid)));
1649 && (CreateToolhelp32SnapshotFunc!=
NULL)
1650 && (Process32FirstFunc!=
NULL)
1651 && (Process32NextFunc!=
NULL) )
1653 HANDLE snap = CreateToolhelp32SnapshotFunc(TH32CS_SNAPALL,0);
1654 if (snap!=INVALID_HANDLE_VALUE)
1656 PROCESSENTRY32 lppe;
1657 lppe.dwSize =
sizeof(PROCESSENTRY32);
1658 BOOL ok = Process32FirstFunc(snap, &lppe);
1661 if (static_cast<int>(lppe.th32ParentProcessID) ==
m_Pid)
1663 pid = lppe.th32ProcessID;
1666 lppe.dwSize =
sizeof(PROCESSENTRY32);
1667 ok = Process32NextFunc(snap, &lppe);
1677 if (!DebugBreakProcessFunc)
1678 Log(
_(
"DebugBreakProcess is not supported, you need Windows XP or newer..."),
Logger::error);
1681 Log(
F(
_(
"Trying to interrupt process with pid: %ld; child pid: %ld gdb pid: %ld"),
1682 pid, childPid, static_cast<long>(
m_Pid)));
1683 HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
1686 DebugBreakProcessFunc(proc);
1697 Log(
_(
"Trying to interrupt the process by sending CTRL-C event to the console!"));
1698 if (GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0) == 0)
1725 DebugLog(
_(
"Child pid is 0, so we will terminate GDB directly"));
1749 filename = cursor.
file;
1766 _(
"Executables and libraries|*.exe;*.dll"),
1779 menu.
Append(idMenuInfoFrame,
_(
"Current stack frame"),
_(
"Displays info about the current (selected) stack frame"));
1780 menu.
Append(idMenuInfoDLL,
_(
"Loaded libraries"),
_(
"List dynamically loaded libraries (DLL/SO)"));
1781 menu.
Append(idMenuInfoFiles,
_(
"Targets and files"),
_(
"Displays info on the targets and files being debugged"));
1782 menu.
Append(idMenuInfoFPU,
_(
"FPU status"),
_(
"Displays the status of the floating point unit"));
1783 menu.
Append(idMenuInfoSignals,
_(
"Signal handling"),
_(
"Displays how the debugger handles various signals"));
1787 menuPrint->
AppendRadioItem(idMenuInfoPrintElementsUnlimited,
_(
"Unlimited"),
1788 _(
"The full arrays are printed (could lead to lock-ups if uninitialised data is printed)"));
1792 menuPrint->
AppendRadioItem(idMenuInfoPrintElements200,
_(
"200 (default)"));
1793 menu.
AppendSubMenu(menuPrint,
_(
"Print Elements"),
_(
"Set limit on string chars or array elements to print"));
1795 _(
"If enabled the debugger will break when an exception is thronw"));
1800 bool checked = (
event.GetId() == idMenuInfoPrintElementsUnlimited &&
m_printElements==0) ||
1801 (event.GetId() == idMenuInfoPrintElements20 && m_printElements==20) ||
1802 (event.GetId() == idMenuInfoPrintElements50 && m_printElements==50) ||
1803 (event.GetId() == idMenuInfoPrintElements100 && m_printElements==100) ||
1804 (event.GetId() == idMenuInfoPrintElements200 && m_printElements==200);
1805 event.Check(checked);
1811 if (event.GetId() == idMenuInfoPrintElementsUnlimited)
1813 else if (event.GetId() == idMenuInfoPrintElements20)
1815 else if (event.GetId() == idMenuInfoPrintElements50)
1817 else if (event.GetId() == idMenuInfoPrintElements100)
1819 else if (event.GetId() == idMenuInfoPrintElements200)
1838 bool flag =
event.IsChecked();
1908 "Please change this in the project's build options, re-compile and retry..."),
1955 _(
"Detected that the Terminal/Console has been closed. " 1956 "Do you want to stop the debugging session?"),
2013 event.RequestMore();
2030 SyncEditor(event.GetString(),
event.GetInt(),
false);
2057 if (!autoSwitch || cursor.
line != -1)
2061 if (cursor.
line != -1)
2081 if (cursor.
line == -1 && autoSwitch)
2123 WatchesContainer::iterator it = std::find(
m_watches.begin(),
m_watches.end(), watch);
2130 WatchesContainer::iterator it = std::find(
m_watches.begin(),
m_watches.end(), watch);
2140 if (watch->GetParent())
2143 cb::shared_ptr<GDBWatch> real_watch = cb::static_pointer_cast<
GDBWatch>(watch);
2145 if (dlg.ShowModal() ==
wxID_OK)
2158 cb::shared_ptr<cbWatch> temp_watch = watch;
2164 temp_watch->GetSymbol(symbol);
2165 temp_watch = temp_watch->GetParent();
2168 symbol =
wxT(
'(') + symbol +
wxT(
')');
2170 if (full_symbol.
empty())
2171 full_symbol = symbol;
2173 full_symbol = symbol + wxT(
'.') + full_symbol;
2181 temp_watch->GetSymbol(symbol);
2182 temp_watch = temp_watch->GetParent();
2184 if (full_symbol.
empty())
2185 full_symbol = symbol;
2188 if (full_symbol.
at(0) ==
'(' && symbol.
at(0) ==
'(')
2190 size_t sec = full_symbol.
find(
')');
2197 else if (full_symbol.
at(0) ==
'(')
2198 full_symbol = symbol + full_symbol;
2200 full_symbol = symbol +
wxT(
'%') + full_symbol;
2226 cb::shared_ptr<GDBWatch> real_watch = cb::static_pointer_cast<
GDBWatch>(watch);
2243 (*it)->MarkAsChangedRecursive(
false);
2255 menu.
Insert(0, idMenuWatchDereference,
_(
"Dereference ") + symbol);
int wxKill(long pid, wxSignal sig=wxSIGTERM, wxKillError *rc=NULL, int flags=wxKILL_NOCHILDREN)
wxString F(const wxChar *msg,...)
sprintf-like function
void ConvertDirectory(wxString &str, wxString base, bool relative)
void AttachToProcess(const wxString &pid)
BOOL WINAPI HandlerRoutine(cb_unused DWORD dwCtrlType)
wxArrayString & GetSearchDirs(cbProject *prj)
bool SetWatchValue(cb::shared_ptr< cbWatch > watch, const wxString &value)
DebuggerLanguage g_DebugLanguage
bool wxGetEnv(const wxString &var, wxString *value)
int GetStackFrameCount() const
SearchDirsMap m_SearchDirs
PluginManager * GetPluginManager() const
wxString wxFileSelector(const wxString &message, const wxString &default_path=wxEmptyString, const wxString &default_filename=wxEmptyString, const wxString &default_extension=wxEmptyString, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, int flags=0, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
cb::shared_ptr< const cbStackFrame > GetStackFrame(int index) const
void NotifyCursorChanged()
Called by implementations to notify cursor changes.
virtual void UpdateWatchLocalsArgs(cb::shared_ptr< GDBWatch > const &watch, bool locals)=0
virtual bool GetUseConsoleRunner() const
Valid only for targets generating a console executable.
void SetFlag(Flags flag, bool value)
static bool GetFlag(Flags flag)
cb::shared_ptr< cbBreakpoint > AddBreakpoint(const wxString &filename, int line)
Request to add a breakpoint.
static bool LoadResource(const wxString &file)
#define wxSCI_F_IDENTIFIER
Generate command-lines needed to produce a build.
ConfigManager * GetConfigManager(const wxString &name_space) const
virtual void ParseOutput(const wxString &output)=0
Parse debugger's output.
bool Validate(const wxString &line, const char cb)
void DeleteBreakpoint(cb::shared_ptr< cbBreakpoint > breakpoint)
virtual void UpdateWatches(cb::shared_ptr< GDBWatch > localsWatch, cb::shared_ptr< GDBWatch > funcArgsWatch, WatchesContainer &watches)=0
Update watches.
virtual void AddDirectory(const wxString &dir)
Add a directory in search list.
wxObject * m_watchToDereferenceProperty
Base class for debugger plugins.
int AddBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp)
void DoBreak(bool temporary)
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
wxInputStream * GetInputStream() const
wxString substr(size_t nStart=0, size_t nLen=npos) const
void DeleteAllProjectBreakpoints(cbProject *project)
void OnProjectLoadingHook(cbProject *project, TiXmlElement *elem, bool loading)
#define wxSCI_C_IDENTIFIER
virtual const wxString & GetExecutionParameters() const
Read the target's execution parameters.
cbDebuggerConfiguration & GetActiveConfig()
virtual void Continue()=0
void OnTimer(wxTimerEvent &event)
bool UpdateExamineMemory()
void DeleteAllBreakpoints()
virtual void GetType(wxString &type) const =0
static bool IsAppShuttingDown()
void OnInfoDLL(wxCommandEvent &event)
void ShiftBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp, int nroflines)
Debugger breakpoint interface.
wxTimer m_TimerPollDebugger
wxString additionalCmds
commands after remote connection established
void MarkAllWatchesAsUnchanged()
bool IsStopped() const
Is the plugin stopped on breakpoint?
void SwitchToPreviousLayout()
cb::shared_ptr< cbWatch > AddWatch(const wxString &symbol)
static Compiler * GetDefaultCompiler()
wxString GetDebuggerExecutable(bool expandMacro=true)
wxString GetShortPath() const
void Stop()
Stop the debugging process (exit debugging).
void CollapseWatch(cb::shared_ptr< cbWatch > watch)
const DebuggerBreakpoint & GetBreakpoint() const
wxString m_watchToDereferenceSymbol
wxString additionalShellCmdsAfter
shell commands after remote connection established
void RequestUpdate(DebugWindows window)
void DoSendCommand(const wxString &cmd)
void SwitchToFrame(int number)
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_SELECTED
static void ConvertToGDBFile(wxString &str)
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
bool EnsureBuildUpToDate(StartType startType)
wxString m_ActiveBuildTarget
static void StripQuotes(wxString &str)
virtual void StepIntoInstruction()=0
void Next()
Execute the next instruction and return control to the debugger.
bool StartDriver(ProjectBuildTarget *target)
static Compiler * GetCompiler(size_t index)
wxString GetDebuggersWorkingDirectory() const
int RunNixConsole(wxString &consoleTty)
bool IsBusy() const
Is the plugin processing something?
EVTIMPORT const wxEventType cbEVT_DEBUGGER_STARTED
cbProject * GetProject() const
bool IsProgramStopped() const
Is the program stopped?
bool Debug(bool breakOnEntry)
Start a new debugging process.
virtual void SetArguments(const wxString &args)
Set the execution arguments.
void ExpandWatch(cb::shared_ptr< cbWatch > watch)
virtual void Start(bool breakOnEntry)=0
Begin the debugging process by launching a program.
static void ConvertToGDBFriendly(wxString &str)
virtual void SwitchToFrame(size_t number)=0
virtual void UpdateWatch(cb::shared_ptr< GDBWatch > const &watch)=0
virtual void AddSpecialWatch(cb::shared_ptr< cbWatch > watch, bool readonly)=0
void OnCursorChanged(wxCommandEvent &event)
DLLIMPORT wxString GetStringFromArray(const wxArrayString &array, const wxString &separator=DEFAULT_ARRAY_SEP, bool SeparatorAtEnd=true)
virtual void EvaluateSymbol(const wxString &symbol, const wxRect &tipRect)=0
Evaluate a symbol.
virtual void EnableCatchingThrow(bool enable)=0
void Log(const wxString &msg, Logger::level level=Logger::info)
SyncEditorResult SyncEditor(const wxString &filename, int line, bool setMarker=true)
#define wxICON_INFORMATION
virtual void InfoFiles()=0
const ThreadsContainer & GetThreads() const
returns the thread container with the current list of threads
DLLIMPORT HookFunctorBase * UnregisterHook(int id, bool deleteHook=true)
Unregister a previously registered project loading/saving hook.
void OnReleaseReal(bool appShutDown)
long int line
If -1, no line info.
void NotifyMissingFile(const wxString &name)
#define wxSCI_C_GLOBALCLASS
wxString AfterFirst(wxUniChar ch) const
void RemoveBreakpoint(int idx, bool removeFromDriver=true)
virtual bool Start(int milliseconds=-1, bool oneShot=wxTIMER_CONTINUOUS)
wxDynamicLibrary * LoadLibrary(const wxString &filename)
bool IsPointerType(wxString type)
std::deque< cb::shared_ptr< DebuggerBreakpoint > > BreakpointsList
size_t find(const wxString &str, size_t nStart=0) const
A generic Code::Blocks event.
bool CompilerFinished(bool compilerFailed, StartType startType)
Called when the compilation has finished.
void ParseOutput(const wxString &output)
int GetThreadsCount() const
int GetActiveStackFrame() const
#define wxSCI_C_DEFAULT
Lexical states for SCLEX_CPP, SCLEX_BULLANT, SCLEX_COBOL, SCLEX_TACL, SCLEX_TAL.
void CleanupWhenProjectClosed(cbProject *project)
const StackFrameContainer & GetStackFrames() const
returns the container with the current backtrace
wxString additionalCmdsBefore
commands before establishing remote connection
static void ConvertToGDBDirectory(wxString &str, wxString base=_T(""), bool relative=true)
bool UpdateCPURegisters()
PipedProcess * m_pProcess
bool WaitingCompilerToFinish() const
DLLIMPORT const wxWX2MBbuf cbU2C(const wxString &str)
Return multibyte (C string) representation of the string.
void RemoveAllBreakpoints()
virtual TargetType GetTargetType() const
Read the target's type.
virtual void SetWorkingDirectory(const wxString &dir)
Set the working directory.
virtual void DetermineLanguage()
Determine language is debugged.
virtual void GetSymbol(wxString &symbol) const =0
wxUSE_UNICODE_dependent wxChar
cb::shared_ptr< const cbThread > GetThread(int index) const
bool IsAttachedToProcess() const
wxString BeforeFirst(wxUniChar ch, wxString *rest=NULL) const
virtual void SendString(const wxString &text)
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
PluginManager manages plugins.
bool Contains(const wxString &str) const
DebuggerManager * GetDebuggerManager() const
void StepOut()
Execute the next instruction, stepping out of function calls if needed, and return control to the deb...
virtual void SwitchThread(size_t threadIndex)=0
Request to switch to another thread.
bool SupportsFeature(cbDebuggerFeature::Flags flag)
static bool Exists(int pid)
DLLIMPORT wxString UnixFilename(const wxString &filename, wxPathFormat format=wxPATH_NATIVE)
void GetCurrentPosition(wxString &filename, int &line)
Represents a Code::Blocks project.
void Continue()
Continue running the debugged program.
bool GetDebuggee(wxString &pathToDebuggee, wxString &workingDirectory, ProjectBuildTarget *target)
void SwitchToDebuggingLayout()
const wxString & GetActiveBuildTarget() const
bool extendedRemote
connect with extended remote or not
void OnCatchThrow(wxCommandEvent &event)
bool IsQueueBusy() const
Is the driver processing some commands?
virtual void SetVarValue(const wxString &var, const wxString &value)=0
virtual bool IsDebuggingStarted() const =0
Is debugging started.
virtual void RunningThreads()=0
int GetBreakpointsCount() const
DLLIMPORT const wxString DEFAULT_CONSOLE_SHELL
void SendCommand(const wxString &cmd, bool debugLog)
cbDisassemblyDlg * GetDisassemblyDialog()
Returns a pointer to the disassembly dialog.
DLLIMPORT wxString cbC2U(const char *str)
Return str as a proper unicode-compatible string.
virtual const wxString & GetTitle() const
Read the target's title.
#define EVT_PIPEDPROCESS_TERMINATED(id, fn)
void DeleteWatch(cb::shared_ptr< cbWatch > watch)
wxInputStream * GetErrorStream() const
void CheckIfConsoleIsClosed()
void OnConfigurationChange(bool isActive)
Called when the user clicks OK in Settings -> Debugger...
ProjectRemoteDebuggingMap m_RemoteDebugging
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
void Break()
Break the debugging process (stop the debuggee for debugging).
virtual void Backtrace()=0
void ShowWatchProperties(cb::shared_ptr< cbWatch > watch)
virtual void CPURegisters()=0
EVTIMPORT const wxEventType cbEVT_DEBUGGER_PAUSED
virtual bool SetActiveAddress(uint64_t addr)=0
const int DEBUGGER_CURSOR_CHANGED
wxCommandEvent ID fired when the cursor has changed.
bool BuildTargetValid(const wxString &name, bool virtuals_too=true) const
Is there a build target (virtual or real) by name?
void OnPrintElements(wxCommandEvent &event)
void UpdateWatch(cb::shared_ptr< cbWatch > watch)
bool wxGetEnvMap(wxEnvVariableHashMap *map)
cbWatchesDlg * GetWatchesDialog()
Returns a pointer to the watches dialog.
DLLIMPORT bool IsWindowReallyShown(wxWindow *win)
Finds out if a window is really shown.
wxString & Item(size_t nIndex)
cbProject * GetActiveProject()
Retrieve the active project.
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
virtual wxString GetBasePath() const
Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
DLLIMPORT int RegisterHook(HookFunctorBase *functor)
Register a project loading/saving hook.
void ClearActiveMarkFromAllEditors()
virtual void InfoFrame()=0
const wxStringCharType * wx_str() const
void QueueCommand(DebuggerCmd *dcmd, QueuePriority prio=Low)
add a command in the queue. The DebuggerCmd will be deleted automatically when finished.
int LaunchProcess(const wxString &cmd, const wxString &cwd)
Function signature breakpoint.
std::vector< cb::shared_ptr< cbThread > > ThreadsContainer
void UpdateBreakpoint(cb::shared_ptr< cbBreakpoint > breakpoint)
virtual void Stop()=0
Stop debugging.
virtual void Attach(int pid)=0
Attach to process.
virtual void Detach()=0
Detach from running process.
virtual void ClearDirectories()
Clear directories search list.
DLLIMPORT uint64_t cbDebuggerStringToAddress(const wxString &address)
Convert a string in hex form to a uint64_t number.
void OnInfoFPU(wxCommandEvent &event)
void OnAddSymbolFile(wxCommandEvent &event)
DebuggerConfiguration & GetActiveConfigEx()
void NotifyPlugins(CodeBlocksEvent &event)
virtual void RenameWatch(wxObject *prop, const wxString &newSymbol)=0
virtual void RemoveWatch(cb::shared_ptr< cbWatch > watch)=0
void AddWatchNoUpdate(const cb::shared_ptr< GDBWatch > &watch)
virtual bool UseDebugBreakProcess()=0
Ask the driver if the debugger should be interrupted with DebugBreakProcess or Ctrl+C event...
EVTIMPORT const wxEventType cbEVT_DEBUGGER_FINISHED
MacrosManager * GetMacrosManager() const
virtual void StepInstruction()=0
const int DEBUGGER_SHOW_FILE_LINE
wxCommandEvent ID fired to display a file/line (w/out changing the cursor)
const wxString & _(const wxString &string)
long GetChildPID() const
Get the child's (debuggee's) PID.
wxString & Trim(bool fromRight=true)
void OnShowFile(wxCommandEvent &event)
Normal file/line breakpoint.
Base class for plugin configuration panels.
Plugin registration object.
static void Yield()
Whenever you need to call wxYield(), call Manager::Yield(). It's safer.
static wxString GetShellString()
void RemoveAllProjectBreakpoints(cbProject *prj)
int GetCurrentFrame() const
virtual wxWindow * GetWindow()=0
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
DebuggerDriver * GetDriver()
Will always return a driver, or throw a code assertion error.
virtual void SetNextStatement(const wxString &filename, int line)=0
bool ToLong(long *val, int base=10) const
Abstract base class for compilers.
void OnGDBError(wxCommandEvent &event)
wxString & erase(size_type pos=0, size_type n=npos)
virtual void Disassemble()=0
virtual const wxArrayString & GetLinkerSearchDirs(ProjectBuildTarget *target)
Get the full linker dirs used in the actual command line.
#define EVT_PIPEDPROCESS_STDERR(id, fn)
void SetCurrentFrame(int number, bool user_selected)
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
void ShiftBreakpoint(int index, int lines_to_shift)
void OnInfoFiles(wxCommandEvent &event)
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
bool m_stopDebuggerConsoleClosed
bool HasWatch(cb::shared_ptr< cbWatch > watch)
The entry point singleton for working with projects.
virtual const wxString & GetCompilerID() const
Read the target's compiler.
virtual wxString GetCommandLine(const wxString &debugger, const wxString &debuggee, const wxString &userArguments)=0
Get the command-line to launch the debugger.
void OnInfoFrame(wxCommandEvent &event)
void ReplaceEnvVars(wxString &buffer)
void OnInfoSignals(wxCommandEvent &event)
Target produces a console executable (without GUI) (distinction between ttExecutable and ttConsoleOnl...
cbBacktraceDlg * GetBacktraceDialog()
int DoDebug(bool breakOnEntry)
cbBreakpointsDlg * GetBreakpointDialog()
Returns a pointer to the breakpoints dialog.
wxString CleanStringValue(wxString value)
RemoteDebuggingMap & GetRemoteDebuggingMap(cbProject *project=0)
wxString GetFullName() const
#define EVT_PIPEDPROCESS_STDOUT(id, fn)
wxString & insert(size_t nPos, const wxString &str)
cbDebuggerConfiguration * LoadConfig(const ConfigManagerWrapper &config)
void AddSourceDir(const wxString &dir)
void wxMilliSleep(unsigned long milliseconds)
wxString GetCommonTopLevelPath() const
bool enabled
Is the breakpoint enabled?
void StepIntoInstruction()
Execute the next instruction and return control to the debugger, if the instruction is a function cal...
const wxString & GetBuildTargetName() const
void OnGDBTerminated(wxCommandEvent &event)
int LaunchProcessWithShell(const wxString &cmd, wxProcess *process, const wxString &cwd)
BreakpointsList const & GetBreakpoints() const
virtual void MemoryDump()=0
cb::shared_ptr< cbWatch > DLLIMPORT cbGetRootWatch(cb::shared_ptr< cbWatch > watch)
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
cbConfigurationPanel * GetProjectConfigurationPanel(wxWindow *parent, cbProject *project)
cb::shared_ptr< cbBreakpoint > GetBreakpoint(int index)
size_t Add(const wxString &str, size_t copies=1)
void OnBuildTargetSelected(CodeBlocksEvent &event)
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
const Cursor & GetCursor() const
Get debugger's cursor.
void OnIdle(wxIdleEvent &event)
wxString additionalShellCmdsBefore
shell commands before establishing remote connection
Represents a Code::Blocks project build target.
bool RunToCursor(const wxString &filename, int line, const wxString &line_text)
Run the debugged program until it reaches the cursor at the current editor.
void EnableBreakpoint(cb::shared_ptr< cbBreakpoint > breakpoint, bool enable)
void SetNextStatement(const wxString &filename, int line)
Sets the position of the Program counter to the specified filename:line.
int Find(wxUniChar ch, bool fromEnd=false) const
cb::shared_ptr< cbBreakpoint > AddDataBreakpoint(const wxString &dataExpression)
Request to add a breakpoint based on a data expression.
wxUniChar GetChar(size_t n) const
WatchesContainer m_watches
void OnGDBOutput(wxCommandEvent &event)
ProjectsArray * GetProjects()
Retrieve an array of all the opened projects.
wxOutputStream * GetOutputStream() const
cb::shared_ptr< GDBWatch > m_funcArgsWatch
void ResetBreakpoint(cb::shared_ptr< DebuggerBreakpoint > bp)
Functor class for use as a project loading/saving hook.
virtual void Prepare(bool isConsole, int printElements)=0
Prepares the debugging process by setting up search dirs etc.
wxUniChar at(size_t n) const
wxString GetDataExpression() const
std::map< ProjectBuildTarget *, RemoteDebugging > RemoteDebuggingMap
void MergeWith(const RemoteDebugging &other)
bool wxSetEnv(const wxString &var, const wxString &value)
int Printf(const wxString &pszFormat,...)
cb::shared_ptr< GDBWatch > m_localsWatch
virtual void InfoSignals()=0
void NextInstruction()
Execute the next instruction and return control to the debugger.
Basic interface for debugger commands.
int SelectTarget(int initial=-1, bool evenIfOne=false)
Displays a target selection dialog.
Abstract base hook functor interface.
bool skipLDpath
skip adjusting LD_LIBRARY_PATH before launching debugger
bool HasDriver() const
Check so see if Driver exists before getting it.
void Step()
Execute the next instruction, stepping into function calls if needed, and return control to the debug...
static wxString Format(const wxString &format,...)
cb::shared_ptr< const cbWatch > GetParent() const
wxString Mid(size_t first, size_t nCount=wxString::npos) const
Dialog that contains a "Don't annoy me" checkbox.
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
void DebugLog(const wxString &msg, Logger::level level=Logger::info)
void SetOwner(wxEvtHandler *owner, int id=-1)
Wrapper class for reading or writing config values, without the need for the full path...
long wxExecute(const wxString &command, int flags=wxEXEC_ASYNC, wxProcess *callback=NULL, const wxExecuteEnv *env=NULL)
void OnUpdateCatchThrow(wxUpdateUIEvent &event)
bool IsRunning() const
Is the plugin currently debugging?
Target only runs commands in pre-build and/or post-build steps.
bool SwitchToThread(int thread_number)