2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef DEBUGGER_GDBENGINE_H
|
|
|
|
|
#define DEBUGGER_GDBENGINE_H
|
|
|
|
|
|
2013-08-29 16:36:42 +02:00
|
|
|
#include <debugger/debuggerengine.h>
|
2010-06-30 14:39:41 +02:00
|
|
|
|
2015-01-10 01:07:01 +01:00
|
|
|
#include <debugger/breakhandler.h>
|
2013-08-29 16:36:42 +02:00
|
|
|
#include <debugger/watchhandler.h>
|
|
|
|
|
#include <debugger/watchutils.h>
|
2014-07-10 18:10:56 +02:00
|
|
|
#include <debugger/debuggertooltipmanager.h>
|
2009-02-20 12:33:16 +01:00
|
|
|
|
2012-12-29 01:31:08 +01:00
|
|
|
#include <coreplugin/id.h>
|
|
|
|
|
|
2013-11-04 09:47:34 +01:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
2015-06-08 12:10:11 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2013-11-04 09:47:34 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QProcess>
|
|
|
|
|
#include <QTextCodec>
|
|
|
|
|
#include <QTime>
|
|
|
|
|
#include <QTimer>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-09-09 16:42:32 +02:00
|
|
|
class GdbProcess;
|
2012-03-30 17:36:44 +02:00
|
|
|
class DebugInfoTask;
|
|
|
|
|
class DebugInfoTaskHandler;
|
2015-02-05 15:47:07 +01:00
|
|
|
class DebuggerResponse;
|
2008-12-02 12:01:29 +01:00
|
|
|
class GdbMi;
|
2013-11-05 18:47:03 +01:00
|
|
|
class MemoryAgentCookie;
|
2015-01-10 01:07:01 +01:00
|
|
|
class BreakpointParameters;
|
|
|
|
|
class BreakpointResponse;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-04-12 12:01:40 +02:00
|
|
|
class DisassemblerAgentCookie;
|
2010-11-24 15:55:09 +01:00
|
|
|
class DisassemblerLines;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2014-12-12 15:33:16 +01:00
|
|
|
class GdbEngine : public DebuggerEngine
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2015-05-27 13:59:56 +02:00
|
|
|
explicit GdbEngine(const DebuggerRunParameters &runParameters);
|
2008-12-02 12:01:29 +01:00
|
|
|
~GdbEngine();
|
2009-09-11 12:30:53 +02:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
private: ////////// General Interface //////////
|
2015-03-04 17:43:59 +01:00
|
|
|
virtual DebuggerEngine *cppEngine() { return this; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-06-13 10:15:56 +02:00
|
|
|
virtual void setupEngine() = 0;
|
|
|
|
|
virtual void handleGdbStartFailed();
|
|
|
|
|
virtual void setupInferior() = 0;
|
|
|
|
|
virtual void notifyInferiorSetupFailed();
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
virtual bool hasCapability(unsigned) const;
|
2009-10-15 12:32:49 +02:00
|
|
|
virtual void detachDebugger();
|
2010-07-09 17:07:59 +02:00
|
|
|
virtual void shutdownInferior();
|
2012-06-13 10:15:56 +02:00
|
|
|
virtual void shutdownEngine() = 0;
|
2011-10-31 16:15:48 +01:00
|
|
|
virtual void abortDebugger();
|
2014-06-05 17:22:51 +02:00
|
|
|
virtual void resetInferior();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-16 12:41:06 +01:00
|
|
|
virtual bool acceptsDebuggerCommands() const;
|
2012-04-10 09:36:15 +02:00
|
|
|
virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
private: ////////// General State //////////
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
DebuggerStartMode startMode() const;
|
2010-09-23 11:15:56 +02:00
|
|
|
Q_SLOT void reloadLocals();
|
2009-08-12 10:51:25 +02:00
|
|
|
|
2009-10-30 16:42:33 +01:00
|
|
|
bool m_registerNamesListed;
|
2009-08-14 13:04:05 +02:00
|
|
|
|
2012-06-13 10:15:56 +02:00
|
|
|
protected: ////////// Gdb Process Management //////////
|
2009-01-27 15:53:50 +01:00
|
|
|
|
2012-06-05 19:55:32 +02:00
|
|
|
void startGdb(const QStringList &args = QStringList());
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleInferiorShutdown(const DebuggerResponse &response);
|
|
|
|
|
void handleGdbExit(const DebuggerResponse &response);
|
2009-10-20 11:02:16 +02:00
|
|
|
|
2011-12-05 08:53:51 +02:00
|
|
|
void loadInitScript();
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-07-08 12:41:26 +02:00
|
|
|
// Something went wrong with the adapter *before* adapterStarted() was emitted.
|
|
|
|
|
// Make sure to clean up everything before emitting this signal.
|
2010-03-03 18:08:18 +01:00
|
|
|
void handleAdapterStartFailed(const QString &msg,
|
2012-12-29 01:31:08 +01:00
|
|
|
Core::Id settingsIdHint = Core::Id());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-08 12:41:26 +02:00
|
|
|
// This triggers the initial breakpoint synchronization and causes
|
2010-07-08 18:10:50 +02:00
|
|
|
// finishInferiorSetup() being called once done.
|
2009-10-19 19:04:01 +02:00
|
|
|
void handleInferiorPrepared();
|
2010-07-08 18:10:50 +02:00
|
|
|
// This notifies the base of a successful inferior setup.
|
|
|
|
|
void finishInferiorSetup();
|
2009-10-19 19:04:01 +02:00
|
|
|
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleDebugInfoLocation(const DebuggerResponse &response);
|
2012-05-10 16:22:06 +02:00
|
|
|
|
2010-07-08 12:41:26 +02:00
|
|
|
// The adapter is still running just fine, but it failed to acquire a debuggee.
|
2010-07-09 17:07:59 +02:00
|
|
|
void notifyInferiorSetupFailed(const QString &msg);
|
|
|
|
|
|
|
|
|
|
void notifyAdapterShutdownOk();
|
|
|
|
|
void notifyAdapterShutdownFailed();
|
2009-10-15 12:32:49 +02:00
|
|
|
|
2010-07-08 12:41:26 +02:00
|
|
|
// Something went wrong with the adapter *after* adapterStarted() was emitted.
|
|
|
|
|
// Make sure to clean up everything before emitting this signal.
|
2009-10-15 12:32:49 +02:00
|
|
|
void handleAdapterCrashed(const QString &msg);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-08 12:41:26 +02:00
|
|
|
private slots:
|
2015-02-12 13:50:54 +01:00
|
|
|
friend class GdbPlainEngine;
|
2013-11-04 09:47:34 +01:00
|
|
|
void handleInterruptDeviceInferior(const QString &error);
|
2015-03-05 11:11:32 +01:00
|
|
|
void handleGdbFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
2010-07-08 12:41:26 +02:00
|
|
|
void handleGdbError(QProcess::ProcessError error);
|
2015-02-12 13:50:54 +01:00
|
|
|
void readDebugeeOutput(const QByteArray &data);
|
2010-07-08 12:41:26 +02:00
|
|
|
void readGdbStandardOutput();
|
|
|
|
|
void readGdbStandardError();
|
|
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
private:
|
|
|
|
|
QTextCodec *m_outputCodec;
|
|
|
|
|
QTextCodec::ConverterState m_outputCodecState;
|
|
|
|
|
|
|
|
|
|
QByteArray m_inbuffer;
|
2009-10-27 12:05:03 +01:00
|
|
|
bool m_busy;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-05-19 12:00:01 +02:00
|
|
|
// Name of the convenience variable containing the last
|
|
|
|
|
// known function return value.
|
|
|
|
|
QByteArray m_resultVarName;
|
|
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
private: ////////// Gdb Command Management //////////
|
|
|
|
|
|
2010-03-03 18:08:18 +01:00
|
|
|
public: // Otherwise the Qt flag macros are unhappy.
|
2009-05-04 18:30:22 +02:00
|
|
|
enum GdbCommandFlag {
|
|
|
|
|
NoFlags = 0,
|
2010-03-03 18:08:18 +01:00
|
|
|
// The command needs a stopped inferior.
|
2010-12-16 12:05:48 +01:00
|
|
|
NeedsStop = 1,
|
2010-03-03 18:08:18 +01:00
|
|
|
// No need to wait for the reply before continuing inferior.
|
|
|
|
|
Discardable = 2,
|
2010-06-28 14:55:19 +02:00
|
|
|
// We can live without receiving an answer.
|
2010-03-03 18:08:18 +01:00
|
|
|
NonCriticalResponse = 8,
|
2015-02-05 15:47:07 +01:00
|
|
|
// Callback expects ResultRunning instead of ResultDone.
|
2010-03-03 18:08:18 +01:00
|
|
|
RunRequest = 16,
|
2015-02-05 15:47:07 +01:00
|
|
|
// Callback expects ResultExit instead of ResultDone.
|
2010-03-03 18:08:18 +01:00
|
|
|
ExitRequest = 32,
|
|
|
|
|
// Auto-set inferior shutdown related states.
|
|
|
|
|
LosesChild = 64,
|
|
|
|
|
// Trigger breakpoint model rebuild when no such commands are pending anymore.
|
|
|
|
|
RebuildBreakpointModel = 128,
|
2010-04-09 14:53:45 +02:00
|
|
|
// This command needs to be send immediately.
|
|
|
|
|
Immediate = 256,
|
2010-06-28 14:53:31 +02:00
|
|
|
// This is a command that needs to be wrapped into -interpreter-exec console
|
2010-12-16 12:05:48 +01:00
|
|
|
ConsoleCommand = 512
|
2009-05-04 18:30:22 +02:00
|
|
|
};
|
|
|
|
|
Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag)
|
|
|
|
|
|
2010-03-03 18:08:18 +01:00
|
|
|
// Type and cookie are sender-internal data, opaque for the "event
|
2008-12-02 12:01:29 +01:00
|
|
|
// queue". resultNeeded == true increments m_pendingResults on
|
2009-09-24 11:45:08 +02:00
|
|
|
// send and decrements on receipt, effectively preventing
|
2008-12-02 12:01:29 +01:00
|
|
|
// watch model updates before everything is finished.
|
2015-02-06 10:30:25 +01:00
|
|
|
void flushCommand(const DebuggerCommand &cmd);
|
2012-06-13 10:15:56 +02:00
|
|
|
protected:
|
2015-02-04 10:48:33 +01:00
|
|
|
void runCommand(const DebuggerCommand &command);
|
2010-01-05 16:51:55 +01:00
|
|
|
void postCommand(const QByteArray &command,
|
2015-02-06 10:30:25 +01:00
|
|
|
int flags = NoFlags,
|
|
|
|
|
DebuggerCommand::Callback callback = DebuggerCommand::Callback());
|
2012-06-13 10:15:56 +02:00
|
|
|
private:
|
2009-11-02 16:40:16 +01:00
|
|
|
void flushQueuedCommands();
|
2009-11-03 14:56:27 +01:00
|
|
|
Q_SLOT void commandTimeout();
|
2008-12-02 12:01:29 +01:00
|
|
|
void setTokenBarrier();
|
|
|
|
|
|
2011-06-06 18:17:51 +02:00
|
|
|
// Sets up an "unexpected result" for the following commeand.
|
|
|
|
|
void scheduleTestResponse(int testCase, const QByteArray &response);
|
|
|
|
|
|
2015-02-06 10:30:25 +01:00
|
|
|
QHash<int, DebuggerCommand> m_commandForToken;
|
2009-12-11 16:59:34 +01:00
|
|
|
int commandTimeoutTime() const;
|
2010-11-16 12:42:57 +01:00
|
|
|
QTimer m_commandTimer;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
QByteArray m_pendingConsoleStreamOutput;
|
|
|
|
|
QByteArray m_pendingLogStreamOutput;
|
2009-10-09 16:35:52 +02:00
|
|
|
|
2010-03-03 18:08:18 +01:00
|
|
|
// This contains the first token number for the current round
|
2009-10-15 12:32:49 +02:00
|
|
|
// of evaluation. Responses with older tokens are considers
|
|
|
|
|
// out of date and discarded.
|
|
|
|
|
int m_oldestAcceptableToken;
|
2011-12-13 15:40:31 +01:00
|
|
|
int m_nonDiscardableCount;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-03 18:08:18 +01:00
|
|
|
int m_pendingBreakpointRequests; // Watch updating commands in flight
|
2009-09-21 11:09:38 +02:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
typedef void (GdbEngine::*CommandsDoneCallback)();
|
2010-03-03 18:08:18 +01:00
|
|
|
// This function is called after all previous responses have been received.
|
2009-10-15 12:32:49 +02:00
|
|
|
CommandsDoneCallback m_commandsDoneCallback;
|
2009-09-21 11:09:38 +02:00
|
|
|
|
2015-02-06 10:30:25 +01:00
|
|
|
QList<DebuggerCommand> m_commandsToRunOnTemporaryBreak;
|
2009-10-15 12:32:49 +02:00
|
|
|
|
|
|
|
|
private: ////////// Gdb Output, State & Capability Handling //////////
|
2012-06-13 10:15:56 +02:00
|
|
|
protected:
|
2011-06-06 18:17:51 +02:00
|
|
|
Q_SLOT void handleResponse(const QByteArray &buff);
|
2009-10-09 10:20:42 +02:00
|
|
|
void handleStopResponse(const GdbMi &data);
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleResultRecord(DebuggerResponse *response);
|
2009-10-09 10:59:56 +02:00
|
|
|
void handleStop1(const GdbMi &data);
|
2012-04-17 10:00:40 +02:00
|
|
|
void handleStop2(const GdbMi &data);
|
2010-12-17 13:07:17 +01:00
|
|
|
Q_SLOT void handleStop2();
|
2009-10-15 12:32:49 +02:00
|
|
|
StackFrame parseStackFrame(const GdbMi &mi, int level);
|
2010-08-11 09:46:39 +02:00
|
|
|
void resetCommandQueue();
|
2009-10-15 12:32:49 +02:00
|
|
|
|
2013-11-27 16:10:14 +01:00
|
|
|
bool isSynchronous() const { return true; }
|
2009-10-15 12:32:49 +02:00
|
|
|
|
|
|
|
|
// Gdb initialization sequence
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleShowVersion(const DebuggerResponse &response);
|
|
|
|
|
void handleListFeatures(const DebuggerResponse &response);
|
|
|
|
|
void handlePythonSetup(const DebuggerResponse &response);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-11-27 16:10:14 +01:00
|
|
|
int m_gdbVersion; // 7.6.1 is 70601
|
2012-02-10 07:42:44 +01:00
|
|
|
bool m_isQnxGdb;
|
2009-09-14 11:02:36 +02:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
private: ////////// Inferior Management //////////
|
2009-05-14 15:03:30 +02:00
|
|
|
|
2009-10-22 22:54:30 +02:00
|
|
|
// This should be always the last call in a function.
|
2010-11-10 16:33:11 +01:00
|
|
|
bool stateAcceptsBreakpointChanges() const;
|
2015-01-10 01:07:01 +01:00
|
|
|
bool acceptsBreakpoint(Breakpoint bp) const;
|
|
|
|
|
void insertBreakpoint(Breakpoint bp);
|
|
|
|
|
void removeBreakpoint(Breakpoint bp);
|
|
|
|
|
void changeBreakpoint(Breakpoint bp);
|
2010-11-10 16:33:11 +01:00
|
|
|
|
|
|
|
|
void executeStep();
|
|
|
|
|
void executeStepOut();
|
|
|
|
|
void executeNext();
|
|
|
|
|
void executeStepI();
|
|
|
|
|
void executeNextI();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-06-13 10:15:56 +02:00
|
|
|
protected:
|
2009-10-15 12:32:49 +02:00
|
|
|
void continueInferiorInternal();
|
|
|
|
|
void autoContinueInferior();
|
2010-11-10 16:33:11 +01:00
|
|
|
void continueInferior();
|
|
|
|
|
void interruptInferior();
|
2012-06-13 10:15:56 +02:00
|
|
|
virtual void interruptInferior2() {}
|
2009-11-02 16:59:57 +01:00
|
|
|
void interruptInferiorTemporarily();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-23 10:16:11 +01:00
|
|
|
void executeRunToLine(const ContextData &data);
|
2010-11-10 16:33:11 +01:00
|
|
|
void executeRunToFunction(const QString &functionName);
|
2011-02-23 10:16:11 +01:00
|
|
|
void executeJumpToLine(const ContextData &data);
|
2010-11-10 16:33:11 +01:00
|
|
|
void executeReturn();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleExecuteContinue(const DebuggerResponse &response);
|
|
|
|
|
void handleExecuteStep(const DebuggerResponse &response);
|
|
|
|
|
void handleExecuteNext(const DebuggerResponse &response);
|
|
|
|
|
void handleExecuteReturn(const DebuggerResponse &response);
|
|
|
|
|
void handleExecuteJumpToLine(const DebuggerResponse &response);
|
|
|
|
|
void handleExecuteRunToLine(const DebuggerResponse &response);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
void maybeHandleInferiorPidChanged(const QString &pid);
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleInfoProc(const DebuggerResponse &response);
|
2013-11-27 16:10:14 +01:00
|
|
|
QString msgPtraceError(DebuggerStartMode sm);
|
2009-11-09 22:11:56 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
private: ////////// View & Data Stuff //////////
|
|
|
|
|
|
2012-10-19 16:37:57 +02:00
|
|
|
void selectThread(ThreadId threadId);
|
2010-11-10 16:33:11 +01:00
|
|
|
void activateFrame(int index);
|
2009-10-15 12:32:49 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
//
|
|
|
|
|
// Breakpoint specific stuff
|
|
|
|
|
//
|
2011-06-24 19:02:12 +02:00
|
|
|
void handleBreakModifications(const GdbMi &bkpts);
|
2015-02-06 01:26:47 +01:00
|
|
|
void handleBreakIgnore(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleBreakDisable(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleBreakEnable(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleBreakInsert1(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleBreakInsert2(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleBreakCondition(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleBreakThreadSpec(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleBreakLineNumber(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleWatchInsert(const DebuggerResponse &response, Breakpoint bp);
|
|
|
|
|
void handleCatchInsert(const DebuggerResponse &response, Breakpoint bp);
|
2015-01-10 01:07:01 +01:00
|
|
|
void handleBkpt(const GdbMi &bkpt, Breakpoint bp);
|
2011-06-15 14:02:26 +02:00
|
|
|
void updateResponse(BreakpointResponse &response, const GdbMi &bkpt);
|
2015-01-10 01:07:01 +01:00
|
|
|
QByteArray breakpointLocation(const BreakpointParameters &data); // For gdb/MI.
|
|
|
|
|
QByteArray breakpointLocation2(const BreakpointParameters &data); // For gdb/CLI fallback.
|
2009-10-22 22:54:30 +02:00
|
|
|
QString breakLocation(const QString &file) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Modules specific stuff
|
|
|
|
|
//
|
2013-11-27 16:10:14 +01:00
|
|
|
protected:
|
2010-11-10 16:33:11 +01:00
|
|
|
void loadSymbols(const QString &moduleName);
|
2012-06-13 10:15:56 +02:00
|
|
|
Q_SLOT void loadAllSymbols();
|
2010-12-21 13:34:59 +01:00
|
|
|
void loadSymbolsForStack();
|
2010-11-10 16:33:11 +01:00
|
|
|
void requestModuleSymbols(const QString &moduleName);
|
2012-11-07 18:31:17 +01:00
|
|
|
void requestModuleSections(const QString &moduleName);
|
2010-11-10 16:33:11 +01:00
|
|
|
void reloadModules();
|
|
|
|
|
void examineModules();
|
2013-11-27 16:10:14 +01:00
|
|
|
|
2009-10-28 22:08:58 +01:00
|
|
|
void reloadModulesInternal();
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleModulesList(const DebuggerResponse &response);
|
2015-02-06 01:26:47 +01:00
|
|
|
void handleShowModuleSections(const DebuggerResponse &response, const QString &moduleName);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-02 17:25:14 +01:00
|
|
|
//
|
|
|
|
|
// Snapshot specific stuff
|
|
|
|
|
//
|
2010-07-21 09:42:33 +02:00
|
|
|
virtual void createSnapshot();
|
2015-02-06 01:26:47 +01:00
|
|
|
void handleMakeSnapshot(const DebuggerResponse &response, const QString &coreFile);
|
2010-02-02 17:25:14 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
//
|
|
|
|
|
// Register specific stuff
|
2009-09-24 11:45:08 +02:00
|
|
|
//
|
2010-11-10 16:33:11 +01:00
|
|
|
Q_SLOT void reloadRegisters();
|
2014-12-17 13:14:29 +01:00
|
|
|
void setRegisterValue(const QByteArray &name, const QString &value);
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleRegisterListNames(const DebuggerResponse &response);
|
|
|
|
|
void handleRegisterListValues(const DebuggerResponse &response);
|
|
|
|
|
void handleMaintPrintRegisters(const DebuggerResponse &response);
|
2014-12-17 13:14:29 +01:00
|
|
|
QHash<int, QByteArray> m_registerNames; // Map GDB register numbers to indices
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
//
|
|
|
|
|
// Disassembler specific stuff
|
|
|
|
|
//
|
2011-02-10 13:43:02 +01:00
|
|
|
// Chain of fallbacks: PointMixed -> PointPlain -> RangeMixed -> RangePlain.
|
2010-12-14 12:29:32 +01:00
|
|
|
void fetchDisassembler(DisassemblerAgent *agent);
|
2011-02-10 13:43:02 +01:00
|
|
|
void fetchDisassemblerByCliPointMixed(const DisassemblerAgentCookie &ac);
|
|
|
|
|
void fetchDisassemblerByCliRangeMixed(const DisassemblerAgentCookie &ac);
|
|
|
|
|
void fetchDisassemblerByCliRangePlain(const DisassemblerAgentCookie &ac);
|
2014-04-11 18:35:37 +02:00
|
|
|
bool handleCliDisassemblerResult(const QByteArray &response, DisassemblerAgent *agent);
|
2011-02-10 13:43:02 +01:00
|
|
|
|
2015-02-06 01:26:47 +01:00
|
|
|
void handleBreakOnQFatal(const DebuggerResponse &response, bool continueSetup);
|
2014-04-11 18:35:37 +02:00
|
|
|
|
2009-02-17 14:08:49 +01:00
|
|
|
//
|
|
|
|
|
// Source file specific stuff
|
2009-09-24 11:45:08 +02:00
|
|
|
//
|
2010-11-10 16:33:11 +01:00
|
|
|
void reloadSourceFiles();
|
2009-10-28 22:08:58 +01:00
|
|
|
void reloadSourceFilesInternal();
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleQuerySources(const DebuggerResponse &response);
|
2009-10-15 12:32:49 +02:00
|
|
|
|
|
|
|
|
QString fullName(const QString &fileName);
|
2009-10-28 11:59:57 +01:00
|
|
|
QString cleanupFullName(const QString &fileName);
|
2009-10-15 12:32:49 +02:00
|
|
|
|
|
|
|
|
// awful hack to keep track of used files
|
|
|
|
|
QMap<QString, QString> m_shortToFullName;
|
|
|
|
|
QMap<QString, QString> m_fullToShortName;
|
2012-03-23 17:53:30 +01:00
|
|
|
QMultiMap<QString, QString> m_baseNameToFullName;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-22 22:54:30 +02:00
|
|
|
bool m_sourcesListUpdating;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
//
|
|
|
|
|
// Stack specific stuff
|
2009-09-24 11:45:08 +02:00
|
|
|
//
|
2012-06-13 10:15:56 +02:00
|
|
|
protected:
|
2009-10-15 12:32:49 +02:00
|
|
|
void updateAll();
|
2015-02-06 01:26:47 +01:00
|
|
|
void handleStackListFrames(const DebuggerResponse &response, bool isFull);
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleStackSelectThread(const DebuggerResponse &response);
|
|
|
|
|
void handleThreadListIds(const DebuggerResponse &response);
|
|
|
|
|
void handleThreadInfo(const DebuggerResponse &response);
|
|
|
|
|
void handleThreadNames(const DebuggerResponse &response);
|
2015-02-11 16:05:55 +01:00
|
|
|
DebuggerCommand stackCommand(int depth);
|
2015-02-06 01:26:47 +01:00
|
|
|
Q_SLOT void reloadStack();
|
2009-10-28 21:33:41 +01:00
|
|
|
Q_SLOT virtual void reloadFullStack();
|
2014-02-07 18:10:02 +01:00
|
|
|
virtual void loadAdditionalQmlStack();
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleQmlStackFrameArguments(const DebuggerResponse &response);
|
|
|
|
|
void handleQmlStackTrace(const DebuggerResponse &response);
|
2009-10-15 12:32:49 +02:00
|
|
|
int currentFrame() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
QList<GdbMi> m_currentFunctionArgs;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
//
|
2009-10-15 12:32:49 +02:00
|
|
|
// Watch specific stuff
|
2009-09-24 11:45:08 +02:00
|
|
|
//
|
2015-03-06 13:36:42 +01:00
|
|
|
virtual bool setToolTipExpression(const DebuggerToolTipContext &);
|
2015-03-19 12:42:53 +01:00
|
|
|
virtual void assignValueInDebugger(WatchItem *item,
|
2010-11-18 13:38:58 +01:00
|
|
|
const QString &expr, const QVariant &value);
|
2009-10-15 12:32:49 +02:00
|
|
|
|
2010-12-14 12:29:32 +01:00
|
|
|
virtual void fetchMemory(MemoryAgent *agent, QObject *token,
|
2010-02-17 17:33:42 +01:00
|
|
|
quint64 addr, quint64 length);
|
2013-11-05 18:47:03 +01:00
|
|
|
void fetchMemoryHelper(const MemoryAgentCookie &cookie);
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleChangeMemory(const DebuggerResponse &response);
|
2011-02-25 13:21:54 +01:00
|
|
|
virtual void changeMemory(MemoryAgent *agent, QObject *token,
|
|
|
|
|
quint64 addr, const QByteArray &data);
|
2015-02-06 01:26:47 +01:00
|
|
|
void handleFetchMemory(const DebuggerResponse &response, MemoryAgentCookie ac);
|
2009-10-15 12:32:49 +02:00
|
|
|
|
|
|
|
|
virtual void watchPoint(const QPoint &);
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleWatchPoint(const DebuggerResponse &response);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-03-19 12:42:53 +01:00
|
|
|
void updateWatchItem(WatchItem *item);
|
2012-05-18 02:28:41 +02:00
|
|
|
void showToolTip();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleVarAssign(const DebuggerResponse &response);
|
|
|
|
|
void handleDetach(const DebuggerResponse &response);
|
2012-03-28 09:37:02 +02:00
|
|
|
void handleThreadGroupCreated(const GdbMi &result);
|
|
|
|
|
void handleThreadGroupExited(const GdbMi &result);
|
|
|
|
|
|
2010-03-29 18:44:02 +02:00
|
|
|
Q_SLOT void createFullBacktrace();
|
2015-02-05 15:47:07 +01:00
|
|
|
void handleCreateFullBacktrace(const DebuggerResponse &response);
|
2010-03-29 18:44:02 +02:00
|
|
|
|
2011-05-26 15:13:37 +02:00
|
|
|
void updateLocals();
|
2015-03-26 13:03:38 +01:00
|
|
|
void doUpdateLocals(const UpdateParameters ¶meters);
|
|
|
|
|
void handleStackFramePython(const DebuggerResponse &response);
|
2010-01-29 22:49:55 +01:00
|
|
|
|
2009-10-15 12:32:49 +02:00
|
|
|
void setLocals(const QList<GdbMi> &locals);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
//
|
|
|
|
|
// Dumper Management
|
|
|
|
|
//
|
2013-01-10 12:40:50 +01:00
|
|
|
void reloadDebuggingHelpers();
|
2009-09-22 10:50:44 +02:00
|
|
|
|
2010-04-08 16:55:25 +02:00
|
|
|
QString m_gdb;
|
2009-10-05 14:59:39 +02:00
|
|
|
|
2010-12-16 12:05:48 +01:00
|
|
|
//
|
2010-06-16 11:08:54 +02:00
|
|
|
// Convenience Functions
|
|
|
|
|
//
|
2009-10-07 17:37:15 +02:00
|
|
|
QString errorMessage(QProcess::ProcessError error);
|
2010-07-09 17:07:59 +02:00
|
|
|
void showExecutionError(const QString &message);
|
2010-01-14 15:25:53 +01:00
|
|
|
|
2010-07-07 16:30:42 +02:00
|
|
|
static QByteArray tooltipIName(const QString &exp);
|
2011-02-11 15:00:13 +01:00
|
|
|
|
2010-12-17 13:07:17 +01:00
|
|
|
// For short-circuiting stack and thread list evaluation.
|
|
|
|
|
bool m_stackNeeded;
|
|
|
|
|
|
2011-06-24 16:25:30 +02:00
|
|
|
bool isQFatalBreakpoint(const BreakpointResponseId &id) const;
|
|
|
|
|
bool isHiddenBreakpoint(const BreakpointResponseId &id) const;
|
2011-01-19 10:48:39 +01:00
|
|
|
|
2010-06-30 14:39:41 +02:00
|
|
|
// HACK:
|
2010-12-20 16:28:26 +01:00
|
|
|
QByteArray m_currentThread;
|
2011-01-21 16:42:57 +01:00
|
|
|
QString m_lastWinException;
|
2012-03-30 17:36:44 +02:00
|
|
|
QString m_lastMissingDebugInfo;
|
2011-06-24 16:25:30 +02:00
|
|
|
BreakpointResponseId m_qFatalBreakpointResponseId;
|
2012-08-29 11:42:28 +02:00
|
|
|
bool m_terminalTrap;
|
2011-06-06 18:17:51 +02:00
|
|
|
|
2012-03-09 15:04:59 +01:00
|
|
|
bool usesExecInterrupt() const;
|
|
|
|
|
|
2011-06-06 18:17:51 +02:00
|
|
|
QHash<int, QByteArray> m_scheduledTestResponses;
|
|
|
|
|
QSet<int> m_testCases;
|
2012-03-30 17:36:44 +02:00
|
|
|
|
|
|
|
|
// Debug information
|
|
|
|
|
friend class DebugInfoTaskHandler;
|
|
|
|
|
void requestDebugInformation(const DebugInfoTask &task);
|
|
|
|
|
DebugInfoTaskHandler *m_debugInfoTaskHandler;
|
2012-04-17 10:00:40 +02:00
|
|
|
|
|
|
|
|
// Indicates whether we had at least one full attempt to load
|
|
|
|
|
// debug information.
|
|
|
|
|
bool attemptQuickStart() const;
|
|
|
|
|
bool m_fullStartDone;
|
2013-03-21 17:32:34 +01:00
|
|
|
bool m_systemDumpersLoaded;
|
2012-05-18 02:28:41 +02:00
|
|
|
|
2012-06-13 10:15:56 +02:00
|
|
|
static QString msgGdbStopFailed(const QString &why);
|
|
|
|
|
static QString msgInferiorStopFailed(const QString &why);
|
|
|
|
|
static QString msgAttachedToStoppedInferior();
|
|
|
|
|
static QString msgInferiorSetupOk();
|
|
|
|
|
static QString msgInferiorRunOk();
|
|
|
|
|
static QString msgConnectRemoteServerFailed(const QString &why);
|
2013-01-24 16:33:17 +01:00
|
|
|
static QByteArray dotEscape(QByteArray str);
|
2012-06-13 10:15:56 +02:00
|
|
|
|
2014-01-04 01:34:51 +01:00
|
|
|
void debugLastCommand();
|
2015-02-11 17:51:15 +01:00
|
|
|
DebuggerCommand m_lastDebuggableCommand;
|
2014-01-04 01:34:51 +01:00
|
|
|
|
2012-06-13 10:15:56 +02:00
|
|
|
protected:
|
|
|
|
|
virtual void write(const QByteArray &data);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
bool prepareCommand();
|
|
|
|
|
void interruptLocalInferior(qint64 pid);
|
2013-09-09 16:42:32 +02:00
|
|
|
|
2015-06-08 12:10:11 +02:00
|
|
|
protected:
|
|
|
|
|
Utils::QtcProcess m_gdbProc;
|
|
|
|
|
QString m_errorString;
|
2013-11-04 09:47:34 +01:00
|
|
|
ProjectExplorer::DeviceProcessSignalOperation::Ptr m_signalOperation;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2009-05-04 18:30:22 +02:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Debugger::Internal::GdbEngine::GdbCommandFlags)
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif // DEBUGGER_GDBENGINE_H
|