/usr/include/codeblocks/debuggermanager.h is in codeblocks-dev 13.12+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | /*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/
#ifndef X_DEBUGGER_MANAGER_H
#define X_DEBUGGER_MANAGER_H
#include "sdk.h"
#ifndef CB_PRECOMP
# include <map>
# include <vector>
# include <manager.h>
# include <settings.h>
# include <wx/string.h>
# include "configmanager.h"
#endif
class wxMenu;
class wxToolBar;
class cbBacktraceDlg;
class cbBreakpointsDlg;
class cbCPURegistersDlg;
class cbDebuggerPlugin;
class cbDebugInterfaceFactory;
class cbDisassemblyDlg;
class cbExamineMemoryDlg;
class cbThreadsDlg;
class cbWatchesDlg;
class cbDebuggerMenuHandler;
class TextCtrlLogger;
class DLLIMPORT cbBreakpoint
{
public:
virtual ~cbBreakpoint() {}
virtual void SetEnabled(bool flag) = 0;
virtual wxString GetLocation() const = 0;
virtual int GetLine() const = 0;
virtual wxString GetLineString() const = 0;
virtual wxString GetType() const = 0;
virtual wxString GetInfo() const = 0;
virtual bool IsEnabled() const = 0;
virtual bool IsVisibleInEditor() const = 0;
virtual bool IsTemporary() const = 0;
};
class DLLIMPORT cbWatch
{
cbWatch& operator =(cbWatch &);
cbWatch(cbWatch &);
public:
cbWatch();
public:
virtual void GetSymbol(wxString &symbol) const = 0;
virtual void GetValue(wxString &value) const = 0;
virtual bool SetValue(const wxString &value) = 0;
virtual void GetFullWatchString(wxString &full_watch) const = 0;
virtual void GetType(wxString &type) const = 0;
virtual void SetType(const wxString &type) = 0;
virtual wxString const & GetDebugString() const = 0;
protected:
virtual ~cbWatch();
public:
static void AddChild(cb::shared_ptr<cbWatch> parent, cb::shared_ptr<cbWatch> watch);
void RemoveChild(int index);
void RemoveChildren();
bool RemoveMarkedChildren();
int GetChildCount() const;
cb::shared_ptr<cbWatch> GetChild(int index);
cb::shared_ptr<const cbWatch> GetChild(int index) const;
cb::shared_ptr<cbWatch> FindChild(const wxString& name);
int FindChildIndex(const wxString& symbol) const;
cb::shared_ptr<const cbWatch> GetParent() const;
cb::shared_ptr<cbWatch> GetParent();
bool IsRemoved() const;
bool IsChanged() const;
void MarkAsRemoved(bool flag);
void MarkChildsAsRemoved();
void MarkAsChanged(bool flag);
void MarkAsChangedRecursive(bool flag);
bool IsExpanded() const;
void Expand(bool expand);
bool IsAutoUpdateEnabled() const;
void AutoUpdate(bool enabled);
private:
cb::weak_ptr<cbWatch> m_parent;
std::vector<cb::shared_ptr<cbWatch> > m_children;
bool m_changed;
bool m_removed;
bool m_expanded;
bool m_autoUpdate;
};
cb::shared_ptr<cbWatch> DLLIMPORT cbGetRootWatch(cb::shared_ptr<cbWatch> watch);
class DLLIMPORT cbStackFrame
{
public:
cbStackFrame();
void SetNumber(int number);
void SetAddress(size_t address);
void SetSymbol(const wxString& symbol);
void SetFile(const wxString& filename, const wxString &line);
void MakeValid(bool flag);
int GetNumber() const;
size_t GetAddress() const;
const wxString& GetSymbol() const;
const wxString& GetFilename() const;
const wxString& GetLine() const;
bool IsValid() const;
private:
bool m_valid; ///< Is this stack frame valid?
int m_number; ///< Stack frame's number (used in backtraces).
size_t m_address; ///< Stack frame's address.
wxString m_symbol; ///< Current function name.
wxString m_file; ///< Current file.
wxString m_line; ///< Current line in file.
};
class DLLIMPORT cbThread
{
public:
cbThread();
cbThread(bool active, int number, const wxString& info);
bool IsActive() const;
int GetNumber() const;
const wxString& GetInfo() const;
private:
bool m_active;
int m_number;
wxString m_info;
};
/**
*
*/
class DLLIMPORT cbDebuggerConfiguration
{
protected:
cbDebuggerConfiguration(const cbDebuggerConfiguration &o);
cbDebuggerConfiguration& operator =(const cbDebuggerConfiguration &);
public:
cbDebuggerConfiguration(const ConfigManagerWrapper &config);
virtual ~cbDebuggerConfiguration() {}
virtual cbDebuggerConfiguration* Clone() const = 0;
virtual wxPanel* MakePanel(wxWindow *parent) = 0;
virtual bool SaveChanges(wxPanel *panel) = 0;
void SetName(const wxString &name);
const wxString& GetName() const;
const ConfigManagerWrapper& GetConfig() const;
void SetConfig(const ConfigManagerWrapper &config);
void SetMenuId(long id);
long GetMenuId() const;
protected:
ConfigManagerWrapper m_config;
private:
wxString m_name;
long m_menuId;
};
/**
*
*/
struct DLLIMPORT cbDebuggerCommonConfig
{
enum Flags
{
AutoBuild = 0,
AutoSwitchFrame,
ShowDebuggersLog,
JumpOnDoubleClick,
RequireCtrlForTooltips,
ShowTemporaryBreakpoints
};
enum Perspective
{
OnlyOne = 0,
OnePerDebugger,
OnePerDebuggerConfig
};
static bool GetFlag(Flags flag);
static void SetFlag(Flags flag, bool value);
static wxString GetValueTooltipFont();
static void SetValueTooltipFont(const wxString &font);
static Perspective GetPerspective();
static void SetPerspective(int perspective);
};
/**
* Tries to detect the path to the debugger's executable.
*/
DLLIMPORT wxString cbDetectDebuggerExecutable(const wxString &exeName);
class DLLIMPORT DebuggerManager : public Mgr<DebuggerManager>
{
private:
DebuggerManager();
~DebuggerManager();
friend class Mgr<DebuggerManager>;
friend class Manager;
public:
typedef std::vector<cbDebuggerConfiguration*> ConfigurationVector;
struct PluginData
{
friend class DebuggerManager;
PluginData() : m_lastConfigID(-1) {}
ConfigurationVector& GetConfigurations() { return m_configurations; }
const ConfigurationVector& GetConfigurations() const { return m_configurations; }
cbDebuggerConfiguration* GetConfiguration(int index);
void ClearConfigurations()
{
for (ConfigurationVector::iterator it = m_configurations.begin(); it != m_configurations.end(); ++it)
delete *it;
m_configurations.clear();
}
private:
ConfigurationVector m_configurations;
int m_lastConfigID;
};
typedef std::map<cbDebuggerPlugin*, PluginData> RegisteredPlugins;
public:
/** Called to register a debugger plugin. It is called by cbDebuggerPlugin::OnAttach and it should not be called
* by the debugger plugins explicitly in their OnAttachReal methods. */
bool RegisterDebugger(cbDebuggerPlugin *plugin);
/** Called to unregister a debugger plugin. It is called by cbDebuggerPlugin::OnRelease and it should not be
* called by the debugger plugins explicitly in their OnReleaseReal methods. */
bool UnregisterDebugger(cbDebuggerPlugin *plugin);
ConfigManagerWrapper NewConfig(cbDebuggerPlugin *plugin, const wxString &name);
void RebuildAllConfigs();
wxMenu* GetMenu();
bool HasMenu() const;
void BuildContextMenu(wxMenu &menu, const wxString& word_at_caret, bool is_running);
TextCtrlLogger* GetLogger(int &index);
TextCtrlLogger* GetLogger();
void HideLogger();
public: // debugger windows
void SetInterfaceFactory(cbDebugInterfaceFactory *factory);
cbDebugInterfaceFactory* GetInterfaceFactory();
void SetMenuHandler(cbDebuggerMenuHandler *handler);
cbDebuggerMenuHandler* GetMenuHandler();
cbBacktraceDlg* GetBacktraceDialog();
/** Returns a pointer to the breakpoints dialog.
* It will return nullptr if there are no debugger plugins loaded.
* Debugger plugin writers can treat it as always returning non-null value.
*/
cbBreakpointsDlg* GetBreakpointDialog();
/** Returns a pointer to the CPU registers dialog.
* It will return nullptr if there are no debugger plugins loaded.
* Debugger plugin writers can treat it as always returning non-null value.
*/
cbCPURegistersDlg* GetCPURegistersDialog();
/** Returns a pointer to the disassembly dialog.
* It will return nullptr if there are no debugger plugins loaded.
* Debugger plugin writers can treat it as always returning non-null value.
*/
cbDisassemblyDlg* GetDisassemblyDialog();
/** Returns a pointer to the memory dialog.
* It will return nullptr if there are no debugger plugins loaded.
* Debugger plugin writers can treat it as always returning non-null value.
*/
cbExamineMemoryDlg* GetExamineMemoryDialog();
/** Returns a pointer to the threads dialog.
* It will return nullptr if there are no debugger plugins loaded.
* Debugger plugin writers can treat it as always returning non-null value.
*/
cbThreadsDlg* GetThreadsDialog();
/** Returns a pointer to the watches dialog.
* It will return nullptr if there are no debugger plugins loaded.
* Debugger plugin writers can treat it as always returning non-null value.
*/
cbWatchesDlg* GetWatchesDialog();
bool ShowBacktraceDialog();
public: // tests if something should be done
bool UpdateBacktrace();
bool UpdateCPURegisters();
bool UpdateDisassembly();
bool UpdateExamineMemory();
bool UpdateThreads();
public: // watches
cbDebuggerPlugin* GetDebuggerHavingWatch(cb::shared_ptr<cbWatch> watch);
bool ShowValueTooltip(const cb::shared_ptr<cbWatch> &watch, const wxRect &rect);
RegisteredPlugins const & GetAllDebuggers() const;
RegisteredPlugins & GetAllDebuggers();
cbDebuggerPlugin* GetActiveDebugger();
void SetActiveDebugger(cbDebuggerPlugin* activeDebugger, ConfigurationVector::iterator config);
void SetTargetsDefaultAsActiveDebugger();
bool IsActiveDebuggerTargetsDefault() const;
bool IsDisassemblyMixedMode();
void SetDisassemblyMixedMode(bool mixed);
private:
void ProcessSettings(RegisteredPlugins::iterator it);
void FindTargetsDebugger();
void RefreshUI();
void CreateWindows();
void DestoryWindows();
void OnProjectActivated(CodeBlocksEvent& event);
void OnTargetSelected(CodeBlocksEvent& event);
void OnSettingsChanged(CodeBlocksEvent& event);
void OnPluginLoadingComplete(CodeBlocksEvent& event);
private:
cbDebugInterfaceFactory *m_interfaceFactory;
RegisteredPlugins m_registered;
cbDebuggerPlugin* m_activeDebugger;
cbDebuggerMenuHandler* m_menuHandler;
cbBacktraceDlg* m_backtraceDialog;
cbBreakpointsDlg* m_breakPointsDialog;
cbCPURegistersDlg* m_cpuRegistersDialog;
cbDisassemblyDlg* m_disassemblyDialog;
cbExamineMemoryDlg* m_examineMemoryDialog;
cbThreadsDlg* m_threadsDialog;
cbWatchesDlg* m_watchesDialog;
TextCtrlLogger* m_logger;
int m_loggerIndex;
bool m_isDisassemblyMixedMode;
bool m_useTargetsDefault;
};
#endif // X_DEBUGGER_MANAGER_H
|