group declarations logically

This commit is contained in:
Oswald Buddenhagen
2009-10-15 12:32:49 +02:00
parent 0e398303cc
commit e0a0aebbae

View File

@@ -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(); virtual void addOptionPages(QList<Core::IOptionsPage*> *opts) const;
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
void startDebugger(const DebuggerStartParametersPtr &sp);
void exitDebugger();
void detachDebugger();
void continueInferiorInternal(); virtual bool checkConfiguration(int toolChain, QString *errorMessage, QString *settingsPage= 0) const;
void autoContinueInferior();
void continueInferior();
void interruptInferior();
void runToLineExec(const QString &fileName, int lineNumber); virtual bool isGdbEngine() const { return true; }
void runToFunctionExec(const QString &functionName);
void jumpToLineExec(const QString &fileName, int lineNumber);
void activateFrame(int index); virtual void startDebugger(const DebuggerStartParametersPtr &sp);
void selectThread(int index); 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); private: ////////// General State //////////
void executeDebuggerCommand(const QString & command);
void watchPoint(const QPoint &);
void loadSymbols(const QString &moduleName);
void loadAllSymbols();
virtual QList<Symbol> 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(); void initializeVariables();
QString fullName(const QString &fileName); DebuggerStartMode startMode() const;
// get one usable name out of these, try full names first const DebuggerStartParameters &startParameters() const
QString fullName(const QStringList &candidates); { return *m_startParameters; }
Q_SLOT void setAutoDerefPointers(const QVariant &on);
void handleResult(const GdbResponse &response); DebuggerStartParametersPtr m_startParameters;
QSharedPointer<TrkOptions> 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 { 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
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,61 +218,6 @@ private:
void postCommandHelper(const GdbCommand &cmd); void postCommandHelper(const GdbCommand &cmd);
void setTokenBarrier(); 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<WatchData> *insertions);
const bool m_dumperInjectionLoad;
QTextCodec *m_outputCodec;
QTextCodec::ConverterState m_outputCodecState;
QByteArray m_inbuffer;
QHash<int, GdbCommand> m_cookieForToken; QHash<int, GdbCommand> m_cookieForToken;
QByteArray m_pendingConsoleStreamOutput; QByteArray m_pendingConsoleStreamOutput;
@@ -295,13 +228,68 @@ private:
// out of date and discarded. // out of date and discarded.
int m_oldestAcceptableToken; 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<GdbCommand> 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_gdbVersion; // 6.8.0 is 680
int m_gdbBuildVersion; // MAC only? int m_gdbBuildVersion; // MAC only?
bool m_isSynchroneous; // Can act synchroneously? bool m_isSynchroneous; // Can act synchroneously?
// awful hack to keep track of used files private: ////////// Inferior Management //////////
QMap<QString, QString> m_shortToFullName;
QMap<QString, QString> m_fullToShortName; 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 // Breakpoint specific stuff
@@ -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:
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;
// Tooltip specific stuff QString m_currentFrame;
//
void sendToolTipCommand(const QString &command, const QString &cookie);
// //
// Watch specific stuff // 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 // 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:
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);
void handleStackListArguments(const GdbResponse &response); WatchData localVariable(const GdbMi &item,
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, const QStringList &uninitializedVariables,
QMap<QByteArray, int> *seen); QMap<QByteArray, int> *seen);
void connectDebuggingHelperActions(); void setLocals(const QList<GdbMi> &locals);
void disconnectDebuggingHelperActions(); void handleStackListArguments(const GdbResponse &response);
AbstractGdbAdapter *createAdapter(const DebuggerStartParametersPtr &dp); void setWatchDataType(WatchData &data, const GdbMi &mi);
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
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; 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<GdbCommand> m_commandsToRunOnTemporaryBreak; const bool m_dumperInjectionLoad;
DebuggingHelperState m_debuggingHelperState;
QtDumperHelper m_dumperHelper;
DebuggerStartParametersPtr m_startParameters; private: ////////// Convenience Functions //////////
// make sure to re-initialize new members in initializeVariables();
QSharedPointer<TrkOptions> m_trkOptions;
AbstractGdbAdapter *m_gdbAdapter;
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