60 watch->m_parent = parent;
61 parent->m_children.push_back(watch);
66 std::vector<cb::shared_ptr<cbWatch> >::iterator it =
m_children.begin();
67 std::advance(it, index);
73 if(watch->IsRemoved())
77 watch->RemoveMarkedChildren();
85 std::vector<cb::shared_ptr<cbWatch> >::iterator new_last;
104 std::vector<cb::shared_ptr<cbWatch> >::iterator it =
m_children.begin();
105 std::advance(it, index);
111 std::vector<cb::shared_ptr<cbWatch> >::const_iterator it =
m_children.begin();
112 std::advance(it, index);
118 for (std::vector<cb::shared_ptr<cbWatch> >::iterator it =
m_children.begin(); it !=
m_children.end(); ++it)
125 return cb::shared_ptr<cbWatch>();
131 for (std::vector<cb::shared_ptr<cbWatch> >::const_iterator it =
m_children.begin();
170 for(std::vector<cb::shared_ptr<cbWatch> >::iterator it =
m_children.begin(); it !=
m_children.end(); ++it)
171 (*it)->MarkAsRemoved(
true);
181 for(std::vector<cb::shared_ptr<cbWatch> >::iterator it =
m_children.begin(); it !=
m_children.end(); ++it)
182 (*it)->MarkAsChangedRecursive(flag);
219 cb::shared_ptr<cbWatch> root = watch;
222 cb::shared_ptr<cbWatch> parent = root->GetParent();
372 return c->
ReadBool(
wxT(
"/common/auto_build"),
true);
373 case AutoSwitchFrame:
374 return c->
ReadBool(
wxT(
"/common/auto_switch_frame"),
true);
375 case ShowDebuggersLog:
376 return c->
ReadBool(
wxT(
"/common/debug_log"),
false);
377 case JumpOnDoubleClick:
378 return c->
ReadBool(
wxT(
"/common/jump_on_double_click"),
false);
379 case RequireCtrlForTooltips:
380 return c->
ReadBool(
wxT(
"/common/require_ctrl_for_tooltips"),
false);
381 case ShowTemporaryBreakpoints:
382 return c->
ReadBool(
wxT(
"/common/show_temporary_breakpoints"),
false);
394 c->
Write(
wxT(
"/common/auto_build"), value);
396 case AutoSwitchFrame:
397 c->
Write(
wxT(
"/common/auto_switch_frame"), value);
399 case ShowDebuggersLog:
400 c->
Write(
wxT(
"/common/debug_log"), value);
402 case JumpOnDoubleClick:
403 c->
Write(
wxT(
"/common/jump_on_double_click"), value);
405 case RequireCtrlForTooltips:
406 c->
Write(
wxT(
"/common/require_ctrl_for_tooltips"), value);
408 case ShowTemporaryBreakpoints:
409 c->
Write(
wxT(
"/common/show_temporary_breakpoints"), value);
424 return configFont.
empty() ? defaultFont : configFont;
429 const wxString &oldFont = GetValueTooltipFont();
431 if (font != oldFont && !font.
empty())
434 c->
Write(
wxT(
"/common/tooltip_font"), font);
441 int v = c->
ReadInt(
wxT(
"/common/perspective"), static_cast<int>(OnePerDebuggerConfig));
442 if (v < OnlyOne || v > OnePerDebuggerConfig)
443 return OnePerDebuggerConfig;
450 if (perspective < OnlyOne || perspective > OnePerDebuggerConfig)
451 perspective = OnePerDebuggerConfig;
452 c->
Write(
wxT(
"/common/perspective"), perspective);
463 if (!platform::windows)
464 exePath =
wxT(
"/usr/bin/") + exeName + exeExt;
468 if (
wxFileExists(cbInstallFolder + sep +
wxT(
"MINGW") + sep +
wxT(
"bin") + sep + exeName + exeExt))
469 exePath = cbInstallFolder + sep +
wxT(
"MINGW") + sep +
wxT(
"bin");
472 exePath = wxT(
"C:\\MinGW\\bin");
474 exePath = wxT(
"C:\\MinGW32\\bin");
487 std::istringstream s(address.
utf8_str().data());
489 s >> std::hex >> result;
490 return (s.fail() ? 0 : result);
496 s <<
"0x" << std::hex << address;
497 return wxString(s.str().c_str(), wxConvUTF8);
527 m_text_control_logger(text_control_logger),
528 m_debug_log(debug_log)
530 int idDebug_LogEntryControl =
wxNewId();
531 int idDebug_ExecuteButton =
wxNewId();
532 int idDebug_ClearButton =
wxNewId();
533 int idDebug_LoadButton =
wxNewId();
558 _T(
"idDebug_ExecuteButton"));
559 button_execute->SetToolTip(
_(
"Execute current command"));
563 _T(
"idDebug_LoadButton"));
565 button_load->SetToolTip(
_(
"Load from file"));
569 _T(
"idDebug_ClearButton"));
571 button_clear->SetToolTip(
_(
"Clear output window"));
581 Connect(idDebug_LogEntryControl,
582 wxEVT_COMMAND_TEXT_ENTER,
584 Connect(idDebug_ExecuteButton,
585 wxEVT_COMMAND_BUTTON_CLICKED,
587 Connect(idDebug_ClearButton,
588 wxEVT_COMMAND_BUTTON_CLICKED,
590 Connect(idDebug_LoadButton,
591 wxEVT_COMMAND_BUTTON_CLICKED,
595 Connect(idDebug_ExecuteButton,
598 Connect(idDebug_LoadButton,
601 Connect(idDebug_LogEntryControl,
608 assert(m_command_entry);
609 wxString cmd = m_command_entry->GetValue();
621 int index = m_command_entry->FindString(cmd);
623 m_command_entry->Delete(index);
624 m_command_entry->Insert(cmd, 0);
632 assert(m_command_entry);
633 assert(m_text_control_logger);
634 m_text_control_logger->Clear();
635 m_command_entry->SetFocus();
648 _T(
"Debugger script files (*.gdb)|*.gdb"),
wxFD_OPEN | compatibility::wxHideReadonly);
687 configIndex = std::max(0, config.
ReadInt(
wxT(
"active_debugger_config"), 0));
693 configMgr.
Write(
wxT(
"active_debugger"), name);
694 configMgr.
Write(
wxT(
"active_debugger_config"), configIndex);
699 if (m_configurations.empty())
701 if (index >= static_cast<int>(m_configurations.size()))
704 return m_configurations[index];
715 m_examineMemoryDialog(
nullptr),
720 m_isDisassemblyMixedMode(false),
721 m_useTargetsDefault(false)
734 if (activeDebuggerName.
empty() && activeConfig == -1)
745 it->second.ClearConfigurations();
753 RegisteredPlugins::iterator it =
m_registered.find(plugin);
759 wxRegEx regExSettingsName(
wxT(
"^[a-z_][a-z0-9_]+$"));
760 if (!regExSettingsName.
Matches(settingsName))
763 s =
wxString::Format(
_(
"The settings name for the debugger plugin \"%s\" - \"%s\" contains invalid characters"),
769 int normalIndex = -1;
781 cbAssert(!it->second.GetConfigurations().empty());
787 if (activeDebuggerName == settingsName)
789 if (activeConfig > static_cast<int>(it->second.GetConfigurations().size()))
806 RegisteredPlugins::iterator it =
m_registered.find(plugin);
810 it->second.ClearConfigurations();
856 for (
size_t jj = 0; jj < configs.Count(); ++jj)
858 wxString configPath = path +
wxT(
"/") + configs[jj];
873 RegisteredPlugins::iterator it =
m_registered.find(plugin);
877 wxString path =
wxT(
"/sets/") + it->first->GetSettingsName();
879 if (it->second.m_lastConfigID == -1)
883 for (
size_t ii = 0; ii < configs.
GetCount(); ++ii)
886 if (configs[ii].Remove(0, 4).ToLong(&
id))
887 it->second.m_lastConfigID = std::max<long>(it->second.m_lastConfigID,
id);
891 path <<
wxT(
"/conf") << ++it->second.m_lastConfigID;
909 int menu_pos = menuBar->
FindMenu(
_(
"&Debug"));
912 menu = menuBar->
GetMenu(menu_pos);
924 int projcompMenuPos = menuBar->
FindMenu(
_(
"&Build"));
926 projcompMenuPos = menuBar->
FindMenu(
_(
"&Compile"));
929 finalPos = projcompMenuPos + 1;
932 projcompMenuPos = menuBar->
FindMenu(
_(
"&Project"));
934 finalPos = projcompMenuPos + 1;
936 menuBar->
Insert(finalPos, menu,
_(
"&Debug"));
947 int menu_pos = menuBar->
FindMenu(
_(
"&Debug"));
965 slot.
title =
_(
"Debugger");
1146 if (it->first->HasWatch(watch))
1174 for (
int ii = 0; ii < count; ++ii)
1178 static_cast<cbEditor*>(editor)->RefreshBreakpointMarkers();
1184 RegisteredPlugins::const_iterator it =
m_registered.find(activeDebugger);
1189 int index = std::distance(it->second.GetConfigurations().begin(), config);
1235 if (
Manager::Get()->GetProjectManager()->IsLoadingOrClosing())
1268 log->
LogError(
_(
"Can't get the compiler for the active target, nor the project, nor the default one!"));
1290 name = dbgString.
substr(0, pos);
1291 config = dbgString.
substr(pos + 1, dbgString.
length() - pos - 1);
1296 if (compiler->
GetID() !=
wxT(
"null"))
1308 if (it->first->GetSettingsName() == name)
1312 for (ConfigurationVector::iterator itConf = configs.begin(); itConf != configs.end(); ++itConf, ++index)
1314 if ((*itConf)->GetName() == config)
1332 targetTitle.c_str()));
void MarkChildsAsRemoved()
cbDebuggerConfiguration(const cbDebuggerConfiguration &o)
void SetActiveConfig(int index)
cbDebuggerPlugin * GetActiveDebugger()
bool IsDisassemblyMixedMode()
bool RemoveMarkedChildren()
void SetMenuHandler(cbDebuggerMenuHandler *handler)
virtual void RebuildMenus()=0
cbWatchesDlg * m_watchesDialog
int FindChildIndex(const wxString &symbol) const
cbExamineMemoryDlg * GetExamineMemoryDialog()
Returns a pointer to the memory dialog.
DLLIMPORT wxString cbFindFileInPATH(const wxString &filename)
bool ShowBacktraceDialog()
const wxString & GetLine() const
virtual void DeleteCPURegisters(cbCPURegistersDlg *dialog)=0
ConfigurationVector & GetConfigurations()
void SetupLog(int normalIndex)
static bool GetFlag(Flags flag)
std::vector< cb::shared_ptr< cbWatch > > m_children
virtual wxWindow * GetWindow()=0
static Perspective GetPerspective()
virtual cbDisassemblyDlg * CreateDisassembly()=0
ConfigManager * GetConfigManager(const wxString &name_space) const
wxString ToString() const
int ReadInt(const wxString &name, int defaultVal=0)
cbDisassemblyDlg * m_disassemblyDialog
const wxValidator wxDefaultValidator
Base class for debugger plugins.
static wxFont GetFont(wxSystemFont index)
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
wxString substr(size_t nStart=0, size_t nLen=npos) const
void RefreshBreakpoints(cb_unused const cbDebuggerPlugin *plugin)
~DebuggerManager() override
void ProcessSettings(RegisteredPlugins::iterator it)
bool UpdateExamineMemory()
static bool IsAppShuttingDown()
virtual void EnableWindow(bool enable)=0
bool UnregisterDebugger(cbDebuggerPlugin *plugin)
Called to unregister a debugger plugin.
DLLIMPORT wxBitmap cbLoadBitmap(const wxString &filename, wxBitmapType bitmapType=wxBITMAP_TYPE_PNG)
This function loads a bitmap from disk.
bool wxFileExists(const wxString &filename)
wxWindow * pWindow
The window to dock.
static Compiler * GetDefaultCompiler()
virtual void DeleteMemory(cbExamineMemoryDlg *dialog)=0
void ReadActiveDebuggerConfig(wxString &name, int &configIndex)
void OnSettingsChanged(CodeBlocksEvent &event)
cbDebuggerPlugin * m_activeDebugger
bool IsAutoUpdateEnabled() const
bool ReadBool(const wxString &name, bool defaultVal=false)
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_SELECTED
#define wxTE_PROCESS_ENTER
virtual void BuildContextMenu(wxMenu &menu, const wxString &word_at_caret, bool is_running)=0
virtual cbExamineMemoryDlg * CreateMemory()=0
const wxString & GetName() const
EVTIMPORT const wxEventType cbEVT_PROJECT_ACTIVATE
Event used to request from the main app to add a log.
Event used to request from the main app to add a window to the docking system.
bool wxDirExists(const wxString &dirname)
void OnPluginLoadingComplete(CodeBlocksEvent &event)
cbCPURegistersDlg * GetCPURegistersDialog()
Returns a pointer to the CPU registers dialog.
static Compiler * GetCompiler(size_t index)
bool Matches(const wxString &text, int flags=0) const
wxWindow * CreateControl(wxWindow *parent) override
virtual void SetPointSize(int pointSize)
void SetInterfaceFactory(cbDebugInterfaceFactory *factory)
EVTIMPORT const wxEventType cbEVT_SETTINGS_CHANGED
wxString m_symbol
Current function name.
static void SetPerspective(int perspective)
const wxScopedCharBuffer utf8_str() const
virtual cbBreakpointsDlg * CreateBreapoints()=0
bool TestIfMarkedForRemoval(cb::shared_ptr< cbWatch > watch)
virtual wxWindow * GetWindow()=0
virtual cbBacktraceDlg * CreateBacktrace()=0
void SetTargetsDefaultAsActiveDebugger()
RegisteredPlugins m_registered
void ClearConfigurations()
cb::shared_ptr< cbWatch > GetChild(int index)
TextCtrlLogger * GetLogger()
cbDebuggerMenuHandler * GetMenuHandler()
void OnProjectActivated(CodeBlocksEvent &event)
cbDebuggerPlugin * GetDebuggerHavingWatch(cb::shared_ptr< cbWatch > watch)
virtual wxWindow * GetWindow()=0
size_t find(const wxString &str, size_t nStart=0) const
A generic Code::Blocks event.
void RemoveChild(int index)
void FindTargetsDebugger()
bool UpdateCPURegisters()
void OnUpdateUI(wxUpdateUIEvent &event)
EditorManager * GetEditorManager() const
void SetAddress(uint64_t address)
cbCPURegistersDlg * m_cpuRegistersDialog
const wxNativeFontInfo * GetNativeFontInfo() const
void LogError(const wxString &msg, int i=app_log)
void SetName(const wxString &name)
void SetDisassemblyMixedMode(bool mixed)
virtual void GetSymbol(wxString &symbol) const =0
wxUSE_UNICODE_dependent wxChar
ConfigManagerWrapper m_config
virtual wxWindow * GetWindow()=0
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
const wxString & GetID() const
Get this compiler's unique ID.
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
DebuggerManager * GetDebuggerManager() const
DebugTextCtrlLogger(bool fixedPitchFont, bool debugLog)
Represents a Code::Blocks project.
const wxString & GetActiveBuildTarget() const
wxWindow * CreateTextCtrl(wxWindow *parent)
void MarkAsChangedRecursive(bool flag)
EVTIMPORT const wxEventType cbEVT_ADD_LOG_WINDOW
void AutoUpdate(bool enabled)
virtual void EnableWindow(bool enable)=0
wxString cbDetectDebuggerExecutable(const wxString &exeName)
Tries to detect the path to the debugger's executable.
void OnTargetSelected(CodeBlocksEvent &event)
wxString cbDebuggerAddressToString(uint64_t address)
Convert a uint64_t variable to a hex string that will look like an address.
#define wxST_NO_AUTORESIZE
EVTIMPORT const wxEventType cbEVT_PLUGIN_LOADING_COMPLETE
cbDisassemblyDlg * GetDisassemblyDialog()
Returns a pointer to the disassembly dialog.
virtual void DeleteThreads(cbThreadsDlg *dialog)=0
EVTIMPORT const wxEventType cbEVT_REMOVE_LOG_WINDOW
wxArrayString EnumerateSubPaths(const wxString &path)
TextCtrlLogger * m_logger
int GetChildCount() const
virtual const wxString & GetTitle() const
Read the target's title.
bool IsActiveDebuggerTargetsDefault() const
virtual void MarkActiveTargetAsValid(bool valid)=0
wxString GetSettingsName() const
virtual void SetActiveDebugger(cbDebuggerPlugin *active)=0
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
const wxString & GetFilename() const
wxFrame * GetAppFrame() const
a logger which prints messages to a wxTextCtrl
const wxSize wxDefaultSize
cbThreadsDlg * GetThreadsDialog()
Returns a pointer to the threads dialog.
const wxPoint wxDefaultPosition
bool BuildTargetValid(const wxString &name, bool virtuals_too=true) const
Is there a build target (virtual or real) by name?
void RemoveAllEventSinksFor(void *owner)
virtual const CompilerPrograms & GetPrograms() const
Get the compiler's programs.
cbWatchesDlg * GetWatchesDialog()
Returns a pointer to the watches dialog.
Base class that all "editors" should inherit from.
LogManager * GetLogManager() const
DLLIMPORT bool IsWindowReallyShown(wxWindow *win)
Finds out if a window is really shown.
virtual void DeleteBacktrace(cbBacktraceDlg *dialog)=0
cbProject * GetActiveProject()
Retrieve the active project.
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
const wxString & GetSymbol() const
virtual cbDebuggerConfiguration * LoadConfig(const ConfigManagerWrapper &config)=0
static wxUniChar GetPathSeparator(wxPathFormat format=wxPATH_NATIVE)
virtual bool IsPointerType() const
Tells us if the watch is for pointer variable.
virtual wxString MakeSymbolToAddress() const
This should return a string that when passed to the debugger will return the address of the variable...
virtual bool IsBuiltinEditor() const
Is this a built-in editor?
void SetNumber(int number)
cb::weak_ptr< cbWatch > m_parent
wxWindow * CreateControl(wxWindow *parent) override
virtual wxString GetPath() const
cbBreakpointsDlg * m_breakPointsDialog
virtual void DeleteBreakpoints(cbBreakpointsDlg *dialog)=0
bool m_valid
Is this stack frame valid?
virtual void RefreshUI()=0
void MarkAsChanged(bool flag)
const wxString & _(const wxString &string)
wxString & Trim(bool fromRight=true)
wxComboBox * m_command_entry
virtual void EnableWindow(bool enable)=0
EditorBase * GetEditor(int index)
std::map< cbDebuggerPlugin *, PluginData > RegisteredPlugins
const wxString & GetInfo() const
static void AddChild(cb::shared_ptr< cbWatch > parent, cb::shared_ptr< cbWatch > watch)
uint64_t m_address
Stack frame's address.
void WriteActiveDebuggerConfig(const wxString &name, int configIndex)
static wxString GetDataFolder(bool global=true)
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
virtual void DeleteDisassembly(cbDisassemblyDlg *dialog)=0
Abstract base class for compilers.
virtual void DeleteWatches(cbWatchesDlg *dialog)=0
wxString GetAddressAsString() const
int m_number
Stack frame's number (used in backtraces).
void OnLoadFile(cb_unused wxCommandEvent &event)
RegisteredPlugins const & GetAllDebuggers() const
wxString GetGUIName() const
cbExamineMemoryDlg * m_examineMemoryDialog
The entry point singleton for working with projects.
virtual const wxString & GetCompilerID() const
Read the target's compiler.
virtual wxString GetDirectory() const
cbBacktraceDlg * GetBacktraceDialog()
cbBreakpointsDlg * GetBreakpointDialog()
Returns a pointer to the breakpoints dialog.
uint64_t cbDebuggerStringToAddress(const wxString &address)
Convert a string in hex form to a uint64_t number.
EVTIMPORT const wxEventType cbEVT_SHOW_DOCK_WINDOW
virtual const wxString & GetName() const
Get the compiler's name.
DebugTextCtrlLogger * m_text_control_logger
static wxString GetExecutableFolder()
cbDebuggerConfiguration * GetConfiguration(int index)
bool ProcessEvent(CodeBlocksEvent &event)
void SetConfig(const ConfigManagerWrapper &config)
wxString m_line
Current line in file.
virtual wxWindow * GetWindow()=0
void MakeValid(bool flag)
void SetFile(const wxString &filename, const wxString &line)
void OnClearLog(cb_unused wxCommandEvent &event)
EVTIMPORT const wxEventType cbEVT_PROJECT_OPEN
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
virtual bool IsRunning() const =0
Is the plugin currently debugging?
virtual int GetPointSize() const
void OnEntryCommand(cb_unused wxCommandEvent &event)
std::vector< cbDebuggerConfiguration * > ConfigurationVector
void SetActiveDebugger(cbDebuggerPlugin *activeDebugger, ConfigurationVector::const_iterator config)
cb::shared_ptr< cbWatch > FindChild(const wxString &name)
Represents a Code::Blocks project build target.
void Sort(bool reverseOrder=false)
cbDebuggerMenuHandler * m_menuHandler
virtual cbCPURegistersDlg * CreateCPURegisters()=0
ConfigManagerWrapper NewConfig(cbDebuggerPlugin *plugin, const wxString &name)
static wxBitmap GetBitmap(const wxArtID &id, const wxArtClient &client=wxART_OTHER, const wxSize &size=wxDefaultSize)
virtual void EnableWindow(bool enable)=0
cbBacktraceDlg * m_backtraceDialog
virtual bool SupportsFeature(cbDebuggerFeature::Flags flag)=0
static void SetFlag(Flags flag, bool value)
wxEventType wxEVT_UPDATE_UI
virtual void EnableWindow(bool enable)=0
virtual bool IsStopped() const =0
Is the plugin stopped on breakpoint?
uint64_t GetAddress() const
cb::shared_ptr< cbWatch > DLLIMPORT cbGetRootWatch(cb::shared_ptr< cbWatch > watch)
cbThreadsDlg * m_threadsDialog
DebugLogPanel(wxWindow *parent, DebugTextCtrlLogger *text_control_logger, bool debug_log)
void SetSymbol(const wxString &symbol)
bool RegisterDebugger(cbDebuggerPlugin *plugin)
Called to register a debugger plugin.
size_t SetLog(Logger *l, int index=no_index)
static wxString Format(const wxString &format,...)
cb::shared_ptr< const cbWatch > GetParent() const
bool m_isDisassemblyMixedMode
const ConfigManagerWrapper & GetConfig() const
wxString m_file
Current file.
virtual void SendCommand(const wxString &cmd, bool debugLog)=0
cbDebugInterfaceFactory * GetInterfaceFactory()
Wrapper class for reading or writing config values, without the need for the full path...
cbDebugInterfaceFactory * m_interfaceFactory
void MarkAsRemoved(bool flag)
virtual cbWatchesDlg * CreateWatches()=0
virtual cbThreadsDlg * CreateThreads()=0