Skip to content
Snippets Groups Projects
Commit e0a0aebb authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

group declarations logically

parent 0e398303
No related branches found
No related tags found
No related merge requests found
...@@ -95,81 +95,70 @@ private: ...@@ -95,81 +95,70 @@ private:
friend class RemoteGdbAdapter; friend class RemoteGdbAdapter;
friend class TrkGdbAdapter; friend class TrkGdbAdapter;
// private: ////////// General Interface //////////
// IDebuggerEngine implementation
//
void stepExec();
void stepOutExec();
void nextExec();
void stepIExec();
void nextIExec();
void shutdown();
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
void startDebugger(const DebuggerStartParametersPtr &sp);
void exitDebugger();
void detachDebugger();
void continueInferiorInternal(); virtual void addOptionPages(QList<Core::IOptionsPage*> *opts) const;
void autoContinueInferior();
void continueInferior();
void interruptInferior();
void runToLineExec(const QString &fileName, int lineNumber); virtual bool checkConfiguration(int toolChain, QString *errorMessage, QString *settingsPage= 0) const;
void runToFunctionExec(const QString &functionName);
void jumpToLineExec(const QString &fileName, int lineNumber);
void activateFrame(int index); virtual bool isGdbEngine() const { return true; }
void selectThread(int index);
Q_SLOT void attemptBreakpointSynchronization(); virtual void startDebugger(const DebuggerStartParametersPtr &sp);
virtual void exitDebugger();
virtual void detachDebugger();
virtual void shutdown();
void assignValueInDebugger(const QString &expr, const QString &value); virtual void executeDebuggerCommand(const QString &command);
void executeDebuggerCommand(const QString & command);
void watchPoint(const QPoint &);
void loadSymbols(const QString &moduleName); private: ////////// General State //////////
void loadAllSymbols();
virtual QList<Symbol> moduleSymbols(const QString &moduleName);
void fetchMemory(MemoryViewAgent *agent, quint64 addr, quint64 length); void initializeVariables();
void handleFetchMemory(const GdbResponse &response); DebuggerStartMode startMode() const;
const DebuggerStartParameters &startParameters() const
{ return *m_startParameters; }
Q_SLOT void setAutoDerefPointers(const QVariant &on);
void fetchDisassembler(DisassemblerViewAgent *agent, DebuggerStartParametersPtr m_startParameters;
const StackFrame &frame); QSharedPointer<TrkOptions> m_trkOptions;
void fetchDisassemblerByAddress(DisassemblerViewAgent *agent,
bool useMixedMode);
void handleFetchDisassemblerByLine(const GdbResponse &response);
void handleFetchDisassemblerByAddress1(const GdbResponse &response);
void handleFetchDisassemblerByAddress0(const GdbResponse &response);
Q_SLOT void setDebugDebuggingHelpers(const QVariant &on); private: ////////// Gdb Process Management //////////
Q_SLOT void setUseDebuggingHelpers(const QVariant &on);
Q_SLOT void setAutoDerefPointers(const QVariant &on);
bool isGdbEngine() const { return true; }
bool isSynchroneous() const;
bool checkConfiguration(int toolChain, QString *errorMessage, QString *settingsPage= 0) const; AbstractGdbAdapter *createAdapter(const DebuggerStartParametersPtr &dp);
void connectAdapter();
void startInferior();
// void gdbInputAvailable(int channel, const QString &msg)
// Own stuff { m_manager->showDebuggerInput(channel, msg); }
// void gdbOutputAvailable(int channel, const QString &msg)
{ m_manager->showDebuggerOutput(channel, msg); }
int currentFrame() const; private slots:
void readGdbStandardOutput();
void readGdbStandardError();
void readDebugeeOutput(const QByteArray &data);
bool supportsThreads() const; void handleAdapterStarted();
void gotoLocation(const StackFrame &frame, bool setLocationMarker); void handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint = QString());
StackFrame parseStackFrame(const GdbMi &mi, int level);
void connectAdapter(); void handleInferiorStartFailed(const QString &msg);
void initializeVariables(); void handleInferiorShutDown();
QString fullName(const QString &fileName); void handleInferiorShutdownFailed(const QString &msg);
// get one usable name out of these, try full names first
QString fullName(const QStringList &candidates); void handleAdapterCrashed(const QString &msg);
void handleAdapterShutDown();
void handleAdapterShutdownFailed(const QString &msg);
void handleResult(const GdbResponse &response); private:
QTextCodec *m_outputCodec;
QTextCodec::ConverterState m_outputCodecState;
QByteArray m_inbuffer;
public: // otherwise the Qt flag macros are unhappy AbstractGdbAdapter *m_gdbAdapter;
private: ////////// Gdb Command Management //////////
public: // otherwise the Qt flag macros are unhappy
enum GdbCommandFlag { enum GdbCommandFlag {
NoFlags = 0, NoFlags = 0,
NeedsStop = 1, // The command needs a stopped inferior NeedsStop = 1, // The command needs a stopped inferior
...@@ -181,9 +170,8 @@ public: // otherwise the Qt flag macros are unhappy ...@@ -181,9 +170,8 @@ public: // otherwise the Qt flag macros are unhappy
ExitRequest = 32 // Callback expect GdbResultExit instead of GdbResultDone ExitRequest = 32 // Callback expect GdbResultExit instead of GdbResultDone
}; };
Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag) Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag)
private:
private:
typedef void (GdbEngine::*GdbCommandCallback) typedef void (GdbEngine::*GdbCommandCallback)
(const GdbResponse &response); (const GdbResponse &response);
typedef void (AbstractGdbAdapter::*AdapterCallback) typedef void (AbstractGdbAdapter::*AdapterCallback)
...@@ -230,78 +218,78 @@ private: ...@@ -230,78 +218,78 @@ private:
void postCommandHelper(const GdbCommand &cmd); void postCommandHelper(const GdbCommand &cmd);
void setTokenBarrier(); void setTokenBarrier();
void updateAll(); QHash<int, GdbCommand> m_cookieForToken;
void updateLocals(const QVariant &cookie = QVariant());
void gdbInputAvailable(int channel, const QString &msg) QByteArray m_pendingConsoleStreamOutput;
{ m_manager->showDebuggerInput(channel, msg); } QByteArray m_pendingLogStreamOutput;
void gdbOutputAvailable(int channel, const QString &msg)
{ m_manager->showDebuggerOutput(channel, msg); }
private slots: // contains the first token number for the current round
void readGdbStandardOutput(); // of evaluation. Responses with older tokens are considers
void readGdbStandardError(); // out of date and discarded.
void readDebugeeOutput(const QByteArray &data); int m_oldestAcceptableToken;
void handleAdapterStarted(); int m_pendingRequests; // Watch updating commands in flight
void handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint = QString());
void handleInferiorStartFailed(const QString &msg); typedef void (GdbEngine::*CommandsDoneCallback)();
void handleInferiorShutDown(); // function called after all previous responses have been received
void handleInferiorShutdownFailed(const QString &msg); CommandsDoneCallback m_commandsDoneCallback;
void handleAdapterCrashed(const QString &msg); QList<GdbCommand> m_commandsToRunOnTemporaryBreak;
void handleAdapterShutDown();
void handleAdapterShutdownFailed(const QString &msg); private: ////////// Gdb Output, State & Capability Handling //////////
private:
void handleResponse(const QByteArray &buff); void handleResponse(const QByteArray &buff);
void handleStopResponse(const GdbMi &data); void handleStopResponse(const GdbMi &data);
void handleResultRecord(const GdbResponse &response);
void handleStop1(const GdbResponse &response); void handleStop1(const GdbResponse &response);
void handleStop1(const GdbMi &data); void handleStop1(const GdbMi &data);
void handleStop2(const GdbResponse &response); void handleStop2(const GdbResponse &response);
void handleStop2(const GdbMi &data); void handleStop2(const GdbMi &data);
void handleResultRecord(const GdbResponse &response); StackFrame parseStackFrame(const GdbMi &mi, int level);
void handleExecContinue(const GdbResponse &response);
// void handleExecRunToFunction(const GdbResponse &response); virtual bool isSynchroneous() const;
bool supportsThreads() const;
// Gdb initialization sequence
void handleShowVersion(const GdbResponse &response); void handleShowVersion(const GdbResponse &response);
void handleQuerySources(const GdbResponse &response);
void handleWatchPoint(const GdbResponse &response);
void handleIsSynchroneous(const GdbResponse &response); void handleIsSynchroneous(const GdbResponse &response);
bool showToolTip();
// Convenience int m_gdbVersion; // 6.8.0 is 680
QMainWindow *mainWindow() const; int m_gdbBuildVersion; // MAC only?
DebuggerStartMode startMode() const; bool m_isSynchroneous; // Can act synchroneously?
qint64 inferiorPid() const { return m_manager->inferiorPid(); }
void handleInferiorPidChanged(qint64 pid) { manager()->notifyInferiorPidChanged(pid); }
void handleChildren(const WatchData &parent, const GdbMi &child, private: ////////// Inferior Management //////////
QList<WatchData> *insertions);
const bool m_dumperInjectionLoad;
QTextCodec *m_outputCodec; Q_SLOT virtual void attemptBreakpointSynchronization();
QTextCodec::ConverterState m_outputCodecState;
QByteArray m_inbuffer; virtual void stepExec();
virtual void stepOutExec();
virtual void nextExec();
virtual void stepIExec();
virtual void nextIExec();
QHash<int, GdbCommand> m_cookieForToken; void continueInferiorInternal();
void autoContinueInferior();
virtual void continueInferior();
virtual void interruptInferior();
QByteArray m_pendingConsoleStreamOutput; virtual void runToLineExec(const QString &fileName, int lineNumber);
QByteArray m_pendingLogStreamOutput; virtual void runToFunctionExec(const QString &functionName);
// void handleExecRunToFunction(const GdbResponse &response);
virtual void jumpToLineExec(const QString &fileName, int lineNumber);
// contains the first token number for the current round void handleExecContinue(const GdbResponse &response);
// of evaluation. Responses with older tokens are considers
// out of date and discarded.
int m_oldestAcceptableToken;
int m_gdbVersion; // 6.8.0 is 680 qint64 inferiorPid() const { return m_manager->inferiorPid(); }
int m_gdbBuildVersion; // MAC only? void handleInferiorPidChanged(qint64 pid) { manager()->notifyInferiorPidChanged(pid); }
bool m_isSynchroneous; // Can act synchroneously? void maybeHandleInferiorPidChanged(const QString &pid);
// awful hack to keep track of used files private: ////////// View & Data Stuff //////////
QMap<QString, QString> m_shortToFullName;
QMap<QString, QString> m_fullToShortName; virtual void selectThread(int index);
virtual void activateFrame(int index);
void gotoLocation(const StackFrame &frame, bool setLocationMarker);
// //
// Breakpoint specific stuff // Breakpoint specific stuff
...@@ -320,9 +308,13 @@ private: ...@@ -320,9 +308,13 @@ private:
// //
// Modules specific stuff // Modules specific stuff
// //
virtual void loadSymbols(const QString &moduleName);
virtual void loadAllSymbols();
virtual QList<Symbol> moduleSymbols(const QString &moduleName);
void reloadModules(); void reloadModules();
void handleModulesList(const GdbResponse &response); void handleModulesList(const GdbResponse &response);
bool m_modulesListOutdated;
// //
// Register specific stuff // Register specific stuff
...@@ -332,54 +324,83 @@ private: ...@@ -332,54 +324,83 @@ private:
void handleRegisterListNames(const GdbResponse &response); void handleRegisterListNames(const GdbResponse &response);
void handleRegisterListValues(const GdbResponse &response); void handleRegisterListValues(const GdbResponse &response);
//
// Disassembler specific stuff
//
virtual void fetchDisassembler(DisassemblerViewAgent *agent,
const StackFrame &frame);
void fetchDisassemblerByAddress(DisassemblerViewAgent *agent,
bool useMixedMode);
void handleFetchDisassemblerByLine(const GdbResponse &response);
void handleFetchDisassemblerByAddress1(const GdbResponse &response);
void handleFetchDisassemblerByAddress0(const GdbResponse &response);
QString parseDisassembler(const GdbMi &lines);
// //
// Source file specific stuff // Source file specific stuff
// //
void reloadSourceFiles(); void reloadSourceFiles();
void handleQuerySources(const GdbResponse &response);
QString fullName(const QString &fileName);
// get one usable name out of these, try full names first
QString fullName(const QStringList &candidates);
// awful hack to keep track of used files
QMap<QString, QString> m_shortToFullName;
QMap<QString, QString> m_fullToShortName;
// //
// Stack specific stuff // Stack specific stuff
// //
void updateAll();
void handleStackListFrames(const GdbResponse &response); void handleStackListFrames(const GdbResponse &response);
void handleStackSelectThread(const GdbResponse &response); void handleStackSelectThread(const GdbResponse &response);
void handleStackListThreads(const GdbResponse &response); void handleStackListThreads(const GdbResponse &response);
void handleStackFrame1(const GdbResponse &response); void handleStackFrame1(const GdbResponse &response);
void handleStackFrame2(const GdbResponse &response); void handleStackFrame2(const GdbResponse &response);
QByteArray m_firstChunk;
Q_SLOT void reloadStack(bool forceGotoLocation); Q_SLOT void reloadStack(bool forceGotoLocation);
Q_SLOT void reloadFullStack(); Q_SLOT void reloadFullStack();
int currentFrame() const;
QList<GdbMi> m_currentFunctionArgs;
QByteArray m_firstChunk;
QString m_currentFrame;
// //
// Tooltip specific stuff // Watch specific stuff
// //
void sendToolTipCommand(const QString &command, const QString &cookie); virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
virtual void assignValueInDebugger(const QString &expr, const QString &value);
virtual void fetchMemory(MemoryViewAgent *agent, quint64 addr, quint64 length);
void handleFetchMemory(const GdbResponse &response);
virtual void watchPoint(const QPoint &);
void handleWatchPoint(const GdbResponse &response);
//
// Watch specific stuff
//
// FIXME: BaseClass. called to improve situation for a watch item // FIXME: BaseClass. called to improve situation for a watch item
void updateSubItem(const WatchData &data); void updateSubItem(const WatchData &data);
void handleChildren(const WatchData &parent, const GdbMi &child,
QList<WatchData> *insertions);
void updateWatchData(const WatchData &data); void updateWatchData(const WatchData &data);
Q_SLOT void updateWatchDataHelper(const WatchData &data); Q_SLOT void updateWatchDataHelper(const WatchData &data);
void rebuildModel(); void rebuildModel();
bool showToolTip();
void insertData(const WatchData &data); void insertData(const WatchData &data);
void sendWatchParameters(const QByteArray &params0); void sendWatchParameters(const QByteArray &params0);
void createGdbVariable(const WatchData &data); void createGdbVariable(const WatchData &data);
void maybeHandleInferiorPidChanged(const QString &pid);
void tryLoadDebuggingHelpers();
void tryQueryDebuggingHelpers();
Q_SLOT void recheckDebuggingHelperAvailability();
void runDebuggingHelper(const WatchData &data, bool dumpChildren); void runDebuggingHelper(const WatchData &data, bool dumpChildren);
void runDirectDebuggingHelper(const WatchData &data, bool dumpChildren); void runDirectDebuggingHelper(const WatchData &data, bool dumpChildren);
bool hasDebuggingHelperForType(const QString &type) const; bool hasDebuggingHelperForType(const QString &type) const;
void handleVarListChildren(const GdbResponse &response); void handleVarListChildren(const GdbResponse &response);
void handleVarListChildrenHelper(const GdbMi &child,
const WatchData &parent);
void handleVarCreate(const GdbResponse &response); void handleVarCreate(const GdbResponse &response);
void handleVarAssign(const GdbResponse &response); void handleVarAssign(const GdbResponse &response);
void handleEvaluateExpression(const GdbResponse &response); void handleEvaluateExpression(const GdbResponse &response);
...@@ -390,55 +411,42 @@ private: ...@@ -390,55 +411,42 @@ private:
void handleDebuggingHelperValue3(const GdbResponse &response); void handleDebuggingHelperValue3(const GdbResponse &response);
void handleDebuggingHelperEditValue(const GdbResponse &response); void handleDebuggingHelperEditValue(const GdbResponse &response);
void handleDebuggingHelperSetup(const GdbResponse &response); void handleDebuggingHelperSetup(const GdbResponse &response);
void updateLocals(const QVariant &cookie = QVariant());
void handleStackListLocals(const GdbResponse &response); void handleStackListLocals(const GdbResponse &response);
WatchData localVariable(const GdbMi &item,
const QStringList &uninitializedVariables,
QMap<QByteArray, int> *seen);
void setLocals(const QList<GdbMi> &locals);
void handleStackListArguments(const GdbResponse &response); void handleStackListArguments(const GdbResponse &response);
void handleVarListChildrenHelper(const GdbMi &child,
const WatchData &parent);
void setWatchDataType(WatchData &data, const GdbMi &mi); void setWatchDataType(WatchData &data, const GdbMi &mi);
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi); void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
inline WatchData localVariable(const GdbMi &item,
const QStringList &uninitializedVariables,
QMap<QByteArray, int> *seen);
void connectDebuggingHelperActions();
void disconnectDebuggingHelperActions();
AbstractGdbAdapter *createAdapter(const DebuggerStartParametersPtr &dp);
bool startModeAllowsDumpers() const;
QString parseDisassembler(const GdbMi &lines);
int m_pendingRequests;
QSet<QString> m_processedNames; QSet<QString> m_processedNames;
QtDumperHelper m_dumperHelper;
DebuggingHelperState m_debuggingHelperState;
QList<GdbMi> m_currentFunctionArgs;
QString m_currentFrame;
QMap<QString, QString> m_varToType; QMap<QString, QString> m_varToType;
typedef void (GdbEngine::*CommandsDoneCallback)(); private: ////////// Dumper Management //////////
// function called after all previous responses have been received
CommandsDoneCallback m_commandsDoneCallback;
void startInferior();
bool m_modulesListOutdated;
QList<GdbCommand> m_commandsToRunOnTemporaryBreak;
DebuggerStartParametersPtr m_startParameters; bool startModeAllowsDumpers() const;
// make sure to re-initialize new members in initializeVariables(); void tryLoadDebuggingHelpers();
void tryQueryDebuggingHelpers();
Q_SLOT void recheckDebuggingHelperAvailability();
void connectDebuggingHelperActions();
void disconnectDebuggingHelperActions();
Q_SLOT void setDebugDebuggingHelpers(const QVariant &on);
Q_SLOT void setUseDebuggingHelpers(const QVariant &on);
QSharedPointer<TrkOptions> m_trkOptions; const bool m_dumperInjectionLoad;
DebuggingHelperState m_debuggingHelperState;
QtDumperHelper m_dumperHelper;
AbstractGdbAdapter *m_gdbAdapter; private: ////////// Convenience Functions //////////
public:
QString errorMessage(QProcess::ProcessError error); QString errorMessage(QProcess::ProcessError error);
void showMessageBox(int icon, const QString &title, const QString &text); void showMessageBox(int icon, const QString &title, const QString &text);
void debugMessage(const QString &msg); void debugMessage(const QString &msg);
void addOptionPages(QList<Core::IOptionsPage*> *opts) const; QMainWindow *mainWindow() const;
const DebuggerStartParameters &startParameters() const
{ return *m_startParameters; }
}; };
} // namespace Internal } // namespace Internal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment