From e0a0aebbae085c1fe5ddba8afcbf8fa58047b0b1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Oct 2009 12:32:49 +0200 Subject: [PATCH] group declarations logically --- src/plugins/debugger/gdb/gdbengine.h | 350 ++++++++++++++------------- 1 file changed, 179 insertions(+), 171 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index b7bf74282ae..83f3239c031 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -95,81 +95,70 @@ private: friend class RemoteGdbAdapter; friend class TrkGdbAdapter; - // - // IDebuggerEngine implementation - // - void stepExec(); - void stepOutExec(); - void nextExec(); - void stepIExec(); - void nextIExec(); +private: ////////// General Interface ////////// - void shutdown(); - void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); - void startDebugger(const DebuggerStartParametersPtr &sp); - void exitDebugger(); - void detachDebugger(); + virtual void addOptionPages(QList *opts) const; - void continueInferiorInternal(); - void autoContinueInferior(); - void continueInferior(); - void interruptInferior(); + virtual bool checkConfiguration(int toolChain, QString *errorMessage, QString *settingsPage= 0) const; - void runToLineExec(const QString &fileName, int lineNumber); - void runToFunctionExec(const QString &functionName); - void jumpToLineExec(const QString &fileName, int lineNumber); + virtual bool isGdbEngine() const { return true; } - void activateFrame(int index); - void selectThread(int index); + virtual void startDebugger(const DebuggerStartParametersPtr &sp); + virtual void exitDebugger(); + virtual void detachDebugger(); + virtual void shutdown(); - Q_SLOT void attemptBreakpointSynchronization(); + virtual void executeDebuggerCommand(const QString &command); - void assignValueInDebugger(const QString &expr, const QString &value); - void executeDebuggerCommand(const QString & command); - void watchPoint(const QPoint &); +private: ////////// General State ////////// - void loadSymbols(const QString &moduleName); - void loadAllSymbols(); - virtual QList moduleSymbols(const QString &moduleName); - - void fetchMemory(MemoryViewAgent *agent, quint64 addr, quint64 length); - void handleFetchMemory(const GdbResponse &response); - - 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); - - Q_SLOT void setDebugDebuggingHelpers(const QVariant &on); - 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; - - // - // Own stuff - // - - int currentFrame() const; - - bool supportsThreads() const; - void gotoLocation(const StackFrame &frame, bool setLocationMarker); - StackFrame parseStackFrame(const GdbMi &mi, int level); - - void connectAdapter(); void initializeVariables(); - QString fullName(const QString &fileName); - // get one usable name out of these, try full names first - QString fullName(const QStringList &candidates); + DebuggerStartMode startMode() const; + const DebuggerStartParameters &startParameters() const + { return *m_startParameters; } + Q_SLOT void setAutoDerefPointers(const QVariant &on); - void handleResult(const GdbResponse &response); + DebuggerStartParametersPtr m_startParameters; + QSharedPointer m_trkOptions; -public: // otherwise the Qt flag macros are unhappy +private: ////////// Gdb Process Management ////////// + + AbstractGdbAdapter *createAdapter(const DebuggerStartParametersPtr &dp); + void connectAdapter(); + void startInferior(); + + void gdbInputAvailable(int channel, const QString &msg) + { m_manager->showDebuggerInput(channel, msg); } + void gdbOutputAvailable(int channel, const QString &msg) + { m_manager->showDebuggerOutput(channel, msg); } + +private slots: + void readGdbStandardOutput(); + void readGdbStandardError(); + void readDebugeeOutput(const QByteArray &data); + + void handleAdapterStarted(); + void handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint = QString()); + + void handleInferiorStartFailed(const QString &msg); + void handleInferiorShutDown(); + void handleInferiorShutdownFailed(const QString &msg); + + void handleAdapterCrashed(const QString &msg); + void handleAdapterShutDown(); + void handleAdapterShutdownFailed(const QString &msg); + +private: + QTextCodec *m_outputCodec; + QTextCodec::ConverterState m_outputCodecState; + + QByteArray m_inbuffer; + + AbstractGdbAdapter *m_gdbAdapter; + +private: ////////// Gdb Command Management ////////// + + public: // otherwise the Qt flag macros are unhappy enum GdbCommandFlag { NoFlags = 0, NeedsStop = 1, // The command needs a stopped inferior @@ -181,9 +170,8 @@ public: // otherwise the Qt flag macros are unhappy ExitRequest = 32 // Callback expect GdbResultExit instead of GdbResultDone }; Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag) + private: - -private: typedef void (GdbEngine::*GdbCommandCallback) (const GdbResponse &response); typedef void (AbstractGdbAdapter::*AdapterCallback) @@ -230,61 +218,6 @@ private: void postCommandHelper(const GdbCommand &cmd); void setTokenBarrier(); - void updateAll(); - void updateLocals(const QVariant &cookie = QVariant()); - - void gdbInputAvailable(int channel, const QString &msg) - { m_manager->showDebuggerInput(channel, msg); } - void gdbOutputAvailable(int channel, const QString &msg) - { m_manager->showDebuggerOutput(channel, msg); } - -private slots: - void readGdbStandardOutput(); - void readGdbStandardError(); - void readDebugeeOutput(const QByteArray &data); - - void handleAdapterStarted(); - void handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint = QString()); - - void handleInferiorStartFailed(const QString &msg); - void handleInferiorShutDown(); - void handleInferiorShutdownFailed(const QString &msg); - - void handleAdapterCrashed(const QString &msg); - void handleAdapterShutDown(); - void handleAdapterShutdownFailed(const QString &msg); - -private: - void handleResponse(const QByteArray &buff); - void handleStopResponse(const GdbMi &data); - void handleStop1(const GdbResponse &response); - void handleStop1(const GdbMi &data); - void handleStop2(const GdbResponse &response); - void handleStop2(const GdbMi &data); - void handleResultRecord(const GdbResponse &response); - void handleExecContinue(const GdbResponse &response); -// void handleExecRunToFunction(const GdbResponse &response); - void handleShowVersion(const GdbResponse &response); - void handleQuerySources(const GdbResponse &response); - void handleWatchPoint(const GdbResponse &response); - void handleIsSynchroneous(const GdbResponse &response); - bool showToolTip(); - - // Convenience - QMainWindow *mainWindow() const; - DebuggerStartMode startMode() const; - qint64 inferiorPid() const { return m_manager->inferiorPid(); } - void handleInferiorPidChanged(qint64 pid) { manager()->notifyInferiorPidChanged(pid); } - - void handleChildren(const WatchData &parent, const GdbMi &child, - QList *insertions); - const bool m_dumperInjectionLoad; - - QTextCodec *m_outputCodec; - QTextCodec::ConverterState m_outputCodecState; - - QByteArray m_inbuffer; - QHash m_cookieForToken; QByteArray m_pendingConsoleStreamOutput; @@ -295,13 +228,68 @@ private: // out of date and discarded. int m_oldestAcceptableToken; + int m_pendingRequests; // Watch updating commands in flight + + typedef void (GdbEngine::*CommandsDoneCallback)(); + // function called after all previous responses have been received + CommandsDoneCallback m_commandsDoneCallback; + + QList m_commandsToRunOnTemporaryBreak; + +private: ////////// Gdb Output, State & Capability Handling ////////// + + void handleResponse(const QByteArray &buff); + void handleStopResponse(const GdbMi &data); + void handleResultRecord(const GdbResponse &response); + void handleStop1(const GdbResponse &response); + void handleStop1(const GdbMi &data); + void handleStop2(const GdbResponse &response); + void handleStop2(const GdbMi &data); + StackFrame parseStackFrame(const GdbMi &mi, int level); + + virtual bool isSynchroneous() const; + bool supportsThreads() const; + + // Gdb initialization sequence + void handleShowVersion(const GdbResponse &response); + void handleIsSynchroneous(const GdbResponse &response); + int m_gdbVersion; // 6.8.0 is 680 int m_gdbBuildVersion; // MAC only? bool m_isSynchroneous; // Can act synchroneously? - // awful hack to keep track of used files - QMap m_shortToFullName; - QMap m_fullToShortName; +private: ////////// Inferior Management ////////// + + Q_SLOT virtual void attemptBreakpointSynchronization(); + + virtual void stepExec(); + virtual void stepOutExec(); + virtual void nextExec(); + virtual void stepIExec(); + virtual void nextIExec(); + + void continueInferiorInternal(); + void autoContinueInferior(); + virtual void continueInferior(); + virtual void interruptInferior(); + + virtual void runToLineExec(const QString &fileName, int lineNumber); + virtual void runToFunctionExec(const QString &functionName); +// void handleExecRunToFunction(const GdbResponse &response); + virtual void jumpToLineExec(const QString &fileName, int lineNumber); + + void handleExecContinue(const GdbResponse &response); + + qint64 inferiorPid() const { return m_manager->inferiorPid(); } + void handleInferiorPidChanged(qint64 pid) { manager()->notifyInferiorPidChanged(pid); } + void maybeHandleInferiorPidChanged(const QString &pid); + +private: ////////// View & Data Stuff ////////// + + virtual void selectThread(int index); + virtual void activateFrame(int index); + + void gotoLocation(const StackFrame &frame, bool setLocationMarker); // // Breakpoint specific stuff @@ -320,9 +308,13 @@ private: // // Modules specific stuff // + virtual void loadSymbols(const QString &moduleName); + virtual void loadAllSymbols(); + virtual QList moduleSymbols(const QString &moduleName); void reloadModules(); void handleModulesList(const GdbResponse &response); + bool m_modulesListOutdated; // // Register specific stuff @@ -332,54 +324,83 @@ private: void handleRegisterListNames(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 // 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 m_shortToFullName; + QMap m_fullToShortName; // // Stack specific stuff // + void updateAll(); void handleStackListFrames(const GdbResponse &response); void handleStackSelectThread(const GdbResponse &response); void handleStackListThreads(const GdbResponse &response); void handleStackFrame1(const GdbResponse &response); void handleStackFrame2(const GdbResponse &response); - QByteArray m_firstChunk; Q_SLOT void reloadStack(bool forceGotoLocation); Q_SLOT void reloadFullStack(); + int currentFrame() const; - - // - // Tooltip specific stuff - // - void sendToolTipCommand(const QString &command, const QString &cookie); - + QList m_currentFunctionArgs; + QByteArray m_firstChunk; + QString m_currentFrame; // // Watch specific stuff // + 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); + // FIXME: BaseClass. called to improve situation for a watch item void updateSubItem(const WatchData &data); + void handleChildren(const WatchData &parent, const GdbMi &child, + QList *insertions); void updateWatchData(const WatchData &data); Q_SLOT void updateWatchDataHelper(const WatchData &data); void rebuildModel(); + bool showToolTip(); void insertData(const WatchData &data); void sendWatchParameters(const QByteArray ¶ms0); 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 runDirectDebuggingHelper(const WatchData &data, bool dumpChildren); bool hasDebuggingHelperForType(const QString &type) const; void handleVarListChildren(const GdbResponse &response); + void handleVarListChildrenHelper(const GdbMi &child, + const WatchData &parent); void handleVarCreate(const GdbResponse &response); void handleVarAssign(const GdbResponse &response); void handleEvaluateExpression(const GdbResponse &response); @@ -390,55 +411,42 @@ private: void handleDebuggingHelperValue3(const GdbResponse &response); void handleDebuggingHelperEditValue(const GdbResponse &response); void handleDebuggingHelperSetup(const GdbResponse &response); + + void updateLocals(const QVariant &cookie = QVariant()); void handleStackListLocals(const GdbResponse &response); + WatchData localVariable(const GdbMi &item, + const QStringList &uninitializedVariables, + QMap *seen); + void setLocals(const QList &locals); void handleStackListArguments(const GdbResponse &response); - void handleVarListChildrenHelper(const GdbMi &child, - const WatchData &parent); void setWatchDataType(WatchData &data, const GdbMi &mi); void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi); - inline WatchData localVariable(const GdbMi &item, - const QStringList &uninitializedVariables, - QMap *seen); - void connectDebuggingHelperActions(); - void disconnectDebuggingHelperActions(); - AbstractGdbAdapter *createAdapter(const DebuggerStartParametersPtr &dp); - bool startModeAllowsDumpers() const; - QString parseDisassembler(const GdbMi &lines); - - int m_pendingRequests; QSet m_processedNames; - - QtDumperHelper m_dumperHelper; - - DebuggingHelperState m_debuggingHelperState; - QList m_currentFunctionArgs; - QString m_currentFrame; QMap m_varToType; - typedef void (GdbEngine::*CommandsDoneCallback)(); - // function called after all previous responses have been received - CommandsDoneCallback m_commandsDoneCallback; - void startInferior(); +private: ////////// Dumper Management ////////// - bool m_modulesListOutdated; + bool startModeAllowsDumpers() const; + 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); - QList m_commandsToRunOnTemporaryBreak; + const bool m_dumperInjectionLoad; + DebuggingHelperState m_debuggingHelperState; + QtDumperHelper m_dumperHelper; - DebuggerStartParametersPtr m_startParameters; - // make sure to re-initialize new members in initializeVariables(); +private: ////////// Convenience Functions ////////// - QSharedPointer m_trkOptions; - - AbstractGdbAdapter *m_gdbAdapter; - -public: QString errorMessage(QProcess::ProcessError error); void showMessageBox(int icon, const QString &title, const QString &text); void debugMessage(const QString &msg); - void addOptionPages(QList *opts) const; - const DebuggerStartParameters &startParameters() const - { return *m_startParameters; } + QMainWindow *mainWindow() const; + }; } // namespace Internal