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
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
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
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
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"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "debuggerconstants.h"
|
2010-11-10 11:39:01 +01:00
|
|
|
#include "debuggercore.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "debuggerdialogs.h"
|
|
|
|
|
#include "debuggerengine.h"
|
2010-12-02 17:43:14 +01:00
|
|
|
#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-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-12-08 12:43:11 +01:00
|
|
|
#include "disassembleragent.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"
|
2010-11-08 15:19:13 +01:00
|
|
|
#include "stackhandler.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#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-11-08 15:19:13 +01:00
|
|
|
#include "watchutils.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-21 13:11:03 +02:00
|
|
|
#include "snapshothandler.h"
|
|
|
|
|
#include "threadshandler.h"
|
2010-11-10 16:33:11 +01:00
|
|
|
#include "gdb/gdboptionspage.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>
|
2010-12-02 13:34:23 +01:00
|
|
|
#include <coreplugin/imode.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-12-03 13:49:35 +01:00
|
|
|
#include <cplusplus/ModelManagerInterface.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
|
|
|
|
2010-11-08 16:17:59 +01:00
|
|
|
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
|
|
|
|
|
2008-12-09 16:18:28 +01:00
|
|
|
#include <texteditor/basetexteditor.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>
|
2010-11-08 15:19:13 +01:00
|
|
|
#include <QtGui/QMenu>
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <QtGui/QMessageBox>
|
2010-11-08 16:17:59 +01:00
|
|
|
#include <QtGui/QPushButton>
|
|
|
|
|
#include <QtGui/QTextBlock>
|
|
|
|
|
#include <QtGui/QTextCursor>
|
2009-10-01 16:38:08 +02:00
|
|
|
#include <QtGui/QToolButton>
|
2010-11-26 09:58:34 +01:00
|
|
|
#include <QtGui/QTreeWidget>
|
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- +
|
2010-11-29 16:53:40 +01:00
|
|
|
// Inferior- Inferior- Inferior- EngineRun- +
|
2010-07-09 17:07:59 +02:00
|
|
|
// Unrunnable} StopOk} RunOk} Failed} +
|
|
|
|
|
// + + + + +
|
|
|
|
|
// InferiorUnrunnable + InferiorRunOk + +
|
|
|
|
|
// + + +
|
|
|
|
|
// InferiorStopOk EngineRunFailed +
|
|
|
|
|
// + v
|
|
|
|
|
// `-+-+-+-+-+-+-+-+-+-+-+>-+
|
|
|
|
|
// +
|
2010-07-15 09:41:11 +02:00
|
|
|
// +
|
2010-11-29 16:53:40 +01: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-11-08 15:19:13 +01:00
|
|
|
// | |
|
|
|
|
|
// | |
|
|
|
|
|
// {notify- {notify-
|
2010-08-18 15:25:49 +02:00
|
|
|
// Engine- Engine-
|
2010-11-08 15:19:13 +01:00
|
|
|
// ShutdownOk} ShutdownFailed}
|
|
|
|
|
// + +
|
|
|
|
|
// EngineShutdownOk EngineShutdownFailed
|
2010-07-09 17:07:59 +02:00
|
|
|
// * *
|
|
|
|
|
// DebuggerFinished
|
2010-11-08 15:19:13 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
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;
|
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";
|
2010-11-19 16:13:22 +01:00
|
|
|
const char * const ATTACHREMOTECDB = "Debugger.AttachRemoteCDB";
|
2010-12-01 15:41:08 +01:00
|
|
|
const char * const STARTREMOTELLDB = "Debugger.StartRemoteLLDB";
|
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
|
|
|
|
|
|
|
|
|
|
|
2010-11-24 11:44:43 +01:00
|
|
|
namespace Cdb {
|
|
|
|
|
void addCdb2OptionPages(QList<Core::IOptionsPage*> *);
|
|
|
|
|
} // namespace Cdb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
// 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<IOptionsPage*> *opts);
|
|
|
|
|
void addScriptOptionPages(QList<IOptionsPage*> *opts);
|
|
|
|
|
void addTcfOptionPages(QList<IOptionsPage*> *opts);
|
|
|
|
|
#ifdef CDB_ENABLED
|
|
|
|
|
void addCdbOptionPages(QList<IOptionsPage*> *opts);
|
|
|
|
|
#endif
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-26 15:10:10 +01:00
|
|
|
#ifdef WITH_LLDB
|
|
|
|
|
void addLldbOptionPages(QList<IOptionsPage*> *opts);
|
|
|
|
|
#endif
|
|
|
|
|
|
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-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
|
|
|
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
|
|
|
|
2010-11-23 13:44:37 +01:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DummyEngine
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class DummyEngine : public DebuggerEngine
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
DummyEngine() : DebuggerEngine(DebuggerStartParameters()) {}
|
2010-11-26 10:20:50 +01:00
|
|
|
~DummyEngine() {}
|
|
|
|
|
|
|
|
|
|
void setupEngine() {}
|
|
|
|
|
void setupInferior() {}
|
|
|
|
|
void runEngine() {}
|
|
|
|
|
void shutdownEngine() {}
|
|
|
|
|
void shutdownInferior() {}
|
|
|
|
|
void executeDebuggerCommand(const QString &) {}
|
|
|
|
|
unsigned debuggerCapabilities() const { return 0; }
|
|
|
|
|
bool acceptsBreakpoint(BreakpointId) const { return false; }
|
2010-11-23 13:44:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static DebuggerEngine *dummyEngine()
|
|
|
|
|
{
|
|
|
|
|
static DummyEngine dummy;
|
|
|
|
|
return &dummy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-01-14 18:09:02 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DebugMode
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-12-02 13:34:23 +01:00
|
|
|
class DebugMode : public IMode
|
2009-01-13 18:15:24 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2010-12-08 17:54:16 +01:00
|
|
|
DebugMode() : m_widget(0) { setObjectName(QLatin1String("DebugMode")); }
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-12-08 17:54:16 +01:00
|
|
|
~DebugMode()
|
|
|
|
|
{
|
|
|
|
|
// Make sure the editor manager does not get deleted.
|
|
|
|
|
//EditorManager::instance()->setParent(0);
|
|
|
|
|
delete m_widget;
|
|
|
|
|
}
|
2010-12-02 13:34:23 +01:00
|
|
|
|
|
|
|
|
// IMode
|
2010-12-03 15:23:23 +01:00
|
|
|
QString displayName() const { return DebuggerPlugin::tr("Debug"); }
|
|
|
|
|
QIcon icon() const { return QIcon(__(":/fancyactionbar/images/mode_Debug.png")); }
|
|
|
|
|
int priority() const { return P_MODE_DEBUG; }
|
|
|
|
|
QWidget *widget();
|
|
|
|
|
QString id() const { return MODE_DEBUG; }
|
|
|
|
|
QString type() const { return CC::MODE_EDIT_TYPE; }
|
|
|
|
|
Context context() const
|
|
|
|
|
{ return Context(CC::C_EDITORMANAGER, C_DEBUGMODE, CC::C_NAVIGATION_PANE); }
|
|
|
|
|
QString contextHelpId() const { return QString(); }
|
2010-12-02 13:34:23 +01:00
|
|
|
private:
|
|
|
|
|
QWidget *m_widget;
|
2010-06-16 11:08:54 +02:00
|
|
|
};
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-11-04 09:54:23 +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);
|
2010-11-10 16:33:11 +01:00
|
|
|
void apply() { m_group.apply(ICore::instance()->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
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(ListSourceFiles),
|
2009-03-26 17:27:44 +01:00
|
|
|
m_ui.checkBoxListSourceFiles);
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(UseAlternatingRowColors),
|
2009-05-05 10:14:35 +02:00
|
|
|
m_ui.checkBoxUseAlternatingRowColors);
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(UseToolTipsInMainEditor),
|
2009-10-01 18:01:23 +02:00
|
|
|
m_ui.checkBoxUseToolTipsInMainEditor);
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(CloseBuffersOnExit),
|
2010-10-08 17:44:11 +02:00
|
|
|
m_ui.checkBoxCloseBuffersOnExit);
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(SwitchModeOnExit),
|
2010-10-08 17:44:11 +02:00
|
|
|
m_ui.checkBoxSwitchModeOnExit);
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(AutoDerefPointers), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(UseToolTipsInLocalsView), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(UseToolTipsInBreakpointsView), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(UseAddressInBreakpointsView), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(UseAddressInStackView), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(MaximalStackDepth),
|
2009-04-02 15:06:24 +02:00
|
|
|
m_ui.spinBoxMaximalStackDepth);
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(ShowStdNamespace), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(ShowQtNamespace), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(SortStructMembers), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(LogTimeStamps), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(VerboseLog), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(BreakOnThrow), 0);
|
|
|
|
|
m_group.insert(debuggerCore()->action(BreakOnCatch), 0);
|
2010-03-25 16:54:23 +01:00
|
|
|
#ifdef Q_OS_WIN
|
2010-11-10 16:33:11 +01:00
|
|
|
Utils::SavedAction *registerAction = debuggerCore()->action(RegisterForPostMortem);
|
2010-03-25 16:54:23 +01:00
|
|
|
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-12-01 14:35:36 +01:00
|
|
|
QLatin1Char sep(' ');
|
|
|
|
|
QTextStream(&m_searchKeywords)
|
|
|
|
|
<< sep << m_ui.checkBoxUseAlternatingRowColors->text()
|
|
|
|
|
<< sep << m_ui.checkBoxUseToolTipsInMainEditor->text()
|
|
|
|
|
<< sep << m_ui.checkBoxListSourceFiles->text()
|
2010-03-25 16:54:23 +01:00
|
|
|
#ifdef Q_OS_WIN
|
2010-12-01 14:35:36 +01:00
|
|
|
<< sep << m_ui.checkBoxRegisterForPostMortem->text()
|
2010-03-25 16:54:23 +01:00
|
|
|
#endif
|
2010-12-01 14:35:36 +01:00
|
|
|
<< sep << m_ui.checkBoxCloseBuffersOnExit->text()
|
|
|
|
|
<< sep << m_ui.checkBoxSwitchModeOnExit->text()
|
|
|
|
|
<< sep << m_ui.labelMaximalStackDepth->text()
|
|
|
|
|
;
|
2009-11-24 15:05:02 +01:00
|
|
|
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
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-11-29 18:59:30 +01:00
|
|
|
static bool oxygenStyle()
|
2009-11-24 15:05:02 +01:00
|
|
|
{
|
2010-11-29 18:59:30 +01:00
|
|
|
const ManhattanStyle *ms = qobject_cast<const ManhattanStyle *>(qApp->style());
|
|
|
|
|
return ms && !qstrcmp("OxygenStyle", ms->baseStyle()->metaObject()->className());
|
2009-11-24 15:05:02 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-07 16:39:17 +02:00
|
|
|
class DebuggingHelperOptionPage : public Core::IOptionsPage
|
2010-11-10 16:33:11 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT // Needs tr-context.
|
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);
|
2010-11-10 16:33:11 +01:00
|
|
|
void apply() { m_group.apply(ICore::instance()->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(
|
2010-11-10 14:30:19 +01:00
|
|
|
ICore::instance()->resourcePath() + "../../lib");
|
2009-03-23 12:28:02 +01:00
|
|
|
|
2009-03-26 17:27:44 +01:00
|
|
|
m_group.clear();
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(UseDebuggingHelpers),
|
2009-11-24 15:05:02 +01:00
|
|
|
m_ui.debuggingHelperGroupBox);
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(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
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(CustomDebuggingHelperLocation),
|
2009-03-26 15:56:16 +01:00
|
|
|
m_ui.dumperLocationChooser);
|
2009-03-23 12:28:02 +01:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
m_group.insert(debuggerCore()->action(UseCodeModel),
|
2009-10-16 16:26:28 +02:00
|
|
|
m_ui.checkBoxUseCodeModel);
|
2010-12-20 17:39:51 +01:00
|
|
|
m_group.insert(debuggerCore()->action(ShowThreadNames),
|
|
|
|
|
m_ui.checkBoxShowThreadNames);
|
|
|
|
|
|
2009-10-16 16:26:28 +02:00
|
|
|
|
2009-03-23 12:28:02 +01:00
|
|
|
#ifndef QT_DEBUG
|
|
|
|
|
#if 0
|
2010-12-02 18:23:53 +01:00
|
|
|
cmd = am->registerAction(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()
|
2010-12-20 17:39:51 +01:00
|
|
|
<< ' ' << m_ui.checkBoxUseCodeModel->text()
|
|
|
|
|
<< ' ' << m_ui.checkBoxShowThreadNames->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")) {
|
2010-12-08 17:56:20 +01:00
|
|
|
*enabledEngines &= ~CdbEngineType;
|
2009-05-25 16:22:11 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-03-11 12:22:24 +01:00
|
|
|
if (option == _("-disable-gdb")) {
|
2010-12-08 17:56:20 +01:00
|
|
|
*enabledEngines &= ~GdbEngineType;
|
2009-05-25 16:22:11 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-06-09 16:13:47 +02:00
|
|
|
if (option == _("-disable-qmldb")) {
|
2010-12-08 17:56:20 +01:00
|
|
|
*enabledEngines &= ~QmlEngineType;
|
2010-06-09 16:13:47 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-03-11 12:22:24 +01:00
|
|
|
if (option == _("-disable-sdb")) {
|
2010-12-08 17:56:20 +01:00
|
|
|
*enabledEngines &= ~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;
|
|
|
|
|
}
|
2010-11-26 15:10:10 +01:00
|
|
|
if (option == _("-disable-lldb")) {
|
|
|
|
|
*enabledEngines &= ~LldbEngineType;
|
|
|
|
|
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;
|
2010-12-08 17:56:20 +01:00
|
|
|
if (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
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-11-10 14:30:19 +01:00
|
|
|
static bool isDebuggable(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.
|
2010-11-10 14:30:19 +01:00
|
|
|
// IFile *file = editor->file();
|
|
|
|
|
// return !(file && file->mimeType() == "application/x-qml");
|
2010-06-16 11:08:54 +02:00
|
|
|
// Nowadays, even Qml is debuggable.
|
2010-11-10 16:33:11 +01:00
|
|
|
return editor;
|
2009-12-14 18:01:39 +01:00
|
|
|
}
|
|
|
|
|
|
2011-01-04 15:54:36 +01:00
|
|
|
class ContextData
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ContextData() : lineNumber(0), address(0) {}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QString fileName;
|
|
|
|
|
int lineNumber;
|
|
|
|
|
quint64 address;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::ContextData)
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2010-11-26 09:58:34 +01:00
|
|
|
// Debugger Actions
|
2010-06-16 11:08:54 +02:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-01-04 15:54:36 +01:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
struct DebuggerActions
|
|
|
|
|
{
|
|
|
|
|
QAction *continueAction;
|
2010-11-08 17:43:31 +01:00
|
|
|
QAction *exitAction; // on the application output button if "Stop" is possible
|
2010-10-05 12:47:23 +02:00
|
|
|
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;
|
2010-11-05 19:38:40 +01:00
|
|
|
//QAction *snapshotAction;
|
2010-06-16 11:08:54 +02:00
|
|
|
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-11-10 11:39:01 +01:00
|
|
|
static DebuggerPluginPrivate *theDebuggerCore = 0;
|
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-11-10 11:39:01 +01:00
|
|
|
class DebuggerPluginPrivate : public DebuggerCore
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2010-03-19 13:58:26 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
public:
|
|
|
|
|
explicit DebuggerPluginPrivate(DebuggerPlugin *plugin);
|
2010-11-10 11:39:01 +01:00
|
|
|
~DebuggerPluginPrivate();
|
2010-03-10 13:46:05 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
bool initialize(const QStringList &arguments, QString *errorMessage);
|
2010-12-06 08:25:29 +01:00
|
|
|
void extensionsInitialized();
|
|
|
|
|
void aboutToShutdown();
|
|
|
|
|
|
2010-11-18 17:35:22 +01:00
|
|
|
void connectEngine(DebuggerEngine *engine);
|
2010-11-04 18:11:09 +01:00
|
|
|
void disconnectEngine() { connectEngine(0); }
|
2010-11-05 19:38:40 +01:00
|
|
|
DebuggerEngine *currentEngine() const { return m_currentEngine; }
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
public slots:
|
2010-11-08 15:50:13 +01:00
|
|
|
void selectThread(int index)
|
|
|
|
|
{
|
|
|
|
|
currentEngine()->selectThread(index);
|
|
|
|
|
}
|
2010-11-08 15:41:44 +01:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
void breakpointSetMarginActionTriggered()
|
2010-11-08 15:41:44 +01:00
|
|
|
{
|
2011-01-04 15:54:36 +01:00
|
|
|
const QAction *action = qobject_cast<const QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(action, return);
|
|
|
|
|
const ContextData data = action->data().value<ContextData>();
|
|
|
|
|
if (data.address)
|
|
|
|
|
toggleBreakpointByAddress(data.address);
|
|
|
|
|
else
|
|
|
|
|
toggleBreakpointByFileAndLine(data.fileName, data.lineNumber);
|
2010-11-24 11:44:43 +01:00
|
|
|
}
|
2010-11-08 15:41:44 +01:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
void breakpointRemoveMarginActionTriggered()
|
2010-11-08 15:41:44 +01:00
|
|
|
{
|
2010-11-10 16:33:11 +01:00
|
|
|
const QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(act, return);
|
2010-11-15 15:15:09 +01:00
|
|
|
m_breakHandler->removeBreakpoint(act->data().toInt());
|
2010-11-10 16:33:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void breakpointEnableMarginActionTriggered()
|
|
|
|
|
{
|
|
|
|
|
const QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(act, return);
|
|
|
|
|
breakHandler()->setEnabled(act->data().toInt(), true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void breakpointDisableMarginActionTriggered()
|
|
|
|
|
{
|
|
|
|
|
const QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(act, return);
|
|
|
|
|
breakHandler()->setEnabled(act->data().toInt(), false);
|
2010-11-08 15:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void updateWatchersHeader(int section, int, int newSize)
|
2010-11-05 19:38:40 +01:00
|
|
|
{
|
|
|
|
|
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-11-05 19:38:40 +01:00
|
|
|
{
|
2010-11-15 12:06:38 +01:00
|
|
|
if (on && m_currentEngine->state() == InferiorStopOk)
|
2010-11-05 19:38:40 +01:00
|
|
|
m_currentEngine->reloadSourceFiles();
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void modulesDockToggled(bool on)
|
2010-11-05 19:38:40 +01:00
|
|
|
{
|
2010-11-15 12:06:38 +01:00
|
|
|
if (on && m_currentEngine->state() == InferiorStopOk)
|
2010-11-05 19:38:40 +01:00
|
|
|
m_currentEngine->reloadModules();
|
|
|
|
|
}
|
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
|
|
|
{
|
2010-11-15 12:06:38 +01:00
|
|
|
if (on && m_currentEngine->state() == InferiorStopOk)
|
2010-11-05 13:35:31 +01:00
|
|
|
m_currentEngine->reloadRegisters();
|
|
|
|
|
}
|
2009-05-05 17:48:54 +02:00
|
|
|
|
2010-11-04 09:54:23 +01:00
|
|
|
void synchronizeBreakpoints()
|
|
|
|
|
{
|
2010-11-15 15:05:39 +01:00
|
|
|
showMessage("ATTEMPT SYNC", LogDebug);
|
2010-11-04 09:54:23 +01:00
|
|
|
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
2010-12-10 10:01:29 +01:00
|
|
|
if (DebuggerEngine *engine = m_snapshotHandler->at(i))
|
2010-11-04 09:54:23 +01:00
|
|
|
engine->attemptBreakpointSynchronization();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-04 18:11:09 +01:00
|
|
|
void synchronizeWatchers()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
2010-12-10 10:01:29 +01:00
|
|
|
if (DebuggerEngine *engine = m_snapshotHandler->at(i))
|
2010-11-25 16:32:07 +01:00
|
|
|
engine->watchHandler()->updateWatchers();
|
2010-11-04 18:11:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void editorOpened(Core::IEditor *editor);
|
|
|
|
|
void setBusyCursor(bool busy);
|
|
|
|
|
void requestMark(TextEditor::ITextEditor *editor, int lineNumber);
|
2011-01-04 13:58:05 +01:00
|
|
|
void showToolTip(TextEditor::ITextEditor *editor,
|
|
|
|
|
const QPoint &pnt, int pos, bool *handled);
|
2010-06-16 11:08:54 +02:00
|
|
|
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();
|
2010-11-24 18:36:17 +01:00
|
|
|
void toggleBreakpointByFileAndLine(const QString &fileName, int lineNumber);
|
|
|
|
|
void toggleBreakpointByAddress(quint64 address);
|
2010-06-16 11:08:54 +02:00
|
|
|
void onModeChanged(Core::IMode *mode);
|
|
|
|
|
void showSettingsDialog();
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-11-12 20:18:29 +01:00
|
|
|
void debugProject();
|
2010-06-16 11:08:54 +02:00
|
|
|
void startExternalApplication();
|
2010-11-19 16:13:22 +01:00
|
|
|
void startRemoteCdbSession();
|
2010-06-16 11:08:54 +02:00
|
|
|
void startRemoteApplication();
|
2010-12-01 15:41:08 +01:00
|
|
|
void startRemoteEngine();
|
2010-06-16 11:08:54 +02:00
|
|
|
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-12-06 11:06:18 +01:00
|
|
|
void languagesChanged();
|
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
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
const CPlusPlus::Snapshot &cppCodeModelSnapshot() const;
|
|
|
|
|
|
|
|
|
|
void showQtDumperLibraryWarning(const QString &details);
|
2010-12-03 14:29:19 +01:00
|
|
|
DebuggerMainWindow *mainWindow() const { return m_mainWindow; }
|
2010-12-03 15:03:51 +01:00
|
|
|
bool isDockVisible(const QString &objectName) const
|
2010-12-03 15:23:23 +01:00
|
|
|
{ return mainWindow()->isDockVisible(objectName); }
|
2010-11-10 11:39:01 +01:00
|
|
|
|
|
|
|
|
bool hasSnapshots() const { return m_snapshotHandler->size(); }
|
2010-12-03 15:55:17 +01:00
|
|
|
void createNewDock(QWidget *widget);
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-10 10:01:29 +01:00
|
|
|
void runControlStarted(DebuggerEngine *engine);
|
|
|
|
|
void runControlFinished(DebuggerEngine *engine);
|
2010-11-10 11:39:01 +01:00
|
|
|
DebuggerLanguages activeLanguages() const;
|
2010-11-10 16:33:11 +01:00
|
|
|
QString gdbBinaryForToolChain(int toolChain) const;
|
2010-11-10 11:39:01 +01:00
|
|
|
void remoteCommand(const QStringList &options, const QStringList &);
|
|
|
|
|
|
|
|
|
|
bool isReverseDebugging() const;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
BreakHandler *breakHandler() const { return m_breakHandler; }
|
|
|
|
|
SnapshotHandler *snapshotHandler() const { return m_snapshotHandler; }
|
|
|
|
|
|
|
|
|
|
void setConfigValue(const QString &name, const QVariant &value);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
void updateState(DebuggerEngine *engine);
|
2010-11-23 13:28:18 +01:00
|
|
|
void updateWatchersWindow();
|
2010-07-21 17:06:22 +02:00
|
|
|
void onCurrentProjectChanged(ProjectExplorer::Project *project);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
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-11-08 15:19:13 +01:00
|
|
|
public slots:
|
2010-11-12 20:18:29 +01:00
|
|
|
void updateDebugActions();
|
2010-11-23 16:42:46 +01:00
|
|
|
|
|
|
|
|
void handleExecDetach()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-23 16:42:46 +01:00
|
|
|
currentEngine()->detachDebugger();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecContinue()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-23 16:42:46 +01:00
|
|
|
currentEngine()->continueInferior();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecInterrupt()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-23 16:42:46 +01:00
|
|
|
currentEngine()->requestInterruptInferior();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecReset()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-23 16:42:46 +01:00
|
|
|
currentEngine()->notifyEngineIll(); // FIXME: Check.
|
|
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
|
|
|
|
|
void handleExecStep()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-23 16:42:46 +01:00
|
|
|
if (boolSetting(OperateByInstruction))
|
2010-11-08 15:19:13 +01:00
|
|
|
currentEngine()->executeStepI();
|
|
|
|
|
else
|
|
|
|
|
currentEngine()->executeStep();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecNext()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-23 16:42:46 +01:00
|
|
|
if (boolSetting(OperateByInstruction))
|
2010-11-08 15:19:13 +01:00
|
|
|
currentEngine()->executeNextI();
|
|
|
|
|
else
|
|
|
|
|
currentEngine()->executeNext();
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-08 15:41:44 +01:00
|
|
|
void handleExecStepOut()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-08 15:41:44 +01:00
|
|
|
currentEngine()->executeStepOut();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecReturn()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-08 15:41:44 +01:00
|
|
|
currentEngine()->executeReturn();
|
|
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
|
|
|
|
|
void handleExecJumpToLine()
|
|
|
|
|
{
|
|
|
|
|
//removeTooltip();
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-08 16:17:59 +01:00
|
|
|
QString fileName;
|
|
|
|
|
int lineNumber;
|
|
|
|
|
if (currentTextEditorPosition(&fileName, &lineNumber))
|
|
|
|
|
currentEngine()->executeJumpToLine(fileName, lineNumber);
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecRunToLine()
|
|
|
|
|
{
|
|
|
|
|
//removeTooltip();
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-08 16:17:59 +01:00
|
|
|
QString fileName;
|
|
|
|
|
int lineNumber;
|
|
|
|
|
if (currentTextEditorPosition(&fileName, &lineNumber))
|
|
|
|
|
currentEngine()->executeRunToLine(fileName, lineNumber);
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecRunToFunction()
|
|
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2010-11-08 16:17:59 +01:00
|
|
|
ITextEditor *textEditor = currentTextEditor();
|
|
|
|
|
QTC_ASSERT(textEditor, return);
|
|
|
|
|
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit*>(textEditor->widget());
|
|
|
|
|
if (!ed)
|
|
|
|
|
return;
|
|
|
|
|
QTextCursor cursor = ed->textCursor();
|
|
|
|
|
QString functionName = cursor.selectedText();
|
|
|
|
|
if (functionName.isEmpty()) {
|
|
|
|
|
const QTextBlock block = cursor.block();
|
|
|
|
|
const QString line = block.text();
|
|
|
|
|
foreach (const QString &str, line.trimmed().split('(')) {
|
|
|
|
|
QString a;
|
|
|
|
|
for (int i = str.size(); --i >= 0; ) {
|
|
|
|
|
if (!str.at(i).isLetterOrNumber())
|
|
|
|
|
break;
|
|
|
|
|
a = str.at(i) + a;
|
|
|
|
|
}
|
|
|
|
|
if (!a.isEmpty()) {
|
|
|
|
|
functionName = a;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!functionName.isEmpty())
|
|
|
|
|
currentEngine()->executeRunToFunction(functionName);
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-08 15:41:44 +01:00
|
|
|
void slotEditBreakpoint()
|
|
|
|
|
{
|
|
|
|
|
const QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(act, return);
|
2010-11-10 16:33:11 +01:00
|
|
|
const BreakpointId id = act->data().toInt();
|
|
|
|
|
QTC_ASSERT(id > 0, return);
|
|
|
|
|
BreakWindow::editBreakpoint(id, mainWindow());
|
2010-11-08 15:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void slotRunToLine()
|
|
|
|
|
{
|
2011-01-04 15:54:36 +01:00
|
|
|
const QAction *action = qobject_cast<const QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(action, return);
|
|
|
|
|
const ContextData data = action->data().value<ContextData>();
|
|
|
|
|
currentEngine()->executeRunToLine(data.fileName, data.lineNumber);
|
2010-11-08 15:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void slotJumpToLine()
|
|
|
|
|
{
|
2011-01-04 15:54:36 +01:00
|
|
|
const QAction *action = qobject_cast<const QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(action, return);
|
|
|
|
|
const ContextData data = action->data().value<ContextData>();
|
|
|
|
|
currentEngine()->executeJumpToLine(data.fileName, data.lineNumber);
|
2010-11-08 15:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-08 15:19:13 +01:00
|
|
|
void handleAddToWatchWindow()
|
|
|
|
|
{
|
|
|
|
|
// Requires a selection, but that's the only case we want anyway.
|
|
|
|
|
EditorManager *editorManager = EditorManager::instance();
|
|
|
|
|
if (!editorManager)
|
|
|
|
|
return;
|
|
|
|
|
IEditor *editor = editorManager->currentEditor();
|
|
|
|
|
if (!editor)
|
|
|
|
|
return;
|
|
|
|
|
ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor);
|
|
|
|
|
if (!textEditor)
|
|
|
|
|
return;
|
|
|
|
|
QTextCursor tc;
|
|
|
|
|
QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit*>(editor->widget());
|
|
|
|
|
if (ptEdit)
|
|
|
|
|
tc = ptEdit->textCursor();
|
|
|
|
|
QString exp;
|
|
|
|
|
if (tc.hasSelection()) {
|
|
|
|
|
exp = tc.selectedText();
|
|
|
|
|
} else {
|
|
|
|
|
int line, column;
|
|
|
|
|
exp = cppExpressionAt(textEditor, tc.position(), &line, &column);
|
|
|
|
|
}
|
|
|
|
|
if (exp.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
currentEngine()->watchHandler()->watchExpression(exp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecExit()
|
|
|
|
|
{
|
2010-11-08 17:43:31 +01:00
|
|
|
currentEngine()->exitDebugger();
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleFrameDown()
|
|
|
|
|
{
|
|
|
|
|
currentEngine()->frameDown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleFrameUp()
|
|
|
|
|
{
|
|
|
|
|
currentEngine()->frameUp();
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-22 12:21:56 +01:00
|
|
|
void handleOperateByInstructionTriggered(bool operateByInstructionTriggered)
|
2010-11-08 15:19:13 +01:00
|
|
|
{
|
2010-11-22 12:21:56 +01:00
|
|
|
// Go to source only if we have the file.
|
|
|
|
|
if (currentEngine()->stackHandler()->currentIndex() >= 0) {
|
|
|
|
|
const StackFrame frame = currentEngine()->stackHandler()->currentFrame();
|
2010-12-16 19:06:33 +01:00
|
|
|
if (operateByInstructionTriggered || frame.isUsable()) {
|
|
|
|
|
currentEngine()->gotoLocation(Location(frame, true));
|
|
|
|
|
}
|
2010-11-22 12:21:56 +01:00
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
bool isActiveDebugLanguage(int lang) const
|
2010-11-08 15:19:13 +01:00
|
|
|
{
|
2010-12-02 17:33:39 +01:00
|
|
|
return m_mainWindow->activeDebugLanguages() & lang;
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
QVariant sessionValue(const QString &name);
|
|
|
|
|
void setSessionValue(const QString &name, const QVariant &value);
|
|
|
|
|
QIcon locationMarkIcon() const { return m_locationMarkIcon; }
|
|
|
|
|
|
|
|
|
|
void openTextEditor(const QString &titlePattern0, const QString &contents);
|
|
|
|
|
void clearCppCodeModelSnapshot();
|
|
|
|
|
void showMessage(const QString &msg, int channel, int timeout = -1);
|
|
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
Utils::SavedAction *action(int code) const;
|
|
|
|
|
bool boolSetting(int code) const;
|
|
|
|
|
QString stringSetting(int code) const;
|
|
|
|
|
|
2010-11-26 09:58:34 +01:00
|
|
|
void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
public:
|
2010-12-02 17:33:39 +01:00
|
|
|
DebuggerMainWindow *m_mainWindow;
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerRunControlFactory *m_debuggerRunControlFactory;
|
|
|
|
|
|
|
|
|
|
QString m_previousMode;
|
2010-11-10 14:30:19 +01:00
|
|
|
Context m_continuableContext;
|
|
|
|
|
Context m_interruptibleContext;
|
|
|
|
|
Context m_undisturbableContext;
|
|
|
|
|
Context m_finishedContext;
|
|
|
|
|
Context m_anyContext;
|
2010-06-16 11:08:54 +02:00
|
|
|
AttachRemoteParameters m_attachRemoteParameters;
|
|
|
|
|
|
2010-11-12 20:18:29 +01:00
|
|
|
QAction *m_debugAction;
|
2010-06-16 11:08:54 +02:00
|
|
|
QAction *m_startExternalAction;
|
|
|
|
|
QAction *m_startRemoteAction;
|
2010-11-19 16:13:22 +01:00
|
|
|
QAction *m_startRemoteCdbAction;
|
2010-12-01 15:41:08 +01:00
|
|
|
QAction *m_startRemoteLldbAction;
|
2010-06-16 11:08:54 +02:00
|
|
|
QAction *m_attachExternalAction;
|
|
|
|
|
QAction *m_attachCoreAction;
|
|
|
|
|
QAction *m_attachTcfAction;
|
|
|
|
|
QAction *m_detachAction;
|
|
|
|
|
QToolButton *m_reverseToolButton;
|
|
|
|
|
|
2010-10-05 12:47:23 +02:00
|
|
|
QIcon m_startIcon;
|
2010-11-08 17:43:31 +01:00
|
|
|
QIcon m_exitIcon;
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
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;
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
mutable CPlusPlus::Snapshot m_codeModelSnapshot;
|
2010-06-16 11:08:54 +02:00
|
|
|
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-11-10 16:33:11 +01:00
|
|
|
DebuggerSettings *m_debuggerSettings;
|
|
|
|
|
QSettings *m_coreSettings;
|
|
|
|
|
bool m_gdbBinariesChanged;
|
2010-12-02 13:20:06 +01:00
|
|
|
uint m_cmdLineEnabledEngines;
|
2010-06-16 11:08:54 +02:00
|
|
|
};
|
|
|
|
|
|
2010-11-23 16:42:46 +01:00
|
|
|
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2011-01-04 15:54:36 +01:00
|
|
|
qRegisterMetaType<WatchData>("WatchData");
|
|
|
|
|
qRegisterMetaType<ContextData>("ContextData");
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
QTC_ASSERT(!theDebuggerCore, /**/);
|
|
|
|
|
theDebuggerCore = this;
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
m_plugin = plugin;
|
|
|
|
|
|
2010-11-23 16:42:46 +01:00
|
|
|
m_startRemoteCdbAction = 0;
|
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_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
|
|
|
|
2010-11-10 14:30:19 +01:00
|
|
|
m_continuableContext = Context(0);
|
|
|
|
|
m_interruptibleContext = Context(0);
|
|
|
|
|
m_undisturbableContext = Context(0);
|
|
|
|
|
m_finishedContext = Context(0);
|
|
|
|
|
m_anyContext = Context(0);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 17:33:39 +01:00
|
|
|
m_mainWindow = 0;
|
2010-07-20 17:36:20 +02:00
|
|
|
m_snapshotHandler = 0;
|
2010-11-04 18:11:09 +01:00
|
|
|
m_currentEngine = 0;
|
2010-11-10 16:33:11 +01:00
|
|
|
m_debuggerSettings = 0;
|
|
|
|
|
|
|
|
|
|
m_gdbBinariesChanged = true;
|
2010-12-02 13:20:06 +01:00
|
|
|
m_cmdLineEnabledEngines = AllEngineTypes;
|
2010-12-06 08:04:43 +01:00
|
|
|
|
|
|
|
|
m_reverseToolButton = 0;
|
|
|
|
|
m_debugAction = 0;
|
|
|
|
|
m_startExternalAction = 0;
|
|
|
|
|
m_startRemoteAction = 0;
|
|
|
|
|
m_startRemoteCdbAction = 0;
|
|
|
|
|
m_startRemoteLldbAction = 0;
|
|
|
|
|
m_attachExternalAction = 0;
|
|
|
|
|
m_attachCoreAction = 0;
|
|
|
|
|
m_attachTcfAction = 0;
|
|
|
|
|
m_detachAction = 0;
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
DebuggerPluginPrivate::~DebuggerPluginPrivate()
|
|
|
|
|
{
|
2010-11-10 16:33:11 +01:00
|
|
|
delete m_debuggerSettings;
|
|
|
|
|
m_debuggerSettings = 0;
|
|
|
|
|
|
2010-12-02 17:33:39 +01:00
|
|
|
delete m_mainWindow;
|
|
|
|
|
m_mainWindow = 0;
|
2010-11-10 11:39:01 +01:00
|
|
|
|
|
|
|
|
delete m_snapshotHandler;
|
|
|
|
|
m_snapshotHandler = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerCore *debuggerCore()
|
|
|
|
|
{
|
|
|
|
|
return theDebuggerCore;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
|
|
|
|
QString *errorMessage)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
// Do not fail to load the whole plugin if something goes wrong here.
|
|
|
|
|
if (!parseArguments(arguments, &m_attachRemoteParameters,
|
|
|
|
|
&m_cmdLineEnabledEngines, errorMessage)) {
|
|
|
|
|
*errorMessage = tr("Error evaluating command line arguments: %1")
|
|
|
|
|
.arg(*errorMessage);
|
|
|
|
|
qWarning("%s\n", qPrintable(*errorMessage));
|
|
|
|
|
errorMessage->clear();
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-03 10:45:51 +01:00
|
|
|
// Cpp/Qml ui setup
|
|
|
|
|
m_mainWindow = new DebuggerMainWindow;
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::setConfigValue(const QString &name, const QVariant &value)
|
|
|
|
|
{
|
|
|
|
|
m_coreSettings->setValue(_("DebugMode/") + name, value);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QVariant DebuggerPluginPrivate::configValue(const QString &name) const
|
|
|
|
|
{
|
|
|
|
|
const QVariant value = m_coreSettings->value(_("DebugMode/") + name);
|
|
|
|
|
if (value.isValid())
|
|
|
|
|
return value;
|
|
|
|
|
// Legacy (pre-2.1): Check old un-namespaced-settings.
|
|
|
|
|
return m_coreSettings->value(name);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
|
|
|
|
|
{
|
|
|
|
|
RunConfiguration *activeRc = 0;
|
|
|
|
|
if (project) {
|
|
|
|
|
Target *target = project->activeTarget();
|
|
|
|
|
QTC_ASSERT(target, return);
|
|
|
|
|
activeRc = target->activeRunConfiguration();
|
|
|
|
|
QTC_ASSERT(activeRc, /**/);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
|
|
|
|
// Run controls might be deleted during exit.
|
2010-12-10 10:01:29 +01:00
|
|
|
if (DebuggerEngine *engine = m_snapshotHandler->at(i)) {
|
|
|
|
|
DebuggerRunControl *runControl = engine->runControl();
|
2010-12-02 13:20:06 +01:00
|
|
|
RunConfiguration *rc = runControl->runConfiguration();
|
|
|
|
|
if (rc == activeRc) {
|
|
|
|
|
m_snapshotHandler->setCurrentIndex(i);
|
|
|
|
|
updateState(engine);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// No corresponding debugger found. So we are ready to start one.
|
|
|
|
|
ICore *core = ICore::instance();
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, Context());
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-06 11:06:18 +01:00
|
|
|
void DebuggerPluginPrivate::languagesChanged()
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2010-12-06 11:06:18 +01:00
|
|
|
const bool debuggerIsCPP =
|
|
|
|
|
m_mainWindow->activeDebugLanguages() & CppLanguage;
|
2010-12-02 13:20:06 +01: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);
|
|
|
|
|
}
|
2010-11-04 18:11:09 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::debugProject()
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
if (Project *pro = pe->startupProject())
|
|
|
|
|
pe->runProject(pro, Constants::DEBUGMODE);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::startExternalApplication()
|
|
|
|
|
{
|
|
|
|
|
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;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
setConfigValue(_("LastExternalExecutableFile"),
|
|
|
|
|
dlg.executableFile());
|
|
|
|
|
setConfigValue(_("LastExternalExecutableArguments"),
|
|
|
|
|
dlg.executableArguments());
|
|
|
|
|
setConfigValue(_("LastExternalWorkingDirectory"),
|
|
|
|
|
dlg.workingDirectory());
|
|
|
|
|
sp.executable = dlg.executableFile();
|
|
|
|
|
sp.startMode = StartExternal;
|
|
|
|
|
sp.workingDirectory = dlg.workingDirectory();
|
|
|
|
|
if (!dlg.executableArguments().isEmpty())
|
|
|
|
|
sp.processArgs = dlg.executableArguments();
|
|
|
|
|
// Fixme: 1 of 3 testing hacks.
|
|
|
|
|
if (sp.processArgs.startsWith(__("@tcf@ ")) || sp.processArgs.startsWith(__("@sym@ ")))
|
|
|
|
|
sp.toolChainType = ToolChain_RVCT2_ARMV5;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-14 12:50:10 +01:00
|
|
|
if (dlg.breakAtMain()) {
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
// FIXME: wrong on non-Qt based binaries
|
|
|
|
|
breakHandler()->breakByFunction("qMain");
|
|
|
|
|
#else
|
|
|
|
|
breakHandler()->breakByFunction("main");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (RunControl *rc = m_debuggerRunControlFactory->create(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::attachExternalApplication()
|
|
|
|
|
{
|
|
|
|
|
AttachExternalDialog dlg(mainWindow());
|
|
|
|
|
if (dlg.exec() == QDialog::Accepted)
|
|
|
|
|
attachExternalApplication(dlg.attachPID(), dlg.executable(), QString());
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::attachExternalApplication
|
|
|
|
|
(qint64 pid, const QString &binary, const QString &crashParameter)
|
|
|
|
|
{
|
|
|
|
|
if (pid == 0) {
|
|
|
|
|
QMessageBox::warning(mainWindow(), tr("Warning"),
|
|
|
|
|
tr("Cannot attach to PID 0"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.attachPID = pid;
|
|
|
|
|
sp.displayName = tr("Process %1").arg(pid);
|
|
|
|
|
sp.executable = binary;
|
|
|
|
|
sp.crashParameter = crashParameter;
|
|
|
|
|
sp.startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
|
|
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::attachCore()
|
|
|
|
|
{
|
|
|
|
|
AttachCoreDialog dlg(mainWindow());
|
|
|
|
|
dlg.setExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
|
|
|
|
|
dlg.setCoreFile(configValue(_("LastExternalCoreFile")).toString());
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
|
|
|
|
setConfigValue(_("LastExternalExecutableFile"), dlg.executableFile());
|
|
|
|
|
setConfigValue(_("LastExternalCoreFile"), dlg.coreFile());
|
|
|
|
|
attachCore(dlg.coreFile(), dlg.executableFile());
|
|
|
|
|
}
|
2010-07-22 10:23:27 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::attachCore(const QString &core, const QString &exe)
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.executable = exe;
|
|
|
|
|
sp.coreFile = core;
|
|
|
|
|
sp.displayName = tr("Core file \"%1\"").arg(core);
|
|
|
|
|
sp.startMode = AttachCore;
|
|
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01: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;
|
|
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-10-05 12:47:23 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::startRemoteCdbSession()
|
|
|
|
|
{
|
|
|
|
|
const QString connectionKey = _("CdbRemoteConnection");
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.toolChainType = ToolChain_MSVC;
|
|
|
|
|
sp.startMode = AttachToRemote;
|
|
|
|
|
StartRemoteCdbDialog dlg(mainWindow());
|
|
|
|
|
QString previousConnection = configValue(connectionKey).toString();
|
|
|
|
|
if (previousConnection.isEmpty())
|
|
|
|
|
previousConnection = QLatin1String("localhost:1234");
|
|
|
|
|
dlg.setConnection(previousConnection);
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
|
|
|
|
sp.remoteChannel = dlg.connection();
|
|
|
|
|
setConfigValue(connectionKey, sp.remoteChannel);
|
|
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::startRemoteApplication()
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
StartRemoteDialog dlg(mainWindow());
|
|
|
|
|
QStringList arches;
|
|
|
|
|
arches.append(_("i386:x86-64:intel"));
|
|
|
|
|
arches.append(_("i386"));
|
|
|
|
|
arches.append(_("arm"));
|
|
|
|
|
QString lastUsed = configValue(_("LastRemoteArchitecture")).toString();
|
|
|
|
|
if (!arches.contains(lastUsed))
|
|
|
|
|
arches.prepend(lastUsed);
|
|
|
|
|
dlg.setRemoteArchitectures(arches);
|
|
|
|
|
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);
|
|
|
|
|
dlg.setRemoteChannel(
|
|
|
|
|
configValue(_("LastRemoteChannel")).toString());
|
|
|
|
|
dlg.setLocalExecutable(
|
|
|
|
|
configValue(_("LastLocalExecutable")).toString());
|
|
|
|
|
dlg.setDebugger(configValue(_("LastDebugger")).toString());
|
|
|
|
|
dlg.setRemoteArchitecture(lastUsed);
|
|
|
|
|
dlg.setGnuTarget(lastUsedGnuTarget);
|
|
|
|
|
dlg.setServerStartScript(
|
|
|
|
|
configValue(_("LastServerStartScript")).toString());
|
|
|
|
|
dlg.setUseServerStartScript(
|
|
|
|
|
configValue(_("LastUseServerStartScript")).toBool());
|
|
|
|
|
dlg.setSysRoot(configValue(_("LastSysroot")).toString());
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
|
|
|
|
setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel());
|
|
|
|
|
setConfigValue(_("LastLocalExecutable"), dlg.localExecutable());
|
|
|
|
|
setConfigValue(_("LastDebugger"), dlg.debugger());
|
|
|
|
|
setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture());
|
|
|
|
|
setConfigValue(_("LastGnuTarget"), dlg.gnuTarget());
|
|
|
|
|
setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
|
|
|
|
|
setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
|
|
|
|
|
setConfigValue(_("LastSysroot"), dlg.sysRoot());
|
|
|
|
|
sp.remoteChannel = dlg.remoteChannel();
|
|
|
|
|
sp.remoteArchitecture = dlg.remoteArchitecture();
|
|
|
|
|
sp.gnuTarget = dlg.gnuTarget();
|
|
|
|
|
sp.executable = dlg.localExecutable();
|
|
|
|
|
sp.displayName = dlg.localExecutable();
|
|
|
|
|
sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.
|
|
|
|
|
if (!sp.debuggerCommand.isEmpty())
|
|
|
|
|
sp.toolChainType = ToolChain_INVALID;
|
|
|
|
|
sp.startMode = AttachToRemote;
|
|
|
|
|
sp.useServerStartScript = dlg.useServerStartScript();
|
|
|
|
|
sp.serverStartScript = dlg.serverStartScript();
|
|
|
|
|
sp.sysRoot = dlg.sysRoot();
|
|
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::startRemoteEngine()
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
StartRemoteEngineDialog dlg(mainWindow());
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
sp.connParams.host = dlg.host();
|
|
|
|
|
sp.connParams.uname = dlg.username();
|
|
|
|
|
sp.connParams.pwd = dlg.password();
|
2010-11-10 16:33:11 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
sp.connParams.timeout = 5;
|
|
|
|
|
sp.connParams.authType = SshConnectionParameters::AuthByPwd;
|
|
|
|
|
sp.connParams.port = 22;
|
|
|
|
|
sp.connParams.proxyType = SshConnectionParameters::NoProxy;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
sp.executable = dlg.inferiorPath();
|
|
|
|
|
sp.serverStartScript = dlg.enginePath();
|
|
|
|
|
sp.startMode = StartRemoteEngine;
|
|
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-09-22 12:25:42 +02:00
|
|
|
|
2010-12-02 13:20:06 +01: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-09-22 12:25:42 +02:00
|
|
|
|
2010-12-02 13:20:06 +01: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();
|
|
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
bool DebuggerPluginPrivate::attachCmdLine()
|
|
|
|
|
{
|
|
|
|
|
if (m_attachRemoteParameters.attachPid) {
|
|
|
|
|
showStatusMessage(tr("Attaching to PID %1.")
|
|
|
|
|
.arg(m_attachRemoteParameters.attachPid));
|
|
|
|
|
const QString crashParameter = m_attachRemoteParameters.winCrashEvent
|
|
|
|
|
? QString::number(m_attachRemoteParameters.winCrashEvent) : QString();
|
|
|
|
|
attachExternalApplication(m_attachRemoteParameters.attachPid,
|
|
|
|
|
QString(), crashParameter);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
const QString target = m_attachRemoteParameters.attachTarget;
|
|
|
|
|
if (target.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-01-04 15:37:17 +01:00
|
|
|
void DebuggerPluginPrivate::editorOpened(IEditor *editor)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
|
|
|
|
if (!isDebuggable(editor))
|
|
|
|
|
return;
|
|
|
|
|
ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
|
|
|
|
|
if (!textEditor)
|
|
|
|
|
return;
|
|
|
|
|
connect(textEditor,
|
|
|
|
|
SIGNAL(markRequested(TextEditor::ITextEditor*,int)),
|
|
|
|
|
SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
|
|
|
|
connect(editor,
|
2011-01-04 13:58:05 +01:00
|
|
|
SIGNAL(tooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)),
|
|
|
|
|
SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int,bool*)));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(textEditor,
|
|
|
|
|
SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
|
|
|
|
SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
|
|
|
|
}
|
2010-09-22 12:25:42 +02:00
|
|
|
|
2011-01-04 15:37:17 +01:00
|
|
|
void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
|
2010-12-02 13:20:06 +01:00
|
|
|
int lineNumber, QMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
if (!isDebuggable(editor))
|
|
|
|
|
return;
|
2010-06-22 12:02:24 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
BreakpointId id = BreakpointId();
|
|
|
|
|
QString fileName;
|
|
|
|
|
quint64 address = 0;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-01-04 15:54:36 +01:00
|
|
|
ContextData args;
|
|
|
|
|
args.lineNumber = lineNumber;
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (editor->property("DisassemblerView").toBool()) {
|
2011-01-04 15:54:36 +01:00
|
|
|
args.fileName = editor->file()->fileName();
|
2010-12-02 13:20:06 +01:00
|
|
|
QString line = editor->contents()
|
|
|
|
|
.section('\n', lineNumber - 1, lineNumber - 1);
|
|
|
|
|
BreakpointResponse needle;
|
|
|
|
|
needle.type = BreakpointByAddress;
|
2010-12-14 12:29:32 +01:00
|
|
|
needle.address = DisassemblerAgent::addressFromDisassemblyLine(line);
|
2011-01-04 15:54:36 +01:00
|
|
|
args.address = needle.address;
|
2010-12-02 13:20:06 +01:00
|
|
|
needle.lineNumber = -1;
|
|
|
|
|
id = breakHandler()->findSimilarBreakpoint(needle);
|
|
|
|
|
} else {
|
2011-01-04 15:54:36 +01:00
|
|
|
args.fileName = editor->file()->fileName();
|
2010-12-02 13:20:06 +01:00
|
|
|
id = breakHandler()->findBreakpointByFileAndLine(fileName, lineNumber);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (id) {
|
|
|
|
|
// Remove existing breakpoint.
|
|
|
|
|
QAction *act = new QAction(menu);
|
|
|
|
|
act->setData(int(id));
|
|
|
|
|
act->setText(tr("Remove Breakpoint %1").arg(id));
|
|
|
|
|
connect(act, SIGNAL(triggered()),
|
|
|
|
|
SLOT(breakpointRemoveMarginActionTriggered()));
|
|
|
|
|
menu->addAction(act);
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Enable/disable existing breakpoint.
|
|
|
|
|
act = new QAction(menu);
|
|
|
|
|
act->setData(int(id));
|
|
|
|
|
if (breakHandler()->isEnabled(id)) {
|
|
|
|
|
act->setText(tr("Disable Breakpoint %1").arg(id));
|
|
|
|
|
connect(act, SIGNAL(triggered()),
|
|
|
|
|
SLOT(breakpointDisableMarginActionTriggered()));
|
|
|
|
|
} else {
|
|
|
|
|
act->setText(tr("Enable Breakpoint %1").arg(id));
|
|
|
|
|
connect(act, SIGNAL(triggered()),
|
|
|
|
|
SLOT(breakpointEnableMarginActionTriggered()));
|
|
|
|
|
}
|
|
|
|
|
menu->addAction(act);
|
2010-08-26 16:02:41 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Edit existing breakpoint.
|
|
|
|
|
act = new QAction(menu);
|
|
|
|
|
act->setText(tr("Edit Breakpoint %1...").arg(id));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(slotEditBreakpoint()));
|
|
|
|
|
act->setData(int(id));
|
|
|
|
|
menu->addAction(act);
|
|
|
|
|
} else {
|
|
|
|
|
// Handle non-existing breakpoint.
|
|
|
|
|
const QString text = address ?
|
|
|
|
|
tr("Set Breakpoint at 0x%1").arg(address, 0, 16) :
|
|
|
|
|
tr("Set Breakpoint at line %1").arg(lineNumber);
|
|
|
|
|
QAction *act = new QAction(text, menu);
|
2011-01-04 15:54:36 +01:00
|
|
|
act->setData(QVariant::fromValue(args));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()),
|
|
|
|
|
SLOT(breakpointSetMarginActionTriggered()));
|
|
|
|
|
menu->addAction(act);
|
|
|
|
|
}
|
|
|
|
|
// Run to, jump to line below in stopped state.
|
2011-01-04 16:05:53 +01:00
|
|
|
if (currentEngine() && currentEngine()->state() == InferiorStopOk) {
|
2010-12-02 13:20:06 +01:00
|
|
|
menu->addSeparator();
|
|
|
|
|
const QString runText =
|
|
|
|
|
DebuggerEngine::tr("Run to Line %1").arg(lineNumber);
|
|
|
|
|
QAction *runToLineAction = new QAction(runText, menu);
|
2011-01-04 15:54:36 +01:00
|
|
|
runToLineAction->setData(QVariant::fromValue(args));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(runToLineAction, SIGNAL(triggered()), SLOT(slotRunToLine()));
|
|
|
|
|
menu->addAction(runToLineAction);
|
|
|
|
|
if (currentEngine()->debuggerCapabilities() & JumpToLineCapability) {
|
|
|
|
|
const QString jumpText =
|
|
|
|
|
DebuggerEngine::tr("Jump to Line %1").arg(lineNumber);
|
|
|
|
|
QAction *jumpToLineAction = new QAction(jumpText, menu);
|
|
|
|
|
menu->addAction(runToLineAction);
|
2011-01-04 15:54:36 +01:00
|
|
|
jumpToLineAction->setData(QVariant::fromValue(args));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(jumpToLineAction, SIGNAL(triggered()), SLOT(slotJumpToLine()));
|
|
|
|
|
menu->addAction(jumpToLineAction);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::toggleBreakpoint()
|
|
|
|
|
{
|
|
|
|
|
ITextEditor *textEditor = currentTextEditor();
|
|
|
|
|
QTC_ASSERT(textEditor, return);
|
|
|
|
|
const int lineNumber = textEditor->currentLine();
|
|
|
|
|
if (textEditor->property("DisassemblerView").toBool()) {
|
|
|
|
|
QString line = textEditor->contents()
|
|
|
|
|
.section('\n', lineNumber - 1, lineNumber - 1);
|
2010-12-14 12:29:32 +01:00
|
|
|
quint64 address = DisassemblerAgent::addressFromDisassemblyLine(line);
|
2010-12-02 13:20:06 +01:00
|
|
|
toggleBreakpointByAddress(address);
|
|
|
|
|
} else if (lineNumber >= 0) {
|
|
|
|
|
toggleBreakpointByFileAndLine(textEditor->file()->fileName(), lineNumber);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::toggleBreakpointByFileAndLine(const QString &fileName,
|
|
|
|
|
int lineNumber)
|
|
|
|
|
{
|
|
|
|
|
BreakHandler *handler = m_breakHandler;
|
|
|
|
|
BreakpointId id =
|
|
|
|
|
handler->findBreakpointByFileAndLine(fileName, lineNumber, true);
|
|
|
|
|
if (!id)
|
|
|
|
|
id = handler->findBreakpointByFileAndLine(fileName, lineNumber, false);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (id) {
|
|
|
|
|
handler->removeBreakpoint(id);
|
|
|
|
|
} else {
|
|
|
|
|
BreakpointParameters data(BreakpointByFileAndLine);
|
|
|
|
|
data.fileName = fileName;
|
|
|
|
|
data.lineNumber = lineNumber;
|
|
|
|
|
handler->appendBreakpoint(data);
|
|
|
|
|
}
|
|
|
|
|
synchronizeBreakpoints();
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::toggleBreakpointByAddress(quint64 address)
|
|
|
|
|
{
|
|
|
|
|
BreakHandler *handler = m_breakHandler;
|
|
|
|
|
BreakpointId id = handler->findBreakpointByAddress(address);
|
2010-11-12 20:18:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (id) {
|
|
|
|
|
handler->removeBreakpoint(id);
|
|
|
|
|
} else {
|
|
|
|
|
BreakpointParameters data(BreakpointByAddress);
|
|
|
|
|
data.address = address;
|
|
|
|
|
handler->appendBreakpoint(data);
|
|
|
|
|
}
|
|
|
|
|
synchronizeBreakpoints();
|
|
|
|
|
}
|
2010-11-09 10:23:10 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::requestMark(ITextEditor *editor, int lineNumber)
|
|
|
|
|
{
|
|
|
|
|
if (editor->property("DisassemblerView").toBool()) {
|
|
|
|
|
QString line = editor->contents()
|
|
|
|
|
.section('\n', lineNumber - 1, lineNumber - 1);
|
2010-12-14 12:29:32 +01:00
|
|
|
quint64 address = DisassemblerAgent::addressFromDisassemblyLine(line);
|
2010-12-02 13:20:06 +01:00
|
|
|
toggleBreakpointByAddress(address);
|
|
|
|
|
} else if (editor->file()) {
|
|
|
|
|
toggleBreakpointByFileAndLine(editor->file()->fileName(), lineNumber);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::showToolTip(ITextEditor *editor,
|
2011-01-04 13:58:05 +01:00
|
|
|
const QPoint &point, int pos, bool *handled)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
|
|
|
|
if (!isDebuggable(editor))
|
|
|
|
|
return;
|
|
|
|
|
if (!boolSetting(UseToolTipsInMainEditor))
|
|
|
|
|
return;
|
2011-01-04 16:05:53 +01:00
|
|
|
if (!currentEngine())
|
|
|
|
|
return;
|
|
|
|
|
if (currentEngine()->state() != InferiorStopOk)
|
2010-12-02 13:20:06 +01:00
|
|
|
return;
|
2011-01-04 13:58:05 +01:00
|
|
|
QTC_ASSERT(handled, return);
|
|
|
|
|
*handled = true;
|
2010-12-02 13:20:06 +01:00
|
|
|
currentEngine()->setToolTipExpression(point, editor, pos);
|
|
|
|
|
}
|
2010-11-09 10:23:10 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
DebuggerRunControl *DebuggerPluginPrivate::createDebugger
|
|
|
|
|
(const DebuggerStartParameters &sp, RunConfiguration *rc)
|
|
|
|
|
{
|
|
|
|
|
return m_debuggerRunControlFactory->create(sp, rc);
|
|
|
|
|
}
|
2010-11-09 10:23:10 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// If updateEngine is set, the engine will update its threads/modules and so forth.
|
|
|
|
|
void DebuggerPluginPrivate::displayDebugger(DebuggerEngine *engine, bool updateEngine)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(engine, return);
|
|
|
|
|
disconnectEngine();
|
|
|
|
|
connectEngine(engine);
|
|
|
|
|
if (updateEngine)
|
|
|
|
|
engine->updateAll();
|
|
|
|
|
engine->updateViews();
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::startDebugger(RunControl *rc)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(rc, return);
|
|
|
|
|
ProjectExplorerPlugin::instance()->startRunControl(rc, Constants::DEBUGMODE);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-19 16:13:22 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine)
|
|
|
|
|
{
|
|
|
|
|
if (!engine)
|
|
|
|
|
engine = dummyEngine();
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (m_currentEngine == engine)
|
|
|
|
|
return;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-14 12:21:29 +01:00
|
|
|
if (m_currentEngine)
|
|
|
|
|
m_currentEngine->resetLocation();
|
2010-12-02 13:20:06 +01:00
|
|
|
m_currentEngine = engine;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
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());
|
|
|
|
|
}
|
2010-11-12 20:18:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
static void changeFontSize(QWidget *widget, qreal size)
|
|
|
|
|
{
|
|
|
|
|
QFont font = widget->font();
|
|
|
|
|
font.setPointSizeF(size);
|
|
|
|
|
widget->setFont(font);
|
|
|
|
|
}
|
2009-06-04 16:06:12 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::fontSettingsChanged
|
|
|
|
|
(const TextEditor::FontSettings &settings)
|
|
|
|
|
{
|
|
|
|
|
qreal size = settings.fontZoom() * settings.fontSize() / 100.;
|
|
|
|
|
changeFontSize(m_breakWindow, size);
|
|
|
|
|
changeFontSize(m_logWindow, size);
|
|
|
|
|
changeFontSize(m_localsWindow, size);
|
|
|
|
|
changeFontSize(m_modulesWindow, size);
|
|
|
|
|
//changeFontSize(m_consoleWindow, size);
|
|
|
|
|
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-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::cleanupViews()
|
|
|
|
|
{
|
|
|
|
|
m_actions.reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(false);
|
|
|
|
|
hideDebuggerToolTip();
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (!boolSetting(CloseBuffersOnExit))
|
|
|
|
|
return;
|
2009-03-02 15:14:12 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
EditorManager *editorManager = EditorManager::instance();
|
|
|
|
|
QTC_ASSERT(editorManager, return);
|
|
|
|
|
QList<IEditor *> toClose;
|
|
|
|
|
foreach (IEditor *editor, editorManager->openedEditors()) {
|
|
|
|
|
if (editor->property(Constants::OPENED_BY_DEBUGGER).toBool()) {
|
|
|
|
|
// Close disassembly views. Close other opened files
|
|
|
|
|
// if they are not modified and not current editor.
|
|
|
|
|
if (editor->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()
|
|
|
|
|
|| (!editor->file()->isModified()
|
|
|
|
|
&& editor != editorManager->currentEditor())) {
|
|
|
|
|
toClose.append(editor);
|
|
|
|
|
} else {
|
|
|
|
|
editor->setProperty(Constants::OPENED_BY_DEBUGGER, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
editorManager->closeEditors(toClose);
|
|
|
|
|
}
|
2010-05-05 12:41:52 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::setBusyCursor(bool busy)
|
|
|
|
|
{
|
|
|
|
|
//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);
|
|
|
|
|
//m_consoleWindow->setCursor(cursor);
|
|
|
|
|
m_localsWindow->setCursor(cursor);
|
|
|
|
|
m_modulesWindow->setCursor(cursor);
|
|
|
|
|
m_logWindow->setCursor(cursor);
|
|
|
|
|
m_registerWindow->setCursor(cursor);
|
|
|
|
|
m_returnWindow->setCursor(cursor);
|
|
|
|
|
m_sourceFilesWindow->setCursor(cursor);
|
|
|
|
|
m_stackWindow->setCursor(cursor);
|
|
|
|
|
m_threadsWindow->setCursor(cursor);
|
|
|
|
|
m_watchersWindow->setCursor(cursor);
|
|
|
|
|
m_snapshotWindow->setCursor(cursor);
|
|
|
|
|
m_scriptConsoleWindow->setCursor(cursor);
|
|
|
|
|
}
|
2009-05-07 17:11:19 +02:00
|
|
|
|
2010-12-02 13:20:06 +01: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();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2010-07-22 10:23:27 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_actions.watchAction1->setEnabled(true);
|
|
|
|
|
m_actions.watchAction2->setEnabled(true);
|
|
|
|
|
m_actions.breakAction->setEnabled(true);
|
|
|
|
|
//m_actions.snapshotAction->setEnabled(false);
|
|
|
|
|
action(OperateByInstruction)->setEnabled(false);
|
2010-10-05 12:47:23 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_actions.exitAction->setEnabled(false);
|
|
|
|
|
m_actions.resetAction->setEnabled(false);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_actions.stepAction->setEnabled(false);
|
|
|
|
|
m_actions.stepOutAction->setEnabled(false);
|
|
|
|
|
m_actions.runToLineAction->setEnabled(false);
|
|
|
|
|
m_actions.runToFunctionAction->setEnabled(false);
|
|
|
|
|
m_actions.returnFromFunctionAction->setEnabled(false);
|
|
|
|
|
m_actions.jumpToLineAction->setEnabled(false);
|
|
|
|
|
m_actions.nextAction->setEnabled(false);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
action(AutoDerefPointers)->setEnabled(true);
|
|
|
|
|
action(ExpandStack)->setEnabled(false);
|
2011-01-04 16:05:53 +01:00
|
|
|
action(ExecuteCommand)->setEnabled(false);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_scriptConsoleWindow->setEnabled(false);
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::updateWatchersWindow()
|
|
|
|
|
{
|
|
|
|
|
m_watchersWindow->setVisible(
|
|
|
|
|
m_watchersWindow->model()->rowCount(QModelIndex()) > 0);
|
|
|
|
|
m_returnWindow->setVisible(
|
|
|
|
|
m_returnWindow->model()->rowCount(QModelIndex()) > 0);
|
|
|
|
|
}
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(engine, return);
|
|
|
|
|
QTC_ASSERT(m_watchersWindow->model(), return);
|
|
|
|
|
QTC_ASSERT(m_returnWindow->model(), return);
|
|
|
|
|
QTC_ASSERT(!engine->isSlaveEngine(), return);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_threadBox->setCurrentIndex(engine->threadsHandler()->currentThread());
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
updateWatchersWindow();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-01-04 16:05:53 +01:00
|
|
|
const DebuggerState state = engine->state();
|
|
|
|
|
//showMessage(QString("PLUGIN SET STATE: ")
|
|
|
|
|
// + DebuggerEngine::stateName(state), LogStatus);
|
|
|
|
|
//qDebug() << "PLUGIN SET STATE: " << state;
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2011-01-04 16:05:53 +01:00
|
|
|
static DebuggerState previousState = DebuggerNotReady;
|
|
|
|
|
if (state == previousState)
|
2010-12-02 13:20:06 +01:00
|
|
|
return;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-01-04 16:05:53 +01:00
|
|
|
bool actionsEnabled = DebuggerEngine::debuggerActionsEnabled(state);
|
2010-12-02 13:20:06 +01:00
|
|
|
|
|
|
|
|
ICore *core = ICore::instance();
|
|
|
|
|
ActionManager *am = core->actionManager();
|
2011-01-04 16:05:53 +01:00
|
|
|
if (state == DebuggerNotReady) {
|
2010-12-02 13:20:06 +01:00
|
|
|
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.exitAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
|
|
|
|
am->command(Constants::DEBUG)->setKeySequence(QKeySequence(DEBUG_KEY));
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, Context());
|
2011-01-04 16:05:53 +01:00
|
|
|
} else if (state == InferiorStopOk) {
|
2010-12-02 13:20:06 +01:00
|
|
|
// F5 continues, Shift-F5 kills. It is "continuable".
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(true);
|
|
|
|
|
m_actions.exitAction->setEnabled(true);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence(STOP_KEY));
|
|
|
|
|
am->command(Constants::DEBUG)->setKeySequence(QKeySequence(DEBUG_KEY));
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, m_continuableContext);
|
2011-01-04 16:05:53 +01:00
|
|
|
} else if (state == InferiorRunOk) {
|
2010-12-02 13:20:06 +01:00
|
|
|
// Shift-F5 interrupts. It is also "interruptible".
|
|
|
|
|
m_actions.interruptAction->setEnabled(true);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.exitAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
|
|
|
|
am->command(Constants::DEBUG)->setKeySequence(QKeySequence(STOP_KEY));
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, m_interruptibleContext);
|
2011-01-04 16:05:53 +01:00
|
|
|
} else if (state == DebuggerFinished) {
|
2010-12-02 13:20:06 +01:00
|
|
|
// We don't want to do anything anymore.
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.exitAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
|
|
|
|
am->command(Constants::DEBUG)->setKeySequence(QKeySequence(DEBUG_KEY));
|
|
|
|
|
//core->updateAdditionalContexts(m_anyContext, m_finishedContext);
|
|
|
|
|
m_codeModelSnapshot = CPlusPlus::Snapshot();
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, Context());
|
|
|
|
|
setBusyCursor(false);
|
|
|
|
|
cleanupViews();
|
2011-01-04 16:05:53 +01:00
|
|
|
} else if (state == InferiorUnrunnable) {
|
2010-12-02 13:20:06 +01:00
|
|
|
// We don't want to do anything anymore.
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.exitAction->setEnabled(true);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence(STOP_KEY));
|
|
|
|
|
am->command(Constants::DEBUG)->setKeySequence(QKeySequence(STOP_KEY));
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, m_finishedContext);
|
|
|
|
|
} else {
|
|
|
|
|
// Everything else is "undisturbable".
|
|
|
|
|
m_actions.interruptAction->setEnabled(false);
|
|
|
|
|
m_actions.continueAction->setEnabled(false);
|
|
|
|
|
m_actions.exitAction->setEnabled(false);
|
|
|
|
|
am->command(Constants::STOP)->setKeySequence(QKeySequence());
|
|
|
|
|
am->command(Constants::DEBUG)->setKeySequence(QKeySequence());
|
|
|
|
|
core->updateAdditionalContexts(m_anyContext, m_undisturbableContext);
|
|
|
|
|
}
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
const bool isCore = engine->startParameters().startMode == AttachCore;
|
2011-01-04 16:05:53 +01:00
|
|
|
const bool stopped = state == InferiorStopOk;
|
2010-12-02 13:20:06 +01:00
|
|
|
const bool detachable = stopped && !isCore;
|
|
|
|
|
m_detachAction->setEnabled(detachable);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (stopped)
|
|
|
|
|
QApplication::alert(mainWindow(), 3000);
|
2010-02-15 16:02:41 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
const uint caps = engine->debuggerCapabilities();
|
|
|
|
|
const bool canReverse = (caps & ReverseSteppingCapability)
|
|
|
|
|
&& boolSetting(EnableReverseDebugging);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(canReverse);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_actions.watchAction1->setEnabled(true);
|
|
|
|
|
m_actions.watchAction2->setEnabled(true);
|
|
|
|
|
m_actions.breakAction->setEnabled(true);
|
|
|
|
|
//m_actions.snapshotAction->setEnabled(stopped && (caps & SnapshotCapability));
|
2009-05-25 17:19:42 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
action(OperateByInstruction)->setEnabled(stopped || isCore);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2011-01-04 16:05:53 +01:00
|
|
|
m_actions.resetAction->setEnabled(state != DebuggerNotReady
|
|
|
|
|
&& state != DebuggerFinished);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_actions.stepAction->setEnabled(stopped);
|
|
|
|
|
m_actions.stepOutAction->setEnabled(stopped);
|
|
|
|
|
m_actions.runToLineAction->setEnabled(stopped);
|
|
|
|
|
m_actions.runToFunctionAction->setEnabled(stopped);
|
|
|
|
|
m_actions.returnFromFunctionAction->
|
|
|
|
|
setEnabled(stopped && (caps & ReturnFromFunctionCapability));
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
const bool canJump = stopped && (caps & JumpToLineCapability);
|
|
|
|
|
m_actions.jumpToLineAction->setEnabled(canJump);
|
2010-06-07 13:17:19 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_actions.nextAction->setEnabled(stopped);
|
2010-02-02 17:25:14 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
const bool canDeref = actionsEnabled && (caps & AutoDerefPointersCapability);
|
|
|
|
|
action(AutoDerefPointers)->setEnabled(canDeref);
|
|
|
|
|
action(AutoDerefPointers)->setEnabled(true);
|
|
|
|
|
action(ExpandStack)->setEnabled(actionsEnabled);
|
2011-01-04 16:05:53 +01:00
|
|
|
action(ExecuteCommand)->setEnabled(state == InferiorStopOk);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2011-01-04 16:05:53 +01:00
|
|
|
const bool notbusy = state == InferiorStopOk
|
|
|
|
|
|| state == DebuggerNotReady
|
|
|
|
|
|| state == DebuggerFinished
|
|
|
|
|
|| state == InferiorUnrunnable;
|
2010-12-02 13:20:06 +01:00
|
|
|
setBusyCursor(!notbusy);
|
2009-09-29 11:13:19 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_scriptConsoleWindow->setEnabled(stopped);
|
|
|
|
|
}
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::updateDebugActions()
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
Project *project = pe->startupProject();
|
|
|
|
|
m_debugAction->setEnabled(pe->canRun(project, Constants::DEBUGMODE));
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::onModeChanged(IMode *mode)
|
|
|
|
|
{
|
|
|
|
|
// 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.
|
2009-12-11 18:19:51 +01:00
|
|
|
|
2010-12-02 17:33:39 +01:00
|
|
|
m_mainWindow->onModeChanged(mode);
|
2010-02-08 09:13:21 +01:00
|
|
|
|
2010-12-08 18:19:49 +01:00
|
|
|
if (mode->id() != Constants::MODE_DEBUG)
|
2010-12-02 13:20:06 +01:00
|
|
|
return;
|
2010-02-08 09:13:21 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
EditorManager *editorManager = EditorManager::instance();
|
|
|
|
|
if (editorManager->currentEditor())
|
|
|
|
|
editorManager->currentEditor()->widget()->setFocus();
|
|
|
|
|
}
|
2010-11-26 15:10:10 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::showSettingsDialog()
|
|
|
|
|
{
|
|
|
|
|
ICore::instance()->showOptionsDialog(
|
|
|
|
|
_(DEBUGGER_SETTINGS_CATEGORY),
|
|
|
|
|
_(DEBUGGER_COMMON_SETTINGS_ID));
|
|
|
|
|
}
|
2010-04-06 16:42:24 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::dumpLog()
|
|
|
|
|
{
|
|
|
|
|
QString fileName = QFileDialog::getSaveFileName(mainWindow(),
|
|
|
|
|
tr("Save Debugger Log"), QDir::tempPath());
|
|
|
|
|
if (fileName.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
QFile file(fileName);
|
|
|
|
|
if (!file.open(QIODevice::WriteOnly))
|
|
|
|
|
return;
|
|
|
|
|
QTextStream ts(&file);
|
|
|
|
|
ts << m_logWindow->inputContents();
|
|
|
|
|
ts << "\n\n=======================================\n\n";
|
|
|
|
|
ts << m_logWindow->combinedContents();
|
|
|
|
|
}
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::clearStatusMessage()
|
|
|
|
|
{
|
|
|
|
|
m_statusLabel->setText(m_lastPermanentStatusMessage);
|
|
|
|
|
}
|
2010-03-10 13:46:05 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
/*! Activates the previous mode when the current mode is the debug mode. */
|
|
|
|
|
void DebuggerPluginPrivate::activatePreviousMode()
|
|
|
|
|
{
|
|
|
|
|
ModeManager *modeManager = ICore::instance()->modeManager();
|
2010-03-10 13:46:05 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (modeManager->currentMode() == modeManager->mode(MODE_DEBUG)
|
|
|
|
|
&& !m_previousMode.isEmpty()) {
|
|
|
|
|
modeManager->activateMode(m_previousMode);
|
|
|
|
|
m_previousMode.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::activateDebugMode()
|
|
|
|
|
{
|
|
|
|
|
m_actions.reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_actions.reverseDirectionAction->setEnabled(false);
|
|
|
|
|
ModeManager *modeManager = ModeManager::instance();
|
|
|
|
|
m_previousMode = modeManager->currentMode()->id();
|
|
|
|
|
modeManager->activateMode(_(MODE_DEBUG));
|
|
|
|
|
}
|
2010-02-12 14:15:20 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::sessionLoaded()
|
|
|
|
|
{
|
|
|
|
|
m_breakHandler->loadSessionData();
|
|
|
|
|
dummyEngine()->watchHandler()->loadSessionData();
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::aboutToUnloadSession()
|
|
|
|
|
{
|
|
|
|
|
m_breakHandler->removeSessionData();
|
|
|
|
|
// Stop debugging the active project when switching sessions.
|
|
|
|
|
// Note that at startup, session switches may occur, which interfere
|
|
|
|
|
// with command-line debugging startup.
|
|
|
|
|
// FIXME ABC: Still wanted? Iterate?
|
|
|
|
|
//if (d->m_engine && state() != DebuggerNotReady
|
2010-12-10 10:01:29 +01:00
|
|
|
// && engine()->sp().startMode == StartInternal)
|
2010-12-02 13:20:06 +01:00
|
|
|
// d->m_engine->shutdown();
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::aboutToSaveSession()
|
|
|
|
|
{
|
|
|
|
|
dummyEngine()->watchHandler()->loadSessionData();
|
|
|
|
|
m_breakHandler->saveSessionData();
|
|
|
|
|
}
|
2009-02-27 11:41:19 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::executeDebuggerCommand()
|
|
|
|
|
{
|
|
|
|
|
if (QAction *action = qobject_cast<QAction *>(sender()))
|
|
|
|
|
currentEngine()->executeDebuggerCommand(action->data().toString());
|
|
|
|
|
}
|
2010-03-10 13:46:05 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
|
|
|
|
|
{
|
|
|
|
|
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-03-11 11:07:16 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::scriptExpressionEntered(const QString &expression)
|
|
|
|
|
{
|
|
|
|
|
currentEngine()->executeDebuggerCommand(expression);
|
|
|
|
|
}
|
2010-03-11 11:07:16 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::openMemoryEditor()
|
|
|
|
|
{
|
|
|
|
|
AddressDialog dialog;
|
|
|
|
|
if (dialog.exec() == QDialog::Accepted)
|
2010-12-08 12:43:11 +01:00
|
|
|
currentEngine()->openMemoryView(dialog.address());
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::coreShutdown()
|
|
|
|
|
{
|
|
|
|
|
m_shuttingDown = true;
|
|
|
|
|
}
|
2010-03-10 13:46:05 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
|
|
|
|
|
{
|
|
|
|
|
if (m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked())
|
2010-12-03 13:49:35 +01:00
|
|
|
m_codeModelSnapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
|
2010-12-02 13:20:06 +01:00
|
|
|
return m_codeModelSnapshot;
|
|
|
|
|
}
|
2010-03-11 11:07:16 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::setSessionValue(const QString &name, const QVariant &value)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(sessionManager(), return);
|
|
|
|
|
sessionManager()->setValue(name, value);
|
|
|
|
|
//qDebug() << "SET SESSION VALUE: " << name;
|
|
|
|
|
}
|
2010-11-23 16:42:46 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QVariant DebuggerPluginPrivate::sessionValue(const QString &name)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(sessionManager(), return QVariant());
|
|
|
|
|
//qDebug() << "GET SESSION VALUE: " << name;
|
|
|
|
|
return sessionManager()->value(name);
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
|
|
|
|
|
const QString &contents)
|
2010-09-27 12:23:34 +02:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
if (m_shuttingDown)
|
|
|
|
|
return;
|
|
|
|
|
QString titlePattern = titlePattern0;
|
|
|
|
|
EditorManager *editorManager = EditorManager::instance();
|
|
|
|
|
QTC_ASSERT(editorManager, return);
|
|
|
|
|
IEditor *editor = editorManager->openEditorWithContents(
|
|
|
|
|
CC::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents);
|
|
|
|
|
QTC_ASSERT(editor, return);
|
|
|
|
|
editorManager->activateEditor(editor, EditorManager::IgnoreNavigationHistory);
|
2010-09-27 12:23:34 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::clearCppCodeModelSnapshot()
|
2010-09-27 12:23:34 +02:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
m_codeModelSnapshot = CPlusPlus::Snapshot();
|
2010-09-27 12:23:34 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int timeout)
|
2010-07-21 17:06:22 +02:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
//qDebug() << "PLUGIN OUTPUT: " << channel << msg;
|
|
|
|
|
//ConsoleWindow *cw = m_consoleWindow;
|
|
|
|
|
QTC_ASSERT(m_logWindow, return);
|
|
|
|
|
switch (channel) {
|
|
|
|
|
case StatusBar:
|
|
|
|
|
// This will append to m_logWindow's output pane, too.
|
|
|
|
|
showStatusMessage(msg, timeout);
|
|
|
|
|
break;
|
|
|
|
|
case LogMiscInput:
|
|
|
|
|
m_logWindow->showInput(LogMisc, msg);
|
|
|
|
|
m_logWindow->showOutput(LogMisc, msg);
|
|
|
|
|
break;
|
|
|
|
|
case LogInput:
|
|
|
|
|
m_logWindow->showInput(LogInput, msg);
|
|
|
|
|
m_logWindow->showOutput(LogInput, msg);
|
|
|
|
|
break;
|
|
|
|
|
case ScriptConsoleOutput:
|
|
|
|
|
m_scriptConsoleWindow->appendResult(msg);
|
|
|
|
|
break;
|
2010-12-03 15:03:51 +01:00
|
|
|
case LogError: {
|
2010-12-02 13:20:06 +01:00
|
|
|
m_logWindow->showOutput(channel, msg);
|
2010-12-03 15:03:51 +01:00
|
|
|
QAction *action = m_mainWindow->dockWidget(_(DOCKWIDGET_OUTPUT))
|
|
|
|
|
->toggleViewAction();
|
|
|
|
|
if (!action->isChecked())
|
|
|
|
|
action->trigger();
|
2010-12-02 13:20:06 +01:00
|
|
|
break;
|
2010-12-03 15:03:51 +01:00
|
|
|
}
|
2010-12-02 13:20:06 +01:00
|
|
|
default:
|
|
|
|
|
m_logWindow->showOutput(channel, msg);
|
|
|
|
|
break;
|
2010-07-21 17:06:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::showQtDumperLibraryWarning(const QString &details)
|
2010-11-12 20:18:29 +01:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
QMessageBox dialog(mainWindow());
|
|
|
|
|
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"),
|
|
|
|
|
QMessageBox::ActionRole);
|
|
|
|
|
QPushButton *helperOff = dialog.addButton(tr("Turn off Helper Usage"),
|
|
|
|
|
QMessageBox::ActionRole);
|
|
|
|
|
QPushButton *justContinue = dialog.addButton(tr("Continue Anyway"),
|
|
|
|
|
QMessageBox::AcceptRole);
|
|
|
|
|
dialog.setDefaultButton(justContinue);
|
|
|
|
|
dialog.setWindowTitle(tr("Debugging Helper Missing"));
|
|
|
|
|
dialog.setText(tr("The debugger could not load the debugging helper library."));
|
|
|
|
|
dialog.setInformativeText(tr(
|
|
|
|
|
"The debugging helper is used to nicely format the values of some Qt "
|
|
|
|
|
"and Standard Library data types. "
|
|
|
|
|
"It must be compiled for each used Qt version separately. "
|
|
|
|
|
"On the Qt4 options page, select a Qt installation "
|
|
|
|
|
"and click Rebuild."));
|
|
|
|
|
if (!details.isEmpty())
|
|
|
|
|
dialog.setDetailedText(details);
|
|
|
|
|
dialog.exec();
|
|
|
|
|
if (dialog.clickedButton() == qtPref) {
|
|
|
|
|
ICore::instance()->showOptionsDialog(
|
|
|
|
|
_(Qt4ProjectManager::Constants::QT_SETTINGS_CATEGORY),
|
|
|
|
|
_(Qt4ProjectManager::Constants::QTVERSION_SETTINGS_PAGE_ID));
|
|
|
|
|
} else if (dialog.clickedButton() == helperOff) {
|
|
|
|
|
action(UseDebuggingHelpers)->setValue(qVariantFromValue(false), false);
|
|
|
|
|
}
|
2010-11-23 13:28:18 +01:00
|
|
|
}
|
2010-11-12 20:18:29 +01:00
|
|
|
|
2010-12-03 15:55:17 +01:00
|
|
|
void DebuggerPluginPrivate::createNewDock(QWidget *widget)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
|
|
|
|
QDockWidget *dockWidget =
|
2010-12-03 15:55:17 +01:00
|
|
|
m_mainWindow->createDockWidget(CppLanguage, widget);
|
2010-12-02 13:20:06 +01:00
|
|
|
dockWidget->setWindowTitle(widget->windowTitle());
|
|
|
|
|
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
|
|
|
|
|
dockWidget->show();
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-10 10:01:29 +01:00
|
|
|
void DebuggerPluginPrivate::runControlStarted(DebuggerEngine *engine)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
|
|
|
|
activateDebugMode();
|
2010-12-10 09:37:31 +01:00
|
|
|
const QString message = tr("Starting debugger '%1' for tool chain '%2'...")
|
|
|
|
|
.arg(engine->objectName())
|
|
|
|
|
.arg(engine->startParameters().toolChainName());
|
2010-12-02 13:20:06 +01:00
|
|
|
showMessage(message, StatusBar);
|
|
|
|
|
showMessage(m_debuggerSettings->dump(), LogDebug);
|
2010-12-10 10:01:29 +01:00
|
|
|
m_snapshotHandler->appendSnapshot(engine);
|
2010-12-10 09:37:31 +01:00
|
|
|
connectEngine(engine);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-10 10:01:29 +01:00
|
|
|
void DebuggerPluginPrivate::runControlFinished(DebuggerEngine *engine)
|
2010-04-06 17:58:11 +02:00
|
|
|
{
|
2010-12-10 10:01:29 +01:00
|
|
|
m_snapshotHandler->removeSnapshot(engine);
|
2010-12-02 13:20:06 +01:00
|
|
|
if (m_snapshotHandler->size() == 0) {
|
|
|
|
|
// Last engine quits.
|
|
|
|
|
disconnectEngine();
|
|
|
|
|
if (boolSetting(SwitchModeOnExit))
|
|
|
|
|
activatePreviousMode();
|
|
|
|
|
} else {
|
|
|
|
|
// Connect to some existing engine.
|
|
|
|
|
m_snapshotHandler->activateSnapshot(0);
|
|
|
|
|
}
|
2010-04-06 17:58:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::remoteCommand(const QStringList &options,
|
|
|
|
|
const QStringList &)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
if (options.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
unsigned enabledEngines = 0;
|
|
|
|
|
QString errorMessage;
|
|
|
|
|
|
|
|
|
|
if (!parseArguments(options,
|
|
|
|
|
&m_attachRemoteParameters, &enabledEngines, &errorMessage)) {
|
|
|
|
|
qWarning("%s", qPrintable(errorMessage));
|
2010-06-16 11:08:54 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2010-12-02 13:20:06 +01:00
|
|
|
|
|
|
|
|
if (!attachCmdLine())
|
|
|
|
|
qWarning("%s", qPrintable(
|
|
|
|
|
_("Incomplete remote attach command received: %1").
|
|
|
|
|
arg(options.join(QString(QLatin1Char(' '))))));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QString DebuggerPluginPrivate::gdbBinaryForToolChain(int toolChain) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
return GdbOptionsPage::gdbBinaryToolChainMap.key(toolChain);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
DebuggerLanguages DebuggerPluginPrivate::activeLanguages() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-12-06 08:43:29 +01:00
|
|
|
QTC_ASSERT(m_mainWindow, return AnyLanguage);
|
2010-12-02 17:33:39 +01:00
|
|
|
return m_mainWindow->activeDebugLanguages();
|
2010-07-15 10:44:53 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
bool DebuggerPluginPrivate::isReverseDebugging() const
|
2010-07-15 10:44:53 +02:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
return m_actions.reverseDirectionAction->isChecked();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QMessageBox *showMessageBox(int icon, const QString &title,
|
|
|
|
|
const QString &text, int buttons)
|
2010-11-19 16:13:22 +01:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon),
|
|
|
|
|
title, text, QMessageBox::StandardButtons(buttons),
|
|
|
|
|
debuggerCore()->mainWindow());
|
|
|
|
|
mb->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
|
mb->show();
|
|
|
|
|
return mb;
|
2010-11-19 16:13:22 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::extensionsInitialized()
|
2010-12-01 15:41:08 +01:00
|
|
|
{
|
2010-12-02 13:20:06 +01:00
|
|
|
ICore *core = ICore::instance();
|
|
|
|
|
QTC_ASSERT(core, return);
|
|
|
|
|
m_coreSettings = core->settings();
|
|
|
|
|
m_debuggerSettings = new DebuggerSettings(m_coreSettings);
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_continuableContext = Context("Gdb.Continuable");
|
|
|
|
|
m_interruptibleContext = Context("Gdb.Interruptible");
|
|
|
|
|
m_undisturbableContext = Context("Gdb.Undisturbable");
|
|
|
|
|
m_finishedContext = Context("Gdb.Finished");
|
|
|
|
|
m_anyContext.add(m_continuableContext);
|
|
|
|
|
m_anyContext.add(m_interruptibleContext);
|
|
|
|
|
m_anyContext.add(m_undisturbableContext);
|
|
|
|
|
m_anyContext.add(m_finishedContext);
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(core, SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown()));
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
Core::ActionManager *am = core->actionManager();
|
|
|
|
|
QTC_ASSERT(am, return);
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
const Context globalcontext(CC::C_GLOBAL);
|
|
|
|
|
const Context cppDebuggercontext(C_CPPDEBUGGER);
|
|
|
|
|
const Context qmlDebuggerContext(C_QMLDEBUGGER);
|
|
|
|
|
const Context cppeditorcontext(CppEditor::Constants::C_CPPEDITOR);
|
2010-05-12 16:48:04 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_startIcon = QIcon(_(":/debugger/images/debugger_start_small.png"));
|
|
|
|
|
m_startIcon.addFile(__(":/debugger/images/debugger_start.png"));
|
|
|
|
|
m_exitIcon = QIcon(_(":/debugger/images/debugger_stop_small.png"));
|
|
|
|
|
m_exitIcon.addFile(__(":/debugger/images/debugger_stop.png"));
|
|
|
|
|
m_continueIcon = QIcon(__(":/debugger/images/debugger_continue_small.png"));
|
|
|
|
|
m_continueIcon.addFile(__(":/debugger/images/debugger_continue.png"));
|
|
|
|
|
m_interruptIcon = QIcon(_(":/debugger/images/debugger_interrupt_small.png"));
|
|
|
|
|
m_interruptIcon.addFile(__(":/debugger/images/debugger_interrupt.png"));
|
|
|
|
|
m_locationMarkIcon = QIcon(_(":/debugger/images/location_16.png"));
|
|
|
|
|
|
|
|
|
|
m_busy = false;
|
|
|
|
|
|
|
|
|
|
m_statusLabel = new QLabel;
|
|
|
|
|
m_statusLabel->setMinimumSize(QSize(30, 10));
|
|
|
|
|
|
|
|
|
|
m_breakHandler = new BreakHandler;
|
|
|
|
|
m_breakWindow = new BreakWindow;
|
2010-12-03 15:55:17 +01:00
|
|
|
m_breakWindow->setObjectName(DOCKWIDGET_BREAK);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_breakWindow->setModel(m_breakHandler->model());
|
|
|
|
|
|
|
|
|
|
//m_consoleWindow = new ConsoleWindow;
|
|
|
|
|
//m_consoleWindow->setObjectName(QLatin1String("CppDebugConsole"));
|
|
|
|
|
m_modulesWindow = new ModulesWindow;
|
2010-12-03 15:55:17 +01:00
|
|
|
m_modulesWindow->setObjectName(DOCKWIDGET_MODULES);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_logWindow = new LogWindow;
|
2010-12-03 15:55:17 +01:00
|
|
|
m_logWindow->setObjectName(DOCKWIDGET_OUTPUT);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_registerWindow = new RegisterWindow;
|
2010-12-03 15:55:17 +01:00
|
|
|
m_registerWindow->setObjectName(DOCKWIDGET_REGISTER);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_stackWindow = new StackWindow;
|
2010-12-03 15:55:17 +01:00
|
|
|
m_stackWindow->setObjectName(DOCKWIDGET_STACK);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_sourceFilesWindow = new SourceFilesWindow;
|
2010-12-03 15:55:17 +01:00
|
|
|
m_sourceFilesWindow->setObjectName(DOCKWIDGET_SOURCE_FILES);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_threadsWindow = new ThreadsWindow;
|
2010-12-03 15:55:17 +01:00
|
|
|
m_threadsWindow->setObjectName(DOCKWIDGET_THREADS);
|
2010-12-02 13:20:06 +01:00
|
|
|
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_scriptConsoleWindow = new ScriptConsole;
|
|
|
|
|
m_scriptConsoleWindow->setWindowTitle(tr("QML Script Console"));
|
2010-12-03 15:55:17 +01:00
|
|
|
m_scriptConsoleWindow->setObjectName(DOCKWIDGET_QML_SCRIPTCONSOLE);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(m_scriptConsoleWindow, SIGNAL(expressionEntered(QString)),
|
|
|
|
|
SLOT(scriptExpressionEntered(QString)));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Snapshot
|
|
|
|
|
m_snapshotHandler = new SnapshotHandler;
|
|
|
|
|
m_snapshotWindow = new SnapshotWindow(m_snapshotHandler);
|
2010-12-03 15:55:17 +01:00
|
|
|
m_snapshotWindow->setObjectName(DOCKWIDGET_SNAPSHOTS);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_snapshotWindow->setModel(m_snapshotHandler->model());
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Watchers
|
|
|
|
|
connect(m_localsWindow->header(), SIGNAL(sectionResized(int,int,int)),
|
|
|
|
|
SLOT(updateWatchersHeader(int,int,int)), Qt::QueuedConnection);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QAction *act = 0;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.continueAction = new QAction(tr("Continue"), this);
|
|
|
|
|
act->setIcon(m_continueIcon);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecContinue()));
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.exitAction = new QAction(tr("Exit Debugger"), this);
|
|
|
|
|
act->setIcon(m_exitIcon);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecExit()));
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.interruptAction = new QAction(tr("Interrupt"), this);
|
|
|
|
|
act->setIcon(m_interruptIcon);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecInterrupt()));
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// A "disabled pause" seems to be a good choice.
|
|
|
|
|
act = m_actions.undisturbableAction = new QAction(tr("Debugger is Busy"), this);
|
|
|
|
|
act->setIcon(m_interruptIcon);
|
|
|
|
|
act->setEnabled(false);
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.resetAction = new QAction(tr("Abort Debugging"), this);
|
|
|
|
|
act->setToolTip(tr("Aborts debugging and "
|
|
|
|
|
"resets the debugger to the initial state."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecReset()));
|
2010-11-10 16:33:11 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.nextAction = new QAction(tr("Step Over"), this);
|
|
|
|
|
act->setIcon(QIcon(__(":/debugger/images/debugger_stepover_small.png")));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecNext()));
|
2009-04-28 15:08:52 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.stepAction = new QAction(tr("Step Into"), this);
|
|
|
|
|
act->setIcon(QIcon(__(":/debugger/images/debugger_stepinto_small.png")));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecStep()));
|
2010-11-24 18:36:17 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.stepOutAction = new QAction(tr("Step Out"), this);
|
|
|
|
|
act->setIcon(QIcon(__(":/debugger/images/debugger_stepout_small.png")));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecStepOut()));
|
2010-11-24 18:36:17 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.runToLineAction = new QAction(tr("Run to Line"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecRunToLine()));
|
2010-06-11 12:38:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.runToFunctionAction =
|
|
|
|
|
new QAction(tr("Run to Outermost Function"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecRunToFunction()));
|
2010-11-24 18:36:17 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.returnFromFunctionAction =
|
|
|
|
|
new QAction(tr("Immediately Return From Inner Function"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecReturn()));
|
|
|
|
|
|
|
|
|
|
act = m_actions.jumpToLineAction = new QAction(tr("Jump to Line"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecJumpToLine()));
|
|
|
|
|
|
|
|
|
|
act = m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this);
|
|
|
|
|
|
|
|
|
|
act = m_actions.watchAction1 = new QAction(tr("Add to Watch Window"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleAddToWatchWindow()));
|
|
|
|
|
|
|
|
|
|
act = m_actions.watchAction2 = new QAction(tr("Add to Watch Window"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleAddToWatchWindow()));
|
|
|
|
|
|
|
|
|
|
//m_actions.snapshotAction = new QAction(tr("Create Snapshot"), this);
|
|
|
|
|
//m_actions.snapshotAction->setProperty(Role, RequestCreateSnapshotRole);
|
|
|
|
|
//m_actions.snapshotAction->setIcon(
|
|
|
|
|
// QIcon(__(":/debugger/images/debugger_snapshot_small.png")));
|
|
|
|
|
|
|
|
|
|
act = m_actions.reverseDirectionAction =
|
|
|
|
|
new QAction(tr("Reverse Direction"), this);
|
|
|
|
|
act->setCheckable(true);
|
|
|
|
|
act->setChecked(false);
|
|
|
|
|
act->setCheckable(false);
|
|
|
|
|
act->setIcon(QIcon(__(":/debugger/images/debugger_reversemode_16.png")));
|
|
|
|
|
act->setIconVisibleInMenu(false);
|
2010-06-11 12:38:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.frameDownAction = new QAction(tr("Move to Called Frame"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleFrameDown()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_actions.frameUpAction = new QAction(tr("Move to Calling Frame"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleFrameUp()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(action(OperateByInstruction), SIGNAL(triggered(bool)),
|
|
|
|
|
SLOT(handleOperateByInstructionTriggered(bool)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(&m_statusTimer, SIGNAL(timeout()), SLOT(clearStatusMessage()));
|
2010-07-13 15:57:34 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(action(ExecuteCommand), SIGNAL(triggered()),
|
|
|
|
|
SLOT(executeDebuggerCommand()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 18:21:39 +01:00
|
|
|
ActionContainer *debugMenu =
|
|
|
|
|
am->actionContainer(ProjectExplorer::Constants::M_DEBUG);
|
2010-12-02 18:19:05 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Dock widgets
|
2010-12-03 15:03:51 +01:00
|
|
|
QDockWidget *dock = 0;
|
2010-12-03 15:55:17 +01:00
|
|
|
dock = m_mainWindow->createDockWidget(CppLanguage, m_modulesWindow);
|
2010-12-03 15:03:51 +01:00
|
|
|
connect(dock->toggleViewAction(), SIGNAL(toggled(bool)),
|
2010-12-02 13:20:06 +01:00
|
|
|
SLOT(modulesDockToggled(bool)), Qt::QueuedConnection);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-03 15:55:17 +01:00
|
|
|
dock = m_mainWindow->createDockWidget(CppLanguage, m_registerWindow);
|
2010-12-03 15:03:51 +01:00
|
|
|
connect(dock->toggleViewAction(), SIGNAL(toggled(bool)),
|
2010-12-02 13:20:06 +01:00
|
|
|
SLOT(registerDockToggled(bool)), Qt::QueuedConnection);
|
2009-05-25 16:22:11 +02:00
|
|
|
|
2010-12-03 15:55:17 +01:00
|
|
|
dock = m_mainWindow->createDockWidget(CppLanguage, m_sourceFilesWindow);
|
2010-12-03 15:03:51 +01:00
|
|
|
connect(dock->toggleViewAction(), SIGNAL(toggled(bool)),
|
2010-12-02 13:20:06 +01:00
|
|
|
SLOT(sourceFilesDockToggled(bool)), Qt::QueuedConnection);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-06 10:25:33 +01:00
|
|
|
dock = m_mainWindow->createDockWidget(AnyLanguage, m_logWindow);
|
|
|
|
|
dock->setProperty(DOCKWIDGET_DEFAULT_AREA, Qt::TopDockWidgetArea);
|
|
|
|
|
|
2010-12-03 15:55:17 +01:00
|
|
|
m_mainWindow->createDockWidget(CppLanguage, m_breakWindow);
|
|
|
|
|
//m_mainWindow->createDockWidget(CppLanguage, m_consoleWindow);
|
|
|
|
|
m_mainWindow->createDockWidget(CppLanguage, m_snapshotWindow);
|
|
|
|
|
m_mainWindow->createDockWidget(CppLanguage, m_stackWindow);
|
|
|
|
|
m_mainWindow->createDockWidget(CppLanguage, m_threadsWindow);
|
2010-12-06 10:25:33 +01:00
|
|
|
m_mainWindow->createDockWidget(QmlLanguage, m_scriptConsoleWindow);
|
2010-03-29 18:44:02 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QSplitter *localsAndWatchers = new Core::MiniSplitter(Qt::Vertical);
|
2010-12-03 15:55:17 +01:00
|
|
|
localsAndWatchers->setObjectName(DOCKWIDGET_WATCHERS);
|
2010-12-02 13:20:06 +01:00
|
|
|
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-06-16 11:08:54 +02:00
|
|
|
|
2010-12-06 10:25:33 +01:00
|
|
|
dock = m_mainWindow->createDockWidget(CppLanguage, localsAndWatchers);
|
|
|
|
|
dock->setProperty(DOCKWIDGET_DEFAULT_AREA, Qt::RightDockWidgetArea);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-06 08:43:29 +01:00
|
|
|
m_debuggerSettings->readSettings();
|
2010-12-06 08:25:29 +01:00
|
|
|
GdbOptionsPage::readGdbBinarySettings();
|
2010-12-06 08:04:43 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Register factory of DebuggerRunControl.
|
|
|
|
|
m_debuggerRunControlFactory = new DebuggerRunControlFactory
|
|
|
|
|
(m_plugin, DebuggerEngineType(m_cmdLineEnabledEngines));
|
|
|
|
|
m_plugin->addAutoReleasedObject(m_debuggerRunControlFactory);
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2010-12-06 08:04:43 +01:00
|
|
|
// The main "Start Debugging" action.
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_debugAction = new QAction(this);
|
|
|
|
|
QIcon debuggerIcon(":/projectexplorer/images/debugger_start_small.png");
|
|
|
|
|
debuggerIcon.addFile(":/projectexplorer/images/debugger_start.png");
|
|
|
|
|
act->setIcon(debuggerIcon);
|
|
|
|
|
act->setText(tr("Start Debugging"));
|
|
|
|
|
connect(act, SIGNAL(triggered()), this, SLOT(debugProject()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Handling of external applications.
|
|
|
|
|
act = m_startExternalAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Start and Debug External Application..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(startExternalApplication()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_startRemoteLldbAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Start and Debug External Application with External Engine..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(startRemoteEngine()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_attachExternalAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Attach to Running External Application..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachExternalApplication()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_attachCoreAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Attach to Core..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachCore()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_attachTcfAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Attach to Running Tcf Agent..."));
|
|
|
|
|
act->setToolTip(tr("This attaches to a running "
|
|
|
|
|
"'Target Communication Framework' agent."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachRemoteTcf()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_startRemoteAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Start and Attach to Remote Application..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(startRemoteApplication()));
|
2010-09-24 16:55:22 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
m_startRemoteCdbAction = new QAction(tr("Attach to Remote CDB Session..."), this);
|
|
|
|
|
connect(m_startRemoteCdbAction, SIGNAL(triggered()), SLOT(startRemoteCdbSession()));
|
|
|
|
|
#endif
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
act = m_detachAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Detach Debugger"));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecDetach()));
|
2010-11-23 13:28:18 +01:00
|
|
|
|
2010-12-02 18:19:05 +01:00
|
|
|
Command *cmd = 0;
|
|
|
|
|
ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING);
|
2010-08-24 16:22:21 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_debugAction, Constants::DEBUG, globalcontext);
|
|
|
|
|
cmd->setAttribute(Core::Command::CA_UpdateText);
|
|
|
|
|
cmd->setAttribute(Core::Command::CA_UpdateIcon);
|
|
|
|
|
cmd->setDefaultText(tr("Start Debugging"));
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::DEBUG_KEY));
|
|
|
|
|
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
|
|
|
|
Core::ICore::instance()->modeManager()->addAction(cmd, Constants::P_ACTION_DEBUG);
|
2010-06-23 14:11:52 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.continueAction,
|
|
|
|
|
Constants::DEBUG, m_continuableContext);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-10-28 08:55:50 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_startExternalAction,
|
|
|
|
|
Constants::STARTEXTERNAL, globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-06-23 14:11:52 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_startRemoteLldbAction,
|
|
|
|
|
Constants::STARTREMOTELLDB, globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_attachExternalAction,
|
|
|
|
|
Constants::ATTACHEXTERNAL, globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2009-09-24 10:08:17 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_attachCoreAction,
|
|
|
|
|
Constants::ATTACHCORE, globalcontext);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_attachTcfAction,
|
|
|
|
|
Constants::ATTACHTCF, globalcontext);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_startRemoteAction,
|
|
|
|
|
Constants::ATTACHREMOTE, globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-10-05 12:47:23 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (m_startRemoteCdbAction) {
|
|
|
|
|
cmd = am->registerAction(m_startRemoteCdbAction,
|
|
|
|
|
Constants::ATTACHREMOTECDB, globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_detachAction,
|
|
|
|
|
Constants::DETACH, globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.exitAction,
|
|
|
|
|
Constants::STOP, globalcontext);
|
|
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(Constants::STOP_KEY));
|
|
|
|
|
cmd->setDefaultText(tr("Stop Debugger"));
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.interruptAction,
|
|
|
|
|
Constants::DEBUG, m_interruptibleContext);
|
|
|
|
|
cmd->setDefaultText(tr("Interrupt Debugger"));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.undisturbableAction,
|
|
|
|
|
Constants::DEBUG, m_undisturbableContext);
|
|
|
|
|
cmd->setDefaultText(tr("Debugger is Busy"));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.resetAction,
|
|
|
|
|
Constants::RESET, globalcontext);
|
|
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(Constants::RESET_KEY));
|
|
|
|
|
cmd->setDefaultText(tr("Reset Debugger"));
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QAction *sep = new QAction(this);
|
|
|
|
|
sep->setSeparator(true);
|
|
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Step"), globalcontext);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.nextAction,
|
|
|
|
|
Constants::NEXT, cppDebuggercontext);
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY));
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-09-24 16:55:22 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.stepAction,
|
|
|
|
|
Constants::STEP, cppDebuggercontext);
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY));
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-11-12 20:18:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.stepOutAction,
|
|
|
|
|
Constants::STEPOUT, cppDebuggercontext);
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY));
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-11-23 16:42:46 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.runToLineAction,
|
|
|
|
|
Constants::RUN_TO_LINE1, cppDebuggercontext);
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY));
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-05-25 18:21:31 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.runToFunctionAction,
|
|
|
|
|
Constants::RUN_TO_FUNCTION, cppDebuggercontext);
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY));
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.jumpToLineAction,
|
|
|
|
|
Constants::JUMP_TO_LINE1, cppDebuggercontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-02-27 11:41:19 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.returnFromFunctionAction,
|
|
|
|
|
Constants::RETURN_FROM_FUNCTION, cppDebuggercontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-06-16 13:44:45 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.reverseDirectionAction,
|
|
|
|
|
Constants::REVERSE, cppDebuggercontext);
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY));
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-05-05 17:48:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
sep = new QAction(this);
|
|
|
|
|
sep->setSeparator(true);
|
|
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Break"), globalcontext);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-05-05 17:48:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
//cmd = am->registerAction(m_actions.snapshotAction,
|
|
|
|
|
// Constants::SNAPSHOT, cppDebuggercontext);
|
|
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(Constants::SNAPSHOT_KEY));
|
|
|
|
|
//cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
//debugMenu->addAction(cmd);
|
2009-09-30 12:27:03 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.frameDownAction,
|
|
|
|
|
Constants::FRAME_DOWN, cppDebuggercontext);
|
|
|
|
|
cmd = am->registerAction(m_actions.frameUpAction,
|
|
|
|
|
Constants::FRAME_UP, cppDebuggercontext);
|
2009-05-05 17:48:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(action(OperateByInstruction),
|
|
|
|
|
Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-08-26 16:02:41 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.breakAction,
|
|
|
|
|
Constants::TOGGLE_BREAK, globalcontext);
|
|
|
|
|
cmd->setDefaultKeySequence(QKeySequence(Constants::TOGGLE_BREAK_KEY));
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(m_actions.breakAction, SIGNAL(triggered()),
|
|
|
|
|
SLOT(toggleBreakpoint()));
|
2010-08-26 16:02:41 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
sep = new QAction(this);
|
|
|
|
|
sep->setSeparator(true);
|
|
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Watch"), globalcontext);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.watchAction1,
|
|
|
|
|
Constants::ADD_TO_WATCH1, cppeditorcontext);
|
|
|
|
|
cmd->action()->setEnabled(true);
|
|
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+W")));
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-10 12:38:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Editor context menu
|
|
|
|
|
ActionContainer *editorContextMenu =
|
|
|
|
|
am->actionContainer(CppEditor::Constants::M_CONTEXT);
|
|
|
|
|
cmd = am->registerAction(sep, _("Debugger.Sep.Views"),
|
|
|
|
|
cppDebuggercontext);
|
|
|
|
|
editorContextMenu->addAction(cmd);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-11-23 16:42:46 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_actions.watchAction2,
|
|
|
|
|
Constants::ADD_TO_WATCH2, cppDebuggercontext);
|
|
|
|
|
cmd->action()->setEnabled(true);
|
|
|
|
|
editorContextMenu->addAction(cmd);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_plugin->addAutoReleasedObject(new CommonOptionsPage);
|
|
|
|
|
QList<Core::IOptionsPage *> engineOptionPages;
|
|
|
|
|
if (m_cmdLineEnabledEngines & GdbEngineType)
|
|
|
|
|
addGdbOptionPages(&engineOptionPages);
|
|
|
|
|
#ifdef CDB_ENABLED
|
|
|
|
|
if (m_cmdLineEnabledEngines & CdbEngineType)
|
|
|
|
|
addCdbOptionPages(&engineOptionPages);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
Debugger::Cdb::addCdb2OptionPages(&engineOptionPages);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef WITH_LLDB
|
|
|
|
|
if (m_cmdLineEnabledEngines & LldbEngineType)
|
|
|
|
|
addLldbOptionPages(&engineOptionPages);
|
|
|
|
|
#endif
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
//if (m_cmdLineEnabledEngines & ScriptEngineType)
|
|
|
|
|
// addScriptOptionPages(&engineOptionPages);
|
|
|
|
|
//if (m_cmdLineEnabledEngines & TcfEngineType)
|
|
|
|
|
// addTcfOptionPages(&engineOptionPages);
|
|
|
|
|
foreach (Core::IOptionsPage *op, engineOptionPages)
|
|
|
|
|
m_plugin->addAutoReleasedObject(op);
|
|
|
|
|
m_plugin->addAutoReleasedObject(new DebuggingHelperOptionPage);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
|
|
|
|
SLOT(onModeChanged(Core::IMode*)));
|
2010-12-03 15:23:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// Debug mode setup
|
2010-12-08 18:19:49 +01:00
|
|
|
m_plugin->addAutoReleasedObject(new DebugMode);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
//
|
|
|
|
|
// Connections
|
|
|
|
|
//
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// TextEditor
|
|
|
|
|
connect(TextEditorSettings::instance(),
|
|
|
|
|
SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
|
|
|
|
|
SLOT(fontSettingsChanged(TextEditor::FontSettings)));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// ProjectExplorer
|
|
|
|
|
connect(sessionManager(), SIGNAL(sessionLoaded()),
|
|
|
|
|
SLOT(sessionLoaded()));
|
|
|
|
|
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
|
|
|
|
|
SLOT(aboutToSaveSession()));
|
|
|
|
|
connect(sessionManager(), SIGNAL(aboutToUnloadSession()),
|
|
|
|
|
SLOT(aboutToUnloadSession()));
|
|
|
|
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()),
|
|
|
|
|
SLOT(updateDebugActions()));
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// EditorManager
|
|
|
|
|
QObject *editorManager = core->editorManager();
|
|
|
|
|
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
|
|
|
|
SLOT(editorOpened(Core::IEditor*)));
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Application interaction
|
|
|
|
|
connect(action(SettingsDialog), SIGNAL(triggered()),
|
|
|
|
|
SLOT(showSettingsDialog()));
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Toolbar
|
|
|
|
|
QWidget *toolbarContainer = new QWidget;
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
QHBoxLayout *hbox = new QHBoxLayout(toolbarContainer);
|
|
|
|
|
hbox->setMargin(0);
|
|
|
|
|
hbox->setSpacing(0);
|
|
|
|
|
hbox->addWidget(toolButton(am->command(Constants::DEBUG)->action()));
|
|
|
|
|
hbox->addWidget(toolButton(am->command(STOP)->action()));
|
|
|
|
|
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-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
//hbox->addWidget(new Utils::StyledSeparator);
|
|
|
|
|
m_reverseToolButton = toolButton(am->command(REVERSE)->action());
|
|
|
|
|
hbox->addWidget(m_reverseToolButton);
|
|
|
|
|
//m_reverseToolButton->hide();
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
hbox->addWidget(new Utils::StyledSeparator);
|
|
|
|
|
hbox->addWidget(new QLabel(tr("Threads:")));
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_threadBox = new QComboBox;
|
|
|
|
|
connect(m_threadBox, SIGNAL(activated(int)), SLOT(selectThread(int)));
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
hbox->addWidget(m_threadBox);
|
|
|
|
|
hbox->addSpacerItem(new QSpacerItem(4, 0));
|
|
|
|
|
hbox->addWidget(m_statusLabel, 10);
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 17:33:39 +01:00
|
|
|
m_mainWindow->setToolbar(CppLanguage, toolbarContainer);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(action(EnableReverseDebugging),
|
|
|
|
|
SIGNAL(valueChanged(QVariant)),
|
|
|
|
|
SLOT(enableReverseDebuggingTriggered(QVariant)));
|
2010-11-10 16:33:11 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
setInitialState();
|
|
|
|
|
connectEngine(0);
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(sessionManager(),
|
|
|
|
|
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
|
|
|
|
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
QTC_ASSERT(m_coreSettings, /**/);
|
2010-11-10 11:39:01 +01:00
|
|
|
m_watchersWindow->setVisible(false);
|
|
|
|
|
m_returnWindow->setVisible(false);
|
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));
|
2010-11-10 11:39:01 +01:00
|
|
|
if (m_attachRemoteParameters.attachPid
|
|
|
|
|
|| !m_attachRemoteParameters.attachTarget.isEmpty())
|
|
|
|
|
QTimer::singleShot(0, this, SLOT(attachCmdLine()));
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
2010-05-05 12:41:52 +02:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
Utils::SavedAction *DebuggerPluginPrivate::action(int code) const
|
|
|
|
|
{
|
|
|
|
|
return m_debuggerSettings->item(code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DebuggerPluginPrivate::boolSetting(int code) const
|
|
|
|
|
{
|
|
|
|
|
return m_debuggerSettings->item(code)->value().toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString DebuggerPluginPrivate::stringSetting(int code) const
|
|
|
|
|
{
|
|
|
|
|
return m_debuggerSettings->item(code)->value().toString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-26 09:58:34 +01:00
|
|
|
void DebuggerPluginPrivate::showModuleSymbols(const QString &moduleName,
|
|
|
|
|
const Symbols &symbols)
|
|
|
|
|
{
|
|
|
|
|
QTreeWidget *w = new QTreeWidget;
|
|
|
|
|
w->setColumnCount(5);
|
|
|
|
|
w->setRootIsDecorated(false);
|
|
|
|
|
w->setAlternatingRowColors(true);
|
|
|
|
|
w->setSortingEnabled(true);
|
2010-12-03 15:55:17 +01:00
|
|
|
w->setObjectName("Symbols." + moduleName);
|
2010-11-26 09:58:34 +01:00
|
|
|
QStringList header;
|
|
|
|
|
header.append(tr("Symbol"));
|
|
|
|
|
header.append(tr("Address"));
|
|
|
|
|
header.append(tr("Code"));
|
|
|
|
|
header.append(tr("Section"));
|
|
|
|
|
header.append(tr("Name"));
|
|
|
|
|
w->setHeaderLabels(header);
|
|
|
|
|
w->setWindowTitle(tr("Symbols in \"%1\"").arg(moduleName));
|
|
|
|
|
foreach (const Symbol &s, symbols) {
|
|
|
|
|
QTreeWidgetItem *it = new QTreeWidgetItem;
|
|
|
|
|
it->setData(0, Qt::DisplayRole, s.name);
|
|
|
|
|
it->setData(1, Qt::DisplayRole, s.address);
|
|
|
|
|
it->setData(2, Qt::DisplayRole, s.state);
|
|
|
|
|
it->setData(3, Qt::DisplayRole, s.section);
|
|
|
|
|
it->setData(4, Qt::DisplayRole, s.demangled);
|
|
|
|
|
w->addTopLevelItem(it);
|
|
|
|
|
}
|
2010-12-03 15:55:17 +01:00
|
|
|
createNewDock(w);
|
2010-11-26 09:58:34 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-06 08:25:29 +01:00
|
|
|
void DebuggerPluginPrivate::aboutToShutdown()
|
|
|
|
|
{
|
|
|
|
|
disconnect(sessionManager(),
|
|
|
|
|
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
|
|
|
|
this, 0);
|
|
|
|
|
m_debuggerSettings->writeSettings();
|
|
|
|
|
m_mainWindow->writeSettings();
|
|
|
|
|
if (GdbOptionsPage::gdbBinariesChanged)
|
|
|
|
|
GdbOptionsPage::writeGdbBinarySettings();
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
} // namespace Internal
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DebuggerPlugin
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-11-26 09:58:34 +01:00
|
|
|
using namespace Debugger::Internal;
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
DebuggerPlugin::DebuggerPlugin()
|
2010-07-13 15:57:34 +02:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
theDebuggerCore = new DebuggerPluginPrivate(this);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
DebuggerPlugin::~DebuggerPlugin()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
delete theDebuggerCore;
|
|
|
|
|
theDebuggerCore = 0;
|
2010-07-13 15:57:34 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
return theDebuggerCore->initialize(arguments, errorMessage);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
ExtensionSystem::IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2010-12-06 08:25:29 +01:00
|
|
|
theDebuggerCore->aboutToShutdown();
|
2010-11-10 11:39:01 +01:00
|
|
|
return SynchronousShutdown;
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
void DebuggerPlugin::remoteCommand(const QStringList &options,
|
|
|
|
|
const QStringList &list)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
theDebuggerCore->remoteCommand(options, list);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
|
|
|
|
|
DebuggerRunControl *DebuggerPlugin::createDebugger
|
|
|
|
|
(const DebuggerStartParameters &sp, RunConfiguration *rc)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
return theDebuggerCore->createDebugger(sp, rc);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
void DebuggerPlugin::startDebugger(RunControl *runControl)
|
2010-06-28 09:10:20 +02:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
theDebuggerCore->startDebugger(runControl);
|
2010-06-28 09:10:20 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
void DebuggerPlugin::extensionsInitialized()
|
2010-11-05 13:35:31 +01:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
theDebuggerCore->extensionsInitialized();
|
2010-11-05 13:35:31 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
bool DebuggerPlugin::isActiveDebugLanguage(int language)
|
2010-10-20 12:13:28 +02:00
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
return theDebuggerCore->isActiveDebugLanguage(language);
|
2010-10-20 12:13:28 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-06 08:51:46 +01:00
|
|
|
DebuggerMainWindow *DebuggerPlugin::mainWindow()
|
|
|
|
|
{
|
|
|
|
|
return theDebuggerCore->m_mainWindow;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-03 15:23:23 +01:00
|
|
|
QWidget *DebugMode::widget()
|
|
|
|
|
{
|
|
|
|
|
if (!m_widget) {
|
|
|
|
|
//qDebug() << "CREATING DEBUG MODE WIDGET";
|
|
|
|
|
m_widget = theDebuggerCore->m_mainWindow->createContents(this);
|
|
|
|
|
m_widget->setFocusProxy(EditorManager::instance());
|
|
|
|
|
}
|
|
|
|
|
return m_widget;
|
|
|
|
|
}
|
2010-11-10 16:33:11 +01:00
|
|
|
|
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)
|