2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "debuggerplugin.h"
|
|
|
|
|
|
2009-03-17 17:00:06 +01:00
|
|
|
#include "debuggeractions.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "debuggeragents.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "debuggerconstants.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "debuggerdialogs.h"
|
|
|
|
|
#include "debuggerengine.h"
|
|
|
|
|
#include "debuggermainwindow.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "debuggerrunner.h"
|
2009-09-25 15:02:16 +02:00
|
|
|
#include "debuggerstringutils.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "debuggertooltip.h"
|
2010-02-09 20:44:40 +01:00
|
|
|
#include "debuggeruiswitcher.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-04 09:54:23 +01:00
|
|
|
#include "breakpoint.h"
|
|
|
|
|
#include "breakhandler.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "breakwindow.h"
|
2010-09-22 12:25:42 +02:00
|
|
|
#include "consolewindow.h"
|
2010-09-22 16:20:08 +02:00
|
|
|
#include "logwindow.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "moduleswindow.h"
|
|
|
|
|
#include "registerwindow.h"
|
|
|
|
|
#include "snapshotwindow.h"
|
|
|
|
|
#include "stackwindow.h"
|
|
|
|
|
#include "sourcefileswindow.h"
|
|
|
|
|
#include "threadswindow.h"
|
2010-11-04 18:11:09 +01:00
|
|
|
#include "watchhandler.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "watchwindow.h"
|
|
|
|
|
|
2010-07-21 13:11:03 +02:00
|
|
|
#include "snapshothandler.h"
|
|
|
|
|
#include "threadshandler.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
#include "ui_commonoptionspage.h"
|
2009-03-23 12:28:02 +01:00
|
|
|
#include "ui_dumperoptionpage.h"
|
2009-01-14 18:09:02 +01:00
|
|
|
|
2009-01-13 13:39:31 +01:00
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
2010-03-18 10:59:06 +01:00
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
|
|
|
|
#include <coreplugin/actionmanager/command.h>
|
2010-11-02 16:53:56 +01:00
|
|
|
#include <coreplugin/uniqueidmanager.h>
|
2009-01-13 18:15:24 +01:00
|
|
|
#include <coreplugin/basemode.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/coreconstants.h>
|
2009-01-14 18:09:02 +01:00
|
|
|
#include <coreplugin/dialogs/ioptionspage.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
2009-01-13 18:15:24 +01:00
|
|
|
#include <coreplugin/findplaceholder.h>
|
2010-06-25 12:56:16 +02:00
|
|
|
#include <coreplugin/icontext.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2010-08-18 13:54:12 +02:00
|
|
|
#include <coreplugin/imode.h>
|
2009-10-26 18:05:11 +01:00
|
|
|
#include <coreplugin/icorelistener.h>
|
2010-06-11 16:31:54 +02:00
|
|
|
#include <coreplugin/manhattanstyle.h>
|
2009-01-13 18:15:24 +01:00
|
|
|
#include <coreplugin/minisplitter.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/modemanager.h>
|
2008-12-09 16:18:28 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <cppeditor/cppeditorconstants.h>
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <cpptools/cppmodelmanagerinterface.h>
|
2008-12-09 16:18:28 +01:00
|
|
|
|
2009-01-20 11:52:04 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
|
|
|
|
|
2010-06-11 16:31:54 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2009-01-28 14:29:54 +01:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/session.h>
|
2010-07-21 17:06:22 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2010-11-01 14:14:17 +01:00
|
|
|
#include <projectexplorer/toolchaintype.h>
|
2008-12-09 16:18:28 +01:00
|
|
|
|
|
|
|
|
#include <texteditor/basetexteditor.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <texteditor/basetextmark.h>
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <texteditor/fontsettings.h>
|
2010-04-19 16:42:02 +02:00
|
|
|
#include <texteditor/texteditorsettings.h>
|
2008-12-09 16:18:28 +01:00
|
|
|
|
|
|
|
|
#include <utils/qtcassert.h>
|
2010-03-18 10:59:06 +01:00
|
|
|
#include <utils/savedaction.h>
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <utils/styledbar.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-08-26 16:02:41 +02:00
|
|
|
#include <qml/scriptconsole.h>
|
|
|
|
|
|
2009-05-25 16:22:11 +02:00
|
|
|
#include <QtCore/QTimer>
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <QtCore/QtPlugin>
|
|
|
|
|
#include <QtGui/QComboBox>
|
2009-01-13 17:41:23 +01:00
|
|
|
#include <QtGui/QDockWidget>
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <QtGui/QFileDialog>
|
|
|
|
|
#include <QtGui/QMessageBox>
|
2009-10-01 16:38:08 +02:00
|
|
|
#include <QtGui/QToolButton>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-08-12 10:51:25 +02:00
|
|
|
#include <climits>
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
#define DEBUG_STATE 1
|
|
|
|
|
#ifdef DEBUG_STATE
|
|
|
|
|
//# define STATE_DEBUG(s)
|
|
|
|
|
// do { QString msg; QTextStream ts(&msg); ts << s;
|
|
|
|
|
// showMessage(msg, LogDebug); } while (0)
|
|
|
|
|
# define STATE_DEBUG(s) do { qDebug() << s; } while(0)
|
|
|
|
|
#else
|
|
|
|
|
# define STATE_DEBUG(s)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Note: the Debugger process itself and any helper processes like
|
2010-07-08 11:44:00 +02:00
|
|
|
// gdbserver, the trk client etc are referred to as 'Engine',
|
2010-06-16 11:08:54 +02:00
|
|
|
// whereas the debugged process is referred to as 'Inferior'.
|
|
|
|
|
//
|
2010-07-08 11:44:00 +02:00
|
|
|
// Transitions marked by '---' are done in the individual engines.
|
|
|
|
|
// Transitions marked by '+-+' are done in the base DebuggerEngine.
|
2010-07-09 17:07:59 +02:00
|
|
|
// Transitions marked by '*' are done asynchronously.
|
2010-07-08 18:10:50 +02:00
|
|
|
// The GdbEngine->setupEngine() function is described in more detail below.
|
2010-07-08 11:44:00 +02:00
|
|
|
//
|
2010-10-26 17:08:12 +02:00
|
|
|
// The engines are responsible for local roll-back to the last
|
|
|
|
|
// acknowledged state before calling notify*Failed. I.e. before calling
|
|
|
|
|
// notifyEngineSetupFailed() any process started during setupEngine()
|
|
|
|
|
// so far must be terminated.
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
2010-07-09 17:07:59 +02:00
|
|
|
// DebuggerNotReady
|
|
|
|
|
// +
|
|
|
|
|
// EngineSetupRequested
|
|
|
|
|
// +
|
|
|
|
|
// (calls *Engine->setupEngine())
|
|
|
|
|
// | |
|
2010-07-12 18:03:50 +02:00
|
|
|
// | |
|
2010-07-09 17:07:59 +02:00
|
|
|
// {notify- {notify-
|
|
|
|
|
// Engine- Engine-
|
|
|
|
|
// SetupOk} SetupFailed}
|
2010-07-12 18:03:50 +02:00
|
|
|
// + +
|
|
|
|
|
// + `+-+-+> EngineSetupFailed
|
|
|
|
|
// + +
|
|
|
|
|
// + [calls RunControl->startFailed]
|
|
|
|
|
// + +
|
|
|
|
|
// + DebuggerFinished
|
2010-07-09 17:07:59 +02:00
|
|
|
// v
|
|
|
|
|
// EngineSetupOk
|
|
|
|
|
// +
|
|
|
|
|
// [calls RunControl->StartSuccessful]
|
|
|
|
|
// +
|
|
|
|
|
// InferiorSetupRequested
|
|
|
|
|
// +
|
|
|
|
|
// (calls *Engine->setupInferior())
|
|
|
|
|
// | |
|
|
|
|
|
// | |
|
|
|
|
|
// {notify- {notify-
|
|
|
|
|
// Inferior- Inferior-
|
|
|
|
|
// SetupOk} SetupFailed}
|
|
|
|
|
// + +
|
|
|
|
|
// + ` +-+-> InferiorSetupFailed +-+-+-+-+-+->.
|
|
|
|
|
// + +
|
|
|
|
|
// + +
|
|
|
|
|
// EngineRunRequested +
|
|
|
|
|
// + +
|
|
|
|
|
// (calls *Engine->runEngine()) +
|
|
|
|
|
// / | | \ +
|
|
|
|
|
// / | | \ +
|
|
|
|
|
// | (core) | (attach) | | +
|
|
|
|
|
// | | | | +
|
|
|
|
|
// {notify- {notifyER&- {notifyER&- {notify- +
|
|
|
|
|
// Inferior- Inferior- Inferior- RunEngine- +
|
|
|
|
|
// Unrunnable} StopOk} RunOk} Failed} +
|
|
|
|
|
// + + + + +
|
|
|
|
|
// InferiorUnrunnable + InferiorRunOk + +
|
|
|
|
|
// + + +
|
|
|
|
|
// InferiorStopOk EngineRunFailed +
|
|
|
|
|
// + v
|
|
|
|
|
// `-+-+-+-+-+-+-+-+-+-+-+>-+
|
|
|
|
|
// +
|
2010-07-15 09:41:11 +02:00
|
|
|
// +
|
2010-10-30 21:54:23 +02:00
|
|
|
// #Interrupt@InferiorRunOk# +
|
2010-07-09 17:07:59 +02:00
|
|
|
// + +
|
2010-07-15 09:41:11 +02:00
|
|
|
// InferiorStopRequested +
|
|
|
|
|
// #SpontaneousStop + +
|
|
|
|
|
// @InferiorRunOk# (calls *Engine-> +
|
|
|
|
|
// + interruptInferior()) +
|
|
|
|
|
// {notify- | | +
|
|
|
|
|
// Spontaneous- {notify- {notify- +
|
|
|
|
|
// Inferior- Inferior- Inferior- +
|
|
|
|
|
// StopOk} StopOk} StopFailed} +
|
|
|
|
|
// + + + +
|
|
|
|
|
// + + + +
|
|
|
|
|
// InferiorStopOk + +
|
|
|
|
|
// + + +
|
|
|
|
|
// + + +
|
|
|
|
|
// + + +
|
|
|
|
|
// #Stop@InferiorUnrunnable# + +
|
|
|
|
|
// #Creator Close Event# + +
|
|
|
|
|
// + + +
|
2010-07-09 17:07:59 +02:00
|
|
|
// InferiorShutdownRequested +
|
|
|
|
|
// + +
|
|
|
|
|
// (calls *Engine->shutdownInferior()) +
|
|
|
|
|
// | | +
|
|
|
|
|
// {notify- {notify- +
|
|
|
|
|
// Inferior- Inferior- +
|
|
|
|
|
// ShutdownOk} ShutdownFailed} +
|
|
|
|
|
// + + +
|
|
|
|
|
// + + +
|
|
|
|
|
// #Inferior exited# + + +
|
|
|
|
|
// | + + +
|
|
|
|
|
// {notifyInferior- + + +
|
|
|
|
|
// Exited} + + +
|
|
|
|
|
// + + + +
|
|
|
|
|
// + + + +
|
|
|
|
|
// + + + +
|
|
|
|
|
// InferiorShutdownOk InferiorShutdownFailed +
|
|
|
|
|
// * * +
|
|
|
|
|
// EngineShutdownRequested +
|
|
|
|
|
// + +
|
2010-11-05 13:35:31 +01:00
|
|
|
// (calls *Engine->shutdownEngine()) <+-+-+-+-+-+-+-+-+-+-+-+-+-+'
|
2010-07-09 17:07:59 +02:00
|
|
|
// | |
|
2010-07-12 18:03:50 +02:00
|
|
|
// | |
|
2010-07-09 17:07:59 +02:00
|
|
|
// {notify- {notify-
|
2010-08-18 15:25:49 +02:00
|
|
|
// Engine- Engine-
|
2010-07-09 17:07:59 +02:00
|
|
|
// ShutdownOk} ShutdownFailed}
|
|
|
|
|
// + +
|
|
|
|
|
// EngineShutdownOk EngineShutdownFailed
|
|
|
|
|
// * *
|
|
|
|
|
// DebuggerFinished
|
2010-08-31 12:49:51 +02:00
|
|
|
/* Here is a matching graph as a GraphViz graph. View it using
|
|
|
|
|
* \code
|
|
|
|
|
grep "^sg1:" debuggerplugin.cpp | cut -c5- | dot -osg1.ps -Tps && gv sg1.ps
|
2010-07-08 11:44:00 +02:00
|
|
|
|
2010-08-31 12:49:51 +02:00
|
|
|
sg1: digraph DebuggerStates {
|
|
|
|
|
sg1: DebuggerNotReady -> EngineSetupRequested
|
|
|
|
|
sg1: EngineSetupRequested -> EngineSetupOk [ label="notifyEngineSetupOk", style="dashed" ];
|
|
|
|
|
sg1: EngineSetupRequested -> EngineSetupFailed [ label= "notifyEngineSetupFailed", style="dashed"];
|
|
|
|
|
sg1: EngineSetupFailed -> DebuggerFinished [ label= "RunControl::StartFailed" ];
|
|
|
|
|
sg1: EngineSetupOk -> InferiorSetupRequested [ label= "RunControl::StartSuccessful" ];
|
|
|
|
|
sg1: InferiorSetupRequested -> InferiorSetupFailed [ label="notifyInferiorFailed", style="dashed" ];
|
|
|
|
|
sg1: InferiorSetupRequested -> EngineRunRequested [ label="notifyInferiorSetupOk", style="dashed" ];
|
|
|
|
|
sg1: InferiorSetupFailed -> EngineShutdownRequested
|
|
|
|
|
sg1: EngineRunRequested -> InferiorUnrunnable [ label="notifyInferiorUnrunnable", style="dashed" ];
|
|
|
|
|
sg1: EngineRunRequested -> InferiorStopOk [ label="notifyEngineRunAndInferiorStopOk", style="dashed" ];
|
|
|
|
|
sg1: EngineRunRequested -> InferiorRunOk [ label="notifyEngineRunAndInferiorRunOk", style="dashed" ];
|
|
|
|
|
sg1: EngineRunRequested -> EngineRunFailed [ label="notifyEngineRunFailed", style="dashed" ];
|
|
|
|
|
sg1: EngineRunFailed -> EngineShutdownRequested
|
|
|
|
|
sg1: InferiorRunOk -> InferiorStopOk [ label="SpontaneousStop\nnotifyInferiorSpontaneousStop", style="dashed" ];
|
|
|
|
|
sg1: InferiorRunOk -> InferiorStopRequested [ label="User stop\nEngine::interruptInferior", style="dashed"];
|
|
|
|
|
sg1: InferiorStopRequested -> InferiorStopOk [ label="notifyInferiorStopOk", style="dashed" ];
|
|
|
|
|
sg1: InferiorStopRequested -> InferiorShutdownRequested [ label="notifyInferiorStopFailed", style="dashed" ];
|
|
|
|
|
sg1: InferiorStopOk -> InferiorRunRequested [ label="User\nEngine::continueInferior" ];
|
|
|
|
|
sg1: InferiorRunRequested -> InferiorRunOk [ label="notifyInferiorRunOk", style="dashed"];
|
|
|
|
|
sg1: InferiorRunRequested -> InferiorRunFailed [ label="notifyInferiorRunFailed", style="dashed"];
|
|
|
|
|
sg1: InferiorRunFailed -> InferiorStopOk
|
|
|
|
|
sg1: InferiorShutdownRequested -> InferiorShutdownOk [ label= "Engine::shutdownInferior\nnotifyInferiorShutdownOk", style="dashed" ];
|
|
|
|
|
sg1: InferiorShutdownRequested -> InferiorShutdownFailed [ label="Engine::shutdownInferior\nnotifyInferiorShutdownFailed", style="dashed" ];
|
|
|
|
|
sg1: InferiorExited -> InferiorShutdownOk [ label="notifyInferiorExited", style="dashed"];
|
|
|
|
|
sg1: InferiorShutdownOk -> EngineShutdownRequested
|
|
|
|
|
sg1: InferiorShutdownFailed -> EngineShutdownRequested
|
|
|
|
|
sg1: EngineShutdownRequested -> EngineShutdownOk [ label="Engine::shutdownEngine\nnotifyEngineShutdownOk", style="dashed" ];
|
|
|
|
|
sg1: EngineShutdownRequested -> EngineShutdownFailed [ label="Engine::shutdownEngine\nnotifyEngineShutdownFailed", style="dashed" ];
|
|
|
|
|
sg1: EngineShutdownOk -> DebuggerFinished [ style = "dotted" ];
|
|
|
|
|
sg1: EngineShutdownFailed -> DebuggerFinished [ style = "dotted" ];
|
|
|
|
|
sg1: }
|
|
|
|
|
* \endcode */
|
2010-07-15 09:41:11 +02:00
|
|
|
// Additional signalling: {notifyInferiorIll} {notifyEngineIll}
|
2010-07-09 17:07:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// GdbEngine specific startup. All happens in EngineSetupRequested state
|
2010-06-16 11:08:54 +02:00
|
|
|
//
|
2010-07-08 11:44:00 +02:00
|
|
|
// Transitions marked by '---' are done in the individual adapters.
|
|
|
|
|
// Transitions marked by '+-+' are done in the GdbEngine.
|
2010-07-09 17:07:59 +02:00
|
|
|
//
|
2010-07-08 18:10:50 +02:00
|
|
|
// GdbEngine::setupEngine()
|
2010-07-08 11:44:00 +02:00
|
|
|
// +
|
|
|
|
|
// (calls *Adapter->startAdapter())
|
|
|
|
|
// | |
|
|
|
|
|
// | `---> handleAdapterStartFailed()
|
|
|
|
|
// | +
|
2010-07-09 17:07:59 +02:00
|
|
|
// | {notifyEngineSetupFailed}
|
2010-07-08 11:44:00 +02:00
|
|
|
// |
|
|
|
|
|
// handleAdapterStarted()
|
|
|
|
|
// +
|
2010-07-09 17:07:59 +02:00
|
|
|
// {notifyEngineSetupOk}
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// GdbEngine::setupInferior()
|
2010-11-05 13:35:31 +01:00
|
|
|
// +
|
2010-07-08 11:44:00 +02:00
|
|
|
// (calls *Adapter->prepareInferior())
|
|
|
|
|
// | |
|
2010-07-09 17:07:59 +02:00
|
|
|
// | `---> handlePrepareInferiorFailed()
|
2010-07-08 11:44:00 +02:00
|
|
|
// | +
|
2010-07-09 17:07:59 +02:00
|
|
|
// | {notifyInferiorSetupFailed}
|
2010-07-08 11:44:00 +02:00
|
|
|
// |
|
2010-07-09 17:07:59 +02:00
|
|
|
// handleInferiorPrepared()
|
2010-07-08 11:44:00 +02:00
|
|
|
// +
|
2010-11-05 13:35:31 +01:00
|
|
|
// {notifyInferiorSetupOk}
|
2010-07-08 11:44:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
using namespace Core;
|
2009-01-13 18:15:24 +01:00
|
|
|
using namespace Debugger::Constants;
|
|
|
|
|
using namespace Debugger::Internal;
|
2008-12-02 12:01:29 +01:00
|
|
|
using namespace ProjectExplorer;
|
2009-01-13 18:15:24 +01:00
|
|
|
using namespace TextEditor;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-11 12:22:24 +01:00
|
|
|
namespace CC = Core::Constants;
|
|
|
|
|
namespace PE = ProjectExplorer::Constants;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Constants {
|
|
|
|
|
|
2009-06-08 19:28:28 +02:00
|
|
|
const char * const M_DEBUG_START_DEBUGGING = "QtCreator.Menu.Debug.StartDebugging";
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const STARTEXTERNAL = "Debugger.StartExternal";
|
|
|
|
|
const char * const ATTACHEXTERNAL = "Debugger.AttachExternal";
|
2009-03-02 15:14:12 +01:00
|
|
|
const char * const ATTACHCORE = "Debugger.AttachCore";
|
2010-05-05 12:41:52 +02:00
|
|
|
const char * const ATTACHTCF = "Debugger.AttachTcf";
|
2009-05-04 14:47:45 +02:00
|
|
|
const char * const ATTACHREMOTE = "Debugger.AttachRemote";
|
2009-05-07 15:20:44 +02:00
|
|
|
const char * const DETACH = "Debugger.Detach";
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-08 09:13:21 +01:00
|
|
|
const char * const RUN_TO_LINE1 = "Debugger.RunToLine1";
|
|
|
|
|
const char * const RUN_TO_LINE2 = "Debugger.RunToLine2";
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const RUN_TO_FUNCTION = "Debugger.RunToFunction";
|
2010-02-08 09:13:21 +01:00
|
|
|
const char * const JUMP_TO_LINE1 = "Debugger.JumpToLine1";
|
|
|
|
|
const char * const JUMP_TO_LINE2 = "Debugger.JumpToLine2";
|
2010-02-15 16:02:41 +01:00
|
|
|
const char * const RETURN_FROM_FUNCTION = "Debugger.ReturnFromFunction";
|
2010-02-02 17:25:14 +01:00
|
|
|
const char * const SNAPSHOT = "Debugger.Snapshot";
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const TOGGLE_BREAK = "Debugger.ToggleBreak";
|
|
|
|
|
const char * const BREAK_BY_FUNCTION = "Debugger.BreakByFunction";
|
|
|
|
|
const char * const BREAK_AT_MAIN = "Debugger.BreakAtMain";
|
2009-12-11 18:19:51 +01:00
|
|
|
const char * const ADD_TO_WATCH1 = "Debugger.AddToWatch1";
|
|
|
|
|
const char * const ADD_TO_WATCH2 = "Debugger.AddToWatch2";
|
2009-09-29 11:13:19 +02:00
|
|
|
const char * const OPERATE_BY_INSTRUCTION = "Debugger.OperateByInstruction";
|
2010-06-07 13:17:19 +02:00
|
|
|
const char * const FRAME_UP = "Debugger.FrameUp";
|
|
|
|
|
const char * const FRAME_DOWN = "Debugger.FrameDown";
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-06-03 20:45:49 +02:00
|
|
|
#ifdef Q_WS_MAC
|
2010-10-19 11:01:49 +02:00
|
|
|
const char * const STOP_KEY = "Shift+Ctrl+Y";
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const RESET_KEY = "Ctrl+Shift+F5";
|
2010-10-19 11:01:49 +02:00
|
|
|
const char * const STEP_KEY = "Ctrl+Shift+I";
|
|
|
|
|
const char * const STEPOUT_KEY = "Ctrl+Shift+T";
|
|
|
|
|
const char * const NEXT_KEY = "Ctrl+Shift+O";
|
2009-05-25 17:19:42 +02:00
|
|
|
const char * const REVERSE_KEY = "";
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const RUN_TO_LINE_KEY = "Shift+F8";
|
|
|
|
|
const char * const RUN_TO_FUNCTION_KEY = "Ctrl+F6";
|
2010-07-02 12:09:16 +02:00
|
|
|
const char * const JUMP_TO_LINE_KEY = "Ctrl+D,Ctrl+L";
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const TOGGLE_BREAK_KEY = "F8";
|
2010-07-02 12:09:16 +02:00
|
|
|
const char * const BREAK_BY_FUNCTION_KEY = "Ctrl+D,Ctrl+F";
|
|
|
|
|
const char * const BREAK_AT_MAIN_KEY = "Ctrl+D,Ctrl+M";
|
|
|
|
|
const char * const ADD_TO_WATCH_KEY = "Ctrl+D,Ctrl+W";
|
|
|
|
|
const char * const SNAPSHOT_KEY = "Ctrl+D,Ctrl+S";
|
2008-12-02 12:01:29 +01:00
|
|
|
#else
|
2010-07-22 10:23:27 +02:00
|
|
|
const char * const STOP_KEY = "Shift+F5";
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const RESET_KEY = "Ctrl+Shift+F5";
|
|
|
|
|
const char * const STEP_KEY = "F11";
|
|
|
|
|
const char * const STEPOUT_KEY = "Shift+F11";
|
|
|
|
|
const char * const NEXT_KEY = "F10";
|
2009-05-25 17:19:42 +02:00
|
|
|
const char * const REVERSE_KEY = "F12";
|
2008-12-02 12:01:29 +01:00
|
|
|
const char * const RUN_TO_LINE_KEY = "";
|
|
|
|
|
const char * const RUN_TO_FUNCTION_KEY = "";
|
|
|
|
|
const char * const JUMP_TO_LINE_KEY = "";
|
|
|
|
|
const char * const TOGGLE_BREAK_KEY = "F9";
|
|
|
|
|
const char * const BREAK_BY_FUNCTION_KEY = "";
|
|
|
|
|
const char * const BREAK_AT_MAIN_KEY = "";
|
|
|
|
|
const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
|
2010-07-02 12:09:16 +02:00
|
|
|
const char * const SNAPSHOT_KEY = "Ctrl+D,Ctrl+S";
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
} // namespace Constants
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
static SessionManager *sessionManager()
|
2009-01-28 14:29:54 +01:00
|
|
|
{
|
2010-08-31 13:07:33 +02:00
|
|
|
return ProjectExplorerPlugin::instance()->session();
|
2009-01-28 14:29:54 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-28 15:08:52 +02:00
|
|
|
static QSettings *settings()
|
|
|
|
|
{
|
|
|
|
|
return ICore::instance()->settings();
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-16 15:57:59 +02:00
|
|
|
static QToolButton *toolButton(QAction *action)
|
|
|
|
|
{
|
|
|
|
|
QToolButton *button = new QToolButton;
|
|
|
|
|
button->setDefaultAction(action);
|
|
|
|
|
return button;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-06-22 17:18:29 +02:00
|
|
|
static const char *Role = "ROLE";
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
// FIXME: Outdated?
|
|
|
|
|
// The createCdbEngine function takes a list of options pages it can add to.
|
|
|
|
|
// This allows for having a "enabled" toggle on the page independently
|
|
|
|
|
// of the engine. That's good for not enabling the related ActiveX control
|
|
|
|
|
// unnecessarily.
|
|
|
|
|
|
|
|
|
|
void addGdbOptionPages(QList<Core::IOptionsPage*> *opts);
|
|
|
|
|
void addScriptOptionPages(QList<Core::IOptionsPage*> *opts);
|
|
|
|
|
void addTcfOptionPages(QList<Core::IOptionsPage*> *opts);
|
|
|
|
|
#ifdef CDB_ENABLED
|
|
|
|
|
void addCdbOptionPages(QList<Core::IOptionsPage*> *opts);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct AttachRemoteParameters
|
|
|
|
|
{
|
|
|
|
|
AttachRemoteParameters() : attachPid(0), winCrashEvent(0) {}
|
2010-10-20 12:13:28 +02:00
|
|
|
void clear();
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
quint64 attachPid;
|
2010-07-15 10:44:53 +02:00
|
|
|
QString attachTarget; // core file name or server:port
|
2010-11-05 13:35:31 +01:00
|
|
|
// Event handle for attaching to crashed Windows processes.
|
2010-06-16 11:08:54 +02:00
|
|
|
quint64 winCrashEvent;
|
|
|
|
|
};
|
|
|
|
|
|
2010-10-20 12:13:28 +02:00
|
|
|
void AttachRemoteParameters::clear()
|
|
|
|
|
{
|
|
|
|
|
attachPid = winCrashEvent = 0;
|
|
|
|
|
attachTarget.clear();
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2009-01-14 18:09:02 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DebugMode
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-01-13 18:15:24 +01:00
|
|
|
class DebugMode : public Core::BaseMode
|
|
|
|
|
{
|
|
|
|
|
public:
|
2010-06-16 11:08:54 +02:00
|
|
|
DebugMode(QObject *parent = 0) : BaseMode(parent)
|
|
|
|
|
{
|
2010-07-08 12:40:38 +02:00
|
|
|
setDisplayName(QCoreApplication::translate("Debugger::Internal::DebugMode", "Debug"));
|
2010-09-14 15:15:57 +02:00
|
|
|
setType(Core::Constants::MODE_EDIT_TYPE);
|
2010-06-16 11:08:54 +02:00
|
|
|
setId(MODE_DEBUG);
|
2010-07-30 22:16:59 +02:00
|
|
|
setIcon(QIcon(__(":/fancyactionbar/images/mode_Debug.png")));
|
2010-06-16 11:08:54 +02:00
|
|
|
setPriority(P_MODE_DEBUG);
|
|
|
|
|
}
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
~DebugMode()
|
|
|
|
|
{
|
|
|
|
|
// Make sure the editor manager does not get deleted.
|
|
|
|
|
EditorManager::instance()->setParent(0);
|
|
|
|
|
}
|
|
|
|
|
};
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-11-04 09:54:23 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// LocationMark
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-08-14 13:04:05 +02:00
|
|
|
// Used in "real" editors
|
2009-01-14 18:09:02 +01:00
|
|
|
class LocationMark : public TextEditor::BaseTextMark
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
LocationMark(const QString &fileName, int linenumber)
|
|
|
|
|
: BaseTextMark(fileName, linenumber)
|
2008-12-12 17:49:52 +01:00
|
|
|
{}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
QIcon icon() const { return DebuggerPlugin::instance()->locationMarkIcon(); }
|
2008-12-02 12:01:29 +01:00
|
|
|
void updateLineNumber(int /*lineNumber*/) {}
|
|
|
|
|
void updateBlock(const QTextBlock & /*block*/) {}
|
2008-12-12 17:49:52 +01:00
|
|
|
void removedFromEditor() {}
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2009-01-14 18:09:02 +01:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2009-04-17 09:03:32 +02:00
|
|
|
// CommonOptionsPage
|
2009-01-14 18:09:02 +01:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
class CommonOptionsPage : public Core::IOptionsPage
|
2009-01-14 18:09:02 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2009-04-17 09:03:32 +02:00
|
|
|
CommonOptionsPage() {}
|
2009-01-14 18:09:02 +01:00
|
|
|
|
|
|
|
|
// IOptionsPage
|
2009-04-28 15:08:52 +02:00
|
|
|
QString id() const
|
2010-03-11 12:22:24 +01:00
|
|
|
{ return _(DEBUGGER_COMMON_SETTINGS_ID); }
|
2010-01-07 18:17:24 +01:00
|
|
|
QString displayName() const
|
2010-03-11 12:22:24 +01:00
|
|
|
{ return QCoreApplication::translate("Debugger", DEBUGGER_COMMON_SETTINGS_NAME); }
|
2009-04-28 15:08:52 +02:00
|
|
|
QString category() const
|
2010-03-11 12:22:24 +01:00
|
|
|
{ return _(DEBUGGER_SETTINGS_CATEGORY); }
|
2010-01-07 18:17:24 +01:00
|
|
|
QString displayCategory() const
|
2010-03-11 12:22:24 +01:00
|
|
|
{ return QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY); }
|
2010-03-26 17:34:10 +01:00
|
|
|
QIcon categoryIcon() const
|
|
|
|
|
{ return QIcon(QLatin1String(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); }
|
2009-01-14 18:09:02 +01:00
|
|
|
|
|
|
|
|
QWidget *createPage(QWidget *parent);
|
2009-04-28 15:08:52 +02:00
|
|
|
void apply() { m_group.apply(settings()); }
|
2009-03-26 15:56:16 +01:00
|
|
|
void finish() { m_group.finish(); }
|
2009-11-24 15:05:02 +01:00
|
|
|
virtual bool matches(const QString &s) const;
|
2009-01-14 18:09:02 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-04-17 09:03:32 +02:00
|
|
|
Ui::CommonOptionsPage m_ui;
|
2009-10-05 11:06:05 +02:00
|
|
|
Utils::SavedActionSet m_group;
|
2009-11-24 15:05:02 +01:00
|
|
|
QString m_searchKeywords;
|
2009-01-14 18:09:02 +01:00
|
|
|
};
|
|
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
QWidget *CommonOptionsPage::createPage(QWidget *parent)
|
2009-01-14 18:09:02 +01:00
|
|
|
{
|
|
|
|
|
QWidget *w = new QWidget(parent);
|
|
|
|
|
m_ui.setupUi(w);
|
2009-03-26 17:27:44 +01:00
|
|
|
m_group.clear();
|
2009-03-26 15:56:16 +01:00
|
|
|
|
2009-05-25 16:22:11 +02:00
|
|
|
m_group.insert(theDebuggerAction(ListSourceFiles),
|
2009-03-26 17:27:44 +01:00
|
|
|
m_ui.checkBoxListSourceFiles);
|
2009-05-25 16:22:11 +02:00
|
|
|
m_group.insert(theDebuggerAction(UseAlternatingRowColors),
|
2009-05-05 10:14:35 +02:00
|
|
|
m_ui.checkBoxUseAlternatingRowColors);
|
2010-01-29 21:33:57 +01:00
|
|
|
m_group.insert(theDebuggerAction(UseToolTipsInMainEditor),
|
2009-10-01 18:01:23 +02:00
|
|
|
m_ui.checkBoxUseToolTipsInMainEditor);
|
2010-10-08 17:44:11 +02:00
|
|
|
m_group.insert(theDebuggerAction(CloseBuffersOnExit),
|
|
|
|
|
m_ui.checkBoxCloseBuffersOnExit);
|
|
|
|
|
m_group.insert(theDebuggerAction(SwitchModeOnExit),
|
|
|
|
|
m_ui.checkBoxSwitchModeOnExit);
|
2009-10-06 10:54:08 +02:00
|
|
|
m_group.insert(theDebuggerAction(AutoDerefPointers), 0);
|
2009-10-01 11:22:44 +02:00
|
|
|
m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), 0);
|
|
|
|
|
m_group.insert(theDebuggerAction(UseToolTipsInBreakpointsView), 0);
|
|
|
|
|
m_group.insert(theDebuggerAction(UseAddressInBreakpointsView), 0);
|
|
|
|
|
m_group.insert(theDebuggerAction(UseAddressInStackView), 0);
|
2010-01-29 21:33:57 +01:00
|
|
|
m_group.insert(theDebuggerAction(MaximalStackDepth),
|
2009-04-02 15:06:24 +02:00
|
|
|
m_ui.spinBoxMaximalStackDepth);
|
2009-11-25 08:35:02 +01:00
|
|
|
m_group.insert(theDebuggerAction(ShowStdNamespace), 0);
|
|
|
|
|
m_group.insert(theDebuggerAction(ShowQtNamespace), 0);
|
2010-09-23 11:15:56 +02:00
|
|
|
m_group.insert(theDebuggerAction(SortStructMembers), 0);
|
2009-12-07 12:10:07 +01:00
|
|
|
m_group.insert(theDebuggerAction(LogTimeStamps), 0);
|
2010-01-15 12:01:26 +01:00
|
|
|
m_group.insert(theDebuggerAction(VerboseLog), 0);
|
2010-02-11 17:29:10 +01:00
|
|
|
m_group.insert(theDebuggerAction(BreakOnThrow), 0);
|
|
|
|
|
m_group.insert(theDebuggerAction(BreakOnCatch), 0);
|
2010-03-25 16:54:23 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
Utils::SavedAction *registerAction = theDebuggerAction(RegisterForPostMortem);
|
|
|
|
|
m_group.insert(registerAction,
|
|
|
|
|
m_ui.checkBoxRegisterForPostMortem);
|
|
|
|
|
connect(registerAction, SIGNAL(toggled(bool)),
|
|
|
|
|
m_ui.checkBoxRegisterForPostMortem, SLOT(setChecked(bool)));
|
|
|
|
|
#endif
|
2009-01-14 18:09:02 +01:00
|
|
|
|
2009-11-24 15:05:02 +01:00
|
|
|
if (m_searchKeywords.isEmpty()) {
|
2010-03-18 10:56:25 +01:00
|
|
|
QTextStream(&m_searchKeywords) << ' '
|
|
|
|
|
<< m_ui.checkBoxListSourceFiles->text()
|
2009-11-24 15:05:02 +01:00
|
|
|
<< ' ' << m_ui.checkBoxUseAlternatingRowColors->text()
|
|
|
|
|
<< ' ' << m_ui.checkBoxUseToolTipsInMainEditor->text()
|
2010-03-25 16:54:23 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
<< ' ' << m_ui.checkBoxRegisterForPostMortem->text()
|
|
|
|
|
#endif
|
2009-11-24 15:05:02 +01:00
|
|
|
<< ' ' << m_ui.labelMaximalStackDepth->text();
|
|
|
|
|
m_searchKeywords.remove(QLatin1Char('&'));
|
|
|
|
|
}
|
2010-03-25 16:54:23 +01:00
|
|
|
#ifndef Q_OS_WIN
|
|
|
|
|
m_ui.checkBoxRegisterForPostMortem->setVisible(false);
|
|
|
|
|
#endif
|
2009-01-14 18:09:02 +01:00
|
|
|
return w;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-24 15:05:02 +01:00
|
|
|
bool CommonOptionsPage::matches(const QString &s) const
|
|
|
|
|
{
|
|
|
|
|
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-23 12:28:02 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2009-04-07 16:39:17 +02:00
|
|
|
// DebuggingHelperOptionPage
|
2009-03-23 12:28:02 +01:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-11-24 15:05:02 +01:00
|
|
|
static inline bool oxygenStyle()
|
|
|
|
|
{
|
|
|
|
|
if (const ManhattanStyle *ms = qobject_cast<const ManhattanStyle *>(qApp->style()))
|
2010-02-23 12:42:04 +01:00
|
|
|
return !qstrcmp("OxygenStyle", ms->baseStyle()->metaObject()->className());
|
2009-11-24 15:05:02 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-07 16:39:17 +02:00
|
|
|
class DebuggingHelperOptionPage : public Core::IOptionsPage
|
2010-07-08 12:40:38 +02:00
|
|
|
{ // Needs tr - context
|
|
|
|
|
Q_OBJECT
|
2009-03-23 12:28:02 +01:00
|
|
|
public:
|
2009-04-07 16:39:17 +02:00
|
|
|
DebuggingHelperOptionPage() {}
|
2009-03-23 12:28:02 +01:00
|
|
|
|
|
|
|
|
// IOptionsPage
|
2010-04-06 16:42:24 +02:00
|
|
|
QString id() const { return _("Z.DebuggingHelper"); }
|
2010-01-07 18:17:24 +01:00
|
|
|
QString displayName() const { return tr("Debugging Helper"); }
|
2010-03-11 12:22:24 +01:00
|
|
|
QString category() const { return _(DEBUGGER_SETTINGS_CATEGORY); }
|
2010-07-15 10:44:53 +02:00
|
|
|
QString displayCategory() const
|
|
|
|
|
{ return QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY); }
|
|
|
|
|
QIcon categoryIcon() const
|
|
|
|
|
{ return QIcon(QLatin1String(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); }
|
2009-03-23 12:28:02 +01:00
|
|
|
|
|
|
|
|
QWidget *createPage(QWidget *parent);
|
2009-04-28 15:08:52 +02:00
|
|
|
void apply() { m_group.apply(settings()); }
|
2009-03-26 15:56:16 +01:00
|
|
|
void finish() { m_group.finish(); }
|
2009-11-24 15:05:02 +01:00
|
|
|
virtual bool matches(const QString &s) const;
|
2009-03-23 12:28:02 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-04-07 16:39:17 +02:00
|
|
|
Ui::DebuggingHelperOptionPage m_ui;
|
2009-10-05 11:06:05 +02:00
|
|
|
Utils::SavedActionSet m_group;
|
2009-11-24 15:05:02 +01:00
|
|
|
QString m_searchKeywords;
|
2009-03-23 12:28:02 +01:00
|
|
|
};
|
|
|
|
|
|
2009-04-07 16:39:17 +02:00
|
|
|
QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
|
2009-03-23 12:28:02 +01:00
|
|
|
{
|
|
|
|
|
QWidget *w = new QWidget(parent);
|
|
|
|
|
m_ui.setupUi(w);
|
|
|
|
|
|
2009-10-05 11:06:05 +02:00
|
|
|
m_ui.dumperLocationChooser->setExpectedKind(Utils::PathChooser::Command);
|
2009-04-07 16:39:17 +02:00
|
|
|
m_ui.dumperLocationChooser->setPromptDialogTitle(tr("Choose DebuggingHelper Location"));
|
2009-03-23 13:02:50 +01:00
|
|
|
m_ui.dumperLocationChooser->setInitialBrowsePathBackup(
|
|
|
|
|
Core::ICore::instance()->resourcePath() + "../../lib");
|
2009-03-23 12:28:02 +01:00
|
|
|
|
2009-03-26 17:27:44 +01:00
|
|
|
m_group.clear();
|
2009-04-07 16:39:17 +02:00
|
|
|
m_group.insert(theDebuggerAction(UseDebuggingHelpers),
|
2009-11-24 15:05:02 +01:00
|
|
|
m_ui.debuggingHelperGroupBox);
|
2009-04-07 16:39:17 +02:00
|
|
|
m_group.insert(theDebuggerAction(UseCustomDebuggingHelperLocation),
|
2009-11-24 15:05:02 +01:00
|
|
|
m_ui.customLocationGroupBox);
|
2010-03-11 12:22:24 +01:00
|
|
|
// Suppress Oxygen style's giving flat group boxes bold titles.
|
2009-11-24 15:05:02 +01:00
|
|
|
if (oxygenStyle())
|
2010-03-11 12:22:24 +01:00
|
|
|
m_ui.customLocationGroupBox->setStyleSheet(_("QGroupBox::title { font: ; }"));
|
2009-11-24 15:05:02 +01:00
|
|
|
|
2009-04-07 16:39:17 +02:00
|
|
|
m_group.insert(theDebuggerAction(CustomDebuggingHelperLocation),
|
2009-03-26 15:56:16 +01:00
|
|
|
m_ui.dumperLocationChooser);
|
2009-03-23 12:28:02 +01:00
|
|
|
|
2009-10-16 16:26:28 +02:00
|
|
|
m_group.insert(theDebuggerAction(UseCodeModel),
|
|
|
|
|
m_ui.checkBoxUseCodeModel);
|
|
|
|
|
|
2009-07-10 14:38:36 +02:00
|
|
|
#ifdef QT_DEBUG
|
2009-04-07 16:39:17 +02:00
|
|
|
m_group.insert(theDebuggerAction(DebugDebuggingHelpers),
|
|
|
|
|
m_ui.checkBoxDebugDebuggingHelpers);
|
2009-07-10 14:38:36 +02:00
|
|
|
#else
|
|
|
|
|
m_ui.checkBoxDebugDebuggingHelpers->hide();
|
|
|
|
|
#endif
|
2009-03-23 12:28:02 +01:00
|
|
|
|
|
|
|
|
#ifndef QT_DEBUG
|
|
|
|
|
#if 0
|
|
|
|
|
cmd = am->registerAction(m_manager->m_dumpLogAction,
|
2010-03-11 12:22:24 +01:00
|
|
|
DUMP_LOG, globalcontext);
|
2009-03-23 12:28:02 +01:00
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
|
|
|
|
|
mdebug->addAction(cmd);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-11-24 15:05:02 +01:00
|
|
|
if (m_searchKeywords.isEmpty()) {
|
|
|
|
|
QTextStream(&m_searchKeywords)
|
|
|
|
|
<< ' ' << m_ui.debuggingHelperGroupBox->title()
|
|
|
|
|
<< ' ' << m_ui.customLocationGroupBox->title()
|
|
|
|
|
<< ' ' << m_ui.dumperLocationLabel->text()
|
|
|
|
|
<< ' ' << m_ui.checkBoxUseCodeModel->text()
|
2010-10-04 15:13:31 +02:00
|
|
|
<< ' ' << m_ui.checkBoxDebugDebuggingHelpers->text();
|
2009-11-24 15:05:02 +01:00
|
|
|
m_searchKeywords.remove(QLatin1Char('&'));
|
|
|
|
|
}
|
2009-03-23 12:28:02 +01:00
|
|
|
return w;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-24 15:05:02 +01:00
|
|
|
bool DebuggingHelperOptionPage::matches(const QString &s) const
|
2009-03-27 13:04:23 +01:00
|
|
|
{
|
2009-11-24 15:05:02 +01:00
|
|
|
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
2009-03-27 13:04:23 +01:00
|
|
|
}
|
|
|
|
|
|
2009-08-12 10:51:25 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2010-06-16 11:08:54 +02:00
|
|
|
// Argument parsing
|
2008-12-02 12:01:29 +01:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-09-24 10:08:17 +02:00
|
|
|
static QString msgParameterMissing(const QString &a)
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
|
|
|
|
return DebuggerPlugin::tr("Option '%1' is missing the parameter.").arg(a);
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-24 10:08:17 +02:00
|
|
|
static QString msgInvalidNumericParameter(const QString &a, const QString &number)
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
|
|
|
|
return DebuggerPlugin::tr("The parameter '%1' of option '%2' is not a number.").arg(number, a);
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-14 18:01:39 +01:00
|
|
|
static bool parseArgument(QStringList::const_iterator &it,
|
2010-06-16 11:08:54 +02:00
|
|
|
const QStringList::const_iterator &cend,
|
|
|
|
|
AttachRemoteParameters *attachRemoteParameters,
|
|
|
|
|
unsigned *enabledEngines, QString *errorMessage)
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
|
|
|
|
const QString &option = *it;
|
|
|
|
|
// '-debug <pid>'
|
2010-07-15 10:44:53 +02:00
|
|
|
// '-debug <corefile>'
|
|
|
|
|
// '-debug <server:port>'
|
2010-03-11 12:22:24 +01:00
|
|
|
if (*it == _("-debug")) {
|
2009-05-25 16:22:11 +02:00
|
|
|
++it;
|
|
|
|
|
if (it == cend) {
|
|
|
|
|
*errorMessage = msgParameterMissing(*it);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool ok;
|
2009-12-14 18:01:39 +01:00
|
|
|
attachRemoteParameters->attachPid = it->toULongLong(&ok);
|
2010-07-15 10:44:53 +02:00
|
|
|
if (!ok)
|
|
|
|
|
attachRemoteParameters->attachTarget = *it;
|
2009-05-25 16:22:11 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2009-05-26 16:27:24 +02:00
|
|
|
// -wincrashevent <event-handle>. A handle used for
|
|
|
|
|
// a handshake when attaching to a crashed Windows process.
|
2010-03-11 12:22:24 +01:00
|
|
|
if (*it == _("-wincrashevent")) {
|
2009-05-25 16:22:11 +02:00
|
|
|
++it;
|
|
|
|
|
if (it == cend) {
|
|
|
|
|
*errorMessage = msgParameterMissing(*it);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool ok;
|
2009-12-14 18:01:39 +01:00
|
|
|
attachRemoteParameters->winCrashEvent = it->toULongLong(&ok);
|
2009-05-25 16:22:11 +02:00
|
|
|
if (!ok) {
|
|
|
|
|
*errorMessage = msgInvalidNumericParameter(option, *it);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2010-05-05 12:41:52 +02:00
|
|
|
// Engine disabling.
|
2010-03-11 12:22:24 +01:00
|
|
|
if (option == _("-disable-cdb")) {
|
2009-12-14 18:01:39 +01:00
|
|
|
*enabledEngines &= ~Debugger::CdbEngineType;
|
2009-05-25 16:22:11 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-03-11 12:22:24 +01:00
|
|
|
if (option == _("-disable-gdb")) {
|
2009-12-14 18:01:39 +01:00
|
|
|
*enabledEngines &= ~Debugger::GdbEngineType;
|
2009-05-25 16:22:11 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-06-09 16:13:47 +02:00
|
|
|
if (option == _("-disable-qmldb")) {
|
|
|
|
|
*enabledEngines &= ~Debugger::QmlEngineType;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2010-03-11 12:22:24 +01:00
|
|
|
if (option == _("-disable-sdb")) {
|
2009-12-14 18:01:39 +01:00
|
|
|
*enabledEngines &= ~Debugger::ScriptEngineType;
|
2009-05-25 16:22:11 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-06-09 16:13:47 +02:00
|
|
|
if (option == _("-disable-tcf")) {
|
2010-05-05 12:41:52 +02:00
|
|
|
*enabledEngines &= ~TcfEngineType;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2009-05-25 16:22:11 +02:00
|
|
|
|
2009-12-14 18:01:39 +01:00
|
|
|
*errorMessage = DebuggerPlugin::tr("Invalid debugger option: %1").arg(option);
|
2009-05-25 16:22:11 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-14 18:01:39 +01:00
|
|
|
static bool parseArguments(const QStringList &args,
|
2010-06-16 11:08:54 +02:00
|
|
|
AttachRemoteParameters *attachRemoteParameters,
|
2010-05-05 12:41:52 +02:00
|
|
|
unsigned *enabledEngines, QString *errorMessage)
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
2010-10-20 12:13:28 +02:00
|
|
|
attachRemoteParameters->clear();
|
2009-05-25 16:22:11 +02:00
|
|
|
const QStringList::const_iterator cend = args.constEnd();
|
|
|
|
|
for (QStringList::const_iterator it = args.constBegin(); it != cend; ++it)
|
2009-12-14 18:01:39 +01:00
|
|
|
if (!parseArgument(it, cend, attachRemoteParameters, enabledEngines, errorMessage))
|
2009-05-25 16:22:11 +02:00
|
|
|
return false;
|
|
|
|
|
if (Debugger::Constants::Internal::debug)
|
2009-09-24 10:08:17 +02:00
|
|
|
qDebug().nospace() << args << "engines=0x"
|
2009-12-14 18:01:39 +01:00
|
|
|
<< QString::number(*enabledEngines, 16)
|
|
|
|
|
<< " pid" << attachRemoteParameters->attachPid
|
2010-07-15 10:44:53 +02:00
|
|
|
<< " target" << attachRemoteParameters->attachTarget << '\n';
|
2009-05-25 16:22:11 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Misc
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
static bool isDebuggable(Core::IEditor *editor)
|
2009-12-14 18:01:39 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
// Only blacklist Qml. Whitelisting would fail on C++ code in files
|
|
|
|
|
// with strange names, more harm would be done this way.
|
|
|
|
|
//Core::IFile *file = editor->file();
|
|
|
|
|
//return !(file && file->mimeType() == "application/x-qml");
|
|
|
|
|
|
|
|
|
|
// Nowadays, even Qml is debuggable.
|
|
|
|
|
Q_UNUSED(editor);
|
|
|
|
|
return true;
|
2009-12-14 18:01:39 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
static TextEditor::ITextEditor *currentTextEditor()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
EditorManager *editorManager = EditorManager::instance();
|
|
|
|
|
if (!editorManager)
|
|
|
|
|
return 0;
|
|
|
|
|
Core::IEditor *editor = editorManager->currentEditor();
|
|
|
|
|
return qobject_cast<ITextEditor*>(editor);
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DebuggerPluginPrivate
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
struct DebuggerActions
|
|
|
|
|
{
|
|
|
|
|
QAction *continueAction;
|
2010-10-05 12:47:23 +02:00
|
|
|
QAction *stopAction; // on the application output button if "Stop" is possible
|
|
|
|
|
QAction *interruptAction; // on the fat debug button if "Pause" is possible
|
|
|
|
|
QAction *undisturbableAction; // on the fat debug button if nothing can be done
|
2010-06-16 11:08:54 +02:00
|
|
|
QAction *resetAction; // FIXME: Should not be needed in a stable release
|
|
|
|
|
QAction *stepAction;
|
|
|
|
|
QAction *stepOutAction;
|
2010-11-04 11:46:16 +01:00
|
|
|
QAction *runToLineAction; // Debug menu
|
2010-06-16 11:08:54 +02:00
|
|
|
QAction *runToFunctionAction;
|
2010-11-04 11:46:16 +01:00
|
|
|
QAction *jumpToLineAction; // in the Debug menu
|
2010-06-16 11:08:54 +02:00
|
|
|
QAction *returnFromFunctionAction;
|
|
|
|
|
QAction *nextAction;
|
|
|
|
|
QAction *snapshotAction;
|
|
|
|
|
QAction *watchAction1; // in the Debug menu
|
|
|
|
|
QAction *watchAction2; // in the text editor context menu
|
|
|
|
|
QAction *breakAction;
|
|
|
|
|
QAction *sepAction;
|
|
|
|
|
QAction *reverseDirectionAction;
|
|
|
|
|
QAction *frameUpAction;
|
|
|
|
|
QAction *frameDownAction;
|
|
|
|
|
};
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
} // namespace Internal
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
using namespace Debugger::Internal;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DebuggerPluginPrivate
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
class DebuggerPluginPrivate : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2010-03-19 13:58:26 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
public:
|
|
|
|
|
explicit DebuggerPluginPrivate(DebuggerPlugin *plugin);
|
2010-03-10 13:46:05 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
bool initialize(const QStringList &arguments, QString *errorMessage);
|
|
|
|
|
void notifyCurrentEngine(int role, const QVariant &value = QVariant());
|
2010-07-13 17:16:31 +02:00
|
|
|
void connectEngine(DebuggerEngine *engine, bool notify = true);
|
2010-11-04 18:11:09 +01:00
|
|
|
void disconnectEngine() { connectEngine(0); }
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
public slots:
|
|
|
|
|
void updateWatchersHeader(int section, int, int newSize)
|
|
|
|
|
{ m_watchersWindow->header()->resizeSection(section, newSize); }
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void sourceFilesDockToggled(bool on)
|
2010-06-22 12:02:24 +02:00
|
|
|
{ if (on) notifyCurrentEngine(RequestReloadSourceFilesRole); }
|
2010-06-16 11:08:54 +02:00
|
|
|
void modulesDockToggled(bool on)
|
2010-06-22 12:02:24 +02:00
|
|
|
{ if (on) notifyCurrentEngine(RequestReloadModulesRole); }
|
2010-11-05 13:35:31 +01:00
|
|
|
|
2010-06-22 12:02:24 +02:00
|
|
|
void registerDockToggled(bool on)
|
2010-11-05 13:35:31 +01:00
|
|
|
{
|
|
|
|
|
if (on && m_currentEngine)
|
|
|
|
|
m_currentEngine->reloadRegisters();
|
|
|
|
|
}
|
2009-05-05 17:48:54 +02:00
|
|
|
|
2010-11-04 09:54:23 +01:00
|
|
|
void synchronizeBreakpoints()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
|
|
|
|
if (DebuggerRunControl *runControl = m_snapshotHandler->at(i)) {
|
|
|
|
|
DebuggerEngine *engine = runControl->engine();
|
|
|
|
|
engine->attemptBreakpointSynchronization();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-04 18:11:09 +01:00
|
|
|
void synchronizeWatchers()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
|
|
|
|
if (DebuggerRunControl *runControl = m_snapshotHandler->at(i)) {
|
|
|
|
|
DebuggerEngine *engine = runControl->engine();
|
|
|
|
|
engine->watchHandler()->synchronizeWatchers();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void onAction();
|
2010-11-04 10:15:36 +01:00
|
|
|
void setSimpleDockWidgetArrangement(Debugger::DebuggerLanguages activeLanguages);
|
2009-05-05 17:48:54 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void editorOpened(Core::IEditor *editor);
|
|
|
|
|
void editorAboutToClose(Core::IEditor *editor);
|
|
|
|
|
void setBusyCursor(bool busy);
|
|
|
|
|
void requestMark(TextEditor::ITextEditor *editor, int lineNumber);
|
|
|
|
|
void showToolTip(TextEditor::ITextEditor *editor, const QPoint &pnt, int pos);
|
|
|
|
|
void requestContextMenu(TextEditor::ITextEditor *editor,
|
|
|
|
|
int lineNumber, QMenu *menu);
|
2009-05-07 15:20:44 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void activatePreviousMode();
|
|
|
|
|
void activateDebugMode();
|
|
|
|
|
void toggleBreakpoint();
|
|
|
|
|
void toggleBreakpoint(const QString &fileName, int lineNumber);
|
|
|
|
|
void onModeChanged(Core::IMode *mode);
|
|
|
|
|
void showSettingsDialog();
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void startExternalApplication();
|
|
|
|
|
void startRemoteApplication();
|
|
|
|
|
void attachExternalApplication();
|
|
|
|
|
void attachExternalApplication
|
|
|
|
|
(qint64 pid, const QString &binary, const QString &crashParameter);
|
2010-10-20 12:13:28 +02:00
|
|
|
bool attachCmdLine();
|
2010-06-16 11:08:54 +02:00
|
|
|
void attachCore();
|
|
|
|
|
void attachCore(const QString &core, const QString &exeFileName);
|
2010-07-15 10:44:53 +02:00
|
|
|
void attachRemote(const QString &spec);
|
2010-06-16 11:08:54 +02:00
|
|
|
void attachRemoteTcf();
|
2009-06-08 19:28:28 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void enableReverseDebuggingTriggered(const QVariant &value);
|
2010-08-18 13:54:12 +02:00
|
|
|
void languagesChanged(const Debugger::DebuggerLanguages &languages);
|
2010-06-22 17:46:20 +02:00
|
|
|
void showStatusMessage(const QString &msg, int timeout = -1);
|
2010-09-09 17:58:26 +02:00
|
|
|
void openMemoryEditor();
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
DebuggerMainWindow *mainWindow()
|
|
|
|
|
{ return qobject_cast<DebuggerMainWindow*>
|
|
|
|
|
(DebuggerUISwitcher::instance()->mainWindow()); }
|
|
|
|
|
|
2010-09-27 12:23:34 +02:00
|
|
|
inline void setConfigValue(const QString &name, const QVariant &value);
|
|
|
|
|
inline QVariant configValue(const QString &name) const;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-15 16:43:56 +02:00
|
|
|
DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp,
|
2010-08-31 13:07:33 +02:00
|
|
|
RunConfiguration *rc = 0);
|
|
|
|
|
void startDebugger(RunControl *runControl);
|
2010-08-18 13:54:12 +02:00
|
|
|
void displayDebugger(DebuggerEngine *engine, bool updateEngine = true);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
void dumpLog();
|
|
|
|
|
void cleanupViews();
|
2010-07-05 17:08:30 +02:00
|
|
|
void setInitialState();
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
void fontSettingsChanged(const TextEditor::FontSettings &settings);
|
|
|
|
|
DebuggerState state() const { return m_state; }
|
|
|
|
|
|
|
|
|
|
void updateState(DebuggerEngine *engine);
|
2010-07-21 17:06:22 +02:00
|
|
|
void onCurrentProjectChanged(ProjectExplorer::Project *project);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
void gotoLocation(const QString &file, int line, bool setMarker);
|
|
|
|
|
|
|
|
|
|
void clearStatusMessage();
|
|
|
|
|
|
|
|
|
|
void sessionLoaded();
|
|
|
|
|
void aboutToUnloadSession();
|
|
|
|
|
void aboutToSaveSession();
|
2010-06-22 12:41:02 +02:00
|
|
|
|
|
|
|
|
void executeDebuggerCommand();
|
2010-08-31 13:07:33 +02:00
|
|
|
void scriptExpressionEntered(const QString &expression);
|
2010-10-22 12:26:13 +02:00
|
|
|
void coreShutdown();
|
2010-08-26 16:02:41 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
public:
|
|
|
|
|
DebuggerState m_state;
|
|
|
|
|
DebuggerUISwitcher *m_uiSwitcher;
|
|
|
|
|
DebuggerPlugin *m_manager;
|
|
|
|
|
DebugMode *m_debugMode;
|
|
|
|
|
DebuggerRunControlFactory *m_debuggerRunControlFactory;
|
|
|
|
|
|
|
|
|
|
QString m_previousMode;
|
2010-10-22 12:26:13 +02:00
|
|
|
QScopedPointer<TextEditor::BaseTextMark> m_locationMark;
|
2010-07-21 18:24:21 +02:00
|
|
|
Core::Context m_continuableContext;
|
|
|
|
|
Core::Context m_interruptibleContext;
|
2010-10-05 12:47:23 +02:00
|
|
|
Core::Context m_undisturbableContext;
|
|
|
|
|
Core::Context m_finishedContext;
|
|
|
|
|
Core::Context m_anyContext;
|
2010-06-16 11:08:54 +02:00
|
|
|
AttachRemoteParameters m_attachRemoteParameters;
|
|
|
|
|
|
|
|
|
|
QAction *m_startExternalAction;
|
|
|
|
|
QAction *m_startRemoteAction;
|
|
|
|
|
QAction *m_attachExternalAction;
|
|
|
|
|
QAction *m_attachCoreAction;
|
|
|
|
|
QAction *m_attachTcfAction;
|
|
|
|
|
QAction *m_detachAction;
|
|
|
|
|
QComboBox *m_langBox;
|
|
|
|
|
QToolButton *m_reverseToolButton;
|
|
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
QIcon m_startIcon;
|
2010-06-16 11:08:54 +02:00
|
|
|
QIcon m_stopIcon;
|
2010-10-05 12:47:23 +02:00
|
|
|
QIcon m_continueIcon;
|
2010-06-16 11:08:54 +02:00
|
|
|
QIcon m_interruptIcon;
|
|
|
|
|
QIcon m_locationMarkIcon;
|
|
|
|
|
|
|
|
|
|
QLabel *m_statusLabel;
|
|
|
|
|
QComboBox *m_threadBox;
|
|
|
|
|
|
|
|
|
|
QDockWidget *m_breakDock;
|
2010-10-13 13:34:27 +02:00
|
|
|
//QDockWidget *m_consoleDock;
|
2010-06-16 11:08:54 +02:00
|
|
|
QDockWidget *m_modulesDock;
|
|
|
|
|
QDockWidget *m_outputDock;
|
|
|
|
|
QDockWidget *m_registerDock;
|
|
|
|
|
QDockWidget *m_snapshotDock;
|
|
|
|
|
QDockWidget *m_sourceFilesDock;
|
|
|
|
|
QDockWidget *m_stackDock;
|
|
|
|
|
QDockWidget *m_threadsDock;
|
|
|
|
|
QDockWidget *m_watchDock;
|
2010-08-26 16:02:41 +02:00
|
|
|
QDockWidget* m_scriptConsoleDock;
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerActions m_actions;
|
|
|
|
|
|
|
|
|
|
BreakWindow *m_breakWindow;
|
2010-11-04 09:54:23 +01:00
|
|
|
BreakHandler *m_breakHandler;
|
2010-10-13 13:34:27 +02:00
|
|
|
//ConsoleWindow *m_consoleWindow;
|
2010-06-16 11:08:54 +02:00
|
|
|
QTreeView *m_returnWindow;
|
|
|
|
|
QTreeView *m_localsWindow;
|
|
|
|
|
QTreeView *m_watchersWindow;
|
|
|
|
|
QTreeView *m_commandWindow;
|
|
|
|
|
QAbstractItemView *m_registerWindow;
|
|
|
|
|
QAbstractItemView *m_modulesWindow;
|
|
|
|
|
QAbstractItemView *m_snapshotWindow;
|
|
|
|
|
SourceFilesWindow *m_sourceFilesWindow;
|
|
|
|
|
QAbstractItemView *m_stackWindow;
|
|
|
|
|
QAbstractItemView *m_threadsWindow;
|
2010-09-22 16:20:08 +02:00
|
|
|
LogWindow *m_logWindow;
|
2010-08-26 16:02:41 +02:00
|
|
|
ScriptConsole *m_scriptConsoleWindow;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
bool m_busy;
|
|
|
|
|
QTimer m_statusTimer;
|
|
|
|
|
QString m_lastPermanentStatusMessage;
|
|
|
|
|
|
|
|
|
|
CPlusPlus::Snapshot m_codeModelSnapshot;
|
|
|
|
|
DebuggerPlugin *m_plugin;
|
|
|
|
|
|
2010-07-20 17:36:20 +02:00
|
|
|
SnapshotHandler *m_snapshotHandler;
|
2010-10-22 12:26:13 +02:00
|
|
|
bool m_shuttingDown;
|
2010-11-04 18:11:09 +01:00
|
|
|
DebuggerEngine *m_currentEngine;
|
2010-06-16 11:08:54 +02:00
|
|
|
};
|
|
|
|
|
|
2010-11-04 18:11:09 +01:00
|
|
|
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
|
|
|
|
m_plugin = plugin;
|
|
|
|
|
|
2010-11-04 18:11:09 +01:00
|
|
|
m_shuttingDown = false;
|
2010-06-16 11:08:54 +02:00
|
|
|
m_statusLabel = 0;
|
|
|
|
|
m_threadBox = 0;
|
|
|
|
|
|
|
|
|
|
m_breakDock = 0;
|
2010-10-13 13:34:27 +02:00
|
|
|
//m_consoleDock = 0;
|
2010-06-16 11:08:54 +02:00
|
|
|
m_modulesDock = 0;
|
|
|
|
|
m_outputDock = 0;
|
|
|
|
|
m_registerDock = 0;
|
|
|
|
|
m_snapshotDock = 0;
|
|
|
|
|
m_sourceFilesDock = 0;
|
|
|
|
|
m_stackDock = 0;
|
|
|
|
|
m_threadsDock = 0;
|
|
|
|
|
m_watchDock = 0;
|
|
|
|
|
|
|
|
|
|
m_breakWindow = 0;
|
2010-11-04 09:54:23 +01:00
|
|
|
m_breakHandler = 0;
|
2010-06-16 11:08:54 +02:00
|
|
|
m_returnWindow = 0;
|
|
|
|
|
m_localsWindow = 0;
|
|
|
|
|
m_watchersWindow = 0;
|
|
|
|
|
m_registerWindow = 0;
|
|
|
|
|
m_modulesWindow = 0;
|
|
|
|
|
m_snapshotWindow = 0;
|
|
|
|
|
m_sourceFilesWindow = 0;
|
|
|
|
|
m_stackWindow = 0;
|
|
|
|
|
m_threadsWindow = 0;
|
2010-09-22 16:20:08 +02:00
|
|
|
m_logWindow = 0;
|
2010-08-26 16:02:41 +02:00
|
|
|
m_scriptConsoleWindow = 0;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_debugMode = 0;
|
2010-07-21 18:24:21 +02:00
|
|
|
|
|
|
|
|
m_continuableContext = Core::Context(0);
|
|
|
|
|
m_interruptibleContext = Core::Context(0);
|
2010-10-05 12:47:23 +02:00
|
|
|
m_undisturbableContext = Core::Context(0);
|
|
|
|
|
m_finishedContext = Core::Context(0);
|
|
|
|
|
m_anyContext = Core::Context(0);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_debugMode = 0;
|
|
|
|
|
m_uiSwitcher = 0;
|
2010-06-22 14:23:22 +02:00
|
|
|
m_state = DebuggerNotReady;
|
2010-07-20 17:36:20 +02:00
|
|
|
m_snapshotHandler = 0;
|
2010-11-04 18:11:09 +01:00
|
|
|
m_currentEngine = 0;
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *errorMessage)
|
|
|
|
|
{
|
2010-07-21 18:24:21 +02:00
|
|
|
m_continuableContext = Core::Context("Gdb.Continuable");
|
|
|
|
|
m_interruptibleContext = Core::Context("Gdb.Interruptible");
|
2010-10-05 12:47:23 +02:00
|
|
|
m_undisturbableContext = Core::Context("Gdb.Undisturbable");
|
|
|
|
|
m_finishedContext = Core::Context("Gdb.Finished");
|
|
|
|
|
m_anyContext.add(m_continuableContext);
|
|
|
|
|
m_anyContext.add(m_interruptibleContext);
|
|
|
|
|
m_anyContext.add(m_undisturbableContext);
|
|
|
|
|
m_anyContext.add(m_finishedContext);
|
2010-07-21 18:24:21 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
// FIXME: Move part of this to extensionsInitialized()?
|
|
|
|
|
ICore *core = ICore::instance();
|
|
|
|
|
QTC_ASSERT(core, return false);
|
2010-10-22 12:26:13 +02:00
|
|
|
connect(core, SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
Core::ActionManager *am = core->actionManager();
|
|
|
|
|
QTC_ASSERT(am, return false);
|
|
|
|
|
|
2010-06-28 14:30:03 +02:00
|
|
|
const Core::Context globalcontext(CC::C_GLOBAL);
|
2010-06-25 17:37:59 +02:00
|
|
|
const Core::Context cppDebuggercontext(C_CPPDEBUGGER);
|
2010-09-22 14:16:29 +02:00
|
|
|
const Core::Context qmlDebuggerContext(C_QMLDEBUGGER);
|
2010-06-25 17:37:59 +02:00
|
|
|
const Core::Context cppeditorcontext(CppEditor::Constants::C_CPPEDITOR);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
m_startIcon = QIcon(_(":/debugger/images/debugger_start_small.png"));
|
|
|
|
|
m_startIcon.addFile(__(":/debugger/images/debugger_start.png"));
|
2010-06-16 11:08:54 +02:00
|
|
|
m_stopIcon = QIcon(_(":/debugger/images/debugger_stop_small.png"));
|
2010-07-30 22:16:59 +02:00
|
|
|
m_stopIcon.addFile(__(":/debugger/images/debugger_stop.png"));
|
2010-10-05 12:47:23 +02:00
|
|
|
m_continueIcon = QIcon(__(":/debugger/images/debugger_continue_small.png"));
|
|
|
|
|
m_continueIcon.addFile(__(":/debugger/images/debugger_continue.png"));
|
2010-06-16 11:08:54 +02:00
|
|
|
m_interruptIcon = QIcon(_(":/debugger/images/debugger_interrupt_small.png"));
|
2010-07-30 22:16:59 +02:00
|
|
|
m_interruptIcon.addFile(__(":/debugger/images/debugger_interrupt.png"));
|
2010-06-16 11:08:54 +02:00
|
|
|
m_locationMarkIcon = QIcon(_(":/debugger/images/location_16.png"));
|
|
|
|
|
|
|
|
|
|
m_busy = false;
|
|
|
|
|
|
|
|
|
|
m_statusLabel = new QLabel;
|
|
|
|
|
m_statusLabel->setMinimumSize(QSize(30, 10));
|
|
|
|
|
|
2010-11-04 09:54:23 +01:00
|
|
|
m_breakHandler = new BreakHandler;
|
|
|
|
|
connect(m_breakHandler, SIGNAL(breakpointSynchronizationRequested()),
|
|
|
|
|
SLOT(synchronizeBreakpoints()));
|
2010-06-16 11:08:54 +02:00
|
|
|
m_breakWindow = new BreakWindow;
|
|
|
|
|
m_breakWindow->setObjectName(QLatin1String("CppDebugBreakpoints"));
|
2010-11-04 18:11:09 +01:00
|
|
|
m_breakWindow->setModel(m_breakHandler->model());
|
|
|
|
|
|
2010-10-13 13:34:27 +02:00
|
|
|
//m_consoleWindow = new ConsoleWindow;
|
|
|
|
|
//m_consoleWindow->setObjectName(QLatin1String("CppDebugConsole"));
|
2010-06-16 11:08:54 +02:00
|
|
|
m_modulesWindow = new ModulesWindow;
|
|
|
|
|
m_modulesWindow->setObjectName(QLatin1String("CppDebugModules"));
|
2010-09-22 16:20:08 +02:00
|
|
|
m_logWindow = new LogWindow;
|
|
|
|
|
m_logWindow->setObjectName(QLatin1String("CppDebugOutput"));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_registerWindow = new RegisterWindow;
|
|
|
|
|
m_registerWindow->setObjectName(QLatin1String("CppDebugRegisters"));
|
|
|
|
|
m_snapshotWindow = new SnapshotWindow;
|
|
|
|
|
m_snapshotWindow->setObjectName(QLatin1String("CppDebugSnapshots"));
|
|
|
|
|
m_stackWindow = new StackWindow;
|
|
|
|
|
m_stackWindow->setObjectName(QLatin1String("CppDebugStack"));
|
|
|
|
|
m_sourceFilesWindow = new SourceFilesWindow;
|
|
|
|
|
m_sourceFilesWindow->setObjectName(QLatin1String("CppDebugSources"));
|
|
|
|
|
m_threadsWindow = new ThreadsWindow;
|
|
|
|
|
m_threadsWindow->setObjectName(QLatin1String("CppDebugThreads"));
|
|
|
|
|
m_returnWindow = new WatchWindow(WatchWindow::ReturnType);
|
|
|
|
|
m_returnWindow->setObjectName(QLatin1String("CppDebugReturn"));
|
|
|
|
|
m_localsWindow = new WatchWindow(WatchWindow::LocalsType);
|
|
|
|
|
m_localsWindow->setObjectName(QLatin1String("CppDebugLocals"));
|
|
|
|
|
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
|
|
|
|
m_watchersWindow->setObjectName(QLatin1String("CppDebugWatchers"));
|
|
|
|
|
m_commandWindow = new QTreeView;
|
2010-08-26 16:02:41 +02:00
|
|
|
m_scriptConsoleWindow = new ScriptConsole;
|
|
|
|
|
m_scriptConsoleWindow->setWindowTitle(tr("QML Script Console"));
|
2010-09-22 14:07:35 +02:00
|
|
|
m_scriptConsoleWindow->setObjectName(QLatin1String("QMLScriptConsole"));
|
2010-08-31 13:07:33 +02:00
|
|
|
connect(m_scriptConsoleWindow, SIGNAL(expressionEntered(QString)),
|
|
|
|
|
SLOT(scriptExpressionEntered(QString)));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-20 17:36:20 +02:00
|
|
|
// Snapshot
|
2010-07-20 18:06:34 +02:00
|
|
|
m_snapshotHandler = new SnapshotHandler;
|
2010-07-20 17:36:20 +02:00
|
|
|
m_snapshotWindow->setModel(m_snapshotHandler->model());
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
// Debug mode setup
|
|
|
|
|
m_debugMode = new DebugMode(this);
|
|
|
|
|
|
|
|
|
|
// Watchers
|
|
|
|
|
connect(m_localsWindow->header(), SIGNAL(sectionResized(int,int,int)),
|
|
|
|
|
this, SLOT(updateWatchersHeader(int,int,int)), Qt::QueuedConnection);
|
|
|
|
|
|
|
|
|
|
m_actions.continueAction = new QAction(tr("Continue"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.continueAction->setProperty(Role, RequestExecContinueRole);
|
2010-10-05 12:47:23 +02:00
|
|
|
m_actions.continueAction->setIcon(m_continueIcon);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-22 10:23:27 +02:00
|
|
|
m_actions.stopAction = new QAction(tr("Stop Debugger"), this);
|
|
|
|
|
m_actions.stopAction->setProperty(Role, RequestExecExitRole);
|
|
|
|
|
m_actions.stopAction->setIcon(m_stopIcon);
|
|
|
|
|
|
2010-07-21 18:24:21 +02:00
|
|
|
m_actions.interruptAction = new QAction(tr("Interrupt"), this);
|
|
|
|
|
m_actions.interruptAction->setIcon(m_interruptIcon);
|
|
|
|
|
m_actions.interruptAction->setProperty(Role, RequestExecInterruptRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
m_actions.undisturbableAction = new QAction(tr("Debugger is Busy"), this);
|
|
|
|
|
// A "disabled pause" seems to be a good choice.
|
|
|
|
|
m_actions.undisturbableAction->setIcon(m_interruptIcon);
|
|
|
|
|
m_actions.undisturbableAction->setEnabled(false);
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.resetAction = new QAction(tr("Abort Debugging"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.resetAction->setProperty(Role, RequestExecResetRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.resetAction->setToolTip(tr("Aborts debugging and "
|
|
|
|
|
"resets the debugger to the initial state."));
|
|
|
|
|
|
|
|
|
|
m_actions.nextAction = new QAction(tr("Step Over"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.nextAction->setProperty(Role, RequestExecNextRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.nextAction->setIcon(
|
2010-07-30 22:16:59 +02:00
|
|
|
QIcon(__(":/debugger/images/debugger_stepover_small.png")));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.stepAction = new QAction(tr("Step Into"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.stepAction->setProperty(Role, RequestExecStepRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.stepAction->setIcon(
|
2010-07-30 22:16:59 +02:00
|
|
|
QIcon(__(":/debugger/images/debugger_stepinto_small.png")));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.stepOutAction = new QAction(tr("Step Out"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.stepOutAction->setProperty(Role, RequestExecStepOutRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.stepOutAction->setIcon(
|
2010-07-30 22:16:59 +02:00
|
|
|
QIcon(__(":/debugger/images/debugger_stepout_small.png")));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-04 11:46:16 +01:00
|
|
|
m_actions.runToLineAction = new QAction(tr("Run to Line"), this);
|
|
|
|
|
m_actions.runToLineAction->setProperty(Role, RequestExecRunToLineRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.runToFunctionAction =
|
|
|
|
|
new QAction(tr("Run to Outermost Function"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.runToFunctionAction->setProperty(Role, RequestExecRunToFunctionRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.returnFromFunctionAction =
|
|
|
|
|
new QAction(tr("Immediately Return From Inner Function"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.returnFromFunctionAction->setProperty(Role, RequestExecReturnFromFunctionRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-04 11:46:16 +01:00
|
|
|
m_actions.jumpToLineAction = new QAction(tr("Jump to Line"), this);
|
|
|
|
|
m_actions.jumpToLineAction->setProperty(Role, RequestExecJumpToLineRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this);
|
|
|
|
|
|
|
|
|
|
m_actions.watchAction1 = new QAction(tr("Add to Watch Window"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.watchAction1->setProperty(Role, RequestExecWatchRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.watchAction2 = new QAction(tr("Add to Watch Window"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.watchAction2->setProperty(Role, RequestExecWatchRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-21 09:42:33 +02:00
|
|
|
m_actions.snapshotAction = new QAction(tr("Create Snapshot"), this);
|
|
|
|
|
m_actions.snapshotAction->setProperty(Role, RequestCreateSnapshotRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.snapshotAction->setIcon(
|
2010-07-30 22:16:59 +02:00
|
|
|
QIcon(__(":/debugger/images/debugger_snapshot_small.png")));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.reverseDirectionAction =
|
|
|
|
|
new QAction(tr("Reverse Direction"), this);
|
|
|
|
|
m_actions.reverseDirectionAction->setCheckable(true);
|
|
|
|
|
m_actions.reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setIcon(
|
2010-07-30 22:16:59 +02:00
|
|
|
QIcon(__(":/debugger/images/debugger_reversemode_16.png")));
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.reverseDirectionAction->setIconVisibleInMenu(false);
|
|
|
|
|
|
|
|
|
|
m_actions.frameDownAction =
|
|
|
|
|
new QAction(tr("Move to Called Frame"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.frameDownAction->setProperty(Role, RequestExecFrameDownRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.frameUpAction =
|
|
|
|
|
new QAction(tr("Move to Calling Frame"), this);
|
2010-06-22 17:18:29 +02:00
|
|
|
m_actions.frameUpAction->setProperty(Role, RequestExecFrameUpRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.reverseDirectionAction->setCheckable(false);
|
2010-06-22 12:02:24 +02:00
|
|
|
theDebuggerAction(OperateByInstruction)->
|
2010-06-22 17:18:29 +02:00
|
|
|
setProperty(Role, RequestOperatedByInstructionTriggeredRole);
|
2010-06-22 12:02:24 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_actions.continueAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.nextAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.stepAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.stepOutAction, SIGNAL(triggered()), SLOT(onAction()));
|
2010-11-04 11:46:16 +01:00
|
|
|
connect(m_actions.runToLineAction, SIGNAL(triggered()), SLOT(onAction()));
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_actions.runToFunctionAction, SIGNAL(triggered()), SLOT(onAction()));
|
2010-11-04 11:46:16 +01:00
|
|
|
connect(m_actions.jumpToLineAction, SIGNAL(triggered()), SLOT(onAction()));
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_actions.returnFromFunctionAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.watchAction1, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.watchAction2, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.snapshotAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.frameDownAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(m_actions.frameUpAction, SIGNAL(triggered()), SLOT(onAction()));
|
2010-07-22 10:23:27 +02:00
|
|
|
connect(m_actions.stopAction, SIGNAL(triggered()), SLOT(onAction()));
|
2010-10-05 12:47:23 +02:00
|
|
|
connect(m_actions.interruptAction, SIGNAL(triggered()), SLOT(onAction()));
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_actions.resetAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
connect(&m_statusTimer, SIGNAL(timeout()), SLOT(clearStatusMessage()));
|
|
|
|
|
|
|
|
|
|
connect(theDebuggerAction(ExecuteCommand), SIGNAL(triggered()),
|
2010-06-22 11:42:28 +02:00
|
|
|
SLOT(executeDebuggerCommand()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
connect(theDebuggerAction(OperateByInstruction), SIGNAL(triggered()),
|
2010-06-22 12:02:24 +02:00
|
|
|
SLOT(onAction()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_plugin->readSettings();
|
|
|
|
|
|
|
|
|
|
// Cpp/Qml ui setup
|
|
|
|
|
m_uiSwitcher = new DebuggerUISwitcher(m_debugMode, this);
|
|
|
|
|
ExtensionSystem::PluginManager::instance()->addObject(m_uiSwitcher);
|
2010-09-28 11:15:57 +02:00
|
|
|
m_uiSwitcher->addLanguage(CppLanguage, cppDebuggercontext);
|
|
|
|
|
m_uiSwitcher->addLanguage(QmlLanguage, qmlDebuggerContext);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
// Dock widgets
|
2010-08-24 17:17:54 +02:00
|
|
|
m_breakDock = m_uiSwitcher->createDockWidget(CppLanguage, m_breakWindow);
|
|
|
|
|
m_breakDock->setObjectName(QString(DOCKWIDGET_BREAK));
|
2010-09-22 12:25:42 +02:00
|
|
|
|
2010-10-13 13:34:27 +02:00
|
|
|
//m_consoleDock = m_uiSwitcher->createDockWidget(CppLanguage, m_consoleWindow,
|
|
|
|
|
// Qt::TopDockWidgetArea);
|
|
|
|
|
//m_consoleDock->setObjectName(QString(DOCKWIDGET_OUTPUT));
|
2010-09-22 12:25:42 +02:00
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_modulesDock = m_uiSwitcher->createDockWidget(CppLanguage, m_modulesWindow,
|
|
|
|
|
Qt::TopDockWidgetArea);
|
|
|
|
|
m_modulesDock->setObjectName(QString(DOCKWIDGET_MODULES));
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_modulesDock->toggleViewAction(), SIGNAL(toggled(bool)),
|
2010-06-22 12:02:24 +02:00
|
|
|
SLOT(modulesDockToggled(bool)), Qt::QueuedConnection);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_registerDock = m_uiSwitcher->createDockWidget(CppLanguage, m_registerWindow,
|
|
|
|
|
Qt::TopDockWidgetArea);
|
|
|
|
|
m_registerDock->setObjectName(QString(DOCKWIDGET_REGISTER));
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_registerDock->toggleViewAction(), SIGNAL(toggled(bool)),
|
2010-06-22 12:02:24 +02:00
|
|
|
SLOT(registerDockToggled(bool)), Qt::QueuedConnection);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-09-22 16:20:08 +02:00
|
|
|
m_outputDock = m_uiSwitcher->createDockWidget(AnyLanguage, m_logWindow,
|
2010-08-24 17:17:54 +02:00
|
|
|
Qt::TopDockWidgetArea);
|
|
|
|
|
m_outputDock->setObjectName(QString(DOCKWIDGET_OUTPUT));
|
2010-09-22 12:25:42 +02:00
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_snapshotDock = m_uiSwitcher->createDockWidget(CppLanguage, m_snapshotWindow);
|
|
|
|
|
m_snapshotDock->setObjectName(QString(DOCKWIDGET_SNAPSHOTS));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_stackDock = m_uiSwitcher->createDockWidget(CppLanguage, m_stackWindow);
|
|
|
|
|
m_stackDock->setObjectName(QString(DOCKWIDGET_STACK));
|
2010-06-22 12:02:24 +02:00
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_sourceFilesDock = m_uiSwitcher->createDockWidget(CppLanguage,
|
|
|
|
|
m_sourceFilesWindow, Qt::TopDockWidgetArea);
|
|
|
|
|
m_sourceFilesDock->setObjectName(QString(DOCKWIDGET_SOURCE_FILES));
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_sourceFilesDock->toggleViewAction(), SIGNAL(toggled(bool)),
|
2010-06-22 12:02:24 +02:00
|
|
|
SLOT(sourceFilesDockToggled(bool)), Qt::QueuedConnection);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_threadsDock = m_uiSwitcher->createDockWidget(CppLanguage, m_threadsWindow);
|
|
|
|
|
m_threadsDock->setObjectName(QString(DOCKWIDGET_THREADS));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
QSplitter *localsAndWatchers = new Core::MiniSplitter(Qt::Vertical);
|
|
|
|
|
localsAndWatchers->setObjectName(QLatin1String("CppDebugLocalsAndWatchers"));
|
|
|
|
|
localsAndWatchers->setWindowTitle(m_localsWindow->windowTitle());
|
|
|
|
|
localsAndWatchers->addWidget(m_localsWindow);
|
|
|
|
|
localsAndWatchers->addWidget(m_returnWindow);
|
|
|
|
|
localsAndWatchers->addWidget(m_watchersWindow);
|
|
|
|
|
localsAndWatchers->setStretchFactor(0, 3);
|
|
|
|
|
localsAndWatchers->setStretchFactor(1, 1);
|
|
|
|
|
localsAndWatchers->setStretchFactor(2, 1);
|
|
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_watchDock = m_uiSwitcher->createDockWidget(CppLanguage, localsAndWatchers);
|
|
|
|
|
m_watchDock->setObjectName(QString(DOCKWIDGET_WATCHERS));
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
m_scriptConsoleDock =
|
|
|
|
|
m_uiSwitcher->createDockWidget(QmlLanguage, m_scriptConsoleWindow);
|
2010-08-26 16:02:41 +02:00
|
|
|
m_scriptConsoleDock->setObjectName(QString(DOCKWIDGET_QML_SCRIPTCONSOLE));
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
// Do not fail the whole plugin if something goes wrong here.
|
|
|
|
|
uint cmdLineEnabledEngines = AllEngineTypes;
|
2010-07-15 10:44:53 +02:00
|
|
|
if (!parseArguments(arguments, &m_attachRemoteParameters,
|
|
|
|
|
&cmdLineEnabledEngines, errorMessage)) {
|
2010-06-16 11:08:54 +02:00
|
|
|
*errorMessage = tr("Error evaluating command line arguments: %1")
|
|
|
|
|
.arg(*errorMessage);
|
|
|
|
|
qWarning("%s\n", qPrintable(*errorMessage));
|
|
|
|
|
errorMessage->clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Register factory of DebuggerRunControl.
|
|
|
|
|
m_debuggerRunControlFactory = new DebuggerRunControlFactory
|
|
|
|
|
(m_plugin, DebuggerEngineType(cmdLineEnabledEngines));
|
|
|
|
|
m_plugin->addAutoReleasedObject(m_debuggerRunControlFactory);
|
|
|
|
|
|
2010-06-25 17:37:59 +02:00
|
|
|
m_debugMode->setContext(
|
|
|
|
|
Core::Context(CC::C_EDITORMANAGER, C_DEBUGMODE, CC::C_NAVIGATION_PANE));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_reverseToolButton = 0;
|
|
|
|
|
|
|
|
|
|
// Handling of external applications.
|
|
|
|
|
m_startExternalAction = new QAction(this);
|
|
|
|
|
m_startExternalAction->setText(tr("Start and Debug External Application..."));
|
|
|
|
|
connect(m_startExternalAction, SIGNAL(triggered()),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(startExternalApplication()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_attachExternalAction = new QAction(this);
|
|
|
|
|
m_attachExternalAction->setText(tr("Attach to Running External Application..."));
|
|
|
|
|
connect(m_attachExternalAction, SIGNAL(triggered()),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(attachExternalApplication()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_attachCoreAction = new QAction(this);
|
|
|
|
|
m_attachCoreAction->setText(tr("Attach to Core..."));
|
2010-10-27 14:10:44 +02:00
|
|
|
connect(m_attachCoreAction, SIGNAL(triggered()), SLOT(attachCore()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_attachTcfAction = new QAction(this);
|
|
|
|
|
m_attachTcfAction->setText(tr("Attach to Running Tcf Agent..."));
|
|
|
|
|
m_attachTcfAction->setToolTip(tr("This attaches to a running "
|
|
|
|
|
"'Target Communication Framework' agent."));
|
2010-08-31 13:07:33 +02:00
|
|
|
connect(m_attachTcfAction, SIGNAL(triggered()), SLOT(attachRemoteTcf()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_startRemoteAction = new QAction(this);
|
|
|
|
|
m_startRemoteAction->setText(tr("Start and Attach to Remote Application..."));
|
|
|
|
|
connect(m_startRemoteAction, SIGNAL(triggered()),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(startRemoteApplication()));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_detachAction = new QAction(this);
|
|
|
|
|
m_detachAction->setText(tr("Detach Debugger"));
|
2010-06-22 17:18:29 +02:00
|
|
|
m_detachAction->setProperty(Role, RequestExecDetachRole);
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_detachAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
|
|
|
|
2010-08-26 16:02:41 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
Core::Command *cmd = 0;
|
|
|
|
|
|
|
|
|
|
Core::ActionContainer *mstart =
|
|
|
|
|
am->actionContainer(PE::M_DEBUG_STARTDEBUGGING);
|
|
|
|
|
|
|
|
|
|
cmd = am->registerAction(m_actions.continueAction,
|
2010-07-21 18:24:21 +02:00
|
|
|
PE::DEBUG, m_continuableContext);
|
2010-03-11 12:22:24 +01:00
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2009-06-04 16:06:12 +02:00
|
|
|
|
2009-05-05 17:48:54 +02:00
|
|
|
cmd = am->registerAction(m_startExternalAction,
|
2008-12-02 12:01:29 +01:00
|
|
|
Constants::STARTEXTERNAL, globalcontext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-03-11 12:22:24 +01:00
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-05-05 17:48:54 +02:00
|
|
|
cmd = am->registerAction(m_attachExternalAction,
|
2008-12-02 12:01:29 +01:00
|
|
|
Constants::ATTACHEXTERNAL, globalcontext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-03-11 12:22:24 +01:00
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2009-03-02 15:14:12 +01:00
|
|
|
|
2009-05-05 17:48:54 +02:00
|
|
|
cmd = am->registerAction(m_attachCoreAction,
|
|
|
|
|
Constants::ATTACHCORE, globalcontext);
|
2010-05-05 12:41:52 +02:00
|
|
|
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-03-11 12:22:24 +01:00
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2009-05-07 17:11:19 +02:00
|
|
|
|
2010-05-05 12:41:52 +02:00
|
|
|
cmd = am->registerAction(m_attachTcfAction,
|
|
|
|
|
Constants::ATTACHTCF, globalcontext);
|
|
|
|
|
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
cmd = am->registerAction(m_startRemoteAction,
|
2009-05-05 17:48:54 +02:00
|
|
|
Constants::ATTACHREMOTE, globalcontext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-03-11 12:22:24 +01:00
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2009-05-04 14:47:45 +02:00
|
|
|
|
2009-05-07 15:20:44 +02:00
|
|
|
cmd = am->registerAction(m_detachAction,
|
|
|
|
|
Constants::DETACH, globalcontext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, AnyLanguage, CC::G_DEFAULT_ONE);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-22 10:23:27 +02:00
|
|
|
cmd = am->registerAction(m_actions.stopAction,
|
|
|
|
|
Constants::STOP, globalcontext);
|
|
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(Constants::STOP_KEY));
|
|
|
|
|
cmd->setDefaultText(tr("Stop Debugger"));
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, AnyLanguage, CC::G_DEFAULT_ONE);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-22 10:23:27 +02:00
|
|
|
cmd = am->registerAction(m_actions.interruptAction,
|
|
|
|
|
PE::DEBUG, m_interruptibleContext);
|
|
|
|
|
cmd->setDefaultText(tr("Interrupt Debugger"));
|
|
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
cmd = am->registerAction(m_actions.undisturbableAction,
|
|
|
|
|
PE::DEBUG, m_undisturbableContext);
|
|
|
|
|
cmd->setDefaultText(tr("Debugger is Busy"));
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.resetAction,
|
2008-12-02 12:01:29 +01:00
|
|
|
Constants::RESET, globalcontext);
|
2010-02-11 11:26:08 +01:00
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(Constants::RESET_KEY));
|
2008-12-02 12:01:29 +01:00
|
|
|
cmd->setDefaultText(tr("Reset Debugger"));
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, AnyLanguage, CC::G_DEFAULT_ONE);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QAction *sep = new QAction(this);
|
|
|
|
|
sep->setSeparator(true);
|
2010-03-11 12:22:24 +01:00
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Step"), globalcontext);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.nextAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::NEXT, cppDebuggercontext);
|
2008-12-02 12:01:29 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY));
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.stepAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::STEP, cppDebuggercontext);
|
2008-12-02 12:01:29 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY));
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.stepOutAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::STEPOUT, cppDebuggercontext);
|
2008-12-02 12:01:29 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY));
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-11-04 11:46:16 +01:00
|
|
|
cmd = am->registerAction(m_actions.runToLineAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::RUN_TO_LINE1, cppDebuggercontext);
|
2008-12-02 12:01:29 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY));
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.runToFunctionAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::RUN_TO_FUNCTION, cppDebuggercontext);
|
2008-12-02 12:01:29 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY));
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-11-04 11:46:16 +01:00
|
|
|
cmd = am->registerAction(m_actions.jumpToLineAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::JUMP_TO_LINE1, cppDebuggercontext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.returnFromFunctionAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::RETURN_FROM_FUNCTION, cppDebuggercontext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-02-15 16:02:41 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.reverseDirectionAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::REVERSE, cppDebuggercontext);
|
2009-05-25 17:19:42 +02:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY));
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2009-05-25 17:19:42 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
sep = new QAction(this);
|
|
|
|
|
sep->setSeparator(true);
|
2010-03-11 12:22:24 +01:00
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Break"), globalcontext);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.snapshotAction,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::SNAPSHOT, cppDebuggercontext);
|
2010-02-02 17:25:14 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::SNAPSHOT_KEY));
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.frameDownAction,
|
2010-06-07 13:17:19 +02:00
|
|
|
Constants::FRAME_DOWN, cppDebuggercontext);
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.frameUpAction,
|
2010-06-07 13:17:19 +02:00
|
|
|
Constants::FRAME_UP, cppDebuggercontext);
|
|
|
|
|
|
2010-02-02 17:25:14 +01:00
|
|
|
|
2009-09-29 11:13:19 +02:00
|
|
|
cmd = am->registerAction(theDebuggerAction(OperateByInstruction),
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2009-09-29 11:13:19 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.breakAction,
|
2010-07-07 13:16:00 +02:00
|
|
|
Constants::TOGGLE_BREAK, globalcontext);
|
2008-12-02 12:01:29 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::TOGGLE_BREAK_KEY));
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(m_actions.breakAction, SIGNAL(triggered()),
|
2010-10-27 14:10:44 +02:00
|
|
|
SLOT(toggleBreakpoint()));
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
//mcppcontext->addAction(cmd);
|
|
|
|
|
|
|
|
|
|
sep = new QAction(this);
|
|
|
|
|
sep->setSeparator(true);
|
2010-03-11 12:22:24 +01:00
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Watch"), globalcontext);
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.watchAction1,
|
2009-12-11 18:19:51 +01:00
|
|
|
Constants::ADD_TO_WATCH1, cppeditorcontext);
|
2009-12-11 15:31:37 +01:00
|
|
|
cmd->action()->setEnabled(true);
|
2010-07-02 12:09:16 +02:00
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+W")));
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2009-12-11 18:19:51 +01:00
|
|
|
|
2010-02-08 09:13:21 +01:00
|
|
|
// Editor context menu
|
2009-12-11 18:19:51 +01:00
|
|
|
ActionContainer *editorContextMenu =
|
|
|
|
|
am->actionContainer(CppEditor::Constants::M_CONTEXT);
|
2010-03-11 12:22:24 +01:00
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Views"),
|
2010-03-23 18:12:03 +01:00
|
|
|
cppDebuggercontext);
|
2009-12-11 18:19:51 +01:00
|
|
|
editorContextMenu->addAction(cmd);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-02-08 09:13:21 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
cmd = am->registerAction(m_actions.watchAction2,
|
2010-03-23 18:12:03 +01:00
|
|
|
Constants::ADD_TO_WATCH2, cppDebuggercontext);
|
2009-12-11 18:19:51 +01:00
|
|
|
cmd->action()->setEnabled(true);
|
2010-02-08 09:13:21 +01:00
|
|
|
editorContextMenu->addAction(cmd);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
m_plugin->addAutoReleasedObject(new CommonOptionsPage);
|
|
|
|
|
QList<Core::IOptionsPage *> engineOptionPages;
|
|
|
|
|
if (cmdLineEnabledEngines & GdbEngineType)
|
|
|
|
|
addGdbOptionPages(&engineOptionPages);
|
|
|
|
|
#ifdef CDB_ENABLED
|
|
|
|
|
if (cmdLineEnabledEngines & CdbEngineType)
|
|
|
|
|
addCdbOptionPages(&engineOptionPages);
|
|
|
|
|
#endif
|
|
|
|
|
//if (cmdLineEnabledEngines & ScriptEngineType)
|
|
|
|
|
// addScriptOptionPages(&engineOptionPages);
|
|
|
|
|
//if (cmdLineEnabledEngines & TcfEngineType)
|
|
|
|
|
// addTcfOptionPages(&engineOptionPages);
|
2010-04-06 16:42:24 +02:00
|
|
|
foreach (Core::IOptionsPage *op, engineOptionPages)
|
2010-06-16 11:08:54 +02:00
|
|
|
m_plugin->addAutoReleasedObject(op);
|
|
|
|
|
m_plugin->addAutoReleasedObject(new DebuggingHelperOptionPage);
|
2010-04-06 16:42:24 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
//setSimpleDockWidgetArrangement(Lang_Cpp);
|
2009-01-13 18:15:24 +01:00
|
|
|
|
|
|
|
|
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
2010-10-27 14:10:44 +02:00
|
|
|
SLOT(onModeChanged(Core::IMode*)));
|
2009-01-13 18:15:24 +01:00
|
|
|
m_debugMode->widget()->setFocusProxy(EditorManager::instance());
|
2010-06-16 11:08:54 +02:00
|
|
|
m_plugin->addObject(m_debugMode);
|
2010-03-10 13:46:05 +01:00
|
|
|
|
|
|
|
|
|
2009-01-13 18:15:24 +01:00
|
|
|
//
|
|
|
|
|
// Connections
|
|
|
|
|
//
|
|
|
|
|
|
2010-02-12 14:15:20 +01:00
|
|
|
// TextEditor
|
2010-04-19 16:42:02 +02:00
|
|
|
connect(TextEditorSettings::instance(),
|
2010-02-12 14:15:20 +01:00
|
|
|
SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(fontSettingsChanged(TextEditor::FontSettings)));
|
2010-02-12 14:15:20 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// ProjectExplorer
|
2009-01-28 14:29:54 +01:00
|
|
|
connect(sessionManager(), SIGNAL(sessionLoaded()),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(sessionLoaded()));
|
2009-01-28 14:29:54 +01:00
|
|
|
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(aboutToSaveSession()));
|
2009-08-13 17:10:53 +02:00
|
|
|
connect(sessionManager(), SIGNAL(aboutToUnloadSession()),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(aboutToUnloadSession()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// EditorManager
|
|
|
|
|
QObject *editorManager = core->editorManager();
|
|
|
|
|
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(editorAboutToClose(Core::IEditor*)));
|
2008-12-02 12:01:29 +01:00
|
|
|
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(editorOpened(Core::IEditor*)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Application interaction
|
2009-03-19 15:54:52 +01:00
|
|
|
connect(theDebuggerAction(SettingsDialog), SIGNAL(triggered()),
|
2010-08-31 13:07:33 +02:00
|
|
|
SLOT(showSettingsDialog()));
|
2009-02-27 11:41:19 +01:00
|
|
|
|
2010-03-11 11:07:16 +01:00
|
|
|
// Toolbar
|
2010-02-09 20:44:40 +01:00
|
|
|
QWidget *toolbarContainer = new QWidget;
|
2010-03-10 13:46:05 +01:00
|
|
|
|
|
|
|
|
QHBoxLayout *hbox = new QHBoxLayout(toolbarContainer);
|
|
|
|
|
hbox->setMargin(0);
|
|
|
|
|
hbox->setSpacing(0);
|
2010-03-11 12:22:24 +01:00
|
|
|
hbox->addWidget(toolButton(am->command(PE::DEBUG)->action()));
|
2010-07-22 10:23:27 +02:00
|
|
|
hbox->addWidget(toolButton(am->command(STOP)->action()));
|
2010-03-11 12:22:24 +01:00
|
|
|
hbox->addWidget(toolButton(am->command(NEXT)->action()));
|
|
|
|
|
hbox->addWidget(toolButton(am->command(STEP)->action()));
|
|
|
|
|
hbox->addWidget(toolButton(am->command(STEPOUT)->action()));
|
|
|
|
|
hbox->addWidget(toolButton(am->command(OPERATE_BY_INSTRUCTION)->action()));
|
2010-03-11 11:07:16 +01:00
|
|
|
|
|
|
|
|
//hbox->addWidget(new Utils::StyledSeparator);
|
2010-03-11 12:22:24 +01:00
|
|
|
m_reverseToolButton = toolButton(am->command(REVERSE)->action());
|
2010-03-11 11:07:16 +01:00
|
|
|
hbox->addWidget(m_reverseToolButton);
|
|
|
|
|
//m_reverseToolButton->hide();
|
|
|
|
|
|
2010-03-10 13:46:05 +01:00
|
|
|
hbox->addWidget(new Utils::StyledSeparator);
|
|
|
|
|
hbox->addWidget(new QLabel(tr("Threads:")));
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
m_threadBox = new QComboBox;
|
|
|
|
|
connect(m_threadBox, SIGNAL(activated(int)),
|
|
|
|
|
m_threadsWindow, SLOT(selectThread(int)));
|
2010-03-10 13:46:05 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
hbox->addWidget(m_threadBox);
|
2010-03-23 14:49:02 +01:00
|
|
|
hbox->addSpacerItem(new QSpacerItem(4, 0));
|
2010-06-16 11:08:54 +02:00
|
|
|
hbox->addWidget(m_statusLabel, 10);
|
2010-03-11 11:07:16 +01:00
|
|
|
|
2010-08-24 17:17:54 +02:00
|
|
|
m_uiSwitcher->setToolbar(CppLanguage, toolbarContainer);
|
2010-08-31 13:07:33 +02:00
|
|
|
connect(m_uiSwitcher,
|
|
|
|
|
SIGNAL(dockResetRequested(Debugger::DebuggerLanguages)),
|
|
|
|
|
SLOT(setSimpleDockWidgetArrangement(Debugger::DebuggerLanguages)));
|
2010-03-11 11:07:16 +01:00
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
connect(theDebuggerAction(EnableReverseDebugging),
|
|
|
|
|
SIGNAL(valueChanged(QVariant)),
|
|
|
|
|
SLOT(enableReverseDebuggingTriggered(QVariant)));
|
2010-03-11 11:07:16 +01:00
|
|
|
|
2010-03-18 10:56:25 +01:00
|
|
|
// UI Switcher
|
2010-08-31 13:07:33 +02:00
|
|
|
connect(m_uiSwitcher,
|
|
|
|
|
SIGNAL(activeLanguagesChanged(Debugger::DebuggerLanguages)),
|
|
|
|
|
SLOT(languagesChanged(Debugger::DebuggerLanguages)));
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-07-05 17:08:30 +02:00
|
|
|
setInitialState();
|
2010-11-04 18:11:09 +01:00
|
|
|
connectEngine(0, false);
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-07-21 17:06:22 +02:00
|
|
|
connect(sessionManager(),
|
2010-08-31 13:07:33 +02:00
|
|
|
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
|
|
|
|
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
|
2010-07-21 17:06:22 +02:00
|
|
|
|
2010-03-11 11:07:16 +01:00
|
|
|
return true;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-09-27 12:23:34 +02:00
|
|
|
void DebuggerPluginPrivate::setConfigValue(const QString &name, const QVariant &value)
|
|
|
|
|
{
|
|
|
|
|
settings()->setValue(_("DebugMode/") + name, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant DebuggerPluginPrivate::configValue(const QString &name) const
|
|
|
|
|
{
|
|
|
|
|
const QVariant value = settings()->value(_("DebugMode/") + name);
|
|
|
|
|
if (value.isValid())
|
|
|
|
|
return value;
|
|
|
|
|
// Legacy (pre-2.1): Check old un-namespaced-settings.
|
|
|
|
|
return settings()->value(name);
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
|
2010-07-21 17:06:22 +02:00
|
|
|
{
|
2010-08-31 13:07:33 +02:00
|
|
|
RunConfiguration *activeRc = 0;
|
2010-07-22 16:23:14 +02:00
|
|
|
if (project) {
|
2010-08-31 13:07:33 +02:00
|
|
|
Target *target = project->activeTarget();
|
2010-07-22 16:23:14 +02:00
|
|
|
QTC_ASSERT(target, return);
|
|
|
|
|
activeRc = target->activeRunConfiguration();
|
|
|
|
|
QTC_ASSERT(activeRc, /**/);
|
|
|
|
|
}
|
2010-07-21 17:06:22 +02:00
|
|
|
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
2010-08-18 11:08:50 +02:00
|
|
|
// Run controls might be deleted during exit.
|
|
|
|
|
if (DebuggerRunControl *runControl = m_snapshotHandler->at(i)) {
|
|
|
|
|
RunConfiguration *rc = runControl->runConfiguration();
|
|
|
|
|
if (rc == activeRc) {
|
|
|
|
|
m_snapshotHandler->setCurrentIndex(i);
|
|
|
|
|
DebuggerEngine *engine = runControl->engine();
|
|
|
|
|
updateState(engine);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2010-07-21 17:06:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// No corresponding debugger found. So we are ready to start one.
|
|
|
|
|
ICore *core = ICore::instance();
|
2010-10-05 12:47:23 +02:00
|
|
|
core->updateAdditionalContexts(m_anyContext, Context());
|
2010-07-21 17:06:22 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::onAction()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(act, return);
|
2010-06-22 17:18:29 +02:00
|
|
|
const int role = act->property(Role).toInt();
|
2010-06-16 11:08:54 +02:00
|
|
|
notifyCurrentEngine(role);
|
2009-05-25 16:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
void DebuggerPluginPrivate::languagesChanged(const DebuggerLanguages &languages)
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
2010-08-24 17:17:54 +02:00
|
|
|
const bool debuggerIsCPP = (languages & CppLanguage);
|
2010-06-16 11:08:54 +02:00
|
|
|
//qDebug() << "DEBUGGER IS CPP: " << debuggerIsCPP;
|
|
|
|
|
|
|
|
|
|
m_startExternalAction->setVisible(debuggerIsCPP);
|
|
|
|
|
m_attachExternalAction->setVisible(debuggerIsCPP);
|
|
|
|
|
m_attachCoreAction->setVisible(debuggerIsCPP);
|
|
|
|
|
m_startRemoteAction->setVisible(debuggerIsCPP);
|
|
|
|
|
m_detachAction->setVisible(debuggerIsCPP);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::startExternalApplication()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
StartExternalDialog dlg(mainWindow());
|
|
|
|
|
dlg.setExecutableFile(
|
|
|
|
|
configValue(_("LastExternalExecutableFile")).toString());
|
|
|
|
|
dlg.setExecutableArguments(
|
|
|
|
|
configValue(_("LastExternalExecutableArguments")).toString());
|
|
|
|
|
dlg.setWorkingDirectory(
|
|
|
|
|
configValue(_("LastExternalWorkingDirectory")).toString());
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
setConfigValue(_("LastExternalExecutableFile"),
|
|
|
|
|
dlg.executableFile());
|
|
|
|
|
setConfigValue(_("LastExternalExecutableArguments"),
|
|
|
|
|
dlg.executableArguments());
|
|
|
|
|
setConfigValue(_("LastExternalWorkingDirectory"),
|
|
|
|
|
dlg.workingDirectory());
|
|
|
|
|
sp.executable = dlg.executableFile();
|
|
|
|
|
sp.startMode = StartExternal;
|
|
|
|
|
sp.workingDirectory = dlg.workingDirectory();
|
|
|
|
|
sp.breakAtMain = dlg.breakAtMain();
|
|
|
|
|
if (!dlg.executableArguments().isEmpty())
|
|
|
|
|
sp.processArgs = dlg.executableArguments().split(QLatin1Char(' '));
|
2010-06-25 15:06:30 +02:00
|
|
|
// Fixme: 1 of 3 testing hacks.
|
|
|
|
|
if (!sp.processArgs.isEmpty()
|
|
|
|
|
&& (sp.processArgs.front() == _("@tcf@") || sp.processArgs.front() == _("@sym@")))
|
2010-11-01 14:14:17 +01:00
|
|
|
sp.toolChainType = ProjectExplorer::ToolChain_RVCT_ARMV5;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-10-22 11:27:45 +02:00
|
|
|
|
|
|
|
|
if (RunControl *rc = m_debuggerRunControlFactory->create(sp))
|
|
|
|
|
startDebugger(rc);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::notifyCurrentEngine(int role, const QVariant &value)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-11-04 18:11:09 +01:00
|
|
|
QTC_ASSERT(m_commandWindow, return);
|
2010-11-05 13:35:31 +01:00
|
|
|
if (m_commandWindow->model())
|
2010-11-04 18:11:09 +01:00
|
|
|
m_commandWindow->model()->setData(QModelIndex(), value, role);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::attachExternalApplication()
|
2010-04-06 17:58:11 +02:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
AttachExternalDialog dlg(mainWindow());
|
|
|
|
|
if (dlg.exec() == QDialog::Accepted)
|
|
|
|
|
attachExternalApplication(dlg.attachPID(), dlg.executable(), QString());
|
2010-04-06 17:58:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::attachExternalApplication
|
|
|
|
|
(qint64 pid, const QString &binary, const QString &crashParameter)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
if (pid == 0) {
|
|
|
|
|
QMessageBox::warning(mainWindow(), tr("Warning"),
|
|
|
|
|
tr("Cannot attach to PID 0"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.attachPID = pid;
|
2010-07-21 09:36:16 +02:00
|
|
|
sp.displayName = tr("Process %1").arg(pid);
|
2010-06-16 11:08:54 +02:00
|
|
|
sp.executable = binary;
|
|
|
|
|
sp.crashParameter = crashParameter;
|
2010-09-06 11:33:07 +02:00
|
|
|
sp.startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
|
2010-10-22 11:27:45 +02:00
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::attachCore()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
AttachCoreDialog dlg(mainWindow());
|
2010-07-15 10:44:53 +02:00
|
|
|
dlg.setExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
|
|
|
|
|
dlg.setCoreFile(configValue(_("LastExternalCoreFile")).toString());
|
2010-06-16 11:08:54 +02:00
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
2010-04-06 17:58:11 +02:00
|
|
|
return;
|
2010-07-15 10:44:53 +02:00
|
|
|
setConfigValue(_("LastExternalExecutableFile"), dlg.executableFile());
|
|
|
|
|
setConfigValue(_("LastExternalCoreFile"), dlg.coreFile());
|
2010-06-16 11:08:54 +02:00
|
|
|
attachCore(dlg.coreFile(), dlg.executableFile());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::attachCore(const QString &core, const QString &exe)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.executable = exe;
|
|
|
|
|
sp.coreFile = core;
|
2010-07-21 09:36:16 +02:00
|
|
|
sp.displayName = tr("Core file \"%1\"").arg(core);
|
2010-06-16 11:08:54 +02:00
|
|
|
sp.startMode = AttachCore;
|
2010-10-22 11:27:45 +02:00
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
2010-07-15 10:44:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::attachRemote(const QString &spec)
|
|
|
|
|
{
|
|
|
|
|
// spec is: executable@server:port@architecture
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.executable = spec.section('@', 0, 0);
|
|
|
|
|
sp.remoteChannel = spec.section('@', 1, 1);
|
|
|
|
|
sp.remoteArchitecture = spec.section('@', 2, 2);
|
|
|
|
|
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
|
|
|
|
|
sp.startMode = AttachToRemote;
|
2010-10-22 11:27:45 +02:00
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::startRemoteApplication()
|
2008-12-05 16:39:33 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
StartRemoteDialog dlg(mainWindow());
|
|
|
|
|
QStringList arches;
|
|
|
|
|
arches.append(_("i386:x86-64:intel"));
|
|
|
|
|
arches.append(_("i386"));
|
2010-10-29 14:04:23 +02:00
|
|
|
arches.append(_("arm"));
|
2010-06-16 11:08:54 +02:00
|
|
|
QString lastUsed = configValue(_("LastRemoteArchitecture")).toString();
|
|
|
|
|
if (!arches.contains(lastUsed))
|
|
|
|
|
arches.prepend(lastUsed);
|
|
|
|
|
dlg.setRemoteArchitectures(arches);
|
2010-10-29 14:04:23 +02:00
|
|
|
QStringList gnuTargets;
|
|
|
|
|
gnuTargets.append(_("auto"));
|
|
|
|
|
gnuTargets.append(_("i686-linux-gnu"));
|
|
|
|
|
gnuTargets.append(_("x86_64-linux-gnu"));
|
|
|
|
|
gnuTargets.append(_("arm-none-linux-gnueabi"));
|
|
|
|
|
const QString lastUsedGnuTarget
|
|
|
|
|
= configValue(_("LastGnuTarget")).toString();
|
|
|
|
|
if (!gnuTargets.contains(lastUsedGnuTarget))
|
|
|
|
|
gnuTargets.prepend(lastUsedGnuTarget);
|
|
|
|
|
dlg.setGnuTargets(gnuTargets);
|
2010-06-16 11:08:54 +02:00
|
|
|
dlg.setRemoteChannel(
|
|
|
|
|
configValue(_("LastRemoteChannel")).toString());
|
|
|
|
|
dlg.setLocalExecutable(
|
|
|
|
|
configValue(_("LastLocalExecutable")).toString());
|
|
|
|
|
dlg.setDebugger(configValue(_("LastDebugger")).toString());
|
|
|
|
|
dlg.setRemoteArchitecture(lastUsed);
|
2010-10-29 14:04:23 +02:00
|
|
|
dlg.setGnuTarget(lastUsedGnuTarget);
|
2010-06-16 11:08:54 +02:00
|
|
|
dlg.setServerStartScript(
|
|
|
|
|
configValue(_("LastServerStartScript")).toString());
|
|
|
|
|
dlg.setUseServerStartScript(
|
|
|
|
|
configValue(_("LastUseServerStartScript")).toBool());
|
|
|
|
|
dlg.setSysRoot(configValue(_("LastSysroot")).toString());
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
2010-04-06 17:58:11 +02:00
|
|
|
return;
|
2010-06-16 11:08:54 +02:00
|
|
|
setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel());
|
|
|
|
|
setConfigValue(_("LastLocalExecutable"), dlg.localExecutable());
|
|
|
|
|
setConfigValue(_("LastDebugger"), dlg.debugger());
|
|
|
|
|
setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture());
|
2010-10-29 14:04:23 +02:00
|
|
|
setConfigValue(_("LastGnuTarget"), dlg.gnuTarget());
|
2010-06-16 11:08:54 +02:00
|
|
|
setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
|
|
|
|
|
setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
|
|
|
|
|
setConfigValue(_("LastSysroot"), dlg.sysRoot());
|
|
|
|
|
sp.remoteChannel = dlg.remoteChannel();
|
|
|
|
|
sp.remoteArchitecture = dlg.remoteArchitecture();
|
2010-10-29 14:04:23 +02:00
|
|
|
sp.gnuTarget = dlg.gnuTarget();
|
2010-06-16 11:08:54 +02:00
|
|
|
sp.executable = dlg.localExecutable();
|
|
|
|
|
sp.displayName = dlg.localExecutable();
|
|
|
|
|
sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.
|
|
|
|
|
if (!sp.debuggerCommand.isEmpty())
|
2010-11-01 14:14:17 +01:00
|
|
|
sp.toolChainType = ProjectExplorer::ToolChain_INVALID;
|
2010-06-16 11:08:54 +02:00
|
|
|
sp.startMode = AttachToRemote;
|
2010-09-06 11:33:07 +02:00
|
|
|
sp.useServerStartScript = dlg.useServerStartScript();
|
|
|
|
|
sp.serverStartScript = dlg.serverStartScript();
|
2010-06-16 11:08:54 +02:00
|
|
|
sp.sysRoot = dlg.sysRoot();
|
2010-10-22 11:27:45 +02:00
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2010-04-09 14:55:09 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::enableReverseDebuggingTriggered(const QVariant &value)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_reverseToolButton, return);
|
|
|
|
|
m_reverseToolButton->setVisible(value.toBool());
|
|
|
|
|
m_actions.reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(value.toBool());
|
|
|
|
|
}
|
2010-05-12 16:48:04 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::attachRemoteTcf()
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
AttachTcfDialog dlg(mainWindow());
|
|
|
|
|
QStringList arches;
|
|
|
|
|
arches.append(_("i386:x86-64:intel"));
|
|
|
|
|
dlg.setRemoteArchitectures(arches);
|
|
|
|
|
dlg.setRemoteChannel(
|
|
|
|
|
configValue(_("LastTcfRemoteChannel")).toString());
|
|
|
|
|
dlg.setRemoteArchitecture(
|
|
|
|
|
configValue(_("LastTcfRemoteArchitecture")).toString());
|
|
|
|
|
dlg.setServerStartScript(
|
|
|
|
|
configValue(_("LastTcfServerStartScript")).toString());
|
|
|
|
|
dlg.setUseServerStartScript(
|
|
|
|
|
configValue(_("LastTcfUseServerStartScript")).toBool());
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
|
|
|
|
setConfigValue(_("LastTcfRemoteChannel"), dlg.remoteChannel());
|
|
|
|
|
setConfigValue(_("LastTcfRemoteArchitecture"), dlg.remoteArchitecture());
|
|
|
|
|
setConfigValue(_("LastTcfServerStartScript"), dlg.serverStartScript());
|
|
|
|
|
setConfigValue(_("LastTcfUseServerStartScript"), dlg.useServerStartScript());
|
|
|
|
|
sp.remoteChannel = dlg.remoteChannel();
|
|
|
|
|
sp.remoteArchitecture = dlg.remoteArchitecture();
|
|
|
|
|
sp.serverStartScript = dlg.serverStartScript();
|
|
|
|
|
sp.startMode = AttachTcf;
|
|
|
|
|
if (dlg.useServerStartScript())
|
|
|
|
|
sp.serverStartScript = dlg.serverStartScript();
|
2010-10-22 11:27:45 +02:00
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-10-20 12:13:28 +02:00
|
|
|
bool DebuggerPluginPrivate::attachCmdLine()
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
|
|
|
|
if (m_attachRemoteParameters.attachPid) {
|
2010-06-22 17:46:20 +02:00
|
|
|
showStatusMessage(tr("Attaching to PID %1.")
|
2010-06-16 11:08:54 +02:00
|
|
|
.arg(m_attachRemoteParameters.attachPid));
|
|
|
|
|
const QString crashParameter = m_attachRemoteParameters.winCrashEvent
|
|
|
|
|
? QString::number(m_attachRemoteParameters.winCrashEvent) : QString();
|
|
|
|
|
attachExternalApplication(m_attachRemoteParameters.attachPid,
|
|
|
|
|
QString(), crashParameter);
|
2010-10-20 12:13:28 +02:00
|
|
|
return true;
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2010-07-15 10:44:53 +02:00
|
|
|
const QString target = m_attachRemoteParameters.attachTarget;
|
|
|
|
|
if (!target.isEmpty()) {
|
|
|
|
|
if (target.indexOf(':') > 0) {
|
|
|
|
|
showStatusMessage(tr("Attaching to remote server %1.").arg(target));
|
|
|
|
|
attachRemote(target);
|
|
|
|
|
} else {
|
|
|
|
|
showStatusMessage(tr("Attaching to core %1.").arg(target));
|
|
|
|
|
attachCore(target, QString());
|
|
|
|
|
}
|
2010-10-20 12:13:28 +02:00
|
|
|
return true;
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2010-10-20 12:13:28 +02:00
|
|
|
return false;
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::editorOpened(Core::IEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
if (!isDebuggable(editor))
|
|
|
|
|
return;
|
|
|
|
|
ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
|
|
|
|
|
if (!textEditor)
|
|
|
|
|
return;
|
|
|
|
|
connect(textEditor, SIGNAL(markRequested(TextEditor::ITextEditor*,int)),
|
2010-10-27 14:10:44 +02:00
|
|
|
SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
2010-06-16 11:08:54 +02:00
|
|
|
connect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
2010-10-27 14:10:44 +02:00
|
|
|
SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
2010-07-15 10:44:53 +02:00
|
|
|
connect(textEditor,
|
|
|
|
|
SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
2010-10-27 14:10:44 +02:00
|
|
|
SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::editorAboutToClose(Core::IEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
if (!isDebuggable(editor))
|
|
|
|
|
return;
|
|
|
|
|
ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
|
|
|
|
|
if (!textEditor)
|
|
|
|
|
return;
|
|
|
|
|
disconnect(textEditor, SIGNAL(markRequested(TextEditor::ITextEditor*,int)),
|
|
|
|
|
this, SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
|
|
|
|
disconnect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
|
|
|
|
this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
|
|
|
|
disconnect(textEditor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
|
|
|
|
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::requestContextMenu(TextEditor::ITextEditor *editor,
|
|
|
|
|
int lineNumber, QMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
if (!isDebuggable(editor))
|
|
|
|
|
return;
|
|
|
|
|
|
2010-06-25 16:06:48 +02:00
|
|
|
QList<QVariant> list;
|
|
|
|
|
list.append(quint64(editor));
|
|
|
|
|
list.append(lineNumber);
|
|
|
|
|
list.append(quint64(menu));
|
|
|
|
|
notifyCurrentEngine(RequestContextMenuRole, list);
|
2009-04-28 15:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::toggleBreakpoint()
|
2010-06-11 12:38:54 +02:00
|
|
|
{
|
|
|
|
|
ITextEditor *textEditor = currentTextEditor();
|
|
|
|
|
QTC_ASSERT(textEditor, return);
|
|
|
|
|
int lineNumber = textEditor->currentLine();
|
|
|
|
|
if (lineNumber >= 0)
|
|
|
|
|
toggleBreakpoint(textEditor->file()->fileName(), lineNumber);
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::toggleBreakpoint(const QString &fileName, int lineNumber)
|
2010-06-11 12:38:54 +02:00
|
|
|
{
|
2010-11-04 09:54:23 +01:00
|
|
|
m_breakHandler->toggleBreakpoint(fileName, lineNumber);
|
|
|
|
|
m_breakHandler->synchronizeBreakpoints();
|
2010-06-11 12:38:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::requestMark(ITextEditor *editor, int lineNumber)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-20 18:14:41 +02:00
|
|
|
if (isDebuggable(editor) && editor && editor->file())
|
2010-06-16 11:08:54 +02:00
|
|
|
toggleBreakpoint(editor->file()->fileName(), lineNumber);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::showToolTip(ITextEditor *editor, const QPoint &point, int pos)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-04-06 17:58:11 +02:00
|
|
|
if (!isDebuggable(editor))
|
|
|
|
|
return;
|
|
|
|
|
if (!theDebuggerBoolSetting(UseToolTipsInMainEditor))
|
|
|
|
|
return;
|
2010-09-24 13:31:19 +02:00
|
|
|
if (state() != InferiorStopOk)
|
2008-12-08 19:26:00 +01:00
|
|
|
return;
|
2010-06-22 18:18:13 +02:00
|
|
|
|
|
|
|
|
QList<QVariant> list;
|
|
|
|
|
list.append(point);
|
|
|
|
|
list.append(quint64(editor));
|
|
|
|
|
list.append(pos);
|
|
|
|
|
notifyCurrentEngine(RequestToolTipByExpressionRole, list);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
DebuggerRunControl *DebuggerPluginPrivate::createDebugger
|
|
|
|
|
(const DebuggerStartParameters &sp, RunConfiguration *rc)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-15 16:43:56 +02:00
|
|
|
return m_debuggerRunControlFactory->create(sp, rc);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void DebuggerPluginPrivate::displayDebugger(DebuggerEngine *engine, bool updateEngine)
|
2010-07-13 15:57:34 +02:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
QTC_ASSERT(engine, return);
|
2010-07-13 15:57:34 +02:00
|
|
|
disconnectEngine();
|
2010-08-18 13:54:12 +02:00
|
|
|
connectEngine(engine);
|
|
|
|
|
if (updateEngine)
|
|
|
|
|
engine->updateAll();
|
|
|
|
|
updateState(engine);
|
2010-07-13 15:57:34 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
void DebuggerPluginPrivate::startDebugger(RunControl *rc)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-23 11:55:35 +02:00
|
|
|
QTC_ASSERT(rc, return);
|
2010-08-24 15:35:46 +02:00
|
|
|
ProjectExplorerPlugin::instance()->startRunControl(rc, PE::DEBUGMODE);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-05 13:35:31 +01:00
|
|
|
|
|
|
|
|
class DummyEngine : public DebuggerEngine
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
DummyEngine() : DebuggerEngine(DebuggerStartParameters()) {}
|
|
|
|
|
virtual ~DummyEngine() {}
|
|
|
|
|
|
|
|
|
|
virtual void setupEngine() {}
|
|
|
|
|
virtual void setupInferior() {}
|
|
|
|
|
virtual void runEngine() {}
|
|
|
|
|
virtual void shutdownEngine() {}
|
|
|
|
|
virtual void shutdownInferior() {}
|
|
|
|
|
virtual void executeDebuggerCommand(const QString &) {}
|
|
|
|
|
virtual unsigned debuggerCapabilities() const { return 0; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2010-07-13 17:16:31 +02:00
|
|
|
void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-11-05 13:35:31 +01:00
|
|
|
static Debugger::DummyEngine dummyEngine;
|
|
|
|
|
|
|
|
|
|
if (!engine)
|
|
|
|
|
engine = &dummyEngine;
|
|
|
|
|
|
2010-11-04 18:11:09 +01:00
|
|
|
if (m_currentEngine == engine)
|
2010-08-24 15:35:46 +02:00
|
|
|
return;
|
|
|
|
|
|
2010-11-05 13:35:31 +01:00
|
|
|
m_currentEngine = engine;
|
|
|
|
|
|
|
|
|
|
if (notify)
|
|
|
|
|
notifyCurrentEngine(RequestActivationRole, false);
|
|
|
|
|
|
|
|
|
|
m_commandWindow->setModel(engine->commandModel());
|
|
|
|
|
m_localsWindow->setModel(engine->localsModel());
|
|
|
|
|
m_modulesWindow->setModel(engine->modulesModel());
|
|
|
|
|
m_registerWindow->setModel(engine->registerModel());
|
|
|
|
|
m_returnWindow->setModel(engine->returnModel());
|
|
|
|
|
m_sourceFilesWindow->setModel(engine->sourceFilesModel());
|
|
|
|
|
m_stackWindow->setModel(engine->stackModel());
|
|
|
|
|
m_threadsWindow->setModel(engine->threadsModel());
|
|
|
|
|
m_threadBox->setModel(engine->threadsModel());
|
|
|
|
|
m_threadBox->setModelColumn(ThreadData::NameColumn);
|
|
|
|
|
m_watchersWindow->setModel(engine->watchersModel());
|
|
|
|
|
|
|
|
|
|
if (notify)
|
|
|
|
|
notifyCurrentEngine(RequestActivationRole, true);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-10-15 17:19:36 +02:00
|
|
|
static void changeFontSize(QWidget *widget, qreal size)
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
QFont font = widget->font();
|
2010-10-15 17:19:36 +02:00
|
|
|
font.setPointSizeF(size);
|
2010-06-16 11:08:54 +02:00
|
|
|
widget->setFont(font);
|
2009-05-25 16:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::fontSettingsChanged
|
|
|
|
|
(const TextEditor::FontSettings &settings)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-10-15 17:19:36 +02:00
|
|
|
qreal size = settings.fontZoom() * settings.fontSize() / 100.;
|
2010-06-16 11:08:54 +02:00
|
|
|
changeFontSize(m_breakWindow, size);
|
2010-09-22 16:20:08 +02:00
|
|
|
changeFontSize(m_logWindow, size);
|
2010-06-16 11:08:54 +02:00
|
|
|
changeFontSize(m_localsWindow, size);
|
|
|
|
|
changeFontSize(m_modulesWindow, size);
|
2010-10-13 13:34:27 +02:00
|
|
|
//changeFontSize(m_consoleWindow, size);
|
2010-06-16 11:08:54 +02:00
|
|
|
changeFontSize(m_registerWindow, size);
|
|
|
|
|
changeFontSize(m_returnWindow, size);
|
|
|
|
|
changeFontSize(m_sourceFilesWindow, size);
|
|
|
|
|
changeFontSize(m_stackWindow, size);
|
|
|
|
|
changeFontSize(m_threadsWindow, size);
|
|
|
|
|
changeFontSize(m_watchersWindow, size);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::cleanupViews()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-10-22 12:26:13 +02:00
|
|
|
m_plugin->resetLocation();
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(false);
|
|
|
|
|
hideDebuggerToolTip();
|
|
|
|
|
|
|
|
|
|
// FIXME ABC: Delete run control / engine?
|
|
|
|
|
//if (d->m_engine)
|
|
|
|
|
// d->m_engine->cleanup();
|
|
|
|
|
|
2010-10-08 17:44:11 +02:00
|
|
|
if (theDebuggerBoolSetting(CloseBuffersOnExit)) {
|
|
|
|
|
if (EditorManager *editorManager = EditorManager::instance()) {
|
|
|
|
|
QList<IEditor *> toClose;
|
2010-10-25 13:37:46 +02:00
|
|
|
foreach (IEditor *editor, editorManager->openedEditors()) {
|
|
|
|
|
if (editor->property(Debugger::Constants::OPENED_BY_DEBUGGER).toBool()) {
|
|
|
|
|
// close disassembly views. close other opened files if they are not modified and not current editor
|
|
|
|
|
if (editor->property(Debugger::Constants::OPENED_WITH_DISASSEMBLY).toBool()
|
|
|
|
|
|| (!editor->file()->isModified() && editor != editorManager->currentEditor())) {
|
|
|
|
|
toClose.append(editor);
|
|
|
|
|
} else {
|
|
|
|
|
editor->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-10-08 17:44:11 +02:00
|
|
|
editorManager->closeEditors(toClose);
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::setBusyCursor(bool busy)
|
2010-03-29 18:44:02 +02:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
//STATE_DEBUG("BUSY FROM: " << m_busy << " TO: " << busy);
|
|
|
|
|
if (busy == m_busy)
|
|
|
|
|
return;
|
|
|
|
|
m_busy = busy;
|
|
|
|
|
QCursor cursor(busy ? Qt::BusyCursor : Qt::ArrowCursor);
|
|
|
|
|
m_breakWindow->setCursor(cursor);
|
2010-10-13 13:34:27 +02:00
|
|
|
//m_consoleWindow->setCursor(cursor);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_localsWindow->setCursor(cursor);
|
|
|
|
|
m_modulesWindow->setCursor(cursor);
|
2010-09-22 16:20:08 +02:00
|
|
|
m_logWindow->setCursor(cursor);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_registerWindow->setCursor(cursor);
|
|
|
|
|
m_returnWindow->setCursor(cursor);
|
|
|
|
|
m_sourceFilesWindow->setCursor(cursor);
|
2010-07-21 12:18:50 +02:00
|
|
|
m_stackWindow->setCursor(cursor);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_threadsWindow->setCursor(cursor);
|
|
|
|
|
m_watchersWindow->setCursor(cursor);
|
2010-07-21 12:18:50 +02:00
|
|
|
m_snapshotWindow->setCursor(cursor);
|
2010-08-26 16:02:41 +02:00
|
|
|
m_scriptConsoleWindow->setCursor(cursor);
|
2010-03-29 18:44:02 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
void DebuggerPluginPrivate::setSimpleDockWidgetArrangement
|
2010-11-04 10:15:36 +01:00
|
|
|
(Debugger::DebuggerLanguages activeLanguages)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
Debugger::DebuggerUISwitcher *uiSwitcher = DebuggerUISwitcher::instance();
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerMainWindow *mw = mainWindow();
|
2010-08-18 13:54:12 +02:00
|
|
|
mw->setTrackingEnabled(false);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QList<QDockWidget *> dockWidgets = mw->dockWidgets();
|
|
|
|
|
foreach (QDockWidget *dockWidget, dockWidgets) {
|
|
|
|
|
dockWidget->setFloating(false);
|
|
|
|
|
mw->removeDockWidget(dockWidget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (QDockWidget *dockWidget, dockWidgets) {
|
2010-10-13 13:34:27 +02:00
|
|
|
if (dockWidget == m_outputDock /*|| dockWidget == m_consoleDock*/) {
|
2010-08-18 13:54:12 +02:00
|
|
|
mw->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
|
|
|
|
|
} else {
|
|
|
|
|
mw->addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
dockWidget->hide();
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
if ((activeLanguages.testFlag(CppLanguage)
|
|
|
|
|
&& !activeLanguages.testFlag(QmlLanguage))
|
2010-09-28 11:14:23 +02:00
|
|
|
|| activeLanguages == AnyLanguage) {
|
2010-08-18 13:54:12 +02:00
|
|
|
m_stackDock->show();
|
|
|
|
|
m_breakDock->show();
|
|
|
|
|
m_watchDock->show();
|
|
|
|
|
m_threadsDock->show();
|
|
|
|
|
m_snapshotDock->show();
|
2010-06-16 11:08:54 +02:00
|
|
|
} else {
|
2010-08-18 13:54:12 +02:00
|
|
|
m_stackDock->show();
|
|
|
|
|
m_breakDock->show();
|
|
|
|
|
m_watchDock->show();
|
2010-08-26 16:02:41 +02:00
|
|
|
m_scriptConsoleDock->show();
|
2010-09-28 11:14:23 +02:00
|
|
|
if (uiSwitcher->qmlInspectorWindow())
|
|
|
|
|
uiSwitcher->qmlInspectorWindow()->show();
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
mw->splitDockWidget(mw->toolBarDockWidget(), m_stackDock, Qt::Vertical);
|
|
|
|
|
mw->splitDockWidget(m_stackDock, m_watchDock, Qt::Horizontal);
|
|
|
|
|
mw->tabifyDockWidget(m_watchDock, m_breakDock);
|
|
|
|
|
mw->tabifyDockWidget(m_watchDock, m_modulesDock);
|
|
|
|
|
mw->tabifyDockWidget(m_watchDock, m_registerDock);
|
|
|
|
|
mw->tabifyDockWidget(m_watchDock, m_threadsDock);
|
|
|
|
|
mw->tabifyDockWidget(m_watchDock, m_sourceFilesDock);
|
|
|
|
|
mw->tabifyDockWidget(m_watchDock, m_snapshotDock);
|
2010-08-31 15:38:13 +02:00
|
|
|
mw->tabifyDockWidget(m_watchDock, m_scriptConsoleDock);
|
2010-08-18 13:54:12 +02:00
|
|
|
if (uiSwitcher->qmlInspectorWindow())
|
|
|
|
|
mw->tabifyDockWidget(m_watchDock, uiSwitcher->qmlInspectorWindow());
|
|
|
|
|
|
|
|
|
|
mw->setTrackingEnabled(true);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-05 17:08:30 +02:00
|
|
|
void DebuggerPluginPrivate::setInitialState()
|
|
|
|
|
{
|
|
|
|
|
m_watchersWindow->setVisible(false);
|
|
|
|
|
m_returnWindow->setVisible(false);
|
|
|
|
|
setBusyCursor(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(false);
|
|
|
|
|
hideDebuggerToolTip();
|
|
|
|
|
|
|
|
|
|
m_startExternalAction->setEnabled(true);
|
|
|
|
|
m_attachExternalAction->setEnabled(true);
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
m_attachCoreAction->setEnabled(false);
|
|
|
|
|
#else
|
|
|
|
|
m_attachCoreAction->setEnabled(true);
|
|
|
|
|
#endif
|
|
|
|
|
m_startRemoteAction->setEnabled(true);
|
|
|
|
|
m_detachAction->setEnabled(false);
|
|
|
|
|
|
|
|
|
|
m_actions.watchAction1->setEnabled(true);
|
|
|
|
|
m_actions.watchAction2->setEnabled(true);
|
|
|
|
|
m_actions.breakAction->setEnabled(true);
|
|
|
|
|
m_actions.snapshotAction->setEnabled(false);
|
|
|
|
|
theDebuggerAction(OperateByInstruction)->setEnabled(false);
|
|
|
|
|
|
2010-07-22 10:23:27 +02:00
|
|
|
m_actions.stopAction->setEnabled(false);
|
2010-07-05 17:08:30 +02:00
|
|
|
m_actions.resetAction->setEnabled(false);
|
|
|
|
|
|
|
|
|
|
m_actions.stepAction->setEnabled(false);
|
|
|
|
|
m_actions.stepOutAction->setEnabled(false);
|
2010-11-04 11:46:16 +01:00
|
|
|
m_actions.runToLineAction->setEnabled(false);
|
2010-07-05 17:08:30 +02:00
|
|
|
m_actions.runToFunctionAction->setEnabled(false);
|
|
|
|
|
m_actions.returnFromFunctionAction->setEnabled(false);
|
2010-11-04 11:46:16 +01:00
|
|
|
m_actions.jumpToLineAction->setEnabled(false);
|
2010-07-05 17:08:30 +02:00
|
|
|
m_actions.nextAction->setEnabled(false);
|
|
|
|
|
|
|
|
|
|
theDebuggerAction(AutoDerefPointers)->setEnabled(true);
|
|
|
|
|
theDebuggerAction(ExpandStack)->setEnabled(false);
|
2010-07-09 17:07:59 +02:00
|
|
|
theDebuggerAction(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-09-24 16:55:22 +02:00
|
|
|
m_scriptConsoleWindow->setEnabled(false);
|
|
|
|
|
|
2010-07-05 17:08:30 +02:00
|
|
|
//emit m_plugin->stateChanged(m_state);
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
|
|
|
|
{
|
2010-10-28 08:55:50 +02:00
|
|
|
QTC_ASSERT(engine, return);
|
|
|
|
|
QTC_ASSERT(m_watchersWindow->model(), return);
|
|
|
|
|
QTC_ASSERT(m_returnWindow->model(), return);
|
|
|
|
|
QTC_ASSERT(!engine->isSlaveEngine(), return);
|
|
|
|
|
|
2010-07-21 13:11:03 +02:00
|
|
|
m_threadBox->setCurrentIndex(engine->threadsHandler()->currentThread());
|
2010-08-24 16:22:21 +02:00
|
|
|
|
2010-06-23 14:11:52 +02:00
|
|
|
m_watchersWindow->setVisible(
|
|
|
|
|
m_watchersWindow->model()->rowCount(QModelIndex()) > 0);
|
|
|
|
|
m_returnWindow->setVisible(
|
|
|
|
|
m_returnWindow->model()->rowCount(QModelIndex()) > 0);
|
|
|
|
|
|
2010-10-28 08:55:50 +02:00
|
|
|
//m_plugin->showMessage(QString("PLUGIN SET STATE: ")
|
|
|
|
|
// + DebuggerEngine::stateName(engine->state()), LogStatus);
|
|
|
|
|
//qDebug() << "PLUGIN SET STATE: " << engine->state();
|
|
|
|
|
|
2010-06-23 14:11:52 +02:00
|
|
|
if (m_state == engine->state())
|
|
|
|
|
return;
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
m_state = engine->state();
|
|
|
|
|
bool actionsEnabled = DebuggerEngine::debuggerActionsEnabled(m_state);
|
|
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
ICore *core = ICore::instance();
|
|
|
|
|
ActionManager *am = core->actionManager();
|
|
|
|
|
if (m_state == DebuggerNotReady) {
|
|
|
|
|
QTC_ASSERT(false, /* We use the Core m_debugAction here */);
|
|
|
|
|
// F5 starts debugging. It is "startable".
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.stopAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
2010-10-27 14:10:44 +02:00
|
|
|
am->command(PE::DEBUG)->setKeySequence(QKeySequence(PE::DEBUG_KEY));
|
2010-10-05 12:47:23 +02:00
|
|
|
core->updateAdditionalContexts(m_anyContext, Context());
|
|
|
|
|
} else if (m_state == InferiorStopOk) {
|
|
|
|
|
// F5 continues, Shift-F5 kills. It is "continuable".
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(true);
|
|
|
|
|
m_actions.stopAction->setEnabled(true);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence(STOP_KEY));
|
2010-10-27 14:10:44 +02:00
|
|
|
am->command(PE::DEBUG)->setKeySequence(QKeySequence(PE::DEBUG_KEY));
|
2010-10-05 12:47:23 +02:00
|
|
|
core->updateAdditionalContexts(m_anyContext, m_continuableContext);
|
|
|
|
|
} else if (m_state == InferiorRunOk) {
|
|
|
|
|
// Shift-F5 interrupts. It is also "interruptible".
|
|
|
|
|
m_actions.interruptAction->setEnabled(true);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.stopAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
|
|
|
|
am->command(PE::DEBUG)->setKeySequence(QKeySequence(STOP_KEY));
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, m_interruptibleContext);
|
|
|
|
|
} else if (m_state == DebuggerFinished) {
|
|
|
|
|
// We don't want to do anything anymore.
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.stopAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
2010-10-27 14:10:44 +02:00
|
|
|
am->command(PE::DEBUG)->setKeySequence(QKeySequence(PE::DEBUG_KEY));
|
2010-10-05 12:47:23 +02:00
|
|
|
//core->updateAdditionalContexts(m_anyContext, m_finishedContext);
|
|
|
|
|
m_codeModelSnapshot = CPlusPlus::Snapshot();
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, Context());
|
2010-06-16 11:08:54 +02:00
|
|
|
setBusyCursor(false);
|
|
|
|
|
cleanupViews();
|
2010-10-05 12:47:23 +02:00
|
|
|
} else if (m_state == InferiorUnrunnable) {
|
|
|
|
|
// We don't want to do anything anymore.
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.stopAction->setEnabled(true);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence(STOP_KEY));
|
|
|
|
|
am->command(PE::DEBUG)->setKeySequence(QKeySequence(STOP_KEY));
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, m_finishedContext);
|
2010-07-22 10:23:27 +02:00
|
|
|
} else {
|
2010-10-05 12:47:23 +02:00
|
|
|
// Everything else is "undisturbable".
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.stopAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
|
|
|
|
am->command(PE::DEBUG)->setKeySequence(QKeySequence());
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, m_undisturbableContext);
|
2010-07-22 10:23:27 +02:00
|
|
|
}
|
2009-09-24 10:08:17 +02:00
|
|
|
|
2010-09-27 18:00:21 +02:00
|
|
|
m_startExternalAction->setEnabled(true);
|
2010-07-21 09:36:16 +02:00
|
|
|
m_attachExternalAction->setEnabled(true);
|
2009-09-24 10:08:17 +02:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
m_attachCoreAction->setEnabled(false);
|
|
|
|
|
#else
|
2010-09-24 13:31:19 +02:00
|
|
|
m_attachCoreAction->setEnabled(true);
|
2009-09-24 10:08:17 +02:00
|
|
|
#endif
|
2010-09-24 13:31:19 +02:00
|
|
|
m_startRemoteAction->setEnabled(true);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-09-24 13:31:19 +02:00
|
|
|
const bool stopped = m_state == InferiorStopOk;
|
2010-10-05 12:47:23 +02:00
|
|
|
const bool detachable = stopped
|
2010-06-16 11:08:54 +02:00
|
|
|
&& engine->startParameters().startMode != AttachCore;
|
2009-09-30 13:07:14 +02:00
|
|
|
m_detachAction->setEnabled(detachable);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
if (stopped)
|
|
|
|
|
QApplication::alert(mainWindow(), 3000);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
const uint caps = engine->debuggerCapabilities();
|
|
|
|
|
const bool canReverse = (caps & ReverseSteppingCapability)
|
|
|
|
|
&& theDebuggerBoolSetting(EnableReverseDebugging);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(canReverse);
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.watchAction1->setEnabled(true);
|
|
|
|
|
m_actions.watchAction2->setEnabled(true);
|
|
|
|
|
m_actions.breakAction->setEnabled(true);
|
2010-10-05 12:47:23 +02:00
|
|
|
m_actions.snapshotAction->setEnabled(stopped && (caps & SnapshotCapability));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
theDebuggerAction(OperateByInstruction)->setEnabled(stopped);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-09-24 13:31:19 +02:00
|
|
|
m_actions.resetAction->setEnabled(m_state != DebuggerNotReady
|
|
|
|
|
&& m_state != DebuggerFinished);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.stepAction->setEnabled(stopped);
|
|
|
|
|
m_actions.stepOutAction->setEnabled(stopped);
|
2010-11-04 11:46:16 +01:00
|
|
|
m_actions.runToLineAction->setEnabled(stopped);
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.runToFunctionAction->setEnabled(stopped);
|
|
|
|
|
m_actions.returnFromFunctionAction->
|
2010-10-05 12:47:23 +02:00
|
|
|
setEnabled(stopped && (caps & ReturnFromFunctionCapability));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
const bool canJump = stopped && (caps & JumpToLineCapability);
|
2010-11-04 11:46:16 +01:00
|
|
|
m_actions.jumpToLineAction->setEnabled(canJump);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
m_actions.nextAction->setEnabled(stopped);
|
|
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
const bool canDeref = actionsEnabled && (caps & AutoDerefPointersCapability);
|
2010-06-16 11:08:54 +02:00
|
|
|
theDebuggerAction(AutoDerefPointers)->setEnabled(canDeref);
|
2010-09-23 11:15:56 +02:00
|
|
|
theDebuggerAction(AutoDerefPointers)->setEnabled(true);
|
2010-06-16 11:08:54 +02:00
|
|
|
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
|
2010-07-09 17:07:59 +02:00
|
|
|
theDebuggerAction(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-09 17:07:59 +02:00
|
|
|
const bool notbusy = m_state == InferiorStopOk
|
2010-06-16 11:08:54 +02:00
|
|
|
|| m_state == DebuggerNotReady
|
2010-07-21 12:18:50 +02:00
|
|
|
|| m_state == DebuggerFinished
|
2010-06-16 11:08:54 +02:00
|
|
|
|| m_state == InferiorUnrunnable;
|
|
|
|
|
setBusyCursor(!notbusy);
|
2010-09-24 16:55:22 +02:00
|
|
|
|
|
|
|
|
m_scriptConsoleWindow->setEnabled(stopped);
|
2009-01-13 18:15:24 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::gotoLocation(const QString &file, int line, bool setMarker)
|
2010-04-13 15:15:02 +02:00
|
|
|
{
|
2010-10-22 12:26:13 +02:00
|
|
|
// CDB might hit on breakpoints while shutting down.
|
|
|
|
|
if (m_shuttingDown)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
bool newEditor = false;
|
|
|
|
|
ITextEditor *editor =
|
2010-09-07 09:51:20 +02:00
|
|
|
BaseTextEditor::openEditorAt(file, line, 0, QString(),
|
2010-09-09 17:58:26 +02:00
|
|
|
EditorManager::IgnoreNavigationHistory, &newEditor);
|
2010-06-16 11:08:54 +02:00
|
|
|
if (!editor)
|
|
|
|
|
return;
|
|
|
|
|
if (newEditor)
|
2010-10-25 13:37:46 +02:00
|
|
|
editor->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true);
|
2010-10-22 12:26:13 +02:00
|
|
|
if (setMarker)
|
|
|
|
|
m_locationMark.reset(new LocationMark(file, line));
|
2010-04-13 15:15:02 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::onModeChanged(IMode *mode)
|
2009-01-13 18:15:24 +01:00
|
|
|
{
|
2009-05-25 18:21:31 +02:00
|
|
|
// FIXME: This one gets always called, even if switching between modes
|
|
|
|
|
// different then the debugger mode. E.g. Welcome and Help mode and
|
|
|
|
|
// also on shutdown.
|
|
|
|
|
|
2010-08-30 17:08:29 +02:00
|
|
|
m_uiSwitcher->onModeChanged(mode);
|
|
|
|
|
|
2009-08-14 13:04:05 +02:00
|
|
|
if (mode != m_debugMode)
|
2009-01-13 18:15:24 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
EditorManager *editorManager = EditorManager::instance();
|
2010-08-18 13:54:12 +02:00
|
|
|
if (editorManager->currentEditor())
|
2009-01-13 18:15:24 +01:00
|
|
|
editorManager->currentEditor()->widget()->setFocus();
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::showSettingsDialog()
|
2009-02-27 11:41:19 +01:00
|
|
|
{
|
2009-04-28 15:08:52 +02:00
|
|
|
Core::ICore::instance()->showOptionsDialog(
|
2010-03-11 12:22:24 +01:00
|
|
|
_(DEBUGGER_SETTINGS_CATEGORY),
|
|
|
|
|
_(DEBUGGER_COMMON_SETTINGS_ID));
|
2009-02-27 11:41:19 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::dumpLog()
|
2009-05-05 17:48:54 +02:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
QString fileName = QFileDialog::getSaveFileName(mainWindow(),
|
|
|
|
|
tr("Save Debugger Log"), QDir::tempPath());
|
|
|
|
|
if (fileName.isEmpty())
|
2009-05-25 16:22:11 +02:00
|
|
|
return;
|
2010-06-16 11:08:54 +02:00
|
|
|
QFile file(fileName);
|
|
|
|
|
if (!file.open(QIODevice::WriteOnly))
|
|
|
|
|
return;
|
|
|
|
|
QTextStream ts(&file);
|
2010-09-22 16:20:08 +02:00
|
|
|
ts << m_logWindow->inputContents();
|
2010-06-16 11:08:54 +02:00
|
|
|
ts << "\n\n=======================================\n\n";
|
2010-09-22 16:20:08 +02:00
|
|
|
ts << m_logWindow->combinedContents();
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2009-06-12 12:57:22 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::clearStatusMessage()
|
|
|
|
|
{
|
|
|
|
|
m_statusLabel->setText(m_lastPermanentStatusMessage);
|
|
|
|
|
}
|
2009-06-16 13:44:45 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
/*! Activates the previous mode when the current mode is the debug mode. */
|
|
|
|
|
void DebuggerPluginPrivate::activatePreviousMode()
|
|
|
|
|
{
|
|
|
|
|
Core::ModeManager *modeManager = ICore::instance()->modeManager();
|
2009-05-25 16:22:11 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
if (modeManager->currentMode() == modeManager->mode(MODE_DEBUG)
|
|
|
|
|
&& !m_previousMode.isEmpty()) {
|
|
|
|
|
modeManager->activateMode(m_previousMode);
|
|
|
|
|
m_previousMode.clear();
|
|
|
|
|
}
|
2009-05-05 17:48:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::activateDebugMode()
|
2009-05-05 17:48:54 +02:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
m_actions.reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(false);
|
|
|
|
|
ModeManager *modeManager = ModeManager::instance();
|
|
|
|
|
m_previousMode = modeManager->currentMode()->id();
|
|
|
|
|
modeManager->activateMode(_(MODE_DEBUG));
|
2009-05-25 16:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::sessionLoaded()
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
2010-11-04 18:11:09 +01:00
|
|
|
m_breakHandler->loadSessionData();
|
|
|
|
|
WatchHandler::loadSessionData();
|
|
|
|
|
synchronizeWatchers();
|
2009-05-05 17:48:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::aboutToUnloadSession()
|
2009-05-05 17:48:54 +02:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
// Stop debugging the active project when switching sessions.
|
2010-10-30 21:54:23 +02:00
|
|
|
// Note that at startup, session switches may occur, which interfere
|
2010-06-16 11:08:54 +02:00
|
|
|
// with command-line debugging startup.
|
2010-06-22 18:18:13 +02:00
|
|
|
// FIXME ABC: Still wanted? Iterate?
|
2010-06-16 11:08:54 +02:00
|
|
|
//if (d->m_engine && state() != DebuggerNotReady
|
|
|
|
|
// && runControl()->sp().startMode == StartInternal)
|
|
|
|
|
// d->m_engine->shutdown();
|
2009-09-30 12:27:03 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPluginPrivate::aboutToSaveSession()
|
2009-09-30 12:27:03 +02:00
|
|
|
{
|
2010-11-04 18:11:09 +01:00
|
|
|
WatchHandler::saveSessionData();
|
|
|
|
|
m_breakHandler->saveSessionData();
|
2009-05-05 17:48:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-22 12:41:02 +02:00
|
|
|
void DebuggerPluginPrivate::executeDebuggerCommand()
|
|
|
|
|
{
|
|
|
|
|
if (QAction *action = qobject_cast<QAction *>(sender()))
|
|
|
|
|
notifyCurrentEngine(RequestExecuteCommandRole, action->data().toString());
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-22 17:46:20 +02:00
|
|
|
void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
|
|
|
|
|
{
|
|
|
|
|
m_plugin->showMessage(msg0, LogStatus);
|
|
|
|
|
QString msg = msg0;
|
|
|
|
|
msg.replace(QLatin1Char('\n'), QString());
|
|
|
|
|
m_statusLabel->setText(msg);
|
|
|
|
|
if (timeout > 0) {
|
|
|
|
|
m_statusTimer.setSingleShot(true);
|
|
|
|
|
m_statusTimer.start(timeout);
|
|
|
|
|
} else {
|
|
|
|
|
m_lastPermanentStatusMessage = msg;
|
|
|
|
|
m_statusTimer.stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
void DebuggerPluginPrivate::scriptExpressionEntered(const QString &expression)
|
2010-08-26 16:02:41 +02:00
|
|
|
{
|
|
|
|
|
notifyCurrentEngine(RequestExecuteCommandRole, expression);
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-09 17:58:26 +02:00
|
|
|
void DebuggerPluginPrivate::openMemoryEditor()
|
2010-11-05 13:35:31 +01:00
|
|
|
{
|
2010-09-09 17:58:26 +02:00
|
|
|
AddressDialog dialog;
|
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
|
|
|
|
QTC_ASSERT(m_watchersWindow, return);
|
|
|
|
|
m_watchersWindow->model()->setData(
|
|
|
|
|
QModelIndex(), dialog.address(), RequestShowMemoryRole);
|
|
|
|
|
}
|
2010-08-26 16:02:41 +02:00
|
|
|
|
2010-10-22 12:26:13 +02:00
|
|
|
void DebuggerPluginPrivate::coreShutdown()
|
|
|
|
|
{
|
|
|
|
|
m_shuttingDown = true;
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DebuggerPlugin
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
DebuggerPlugin *theInstance = 0;
|
|
|
|
|
|
|
|
|
|
DebuggerPlugin *DebuggerPlugin::instance()
|
|
|
|
|
{
|
|
|
|
|
return theInstance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerPlugin::DebuggerPlugin()
|
|
|
|
|
{
|
|
|
|
|
d = new DebuggerPluginPrivate(this);
|
|
|
|
|
theInstance = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerPlugin::~DebuggerPlugin()
|
|
|
|
|
{
|
|
|
|
|
theInstance = 0;
|
|
|
|
|
delete DebuggerSettings::instance();
|
|
|
|
|
|
|
|
|
|
removeObject(d->m_debugMode);
|
|
|
|
|
|
|
|
|
|
delete d->m_debugMode;
|
|
|
|
|
d->m_debugMode = 0;
|
|
|
|
|
|
|
|
|
|
removeObject(d->m_uiSwitcher);
|
|
|
|
|
delete d->m_uiSwitcher;
|
|
|
|
|
d->m_uiSwitcher = 0;
|
|
|
|
|
|
2010-09-14 17:52:25 +02:00
|
|
|
delete d->m_commandWindow;
|
|
|
|
|
d->m_commandWindow = 0;
|
|
|
|
|
|
2010-09-14 18:14:30 +02:00
|
|
|
delete d->m_snapshotHandler;
|
|
|
|
|
d->m_snapshotHandler = 0;
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
delete d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|
|
|
|
{
|
|
|
|
|
return d->initialize(arguments, errorMessage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(sessionManager(), return);
|
|
|
|
|
sessionManager()->setValue(name, value);
|
|
|
|
|
//qDebug() << "SET SESSION VALUE: " << name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant DebuggerPlugin::sessionValue(const QString &name)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(sessionManager(), return QVariant());
|
|
|
|
|
//qDebug() << "GET SESSION VALUE: " << name;
|
|
|
|
|
return sessionManager()->value(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->m_debugMode, return);
|
|
|
|
|
settings()->setValue(name, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant DebuggerPlugin::configValue(const QString &name) const
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->m_debugMode, return QVariant());
|
|
|
|
|
return settings()->value(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::resetLocation()
|
|
|
|
|
{
|
2010-10-22 12:26:13 +02:00
|
|
|
d->m_locationMark.reset();
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::gotoLocation(const QString &file, int line, bool setMarker)
|
|
|
|
|
{
|
2010-10-22 12:26:13 +02:00
|
|
|
d->gotoLocation(file, line, setMarker);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::openTextEditor(const QString &titlePattern0,
|
|
|
|
|
const QString &contents)
|
|
|
|
|
{
|
2010-10-22 12:26:13 +02:00
|
|
|
if (d->m_shuttingDown)
|
|
|
|
|
return;
|
2010-06-16 11:08:54 +02:00
|
|
|
QString titlePattern = titlePattern0;
|
|
|
|
|
EditorManager *editorManager = EditorManager::instance();
|
|
|
|
|
QTC_ASSERT(editorManager, return);
|
2010-09-08 09:13:59 +02:00
|
|
|
IEditor *editor = editorManager->openEditorWithContents(
|
2010-06-16 11:08:54 +02:00
|
|
|
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents);
|
|
|
|
|
QTC_ASSERT(editor, return);
|
2010-09-14 15:15:57 +02:00
|
|
|
editorManager->activateEditor(editor, EditorManager::IgnoreNavigationHistory);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::writeSettings() const
|
|
|
|
|
{
|
|
|
|
|
QSettings *s = settings();
|
|
|
|
|
DebuggerSettings::instance()->writeSettings(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::readSettings()
|
|
|
|
|
{
|
|
|
|
|
//qDebug() << "PLUGIN READ SETTINGS";
|
|
|
|
|
QSettings *s = settings();
|
|
|
|
|
DebuggerSettings::instance()->readSettings(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const CPlusPlus::Snapshot &DebuggerPlugin::cppCodeModelSnapshot() const
|
|
|
|
|
{
|
|
|
|
|
if (d->m_codeModelSnapshot.isEmpty() && theDebuggerAction(UseCodeModel)->isChecked())
|
|
|
|
|
d->m_codeModelSnapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
|
|
|
|
return d->m_codeModelSnapshot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::clearCppCodeModelSnapshot()
|
|
|
|
|
{
|
|
|
|
|
d->m_codeModelSnapshot = CPlusPlus::Snapshot();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-13 13:36:47 +02:00
|
|
|
ExtensionSystem::IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2010-08-31 13:07:33 +02:00
|
|
|
disconnect(sessionManager(),
|
|
|
|
|
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), d, 0);
|
2010-06-16 11:08:54 +02:00
|
|
|
writeSettings();
|
|
|
|
|
if (d->m_uiSwitcher)
|
|
|
|
|
d->m_uiSwitcher->aboutToShutdown();
|
2010-08-20 14:19:25 +02:00
|
|
|
return SynchronousShutdown;
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::showMessage(const QString &msg, int channel, int timeout)
|
|
|
|
|
{
|
|
|
|
|
//qDebug() << "PLUGIN OUTPUT: " << channel << msg;
|
2010-09-22 16:20:08 +02:00
|
|
|
LogWindow *ow = d->m_logWindow;
|
2010-10-13 13:34:27 +02:00
|
|
|
//ConsoleWindow *cw = d->m_consoleWindow;
|
2010-06-16 11:08:54 +02:00
|
|
|
QTC_ASSERT(ow, return);
|
|
|
|
|
switch (channel) {
|
|
|
|
|
case StatusBar:
|
2010-06-30 13:15:44 +02:00
|
|
|
// This will append to ow's output pane, too.
|
2010-06-22 17:46:20 +02:00
|
|
|
d->showStatusMessage(msg, timeout);
|
2010-06-16 11:08:54 +02:00
|
|
|
break;
|
|
|
|
|
case LogMiscInput:
|
|
|
|
|
ow->showInput(LogMisc, msg);
|
|
|
|
|
ow->showOutput(LogMisc, msg);
|
|
|
|
|
break;
|
|
|
|
|
case LogInput:
|
2010-06-30 13:15:44 +02:00
|
|
|
ow->showInput(LogInput, msg);
|
|
|
|
|
ow->showOutput(LogInput, msg);
|
2010-06-16 11:08:54 +02:00
|
|
|
break;
|
2010-08-26 16:02:41 +02:00
|
|
|
case ScriptConsoleOutput:
|
|
|
|
|
d->m_scriptConsoleWindow->appendResult(msg);
|
|
|
|
|
break;
|
2010-06-16 11:08:54 +02:00
|
|
|
default:
|
|
|
|
|
ow->showOutput(channel, msg);
|
2010-10-13 13:34:27 +02:00
|
|
|
//cw->showOutput(channel, msg);
|
2010-06-16 11:08:54 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Register specific stuff
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
bool DebuggerPlugin::isReverseDebugging() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_actions.reverseDirectionAction->isChecked();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QMessageBox *DebuggerPlugin::showMessageBox(int icon, const QString &title,
|
|
|
|
|
const QString &text, int buttons)
|
|
|
|
|
{
|
|
|
|
|
QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon),
|
|
|
|
|
title, text, QMessageBox::StandardButtons(buttons), mainWindow());
|
|
|
|
|
mb->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
|
mb->show();
|
|
|
|
|
return mb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::ensureLogVisible()
|
|
|
|
|
{
|
|
|
|
|
QAction *action = d->m_outputDock->toggleViewAction();
|
|
|
|
|
if (!action->isChecked())
|
|
|
|
|
action->trigger();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QIcon DebuggerPlugin::locationMarkIcon() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_locationMarkIcon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::extensionsInitialized()
|
|
|
|
|
{
|
2010-06-29 18:12:22 +02:00
|
|
|
d->m_uiSwitcher->initialize();
|
|
|
|
|
d->m_watchersWindow->setVisible(false);
|
|
|
|
|
d->m_returnWindow->setVisible(false);
|
2010-09-09 17:58:26 +02:00
|
|
|
connect(d->m_uiSwitcher, SIGNAL(memoryEditorRequested()),
|
|
|
|
|
d, SLOT(openMemoryEditor()));
|
2010-06-29 18:12:22 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
// time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
|
|
|
|
|
const QByteArray env = qgetenv("QTC_DEBUGGER_TEST");
|
|
|
|
|
//qDebug() << "EXTENSIONS INITIALIZED:" << env;
|
|
|
|
|
// if (!env.isEmpty())
|
|
|
|
|
// m_plugin->runTest(QString::fromLocal8Bit(env));
|
|
|
|
|
if (d->m_attachRemoteParameters.attachPid
|
2010-07-15 10:44:53 +02:00
|
|
|
|| !d->m_attachRemoteParameters.attachTarget.isEmpty())
|
2010-06-16 11:08:54 +02:00
|
|
|
QTimer::singleShot(0, d, SLOT(attachCmdLine()));
|
|
|
|
|
}
|
2010-05-05 12:41:52 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
QWidget *DebuggerPlugin::mainWindow() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_uiSwitcher->mainWindow();
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
DebuggerRunControl *DebuggerPlugin::createDebugger
|
|
|
|
|
(const DebuggerStartParameters &sp, RunConfiguration *rc)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2010-07-15 16:43:56 +02:00
|
|
|
return instance()->d->createDebugger(sp, rc);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
void DebuggerPlugin::startDebugger(RunControl *runControl)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
|
|
|
|
instance()->d->startDebugger(runControl);
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
void DebuggerPlugin::displayDebugger(RunControl *runControl)
|
2010-07-13 15:57:34 +02:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
DebuggerRunControl *rc = qobject_cast<DebuggerRunControl *>(runControl);
|
|
|
|
|
QTC_ASSERT(rc, return);
|
|
|
|
|
instance()->d->displayDebugger(rc->engine());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if updateEngine is set, the engine will update its threads/modules and so forth.
|
|
|
|
|
void DebuggerPlugin::displayDebugger(DebuggerEngine *engine, bool updateEngine)
|
|
|
|
|
{
|
|
|
|
|
instance()->d->displayDebugger(engine, updateEngine);
|
2010-07-13 15:57:34 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerPlugin::updateState(DebuggerEngine *engine)
|
|
|
|
|
{
|
|
|
|
|
d->updateState(engine);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::activateDebugMode()
|
|
|
|
|
{
|
|
|
|
|
d->activateDebugMode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::createNewDock(QWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
QDockWidget *dockWidget =
|
2010-08-24 17:17:54 +02:00
|
|
|
DebuggerUISwitcher::instance()->createDockWidget(CppLanguage, widget);
|
2010-06-16 11:08:54 +02:00
|
|
|
dockWidget->setWindowTitle(widget->windowTitle());
|
|
|
|
|
dockWidget->setObjectName(widget->windowTitle());
|
|
|
|
|
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
|
|
|
|
|
//dockWidget->setWidget(widget);
|
|
|
|
|
//mainWindow()->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
|
|
|
|
|
dockWidget->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::runControlStarted(DebuggerRunControl *runControl)
|
|
|
|
|
{
|
|
|
|
|
d->connectEngine(runControl->engine());
|
2010-07-20 17:36:20 +02:00
|
|
|
d->m_snapshotHandler->appendSnapshot(runControl);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::runControlFinished(DebuggerRunControl *runControl)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(runControl);
|
2010-07-20 17:36:20 +02:00
|
|
|
d->m_snapshotHandler->removeSnapshot(runControl);
|
2010-06-22 15:14:44 +02:00
|
|
|
d->disconnectEngine();
|
2010-10-08 17:44:11 +02:00
|
|
|
if (theDebuggerBoolSetting(SwitchModeOnExit))
|
|
|
|
|
if (d->m_snapshotHandler->size() == 0)
|
|
|
|
|
d->activatePreviousMode();
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
DebuggerLanguages DebuggerPlugin::activeLanguages() const
|
|
|
|
|
{
|
|
|
|
|
return DebuggerUISwitcher::instance()->activeDebugLanguages();
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-28 09:10:20 +02:00
|
|
|
bool DebuggerPlugin::isRegisterViewVisible() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_registerDock->toggleViewAction()->isChecked();
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-04 09:54:23 +01:00
|
|
|
bool DebuggerPlugin::hasSnapshots() const
|
2010-08-27 16:22:51 +02:00
|
|
|
{
|
|
|
|
|
return d->m_snapshotHandler->size();
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-04 09:54:23 +01:00
|
|
|
Internal::BreakHandler *DebuggerPlugin::breakHandler() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_breakHandler;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-05 13:35:31 +01:00
|
|
|
DebuggerEngine *DebuggerPlugin::currentEngine() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_currentEngine;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-20 12:13:28 +02:00
|
|
|
void DebuggerPlugin::remoteCommand(const QStringList &options, const QStringList &)
|
|
|
|
|
{
|
2010-10-29 13:48:14 +02:00
|
|
|
if (options.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2010-10-20 12:13:28 +02:00
|
|
|
unsigned enabledEngines = 0;
|
|
|
|
|
QString errorMessage;
|
|
|
|
|
bool success = false;
|
|
|
|
|
do {
|
|
|
|
|
if (!parseArguments(options, &d->m_attachRemoteParameters, &enabledEngines, &errorMessage))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (!d->attachCmdLine()) {
|
|
|
|
|
errorMessage = QString::fromLatin1("Incomplete remote attach command received: %1").
|
|
|
|
|
arg(options.join(QString(QLatin1Char(' '))));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
success = true;
|
|
|
|
|
} while (false);
|
|
|
|
|
|
|
|
|
|
if (!success)
|
|
|
|
|
qWarning("%s", qPrintable(errorMessage));
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-20 16:02:55 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Testing
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
void DebuggerPlugin::runTest(const QString &fileName)
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.executable = fileName;
|
|
|
|
|
sp.processArgs = QStringList() << "--run-debuggee";
|
|
|
|
|
sp.workingDirectory.clear();
|
|
|
|
|
startDebugger(m_debuggerRunControlFactory->create(sp));
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "debuggerplugin.moc"
|
|
|
|
|
|
2010-08-31 13:07:33 +02:00
|
|
|
Q_EXPORT_PLUGIN(Debugger::DebuggerPlugin)
|