Code::Blocks  SVN r11506
debuggermanager.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 11487 $
6  * $Id: debuggermanager.cpp 11487 2018-10-03 09:06:21Z ollydbg $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/debuggermanager.cpp $
8  */
9 
10 #include "sdk_precomp.h"
11 #ifndef CB_PRECOMP
12  #include <wx/artprov.h>
13  #include <wx/bmpbuttn.h>
14  #include <wx/combobox.h>
15  #include <wx/filedlg.h>
16  #include <wx/frame.h>
17  #include <wx/menu.h>
18  #include <wx/settings.h>
19  #include <wx/sizer.h>
20  #include <wx/stattext.h>
21  #include <wx/regex.h>
22 
23  #include "cbeditor.h"
24  #include "cbexception.h"
25  #include "cbplugin.h"
26  #include "cbproject.h"
27  #include "compilerfactory.h"
28  #include "configmanager.h"
29  #include "editormanager.h"
30  #include "logmanager.h"
31  #include "projectmanager.h"
32 #endif
33 
34 #include <algorithm>
35 #include <sstream>
36 #include <wx/toolbar.h>
37 
38 #include "debuggermanager.h"
39 
40 #include "annoyingdialog.h"
41 #include "cbdebugger_interfaces.h"
42 #include "loggers.h"
43 #include "manager.h"
44 
46  m_changed(true),
47  m_removed(false),
48  m_expanded(false),
49  m_autoUpdate(true)
50 {
51 }
52 
54 {
55  m_children.clear();
56 }
57 
58 void cbWatch::AddChild(cb::shared_ptr<cbWatch> parent, cb::shared_ptr<cbWatch> watch)
59 {
60  watch->m_parent = parent;
61  parent->m_children.push_back(watch);
62 }
63 
64 void cbWatch::RemoveChild(int index)
65 {
66  std::vector<cb::shared_ptr<cbWatch> >::iterator it = m_children.begin();
67  std::advance(it, index);
68  m_children.erase(it);
69 }
70 
71 inline bool TestIfMarkedForRemoval(cb::shared_ptr<cbWatch> watch)
72 {
73  if(watch->IsRemoved())
74  return true;
75  else
76  {
77  watch->RemoveMarkedChildren();
78  return false;
79  }
80 }
81 
83 {
84  size_t start_size = m_children.size();
85  std::vector<cb::shared_ptr<cbWatch> >::iterator new_last;
86  new_last = std::remove_if(m_children.begin(), m_children.end(), &TestIfMarkedForRemoval);
87  m_children.erase(new_last, m_children.end());
88 
89  return start_size != m_children.size();
90 
91 }
93 {
94  m_children.clear();
95 }
96 
98 {
99  return m_children.size();
100 }
101 
102 cb::shared_ptr<cbWatch> cbWatch::GetChild(int index)
103 {
104  std::vector<cb::shared_ptr<cbWatch> >::iterator it = m_children.begin();
105  std::advance(it, index);
106  return *it;
107 }
108 
109 cb::shared_ptr<const cbWatch> cbWatch::GetChild(int index) const
110 {
111  std::vector<cb::shared_ptr<cbWatch> >::const_iterator it = m_children.begin();
112  std::advance(it, index);
113  return *it;
114 }
115 
116 cb::shared_ptr<cbWatch> cbWatch::FindChild(const wxString& symbol)
117 {
118  for (std::vector<cb::shared_ptr<cbWatch> >::iterator it = m_children.begin(); it != m_children.end(); ++it)
119  {
120  wxString s;
121  (*it)->GetSymbol(s);
122  if(s == symbol)
123  return *it;
124  }
125  return cb::shared_ptr<cbWatch>();
126 }
127 
128 int cbWatch::FindChildIndex(const wxString& symbol) const
129 {
130  int index = 0;
131  for (std::vector<cb::shared_ptr<cbWatch> >::const_iterator it = m_children.begin();
132  it != m_children.end();
133  ++it, ++index)
134  {
135  wxString s;
136  (*it)->GetSymbol(s);
137  if(s == symbol)
138  return index;
139  }
140  return -1;
141 }
142 
143 cb::shared_ptr<const cbWatch> cbWatch::GetParent() const
144 {
145  return m_parent.lock();
146 }
147 
148 cb::shared_ptr<cbWatch> cbWatch::GetParent()
149 {
150  return m_parent.lock();
151 }
152 
153 bool cbWatch::IsRemoved() const
154 {
155  return m_removed;
156 }
157 
158 bool cbWatch::IsChanged() const
159 {
160  return m_changed;
161 }
162 
163 void cbWatch::MarkAsRemoved(bool flag)
164 {
165  m_removed = flag;
166 }
167 
169 {
170  for(std::vector<cb::shared_ptr<cbWatch> >::iterator it = m_children.begin(); it != m_children.end(); ++it)
171  (*it)->MarkAsRemoved(true);
172 }
173 void cbWatch::MarkAsChanged(bool flag)
174 {
175  m_changed = flag;
176 }
177 
179 {
180  m_changed = flag;
181  for(std::vector<cb::shared_ptr<cbWatch> >::iterator it = m_children.begin(); it != m_children.end(); ++it)
182  (*it)->MarkAsChangedRecursive(flag);
183 }
184 
186 {
187  return m_expanded;
188 }
189 
190 void cbWatch::Expand(bool expand)
191 {
192  m_expanded = expand;
193 }
194 
196 {
197  return m_autoUpdate;
198 }
199 
200 void cbWatch::AutoUpdate(bool enabled)
201 {
202  m_autoUpdate = enabled;
203 }
204 
206 {
207  wxString symbol;
208  GetSymbol(symbol);
209  return symbol;
210 }
211 
213 {
214  return false;
215 }
216 
217 cb::shared_ptr<cbWatch> DLLIMPORT cbGetRootWatch(cb::shared_ptr<cbWatch> watch)
218 {
219  cb::shared_ptr<cbWatch> root = watch;
220  while (root)
221  {
222  cb::shared_ptr<cbWatch> parent = root->GetParent();
223  if (!parent)
224  break;
225  root = parent;
226  }
227  return root;
228 }
229 
231  m_valid(false)
232 {
233 }
234 
235 void cbStackFrame::SetNumber(int number)
236 {
237  m_number = number;
238 }
239 
240 void cbStackFrame::SetAddress(uint64_t address)
241 {
242  m_address = address;
243 }
244 
246 {
247  m_symbol = symbol;
248 }
249 
250 void cbStackFrame::SetFile(const wxString& filename, const wxString &line)
251 {
252  m_file = filename;
253  m_line = line;
254 }
255 
256 void cbStackFrame::MakeValid(bool flag)
257 {
258  m_valid = flag;
259 }
260 
262 {
263  return m_number;
264 }
265 
266 uint64_t cbStackFrame::GetAddress() const
267 {
268  return m_address;
269 }
270 
272 {
273  if(m_address!=0)
275  else
276  return wxEmptyString;
277 }
278 
280 {
281  return m_symbol;
282 }
283 
285 {
286  return m_file;
287 }
288 
290 {
291  return m_line;
292 }
293 
295 {
296  return m_valid;
297 }
298 
300 {
301 }
302 
303 cbThread::cbThread(bool active, int number, const wxString& info)
304 {
305  m_active = active;
306  m_number = number;
307  m_info = info;
308 }
309 
310 bool cbThread::IsActive() const
311 {
312  return m_active;
313 }
314 
316 {
317  return m_number;
318 }
319 
321 {
322  return m_info;
323 }
324 
326  m_config(config),
327  m_menuId(wxID_ANY)
328 {
329 }
330 
332  m_config(o.m_config),
333  m_name(o.m_name)
334 {
335 }
336 
338 {
339  m_name = name;
340 }
342 {
343  return m_name;
344 }
345 
347 {
348  return m_config;
349 }
350 
352 {
353  m_config = config;
354 }
355 
357 {
358  m_menuId = id;
359 }
360 
362 {
363  return m_menuId;
364 }
365 
367 {
368  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
369  switch (flag)
370  {
371  case AutoBuild:
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);
383  default:
384  return false;
385  }
386 }
387 
389 {
390  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
391  switch (flag)
392  {
393  case AutoBuild:
394  c->Write(wxT("/common/auto_build"), value);
395  break;
396  case AutoSwitchFrame:
397  c->Write(wxT("/common/auto_switch_frame"), value);
398  break;
399  case ShowDebuggersLog:
400  c->Write(wxT("/common/debug_log"), value);
401  break;
402  case JumpOnDoubleClick:
403  c->Write(wxT("/common/jump_on_double_click"), value);
404  break;
405  case RequireCtrlForTooltips:
406  c->Write(wxT("/common/require_ctrl_for_tooltips"), value);
407  break;
408  case ShowTemporaryBreakpoints:
409  c->Write(wxT("/common/show_temporary_breakpoints"), value);
410  default:
411  ;
412  }
413 }
414 
416 {
418  system.SetPointSize(std::max(system.GetPointSize() - 3, 7));
419  wxString defaultFont = system.GetNativeFontInfo()->ToString();
420 
421  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
422  wxString configFont = c->Read(wxT("/common/tooltip_font"));
423 
424  return configFont.empty() ? defaultFont : configFont;
425 }
426 
428 {
429  const wxString &oldFont = GetValueTooltipFont();
430 
431  if (font != oldFont && !font.empty())
432  {
433  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
434  c->Write(wxT("/common/tooltip_font"), font);
435  }
436 }
437 
439 {
440  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
441  int v = c->ReadInt(wxT("/common/perspective"), static_cast<int>(OnePerDebuggerConfig));
442  if (v < OnlyOne || v > OnePerDebuggerConfig)
443  return OnePerDebuggerConfig;
444  return static_cast<Perspective>(v);
445 }
446 
448 {
449  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
450  if (perspective < OnlyOne || perspective > OnePerDebuggerConfig)
451  perspective = OnePerDebuggerConfig;
452  c->Write(wxT("/common/perspective"), perspective);
453 }
454 
456 {
457  wxString exeExt(platform::windows ? wxT(".exe") : wxEmptyString);
458  wxString exePath = cbFindFileInPATH(exeName);
460 
461  if (exePath.empty())
462  {
463  if (!platform::windows)
464  exePath = wxT("/usr/bin/") + exeName + exeExt;
465  else
466  {
467  const wxString &cbInstallFolder = ConfigManager::GetExecutableFolder();
468  if (wxFileExists(cbInstallFolder + sep + wxT("MINGW") + sep + wxT("bin") + sep + exeName + exeExt))
469  exePath = cbInstallFolder + sep + wxT("MINGW") + sep + wxT("bin");
470  else
471  {
472  exePath = wxT("C:\\MinGW\\bin");
473  if (!wxDirExists(exePath))
474  exePath = wxT("C:\\MinGW32\\bin");
475  }
476  }
477  }
478  if (!wxDirExists(exePath))
479  return wxEmptyString;
480  return exePath + wxFileName::GetPathSeparator() + exeName + exeExt;
481 }
482 
483 uint64_t cbDebuggerStringToAddress(const wxString &address)
484 {
485  if (address.empty())
486  return 0;
487  std::istringstream s(address.utf8_str().data());
488  uint64_t result;
489  s >> std::hex >> result;
490  return (s.fail() ? 0 : result);
491 }
492 
494 {
495  std::stringstream s;
496  s << "0x" << std::hex << address;
497  return wxString(s.str().c_str(), wxConvUTF8);
498 }
499 
501 {
502 public:
503  DebugTextCtrlLogger(bool fixedPitchFont, bool debugLog) :
504  TextCtrlLogger(fixedPitchFont),
505  m_panel(nullptr),
506  m_debugLog(debugLog)
507  {
508  }
509 
511  {
512  return TextCtrlLogger::CreateControl(parent);
513  }
514 
515  wxWindow* CreateControl(wxWindow* parent) override;
516 
517 private:
520 };
521 
522 class DebugLogPanel : public wxPanel
523 {
524 public:
525  DebugLogPanel(wxWindow *parent, DebugTextCtrlLogger *text_control_logger, bool debug_log) :
526  wxPanel(parent),
527  m_text_control_logger(text_control_logger),
528  m_debug_log(debug_log)
529  {
530  int idDebug_LogEntryControl = wxNewId();
531  int idDebug_ExecuteButton = wxNewId();
532  int idDebug_ClearButton = wxNewId();
533  int idDebug_LoadButton = wxNewId();
534 
535  wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
536  wxBoxSizer *control_sizer = new wxBoxSizer(wxHORIZONTAL);
537 
538  wxWindow *text_control = text_control_logger->CreateTextCtrl(this);
539  sizer->Add(text_control, wxEXPAND, wxEXPAND | wxALL , 0);
540  sizer->Add(control_sizer, 0, wxEXPAND | wxALL, 0);
541 
542  wxStaticText *label = new wxStaticText(this, wxID_ANY, _T("Command:"),
544 
545  m_command_entry = new wxComboBox(this, idDebug_LogEntryControl, wxEmptyString,
546  wxDefaultPosition, wxDefaultSize, 0, nullptr,
548 
549  wxBitmap execute_bitmap = wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_EXECUTABLE_FILE")),
550  wxART_BUTTON);
551  wxBitmap clear_bitmap = wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_DELETE")),wxART_BUTTON);
552  wxBitmap file_open_bitmap =wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_FILE_OPEN")),
553  wxART_BUTTON);
554 
555  wxBitmapButton *button_execute;
556  button_execute = new wxBitmapButton(this, idDebug_ExecuteButton, execute_bitmap, wxDefaultPosition,
558  _T("idDebug_ExecuteButton"));
559  button_execute->SetToolTip(_("Execute current command"));
560 
561  wxBitmapButton *button_load = new wxBitmapButton(this, idDebug_LoadButton, file_open_bitmap, wxDefaultPosition,
563  _T("idDebug_LoadButton"));
564  button_load->SetDefault();
565  button_load->SetToolTip(_("Load from file"));
566 
567  wxBitmapButton *button_clear = new wxBitmapButton(this, idDebug_ClearButton, clear_bitmap, wxDefaultPosition,
569  _T("idDebug_ClearButton"));
570  button_clear->SetDefault();
571  button_clear->SetToolTip(_("Clear output window"));
572 
573  control_sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2);
574  control_sizer->Add(m_command_entry, wxEXPAND, wxEXPAND | wxALL, 2);
575  control_sizer->Add(button_execute, 0, wxEXPAND | wxALL, 0);
576  control_sizer->Add(button_load, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
577  control_sizer->Add(button_clear, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
578 
579  SetSizer(sizer);
580 
581  Connect(idDebug_LogEntryControl,
582  wxEVT_COMMAND_TEXT_ENTER,
583  wxObjectEventFunction(&DebugLogPanel::OnEntryCommand));
584  Connect(idDebug_ExecuteButton,
585  wxEVT_COMMAND_BUTTON_CLICKED,
586  wxObjectEventFunction(&DebugLogPanel::OnEntryCommand));
587  Connect(idDebug_ClearButton,
588  wxEVT_COMMAND_BUTTON_CLICKED,
589  wxObjectEventFunction(&DebugLogPanel::OnClearLog));
590  Connect(idDebug_LoadButton,
591  wxEVT_COMMAND_BUTTON_CLICKED,
592  wxObjectEventFunction(&DebugLogPanel::OnLoadFile));
593 
594  // UpdateUI events
595  Connect(idDebug_ExecuteButton,
597  wxObjectEventFunction(&DebugLogPanel::OnUpdateUI));
598  Connect(idDebug_LoadButton,
600  wxObjectEventFunction(&DebugLogPanel::OnUpdateUI));
601  Connect(idDebug_LogEntryControl,
603  wxObjectEventFunction(&DebugLogPanel::OnUpdateUI));
604  }
605 
606  void OnEntryCommand(cb_unused wxCommandEvent& event)
607  {
608  assert(m_command_entry);
609  wxString cmd = m_command_entry->GetValue();
610  cmd.Trim(false);
611  cmd.Trim(true);
612 
613  if (cmd.IsEmpty())
614  return;
616  if (plugin)
617  {
618  plugin->SendCommand(cmd, m_debug_log);
619 
620  // If it already exists in the list, remove it and add it as the first element of the wxComboBox list
621  int index = m_command_entry->FindString(cmd);
622  if (index != wxNOT_FOUND)
623  m_command_entry->Delete(index);
624  m_command_entry->Insert(cmd, 0);
625 
626  m_command_entry->SetValue(wxEmptyString);
627  }
628  }
629 
630  void OnClearLog(cb_unused wxCommandEvent& event)
631  {
632  assert(m_command_entry);
633  assert(m_text_control_logger);
634  m_text_control_logger->Clear();
635  m_command_entry->SetFocus();
636  }
637 
638  void OnLoadFile(cb_unused wxCommandEvent& event)
639  {
641  if (!plugin)
642  return;
643 
644  ConfigManager* manager = Manager::Get()->GetConfigManager(_T("app"));
645  wxString path = manager->Read(_T("/file_dialogs/file_run_dbg_script/directory"), wxEmptyString);
646 
647  wxFileDialog dialog(this, _("Load script"), path, wxEmptyString,
648  _T("Debugger script files (*.gdb)|*.gdb"), wxFD_OPEN | compatibility::wxHideReadonly);
649 
650  if (dialog.ShowModal() == wxID_OK)
651  {
652  manager->Write(_T("/file_dialogs/file_run_dbg_script/directory"), dialog.GetDirectory());
653 
654  plugin->SendCommand(_T("source ") + dialog.GetPath(), m_debug_log);
655  }
656  }
657 
659  {
661  event.Enable(plugin && plugin->IsRunning() && plugin->IsStopped());
662  }
663 private:
667 };
668 
670 {
671  if(!m_panel)
672  m_panel = new DebugLogPanel(parent, this, m_debugLog);
673 
674  return m_panel;
675 }
676 
677 template<> DebuggerManager* Mgr<DebuggerManager>::instance = nullptr;
678 template<> bool Mgr<DebuggerManager>::isShutdown = false;
679 
680 inline void ReadActiveDebuggerConfig(wxString &name, int &configIndex)
681 {
682  ConfigManager &config = *Manager::Get()->GetConfigManager(_T("debugger_common"));
683  name = config.Read(wxT("active_debugger"), wxEmptyString);
684  if (name.empty())
685  configIndex = -1;
686  else
687  configIndex = std::max(0, config.ReadInt(wxT("active_debugger_config"), 0));
688 }
689 
690 inline void WriteActiveDebuggerConfig(const wxString &name, int configIndex)
691 {
692  ConfigManager &configMgr = *Manager::Get()->GetConfigManager(_T("debugger_common"));
693  configMgr.Write(wxT("active_debugger"), name);
694  configMgr.Write(wxT("active_debugger_config"), configIndex);
695 }
696 
698 {
699  if (m_configurations.empty())
700  cbAssert(false);
701  if (index >= static_cast<int>(m_configurations.size()))
702  return nullptr;
703  else
704  return m_configurations[index];
705 }
706 
708  m_interfaceFactory(nullptr),
709  m_activeDebugger(nullptr),
710  m_menuHandler(nullptr),
711  m_backtraceDialog(nullptr),
712  m_breakPointsDialog(nullptr),
713  m_cpuRegistersDialog(nullptr),
714  m_disassemblyDialog(nullptr),
715  m_examineMemoryDialog(nullptr),
716  m_threadsDialog(nullptr),
717  m_watchesDialog(nullptr),
718  m_logger(nullptr),
719  m_loggerIndex(-1),
720  m_isDisassemblyMixedMode(false),
721  m_useTargetsDefault(false)
722 {
725  // connect with cbEVT_PROJECT_OPEN, too (see here: http://forums.codeblocks.org/index.php/topic,17260.msg118431.html#msg118431)
730 
731  wxString activeDebuggerName;
732  int activeConfig;
733  ReadActiveDebuggerConfig(activeDebuggerName, activeConfig);
734  if (activeDebuggerName.empty() && activeConfig == -1)
735  m_useTargetsDefault = true;
736 
737  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
738  m_isDisassemblyMixedMode = c->ReadBool(wxT("/common/disassembly/mixed_mode"), false);
739 
740 }
741 
743 {
744  for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)
745  it->second.ClearConfigurations();
746 
748  delete m_interfaceFactory;
749 }
750 
752 {
753  RegisteredPlugins::iterator it = m_registered.find(plugin);
754  if (it != m_registered.end())
755  return false;
756  const wxString &guiName=plugin->GetGUIName();
757  const wxString &settingsName=plugin->GetSettingsName();
758 
759  wxRegEx regExSettingsName(wxT("^[a-z_][a-z0-9_]+$"));
760  if (!regExSettingsName.Matches(settingsName))
761  {
762  wxString s;
763  s = wxString::Format(_("The settings name for the debugger plugin \"%s\" - \"%s\" contains invalid characters"),
764  guiName.c_str(), settingsName.c_str());
766  return false;
767  }
768 
769  int normalIndex = -1;
770  GetLogger(normalIndex);
771  plugin->SetupLog(normalIndex);
772 
773  PluginData data;
774 
775  m_registered[plugin] = data;
776  it = m_registered.find(plugin);
777  ProcessSettings(it);
778 
779  // There should be at least one configuration for every plugin.
780  // If this is not the case, something is wrong and should be fixed.
781  cbAssert(!it->second.GetConfigurations().empty());
782 
783  wxString activeDebuggerName;
784  int activeConfig;
785  ReadActiveDebuggerConfig(activeDebuggerName, activeConfig);
786 
787  if (activeDebuggerName == settingsName)
788  {
789  if (activeConfig > static_cast<int>(it->second.GetConfigurations().size()))
790  activeConfig = 0;
791 
792  m_activeDebugger = plugin;
793  m_activeDebugger->SetActiveConfig(activeConfig);
794 
796  }
797 
798  CreateWindows();
800 
801  return true;
802 }
803 
805 {
806  RegisteredPlugins::iterator it = m_registered.find(plugin);
807  if(it == m_registered.end())
808  return false;
809 
810  it->second.ClearConfigurations();
811  m_registered.erase(it);
812  if (plugin == m_activeDebugger)
813  {
814  if (m_registered.empty())
815  m_activeDebugger = nullptr;
816  else
817  m_activeDebugger = m_registered.begin()->first;
819  }
821  {
823  RefreshUI();
824  }
825 
826  if (m_registered.empty())
827  {
828  DestoryWindows();
829 
830  if (Manager::Get()->GetLogManager())
832  }
833 
834  return true;
835 }
836 
837 void DebuggerManager::ProcessSettings(RegisteredPlugins::iterator it)
838 {
839  cbDebuggerPlugin *plugin = it->first;
840  PluginData &data = it->second;
841  ConfigManager *config = Manager::Get()->GetConfigManager(wxT("debugger_common"));
842  wxString path = wxT("/sets/") + plugin->GetSettingsName();
843  wxArrayString configs = config->EnumerateSubPaths(path);
844  configs.Sort();
845 
846  if (configs.empty())
847  {
848  config->Write(path + wxT("/conf1/name"), wxString(wxT("Default")));
849  configs = config->EnumerateSubPaths(path);
850  configs.Sort();
851  }
852 
853  data.ClearConfigurations();
854  data.m_lastConfigID = -1;
855 
856  for (size_t jj = 0; jj < configs.Count(); ++jj)
857  {
858  wxString configPath = path + wxT("/") + configs[jj];
859  wxString name = config->Read(configPath + wxT("/name"));
860 
861  cbDebuggerConfiguration *pluginConfig;
862  pluginConfig = plugin->LoadConfig(ConfigManagerWrapper(wxT("debugger_common"), configPath + wxT("/values")));
863  if (pluginConfig)
864  {
865  pluginConfig->SetName(name);
866  data.GetConfigurations().push_back(pluginConfig);
867  }
868  }
869 }
870 
872 {
873  RegisteredPlugins::iterator it = m_registered.find(plugin);
874  if (it == m_registered.end())
875  return ConfigManagerWrapper();
876 
877  wxString path = wxT("/sets/") + it->first->GetSettingsName();
878 
879  if (it->second.m_lastConfigID == -1)
880  {
881  ConfigManager *config = Manager::Get()->GetConfigManager(wxT("debugger_common"));
882  wxArrayString configs = config->EnumerateSubPaths(path);
883  for (size_t ii = 0; ii < configs.GetCount(); ++ii)
884  {
885  long id;
886  if (configs[ii].Remove(0, 4).ToLong(&id))
887  it->second.m_lastConfigID = std::max<long>(it->second.m_lastConfigID, id);
888  }
889  }
890 
891  path << wxT("/conf") << ++it->second.m_lastConfigID;
892 
893  return ConfigManagerWrapper(wxT("debugger_common"), path + wxT("/values"));
894 }
895 
897 {
898  for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)
899  ProcessSettings(it);
901 }
902 
904 {
905  wxMenuBar *menuBar = Manager::Get()->GetAppFrame()->GetMenuBar();
906  cbAssert(menuBar);
907  wxMenu *menu = NULL;
908 
909  int menu_pos = menuBar->FindMenu(_("&Debug"));
910 
911  if(menu_pos != wxNOT_FOUND)
912  menu = menuBar->GetMenu(menu_pos);
913 
914  if (!menu)
915  {
916  menu = Manager::Get()->LoadMenu(_T("debugger_menu"),true);
917 
918  // ok, now, where do we insert?
919  // three possibilities here:
920  // a) locate "Compile" menu and insert after it
921  // b) locate "Project" menu and insert after it
922  // c) if not found (?), insert at pos 5
923  int finalPos = 5;
924  int projcompMenuPos = menuBar->FindMenu(_("&Build"));
925  if (projcompMenuPos == wxNOT_FOUND)
926  projcompMenuPos = menuBar->FindMenu(_("&Compile"));
927 
928  if (projcompMenuPos != wxNOT_FOUND)
929  finalPos = projcompMenuPos + 1;
930  else
931  {
932  projcompMenuPos = menuBar->FindMenu(_("&Project"));
933  if (projcompMenuPos != wxNOT_FOUND)
934  finalPos = projcompMenuPos + 1;
935  }
936  menuBar->Insert(finalPos, menu, _("&Debug"));
937 
939  }
940  return menu;
941 }
942 
944 {
945  wxMenuBar *menuBar = Manager::Get()->GetAppFrame()->GetMenuBar();
946  cbAssert(menuBar);
947  int menu_pos = menuBar->FindMenu(_("&Debug"));
948  return menu_pos != wxNOT_FOUND;
949 }
950 
951 void DebuggerManager::BuildContextMenu(wxMenu &menu, const wxString& word_at_caret, bool is_running)
952 {
953  m_menuHandler->BuildContextMenu(menu, word_at_caret, is_running);
954 }
955 
957 {
958  LogManager* msgMan = Manager::Get()->GetLogManager();
959 
960  if (!m_logger)
961  {
962  m_logger = new DebugTextCtrlLogger(true, false);
963  m_loggerIndex = msgMan->SetLog(m_logger);
964  LogSlot &slot = msgMan->Slot(m_loggerIndex);
965  slot.title = _("Debugger");
966  // set log image
967  wxString prefix = ConfigManager::GetDataFolder() + _T("/images/");
968  wxBitmap* bmp = new wxBitmap(cbLoadBitmap(prefix + _T("misc_16x16.png"), wxBITMAP_TYPE_PNG));
969  slot.icon = bmp;
970 
972  Manager::Get()->ProcessEvent(evtAdd);
973  }
974 
975  index = m_loggerIndex;
976  return m_logger;
977 }
978 
980 {
981  int index;
982  return GetLogger(index);
983 }
984 
986 {
987 
989  Manager::Get()->ProcessEvent(evt);
990  m_logger = nullptr;
991  m_loggerIndex = -1;
992 }
993 
995 {
997  m_interfaceFactory = factory;
998 
999  CreateWindows();
1000 
1005  m_threadsDialog->EnableWindow(false);
1006 }
1007 
1009 {
1010  if (!m_backtraceDialog)
1012  if (!m_breakPointsDialog)
1014  if (!m_cpuRegistersDialog)
1016  if (!m_disassemblyDialog)
1018  if (!m_examineMemoryDialog)
1020  if (!m_threadsDialog)
1022  if (!m_watchesDialog)
1024 }
1025 
1027 {
1029  m_backtraceDialog = nullptr;
1030 
1032  m_breakPointsDialog = nullptr;
1033 
1035  m_cpuRegistersDialog = nullptr;
1036 
1038  m_disassemblyDialog = nullptr;
1039 
1041  m_examineMemoryDialog = nullptr;
1042 
1044  m_threadsDialog = nullptr;
1045 
1047  m_watchesDialog = nullptr;
1048 }
1049 
1051 {
1052  return m_interfaceFactory;
1053 }
1054 
1056 {
1057  m_menuHandler = handler;
1058 }
1059 
1061 {
1062  return m_menuHandler;
1063 }
1064 
1066 {
1067  return m_backtraceDialog;
1068 }
1069 
1071 {
1072  return m_breakPointsDialog;
1073 }
1074 
1076 {
1077  return m_cpuRegistersDialog;
1078 }
1079 
1081 {
1082  return m_disassemblyDialog;
1083 }
1084 
1086 {
1087  return m_examineMemoryDialog;
1088 }
1089 
1091 {
1092  return m_threadsDialog;
1093 }
1094 
1096 {
1097  return m_watchesDialog;
1098 }
1099 
1101 {
1102  cbBacktraceDlg *dialog = GetBacktraceDialog();
1103 
1104  if (!IsWindowReallyShown(dialog->GetWindow()))
1105  {
1106  // show the backtrace window
1108  evt.pWindow = dialog->GetWindow();
1109  Manager::Get()->ProcessEvent(evt);
1110  return true;
1111  }
1112  else
1113  return false;
1114 }
1115 
1117 {
1119 }
1120 
1122 {
1124 }
1125 
1127 {
1129 }
1130 
1132 {
1134 }
1135 
1137 {
1139 }
1140 
1142 {
1143  watch = cbGetRootWatch(watch);
1144  for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)
1145  {
1146  if (it->first->HasWatch(watch))
1147  return it->first;
1148  }
1149  return NULL;
1150 }
1151 
1152 bool DebuggerManager::ShowValueTooltip(const cb::shared_ptr<cbWatch> &watch, const wxRect &rect)
1153 {
1154  return m_interfaceFactory->ShowValueTooltip(watch, rect);
1155 }
1156 
1158 {
1159  return m_registered;
1160 }
1162 {
1163  return m_registered;
1164 }
1166 {
1167  return m_activeDebugger;
1168 }
1169 
1170 inline void RefreshBreakpoints(cb_unused const cbDebuggerPlugin* plugin)
1171 {
1172  EditorManager *editorManager = Manager::Get()->GetEditorManager();
1173  int count = editorManager->GetEditorsCount();
1174  for (int ii = 0; ii < count; ++ii)
1175  {
1176  EditorBase *editor = editorManager->GetEditor(ii);
1177  if (editor->IsBuiltinEditor())
1178  static_cast<cbEditor*>(editor)->RefreshBreakpointMarkers();
1179  }
1180 }
1181 
1182 void DebuggerManager::SetActiveDebugger(cbDebuggerPlugin* activeDebugger, ConfigurationVector::const_iterator config)
1183 {
1184  RegisteredPlugins::const_iterator it = m_registered.find(activeDebugger);
1185  cbAssert(it != m_registered.end());
1186 
1187  m_useTargetsDefault = false;
1188  m_activeDebugger = activeDebugger;
1189  int index = std::distance(it->second.GetConfigurations().begin(), config);
1191 
1192  WriteActiveDebuggerConfig(it->first->GetSettingsName(), index);
1193  RefreshUI();
1194 }
1195 
1197 {
1201 
1202  if (m_activeDebugger)
1203  {
1204  if (m_backtraceDialog)
1208  if (m_disassemblyDialog)
1212  if (m_threadsDialog)
1214  }
1215  if (m_watchesDialog)
1217  if (m_breakPointsDialog)
1219 }
1220 
1222 {
1224 }
1225 
1227 {
1228  m_activeDebugger = nullptr;
1229  m_menuHandler->SetActiveDebugger(nullptr);
1231 }
1232 
1234 {
1235  if (Manager::Get()->GetProjectManager()->IsLoadingOrClosing())
1236  return;
1237 
1238  m_activeDebugger = nullptr;
1239  m_menuHandler->SetActiveDebugger(nullptr);
1240 
1241  if (m_registered.empty())
1242  {
1244  return;
1245  }
1246 
1247  ProjectManager* projectMgr = Manager::Get()->GetProjectManager();
1249  cbProject* project = projectMgr->GetActiveProject();
1250  ProjectBuildTarget *target = nullptr;
1251  if (project)
1252  {
1253  const wxString &targetName = project->GetActiveBuildTarget();
1254  if (project->BuildTargetValid(targetName))
1255  target = project->GetBuildTarget(targetName);
1256  }
1257 
1258 
1259  Compiler *compiler = nullptr;
1260  if (!target)
1261  {
1262  if (project)
1263  compiler = CompilerFactory::GetCompiler(project->GetCompilerID());
1264  if (!compiler)
1266  if (!compiler)
1267  {
1268  log->LogError(_("Can't get the compiler for the active target, nor the project, nor the default one!"));
1270  return;
1271  }
1272  }
1273  else
1274  {
1275  compiler = CompilerFactory::GetCompiler(target->GetCompilerID());
1276  if (!compiler)
1277  {
1278  log->LogError(wxString::Format(_("Current target '%s' doesn't have valid compiler!"),
1279  target->GetTitle().c_str()));
1281  return;
1282  }
1283  }
1284  wxString dbgString = compiler->GetPrograms().DBGconfig;
1285  wxString::size_type pos = dbgString.find(wxT(':'));
1286 
1287  wxString name, config;
1288  if (pos != wxString::npos)
1289  {
1290  name = dbgString.substr(0, pos);
1291  config = dbgString.substr(pos + 1, dbgString.length() - pos - 1);
1292  }
1293 
1294  if (name.empty() || config.empty())
1295  {
1296  if (compiler->GetID() != wxT("null"))
1297  {
1298  log->LogError(wxString::Format(_("Current compiler '%s' doesn't have correctly defined debugger!"),
1299  compiler->GetName().c_str()));
1300  }
1302  return;
1303  }
1304 
1305  for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)
1306  {
1307  PluginData &data = it->second;
1308  if (it->first->GetSettingsName() == name)
1309  {
1310  ConfigurationVector &configs = data.GetConfigurations();
1311  int index = 0;
1312  for (ConfigurationVector::iterator itConf = configs.begin(); itConf != configs.end(); ++itConf, ++index)
1313  {
1314  if ((*itConf)->GetName() == config)
1315  {
1316  m_activeDebugger = it->first;
1318  m_useTargetsDefault = true;
1319 
1321  RefreshUI();
1323  return;
1324  }
1325  }
1326  }
1327  }
1328 
1329  wxString targetTitle(target ? target->GetTitle() : wxT("<nullptr>"));
1330  log->LogError(wxString::Format(_("Can't find the debugger config: '%s:%s' for the current target '%s'!"),
1331  name.c_str(), config.c_str(),
1332  targetTitle.c_str()));
1334 }
1335 
1337 {
1338  return m_isDisassemblyMixedMode;
1339 }
1340 
1342 {
1343  m_isDisassemblyMixedMode = mixed;
1344  ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
1345  c->Write(wxT("/common/disassembly/mixed_mode"), m_isDisassemblyMixedMode);
1346 }
1347 
1349 {
1350  if (m_useTargetsDefault)
1352 }
1353 
1355 {
1356  if (m_useTargetsDefault)
1358 }
1359 
1361 {
1362  if (event.GetInt() == cbSettingsType::Compiler || event.GetInt() == cbSettingsType::Debugger)
1363  {
1364  if (m_useTargetsDefault)
1366  }
1367 }
1368 
1370 {
1371  RefreshUI();
1372  if (!m_activeDebugger)
1373  {
1374  m_useTargetsDefault = true;
1376  }
1377 }
void MarkChildsAsRemoved()
cbDebuggerConfiguration(const cbDebuggerConfiguration &o)
void SetActiveConfig(int index)
Definition: cbplugin.cpp:280
int GetNumber() const
cbDebuggerPlugin * GetActiveDebugger()
bool RemoveMarkedChildren()
virtual int ShowModal()
void SetMenuHandler(cbDebuggerMenuHandler *handler)
int wxNewId()
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)
Definition: globals.cpp:420
const wxString & GetLine() const
virtual void DeleteCPURegisters(cbCPURegistersDlg *dialog)=0
#define wxCB_DROPDOWN
ConfigurationVector & GetConfigurations()
virtual bool Insert(size_t pos, wxMenu *menu, const wxString &title)
void SetupLog(int normalIndex)
Definition: cbplugin.cpp:561
virtual wxWindow * SetDefault()
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
Definition: manager.cpp:474
wxString ToString() const
int ReadInt(const wxString &name, int defaultVal=0)
cbDisassemblyDlg * m_disassemblyDialog
const wxValidator wxDefaultValidator
Base class for debugger plugins.
Definition: cbplugin.h:397
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...
Definition: manager.cpp:182
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)
static bool IsAppShuttingDown()
Definition: manager.cpp:333
size_t length() const
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.
Definition: globals.cpp:1102
bool wxFileExists(const wxString &filename)
wxWindow * pWindow
The window to dock.
Definition: sdk_events.h:137
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)
virtual void Reload()=0
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_SELECTED
Definition: sdk_events.cpp:119
#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
Definition: sdk_events.cpp:99
Event used to request from the main app to add a log.
Definition: sdk_events.h:182
Event used to request from the main app to add a window to the docking system.
Definition: sdk_events.h:83
wxCStrData c_str() const
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
Definition: loggers.cpp:168
virtual void SetPointSize(int pointSize)
#define _T(string)
void SetInterfaceFactory(cbDebugInterfaceFactory *factory)
EVTIMPORT const wxEventType cbEVT_SETTINGS_CHANGED
Definition: sdk_events.cpp:179
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)
static wxMenu * LoadMenu(wxString menu_id, bool createonfailure=false)
Loads Menu from XRC.
Definition: manager.cpp:368
virtual wxWindow * GetWindow()=0
virtual cbBacktraceDlg * CreateBacktrace()=0
void SetTargetsDefaultAsActiveDebugger()
RegisteredPlugins m_registered
cb::shared_ptr< cbWatch > GetChild(int index)
TextCtrlLogger * GetLogger()
cbDebuggerMenuHandler * GetMenuHandler()
#define wxT(string)
void OnProjectActivated(CodeBlocksEvent &event)
cbDebuggerPlugin * GetDebuggerHavingWatch(cb::shared_ptr< cbWatch > watch)
#define wxNOT_FOUND
virtual wxWindow * GetWindow()=0
bool empty() const
size_t find(const wxString &str, size_t nStart=0) const
A generic Code::Blocks event.
Definition: sdk_events.h:20
void RemoveChild(int index)
bool IsValid() const
void OnUpdateUI(wxUpdateUIEvent &event)
EditorManager * GetEditorManager() const
Definition: manager.cpp:434
void SetAddress(uint64_t address)
bool IsActive() const
#define DLLIMPORT
Definition: settings.h:16
cbCPURegistersDlg * m_cpuRegistersDialog
const wxNativeFontInfo * GetNativeFontInfo() const
void LogError(const wxString &msg, int i=app_log)
Definition: logmanager.h:142
virtual bool ShowValueTooltip(const cb::shared_ptr< cbWatch > &watch, const wxRect &rect)=0
Show new value tooltip.
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.
Definition: manager.cpp:429
const wxString & GetID() const
Get this compiler&#39;s unique ID.
Definition: compiler.h:351
#define wxBU_AUTODRAW
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
DebuggerManager * GetDebuggerManager() const
Definition: manager.cpp:484
DebugTextCtrlLogger(bool fixedPitchFont, bool debugLog)
Event functor class.
Definition: cbfunctor.h:37
Represents a Code::Blocks project.
Definition: cbproject.h:96
const wxString & GetActiveBuildTarget() const
Definition: cbproject.cpp:1373
static void SetValueTooltipFont(const wxString &font)
wxWindow * CreateTextCtrl(wxWindow *parent)
void MarkAsChangedRecursive(bool flag)
EVTIMPORT const wxEventType cbEVT_ADD_LOG_WINDOW
Definition: sdk_events.cpp:162
null_pointer_t nullptr
Definition: nullptr.cpp:16
void AutoUpdate(bool enabled)
virtual void EnableWindow(bool enable)=0
wxString cbDetectDebuggerExecutable(const wxString &exeName)
Tries to detect the path to the debugger&#39;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
Definition: sdk_events.cpp:78
cbDisassemblyDlg * GetDisassemblyDialog()
Returns a pointer to the disassembly dialog.
virtual void DeleteThreads(cbThreadsDlg *dialog)=0
EVTIMPORT const wxEventType cbEVT_REMOVE_LOG_WINDOW
Definition: sdk_events.cpp:163
wxArrayString EnumerateSubPaths(const wxString &path)
TextCtrlLogger * m_logger
int GetChildCount() const
virtual const wxString & GetTitle() const
Read the target&#39;s title.
bool IsActiveDebuggerTargetsDefault() const
virtual void MarkActiveTargetAsValid(bool valid)=0
wxString GetSettingsName() const
Definition: cbplugin.h:619
virtual ~cbWatch()
virtual void SetActiveDebugger(cbDebuggerPlugin *active)=0
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
const wxString & GetFilename() const
wxFrame * GetAppFrame() const
Definition: manager.cpp:419
a logger which prints messages to a wxTextCtrl
Definition: loggers.h:90
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?
Definition: cbproject.cpp:1335
void RemoveAllEventSinksFor(void *owner)
Definition: manager.cpp:570
static const wxString sep
virtual const CompilerPrograms & GetPrograms() const
Get the compiler&#39;s programs.
Definition: compiler.h:299
cbWatchesDlg * GetWatchesDialog()
Returns a pointer to the watches dialog.
Base class that all "editors" should inherit from.
Definition: editorbase.h:30
LogManager * GetLogManager() const
Definition: manager.cpp:439
DLLIMPORT bool IsWindowReallyShown(wxWindow *win)
Finds out if a window is really shown.
Definition: globals.cpp:931
virtual void DeleteBacktrace(cbBacktraceDlg *dialog)=0
bool IsRemoved() const
cbProject * GetActiveProject()
Retrieve the active project.
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
wxString title
Definition: logmanager.h:64
size_t size_type
const wxString & GetSymbol() const
virtual cbDebuggerConfiguration * LoadConfig(const ConfigManagerWrapper &config)=0
static wxUniChar GetPathSeparator(wxPathFormat format=wxPATH_NATIVE)
wxString DBGconfig
Definition: compiler.h:205
wxArtClient wxART_BUTTON
virtual bool IsPointerType() const
Tells us if the watch is for pointer variable.
bool m_removed
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?
Definition: editorbase.cpp:209
wxMenu * GetMenu(size_t menuIndex) const
void SetNumber(int number)
wxString wxEmptyString
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)
Definition: manager.h:183
bool m_autoUpdate
const wxString & _(const wxString &string)
wxString & Trim(bool fromRight=true)
wxComboBox * m_command_entry
virtual void EnableWindow(bool enable)=0
int FindMenu(const wxString &title) const
EditorBase * GetEditor(int index)
std::map< cbDebuggerPlugin *, PluginData > RegisteredPlugins
const wxString & GetInfo() const
#define cbAssert(expr)
Definition: cbexception.h:48
static void AddChild(cb::shared_ptr< cbWatch > parent, cb::shared_ptr< cbWatch > watch)
uint64_t m_address
Stack frame&#39;s address.
void WriteActiveDebuggerConfig(const wxString &name, int configIndex)
static wxString GetDataFolder(bool global=true)
bool m_expanded
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Definition: cbproject.cpp:1392
virtual void DeleteDisassembly(cbDisassemblyDlg *dialog)=0
Abstract base class for compilers.
Definition: compiler.h:274
virtual void DeleteWatches(cbWatchesDlg *dialog)=0
wxString GetAddressAsString() const
int m_number
Stack frame&#39;s number (used in backtraces).
static wxString GetValueTooltipFont()
bool IsEmpty() const
void OnLoadFile(cb_unused wxCommandEvent &event)
RegisteredPlugins const & GetAllDebuggers() const
wxString GetGUIName() const
Definition: cbplugin.h:618
cbExamineMemoryDlg * m_examineMemoryDialog
The entry point singleton for working with projects.
LogSlot & Slot(int i)
Definition: logmanager.cpp:147
virtual const wxString & GetCompilerID() const
Read the target&#39;s compiler.
virtual wxString GetDirectory() const
static const size_t npos
cbBacktraceDlg * GetBacktraceDialog()
cbBreakpointsDlg * GetBreakpointDialog()
Returns a pointer to the breakpoints dialog.
int GetNumber() const
uint64_t cbDebuggerStringToAddress(const wxString &address)
Convert a string in hex form to a uint64_t number.
EVTIMPORT const wxEventType cbEVT_SHOW_DOCK_WINDOW
Definition: sdk_events.cpp:131
virtual const wxString & GetName() const
Get the compiler&#39;s name.
Definition: compiler.h:293
DebugTextCtrlLogger * m_text_control_logger
static wxString GetExecutableFolder()
bool HasMenu() const
bool ShowValueTooltip(const cb::shared_ptr< cbWatch > &watch, const wxRect &rect)
cbDebuggerConfiguration * GetConfiguration(int index)
bool ProcessEvent(CodeBlocksEvent &event)
Definition: manager.cpp:246
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)
bool IsChanged() const
void OnClearLog(cb_unused wxCommandEvent &event)
EVTIMPORT const wxEventType cbEVT_PROJECT_OPEN
Definition: sdk_events.cpp:97
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
Definition: manager.cpp:550
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 BuildContextMenu(wxMenu &menu, const wxString &word_at_caret, bool is_running)
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
size_t GetCount() const
void RemoveChildren()
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?
bool IsExpanded() const
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.
#define NULL
Definition: prefix.cpp:59
size_t SetLog(Logger *l, int index=no_index)
Definition: logmanager.cpp:110
static wxString Format(const wxString &format,...)
cb::shared_ptr< const cbWatch > GetParent() const
const ConfigManagerWrapper & GetConfig() const
wxBitmap * icon
Definition: logmanager.h:63
wxString m_file
Current file.
void Expand(bool expand)
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
bool m_changed
virtual cbThreadsDlg * CreateThreads()=0