Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] (C++) Modernize Interfaces/*.* #3586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Interfaces/IWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class IWorkspace : public wxEvtHandler
wxString m_workspaceType;

public:
typedef std::list<IWorkspace*> List_t;
using List_t = std::list<IWorkspace*>;

public:
IWorkspace() {}
virtual ~IWorkspace() {}
IWorkspace() = default;
~IWorkspace() override = default;

/**
* @brief return the workspace name
Expand Down Expand Up @@ -101,7 +101,7 @@ class IWorkspace : public wxEvtHandler
/**
* @brief return the project name of a file.
* If the workspace does not support projects, return an empty string
* If the we could not match a project for the given filename, return empty string
* If we could not match a project for the given filename, return empty string
*/
virtual wxString GetProjectFromFile(const wxFileName& filename) const = 0;

Expand Down
184 changes: 67 additions & 117 deletions Interfaces/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,59 +67,46 @@ struct StackEntry {
wxString function;
wxString file;
wxString line;
bool active;
bool active = false;
};

struct ThreadEntry {
bool active;
long dbgid;
bool active = false;
long dbgid = 0;
wxString file;
wxString line;
wxString function;
};

struct VariableObjChild {
int numChilds; // If this child has children (i.e. is this child a node or leaf)
wxString varName; // the name of the variable object node
wxString gdbId; // A unique name given by gdb which holds this node information for further queries
int numChilds = 0; // If this child has children (i.e. is this child a node or leaf)
wxString varName; // the name of the variable object node
wxString gdbId; // A unique name given by gdb which holds this node information for further queries
wxString value;
bool isAFake; // Sets to true of this variable object is a fake node
bool isAFake = false; // Sets to true of this variable object is a fake node
wxString type;
VariableObjChild()
: numChilds(0)
, isAFake(false)
{
}

VariableObjChild() = default;
};

struct VariableObject {
bool isPtr; // if this variable object is of type pointer
bool isPtrPtr; // if this variable object is of type pointer pointer
wxString gdbId; // GDB unique identifier for this variable object
wxString typeName; // the type of this variable object
int numChilds; // Number of children
bool has_more; // has_nore?
VariableObject()
: isPtr(false)
, isPtrPtr(false)
, numChilds(0)
, has_more(false)
{
}
bool isPtr = false; // if this variable object is of type pointer
bool isPtrPtr = false; // if this variable object is of type pointer pointer
wxString gdbId; // GDB unique identifier for this variable object
wxString typeName; // the type of this variable object
int numChilds = 0; // Number of children
bool has_more = false; // has_more?
VariableObject() = default;
};

struct LocalVariable {
wxString name;
wxString value;
wxString type;
bool updated;
bool updated = false;
wxString gdbId; // Mac generates variable object for locals as well...

LocalVariable()
: updated(false)
{
}
~LocalVariable() {}
LocalVariable() = default;
};

struct VariableObjectUpdateInfo {
Expand All @@ -128,7 +115,6 @@ struct VariableObjectUpdateInfo {
};

struct DisassembleEntry {
public:
wxString m_address;
wxString m_function;
wxString m_offset;
Expand All @@ -140,17 +126,17 @@ struct DbgRegister {
wxString reg_value;
};

typedef std::vector<VariableObjChild> VariableObjChildren;
typedef std::vector<StackEntry> StackEntryArray;
typedef std::vector<ThreadEntry> ThreadEntryArray;
typedef std::vector<LocalVariable> LocalVariables;
typedef std::vector<DisassembleEntry> DisassembleEntryVec_t;
typedef std::vector<DbgRegister> DbgRegistersVec_t;
using VariableObjChildren = std::vector<VariableObjChild>;
using StackEntryArray = std::vector<StackEntry>;
using ThreadEntryArray = std::vector<ThreadEntry>;
using LocalVariables = std::vector<LocalVariable>;
using DisassembleEntryVec_t = std::vector<DisassembleEntry>;
using DbgRegistersVec_t = std::vector<DbgRegister>;

#define READ_CONFIG_PARAM(name, value) \
{ \
decltype(value) dummy; \
if(arch.Read(name, dummy)) { \
if (arch.Read(name, dummy)) { \
value = dummy; \
} \
}
Expand All @@ -165,56 +151,32 @@ class DebuggerInformation : public SerializedObject

wxString name;
wxString path;
bool enableDebugLog;
bool enablePendingBreakpoints;
bool breakAtWinMain;
bool showTerminal;
wxString consoleCommand;
bool useRelativeFilePaths;
int maxCallStackFrames;
bool catchThrow;
bool showTooltipsOnlyWithControlKeyIsDown;
bool debugAsserts;
bool enableDebugLog = false;
bool enablePendingBreakpoints = true;
bool breakAtWinMain = false;
bool showTerminal = false;
wxString consoleCommand = TERMINAL_CMD;
bool useRelativeFilePaths = false;
int maxCallStackFrames = 500;
bool catchThrow = false;
bool showTooltipsOnlyWithControlKeyIsDown = true;
bool debugAsserts = false;
wxString initFileCommands;
int maxDisplayStringSize = 200;
int maxDisplayElements = 100;
bool resolveLocals;
bool autoExpandTipItems;
bool applyBreakpointsAfterProgramStarted;
bool whenBreakpointHitRaiseCodelite;
bool resolveLocals = true;
bool autoExpandTipItems = true;
bool applyBreakpointsAfterProgramStarted = false;
bool whenBreakpointHitRaiseCodelite = true;
wxString cygwinPathCommand;
bool charArrAsPtr;
bool enableGDBPrettyPrinting;
bool defaultHexDisplay;
size_t flags; // see eGdbFlags
bool charArrAsPtr = false;
bool enableGDBPrettyPrinting = true;
bool defaultHexDisplay = false;
size_t flags = 0; // see eGdbFlags

public:
DebuggerInformation()
: name(wxEmptyString)
, path(wxEmptyString)
, enableDebugLog(false)
, enablePendingBreakpoints(true)
, breakAtWinMain(false)
, showTerminal(false)
, consoleCommand(TERMINAL_CMD)
, useRelativeFilePaths(false)
, maxCallStackFrames(500)
, catchThrow(false)
, showTooltipsOnlyWithControlKeyIsDown(true)
, debugAsserts(false)
, initFileCommands(wxEmptyString)
, resolveLocals(true)
, autoExpandTipItems(true)
, applyBreakpointsAfterProgramStarted(false)
, whenBreakpointHitRaiseCodelite(true)
, charArrAsPtr(false)
, enableGDBPrettyPrinting(true)
, defaultHexDisplay(false)
, flags(0)
{
}

virtual ~DebuggerInformation() {}
DebuggerInformation() = default;
~DebuggerInformation() override = default;

void Serialize(Archive& arch)
{
Expand Down Expand Up @@ -291,28 +253,19 @@ class DebuggerStartupInfo
public:
enum DebugType { DebugProject = 1, AttachProcess = 2, QuickDebug = 3 };

long pid;
long pid = wxNOT_FOUND;
wxString project;
IDebugger* debugger;
IDebugger* debugger = nullptr;

DebuggerStartupInfo()
: pid(wxNOT_FOUND)
, project(wxEmptyString)
, debugger(NULL)
{
}
DebuggerStartupInfo() = default;

DebuggerStartupInfo(long pid)
explicit DebuggerStartupInfo(long pid)
: pid(pid)
, project(wxEmptyString)
, debugger(NULL)
{
}

DebuggerStartupInfo(const wxString& project)
: pid(wxNOT_FOUND)
, project(project)
, debugger(NULL)
explicit DebuggerStartupInfo(const wxString& project)
: project(project)
{
}

Expand Down Expand Up @@ -362,28 +315,23 @@ class EnvironmentConfig;
class IDebugger
{
protected:
IDebuggerObserver* m_observer;
IDebuggerObserver* m_observer = nullptr;
DebuggerInformation m_info;
EnvironmentConfig* m_env;
EnvironmentConfig* m_env = nullptr;
wxString m_name;
bool m_isRemoteDebugging;
bool m_isRemoteExtended;
bool m_isRemoteDebugging = false;
bool m_isRemoteExtended = false;
bool m_isSSHDebugging = false;
wxString m_debuggeeProjectName;
wxString m_sshAccount;

//! Command to execute right after connect to the remote target
wxString m_debuggerPostRemoteConnectCommands;

public:
IDebugger()
: m_observer(NULL)
, m_env(NULL)
, m_isRemoteDebugging(false)
, m_isRemoteExtended(false)
{}

virtual ~IDebugger(){};
IDebugger() = default;

virtual ~IDebugger() = default;
void SetProjectName(const wxString& project) { m_debuggeeProjectName = project; }
void SetName(const wxString& name) { m_name = name; }
wxString GetName() const { return m_name; }
Expand All @@ -401,13 +349,15 @@ class IDebugger

void SetIsRemoteDebugging(bool isRemoteDebugging) { this->m_isRemoteDebugging = isRemoteDebugging; }
void SetIsRemoteExtended(bool isRemoteExtended) { this->m_isRemoteExtended = isRemoteExtended; }
void SetPostRemoteConnectCommands(const wxString& commands) { this->m_debuggerPostRemoteConnectCommands = commands; }


void SetPostRemoteConnectCommands(const wxString& commands)
{
this->m_debuggerPostRemoteConnectCommands = commands;
}

bool GetIsRemoteDebugging() const { return m_isRemoteDebugging; }
bool GetIsRemoteExtended() const { return m_isRemoteExtended; }
const wxString& GetPostRemoteConnectCommands() const { return this->m_debuggerPostRemoteConnectCommands; }

void SetIsSSHDebugging(bool isSSHDebugging) { this->m_isSSHDebugging = isSSHDebugging; }
bool IsSSHDebugging() const { return m_isSSHDebugging; }
void SetSshAccount(const wxString& sshAccount) { this->m_sshAccount = sshAccount; }
Expand Down Expand Up @@ -720,7 +670,7 @@ class IDebugger
//-----------------------------------------------------------
// Each debugger module must implement these two functions
//-----------------------------------------------------------
typedef IDebugger* (*GET_DBG_CREATE_FUNC)();
typedef DebuggerInfo (*GET_DBG_INFO_FUNC)();
using GET_DBG_CREATE_FUNC = IDebugger* (*)();
using GET_DBG_INFO_FUNC = DebuggerInfo (*)();

#endif // DEBUGGER_H
51 changes: 17 additions & 34 deletions Interfaces/debuggerobserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,51 +88,34 @@ enum UserReason { DBG_USERR_QUICKWACTH = 0, DBG_USERR_WATCHTABLE, DBG_USERR_LOCA
class DebuggerEventData : public wxClientData
{
public:
DebuggerUpdateReason m_updateReason; // Event reason - the reason why this event was sent
DebuggerUpdateReason m_updateReason = DBG_UR_INVALID; // Event reason - the reason why this event was sent
// ==================================================
// Available when the following UpdateReason are set:
// ==================================================
DebuggerReasons m_controlReason; // DBG_UR_GOT_CONTROL
wxString m_file; //
int m_line; //
wxString m_text; // DBG_UR_ADD_LINE, DBG_UR_REMOTE_TARGET_CONNECTED, DBG_UR_ASCII_VIEWER
int m_bpInternalId; // DBG_UR_BP_ADDED
int m_bpDebuggerId; // DBG_UR_BP_ADDED, DBG_UR_BP_HIT
LocalVariables m_locals; // DBG_UR_LOCALS
wxString m_expression; // DBG_UR_EXPRESSION, DBG_UR_TYPE_RESOLVED, DBG_UR_ASCII_VIEWER, DBG_UR_WATCHMEMORY,
// DBG_UR_VARIABLEOBJ
// DBG_UR_EVALVARIABLEOBJ, DBG_UR_FUNCTIONFINISHED
DebuggerReasons m_controlReason = DBG_UNKNOWN; // DBG_UR_GOT_CONTROL
wxString m_file; //
int m_line = wxNOT_FOUND; //
wxString m_text; // DBG_UR_ADD_LINE, DBG_UR_REMOTE_TARGET_CONNECTED, DBG_UR_ASCII_VIEWER
int m_bpInternalId = wxNOT_FOUND; // DBG_UR_BP_ADDED
int m_bpDebuggerId = wxNOT_FOUND; // DBG_UR_BP_ADDED, DBG_UR_BP_HIT
LocalVariables m_locals; // DBG_UR_LOCALS
wxString m_expression; // DBG_UR_EXPRESSION, DBG_UR_TYPE_RESOLVED, DBG_UR_ASCII_VIEWER, DBG_UR_WATCHMEMORY,
// DBG_UR_VARIABLEOBJ, DBG_UR_EVALVARIABLEOBJ, DBG_UR_FUNCTIONFINISHED
wxString m_evaluated; // DBG_UR_EXPRESSION, DBG_UR_TYPE_RESOLVED, DBG_UR_WATCHMEMORY, DBG_UR_EVALVARIABLEOBJ
StackEntryArray m_stack; // DBG_UR_UPDATE_STACK_LIST
std::vector<clDebuggerBreakpoint> m_bpInfoList; // DBG_UR_RECONCILE_BPTS
bool m_onlyIfLogging; // DBG_UR_ADD_LINE
bool m_onlyIfLogging = false; // DBG_UR_ADD_LINE
ThreadEntryArray m_threads; // DBG_UR_LISTTHRAEDS
VariableObjChildren m_varObjChildren; // DBG_UR_LISTCHILDREN
VariableObject m_variableObject; // DBG_UR_VARIABLEOBJ
int m_userReason; // User reason as provided in the calling API which triggered the DebuggerUpdate call
int m_userReason =
wxNOT_FOUND; // User reason as provided in the calling API which triggered the DebuggerUpdate call
StackEntry m_frameInfo; // DBG_UR_FRAMEINFO
VariableObjectUpdateInfo m_varObjUpdateInfo; // DBG_UR_VAROBJUPDATE
DisassembleEntryVec_t m_disassembleLines; // None
DbgRegistersVec_t m_registers; // Sent with event wxEVT_DEBUGGER_LIST_REGISTERS
DebuggerEventData()
: m_updateReason(DBG_UR_INVALID)
, m_controlReason(DBG_UNKNOWN)
, m_file(wxEmptyString)
, m_line(wxNOT_FOUND)
, m_text(wxEmptyString)
, m_bpInternalId(wxNOT_FOUND)
, m_bpDebuggerId(wxNOT_FOUND)
, m_expression(wxEmptyString)
, m_evaluated(wxEmptyString)
, m_onlyIfLogging(false)
, m_userReason(wxNOT_FOUND)
{
m_stack.clear();
m_bpInfoList.clear();
m_threads.clear();
m_varObjChildren.clear();
m_registers.clear();
}

DebuggerEventData() = default;
};

/**
Expand All @@ -144,8 +127,8 @@ class DebuggerEventData : public wxClientData
class IDebuggerObserver
{
public:
IDebuggerObserver(){};
virtual ~IDebuggerObserver(){};
IDebuggerObserver() = default;
virtual ~IDebuggerObserver() = default;

/**
* @brief the reporting method of the debugger. Must be implemented by any 'DebuggerObserver'
Expand Down
Loading
Loading