2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
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
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** 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"
|
|
|
|
|
|
2011-01-10 10:14:23 +01:00
|
|
|
#include "debuggerstartparameters.h"
|
2009-03-17 17:00:06 +01:00
|
|
|
#include "debuggeractions.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "debuggerconstants.h"
|
2011-04-21 15:52:51 +02:00
|
|
|
#include "debuggerinternalconstants.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"
|
2011-01-10 10:35:41 +01:00
|
|
|
#include "debuggerruncontrolfactory.h"
|
2009-09-25 15:02:16 +02:00
|
|
|
#include "debuggerstringutils.h"
|
2011-04-19 12:17:48 +02:00
|
|
|
#include "memoryagent.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"
|
2012-02-15 12:35:43 +01:00
|
|
|
#include "qtmessagelogwindow.h"
|
2011-04-12 17:32:41 +02:00
|
|
|
#include "disassemblerlines.h"
|
2010-09-22 16:20:08 +02:00
|
|
|
#include "logwindow.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "moduleswindow.h"
|
2011-01-10 10:14:23 +01:00
|
|
|
#include "moduleshandler.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#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"
|
2011-02-11 15:00:13 +01:00
|
|
|
#include "debuggertooltipmanager.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-21 13:11:03 +02:00
|
|
|
#include "snapshothandler.h"
|
|
|
|
|
#include "threadshandler.h"
|
2011-02-22 12:28:46 +01:00
|
|
|
#include "commonoptionspage.h"
|
2008-12-02 12:01:29 +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>
|
2011-09-05 16:10:37 +02:00
|
|
|
#include <coreplugin/id.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>
|
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>
|
2012-03-14 10:25:55 +01:00
|
|
|
#include <cpptools/ModelManagerInterface.h>
|
2008-12-09 16:18:28 +01:00
|
|
|
|
2009-01-20 11:52:04 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2012-01-25 17:28:06 +01:00
|
|
|
#include <extensionsystem/invoker.h>
|
2009-01-20 11:52:04 +01:00
|
|
|
|
2011-10-25 18:23:37 +08:00
|
|
|
#include <projectexplorer/abi.h>
|
2012-01-23 16:45:00 +01:00
|
|
|
#include <projectexplorer/applicationrunconfiguration.h>
|
|
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2011-10-25 18:23:37 +08:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
|
|
|
|
#include <projectexplorer/projectexplorersettings.h>
|
|
|
|
|
#include <projectexplorer/project.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/session.h>
|
2010-07-21 17:06:22 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2011-10-25 18:23:37 +08:00
|
|
|
#include <projectexplorer/toolchain.h>
|
|
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2008-12-09 16:18:28 +01:00
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2010-11-08 16:17:59 +01:00
|
|
|
|
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>
|
2011-01-12 16:36:29 +01:00
|
|
|
#include <utils/proxyaction.h>
|
2011-03-16 13:49:28 +01:00
|
|
|
#include <utils/statuslabel.h>
|
2011-03-30 15:15:15 +02:00
|
|
|
#include <utils/fileutils.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QtPlugin>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QDockWidget>
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QMenu>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QTextBlock>
|
|
|
|
|
#include <QTextCursor>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
#include <QInputDialog>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-01-23 16:45:00 +01:00
|
|
|
#ifdef WITH_TESTS
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QTest>
|
|
|
|
|
#include <QSignalSpy>
|
|
|
|
|
#include <QTestEventLoop>
|
2012-01-26 13:14:00 +01:00
|
|
|
|
|
|
|
|
//#define WITH_BENCHMARK
|
|
|
|
|
#ifdef WITH_BENCHMARK
|
|
|
|
|
#include <valgrind/callgrind.h>
|
2012-01-23 16:45:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
2012-01-26 13:14:00 +01:00
|
|
|
#endif // WITH_TESTS
|
|
|
|
|
|
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
|
|
|
|
|
|
2011-01-26 17:22:25 +01:00
|
|
|
/*!
|
|
|
|
|
\namespace Debugger
|
|
|
|
|
Debugger plugin namespace
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\namespace Debugger::Internal
|
|
|
|
|
Internal namespace of the Debugger plugin
|
2011-02-04 15:08:31 +01:00
|
|
|
\internal
|
2011-01-26 17:22:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\class Debugger::DebuggerEngine
|
|
|
|
|
|
|
|
|
|
\brief Base class of a debugger engine.
|
|
|
|
|
|
|
|
|
|
Note: the Debugger process itself and any helper processes like
|
2011-06-09 14:45:08 +02:00
|
|
|
gdbserver, the CODA client etc are referred to as 'Engine',
|
2011-01-26 17:22:25 +01:00
|
|
|
whereas the debugged process is referred to as 'Inferior'.
|
|
|
|
|
|
|
|
|
|
Transitions marked by '---' are done in the individual engines.
|
|
|
|
|
Transitions marked by '+-+' are done in the base DebuggerEngine.
|
|
|
|
|
Transitions marked by '*' are done asynchronously.
|
|
|
|
|
|
|
|
|
|
The GdbEngine->setupEngine() function is described in more detail below.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
\code
|
|
|
|
|
|
|
|
|
|
DebuggerNotReady
|
|
|
|
|
progressmanager/progressmanager.cpp +
|
|
|
|
|
EngineSetupRequested
|
|
|
|
|
+
|
|
|
|
|
(calls *Engine->setupEngine())
|
|
|
|
|
| |
|
|
|
|
|
| |
|
|
|
|
|
{notify- {notify-
|
|
|
|
|
Engine- Engine-
|
|
|
|
|
SetupOk} SetupFailed}
|
|
|
|
|
+ +
|
|
|
|
|
+ `+-+-+> EngineSetupFailed
|
|
|
|
|
+ +
|
|
|
|
|
+ [calls RunControl->startFailed]
|
|
|
|
|
+ +
|
|
|
|
|
+ DebuggerFinished
|
|
|
|
|
v
|
|
|
|
|
EngineSetupOk
|
|
|
|
|
+
|
|
|
|
|
[calls RunControl->StartSuccessful]
|
|
|
|
|
+
|
|
|
|
|
InferiorSetupRequested
|
|
|
|
|
+
|
|
|
|
|
(calls *Engine->setupInferior())
|
|
|
|
|
| |
|
|
|
|
|
| |
|
|
|
|
|
{notify- {notify-
|
|
|
|
|
Inferior- Inferior-
|
|
|
|
|
SetupOk} SetupFailed}
|
|
|
|
|
+ +
|
|
|
|
|
+ ` +-+-> InferiorSetupFailed +-+-+-+-+-+->.
|
|
|
|
|
+ +
|
|
|
|
|
InferiorSetupOk +
|
|
|
|
|
+ +
|
|
|
|
|
EngineRunRequested +
|
|
|
|
|
+ +
|
|
|
|
|
(calls *Engine->runEngine()) +
|
|
|
|
|
/ | | \ +
|
|
|
|
|
/ | | \ +
|
|
|
|
|
| (core) | (attach) | | +
|
|
|
|
|
| | | | +
|
|
|
|
|
{notify- {notifyER&- {notifyER&- {notify- +
|
|
|
|
|
Inferior- Inferior- Inferior- EngineRun- +
|
|
|
|
|
Unrunnable} StopOk} RunOk} Failed} +
|
|
|
|
|
+ + + + +
|
|
|
|
|
InferiorUnrunnable + InferiorRunOk + +
|
|
|
|
|
+ + +
|
|
|
|
|
InferiorStopOk EngineRunFailed +
|
|
|
|
|
+ v
|
|
|
|
|
`-+-+-+-+-+-+-+-+-+-+-+>-+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
#Interrupt@InferiorRunOk# +
|
|
|
|
|
+ +
|
|
|
|
|
InferiorStopRequested +
|
|
|
|
|
#SpontaneousStop + +
|
|
|
|
|
@InferiorRunOk# (calls *Engine-> +
|
|
|
|
|
+ interruptInferior()) +
|
|
|
|
|
{notify- | | +
|
|
|
|
|
Spontaneous- {notify- {notify- +
|
|
|
|
|
Inferior- Inferior- Inferior- +
|
|
|
|
|
StopOk} StopOk} StopFailed} +
|
|
|
|
|
+ + + +
|
|
|
|
|
+ + + +
|
|
|
|
|
InferiorStopOk + +
|
|
|
|
|
+ + +
|
|
|
|
|
+ + +
|
|
|
|
|
+ + +
|
|
|
|
|
#Stop@InferiorUnrunnable# + +
|
|
|
|
|
#Creator Close Event# + +
|
|
|
|
|
+ + +
|
|
|
|
|
InferiorShutdownRequested +
|
|
|
|
|
+ +
|
|
|
|
|
(calls *Engine->shutdownInferior()) +
|
|
|
|
|
| | +
|
|
|
|
|
{notify- {notify- +
|
|
|
|
|
Inferior- Inferior- +
|
|
|
|
|
ShutdownOk} ShutdownFailed} +
|
|
|
|
|
+ + +
|
|
|
|
|
+ + +
|
|
|
|
|
#Inferior exited# + + +
|
|
|
|
|
| + + +
|
|
|
|
|
{notifyInferior- + + +
|
|
|
|
|
Exited} + + +
|
|
|
|
|
+ + + +
|
|
|
|
|
InferiorExitOk + + +
|
|
|
|
|
+ + + +
|
|
|
|
|
InferiorShutdownOk InferiorShutdownFailed +
|
|
|
|
|
* * +
|
|
|
|
|
EngineShutdownRequested +
|
|
|
|
|
+ +
|
|
|
|
|
(calls *Engine->shutdownEngine()) <+-+-+-+-+-+-+-+-+-+-+-+-+-+'
|
|
|
|
|
| |
|
|
|
|
|
| |
|
|
|
|
|
{notify- {notify-
|
|
|
|
|
Engine- Engine-
|
|
|
|
|
ShutdownOk} ShutdownFailed}
|
|
|
|
|
+ +
|
|
|
|
|
EngineShutdownOk EngineShutdownFailed
|
|
|
|
|
* *
|
|
|
|
|
DebuggerFinished
|
|
|
|
|
|
|
|
|
|
\endcode */
|
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" ];
|
2011-01-17 10:36:13 +01:00
|
|
|
sg1: InferiorSetupRequested -> InferiorSetupOk [ label="notifyInferiorSetupOk", style="dashed" ];
|
2010-08-31 12:49:51 +02:00
|
|
|
sg1: InferiorSetupRequested -> InferiorSetupFailed [ label="notifyInferiorFailed", style="dashed" ];
|
2011-01-17 10:36:13 +01:00
|
|
|
sg1: InferiorSetupOk -> EngineRunRequested
|
2010-08-31 12:49:51 +02:00
|
|
|
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
|
2011-01-17 10:36:13 +01:00
|
|
|
sg1: InferiorStopOk -> InferiorShutdownRequested [ label="Close event" ];
|
|
|
|
|
sg1: InferiorUnrunnable -> InferiorShutdownRequested [ label="Close event" ];
|
2010-08-31 12:49:51 +02:00
|
|
|
sg1: InferiorShutdownRequested -> InferiorShutdownOk [ label= "Engine::shutdownInferior\nnotifyInferiorShutdownOk", style="dashed" ];
|
|
|
|
|
sg1: InferiorShutdownRequested -> InferiorShutdownFailed [ label="Engine::shutdownInferior\nnotifyInferiorShutdownFailed", style="dashed" ];
|
2011-01-17 10:36:13 +01:00
|
|
|
sg1: InferiorExited -> InferiorExitOk [ label="notifyInferiorExited", style="dashed"];
|
|
|
|
|
sg1: InferiorExitOk -> InferiorShutdownOk
|
2010-08-31 12:49:51 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2011-01-26 17:22:25 +01:00
|
|
|
/*!
|
|
|
|
|
\class Debugger::Internal::GdbEngine
|
|
|
|
|
\brief Implementation of Debugger::Engine driving a gdb executable.
|
|
|
|
|
|
|
|
|
|
GdbEngine specific startup. All happens in EngineSetupRequested state:
|
|
|
|
|
|
|
|
|
|
Transitions marked by '---' are done in the individual adapters.
|
|
|
|
|
|
|
|
|
|
Transitions marked by '+-+' are done in the GdbEngine.
|
|
|
|
|
|
|
|
|
|
\code
|
|
|
|
|
GdbEngine::setupEngine()
|
|
|
|
|
+
|
|
|
|
|
(calls *Adapter->startAdapter())
|
|
|
|
|
| |
|
|
|
|
|
| `---> handleAdapterStartFailed()
|
|
|
|
|
| +
|
|
|
|
|
| {notifyEngineSetupFailed}
|
|
|
|
|
|
|
|
|
|
|
handleAdapterStarted()
|
|
|
|
|
+
|
|
|
|
|
{notifyEngineSetupOk}
|
2010-07-08 11:44:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-26 17:22:25 +01:00
|
|
|
GdbEngine::setupInferior()
|
|
|
|
|
+
|
|
|
|
|
(calls *Adapter->prepareInferior())
|
|
|
|
|
| |
|
|
|
|
|
| `---> handlePrepareInferiorFailed()
|
|
|
|
|
| +
|
|
|
|
|
| {notifyInferiorSetupFailed}
|
|
|
|
|
|
|
|
|
|
|
handleInferiorPrepared()
|
|
|
|
|
+
|
|
|
|
|
{notifyInferiorSetupOk}
|
2010-07-08 11:44:00 +02:00
|
|
|
|
2011-01-26 17:22:25 +01:00
|
|
|
\endcode */
|
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;
|
2011-12-06 15:39:25 +01:00
|
|
|
using namespace ExtensionSystem;
|
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 {
|
|
|
|
|
|
2012-01-25 10:25:05 +01:00
|
|
|
#ifdef Q_OS_MAC
|
2011-08-03 19:04:51 +02:00
|
|
|
const char STOP_KEY[] = "Shift+Ctrl+Y";
|
|
|
|
|
const char RESET_KEY[] = "Ctrl+Shift+F5";
|
|
|
|
|
const char STEP_KEY[] = "Ctrl+Shift+I";
|
|
|
|
|
const char STEPOUT_KEY[] = "Ctrl+Shift+T";
|
|
|
|
|
const char NEXT_KEY[] = "Ctrl+Shift+O";
|
|
|
|
|
const char REVERSE_KEY[] = "";
|
|
|
|
|
const char RUN_TO_LINE_KEY[] = "Shift+F8";
|
|
|
|
|
const char RUN_TO_SELECTED_FUNCTION_KEY[] = "Ctrl+F6";
|
|
|
|
|
const char JUMP_TO_LINE_KEY[] = "Ctrl+D,Ctrl+L";
|
|
|
|
|
const char TOGGLE_BREAK_KEY[] = "F8";
|
|
|
|
|
const char BREAK_BY_FUNCTION_KEY[] = "Ctrl+D,Ctrl+F";
|
|
|
|
|
const char BREAK_AT_MAIN_KEY[] = "Ctrl+D,Ctrl+M";
|
|
|
|
|
const char ADD_TO_WATCH_KEY[] = "Ctrl+D,Ctrl+W";
|
|
|
|
|
const char SNAPSHOT_KEY[] = "Ctrl+D,Ctrl+S";
|
2008-12-02 12:01:29 +01:00
|
|
|
#else
|
2011-08-03 19:04:51 +02:00
|
|
|
const char STOP_KEY[] = "Shift+F5";
|
|
|
|
|
const char RESET_KEY[] = "Ctrl+Shift+F5";
|
|
|
|
|
const char STEP_KEY[] = "F11";
|
|
|
|
|
const char STEPOUT_KEY[] = "Shift+F11";
|
|
|
|
|
const char NEXT_KEY[] = "F10";
|
|
|
|
|
const char REVERSE_KEY[] = "F12";
|
2011-10-26 16:36:28 +08:00
|
|
|
const char RUN_TO_LINE_KEY[] = "Ctrl+F10";
|
2011-08-03 19:04:51 +02:00
|
|
|
const char RUN_TO_SELECTED_FUNCTION_KEY[] = "Ctrl+F6";
|
|
|
|
|
const char JUMP_TO_LINE_KEY[] = "";
|
|
|
|
|
const char TOGGLE_BREAK_KEY[] = "F9";
|
|
|
|
|
const char BREAK_BY_FUNCTION_KEY[] = "";
|
|
|
|
|
const char BREAK_AT_MAIN_KEY[] = "";
|
|
|
|
|
const char ADD_TO_WATCH_KEY[] = "Ctrl+Alt+Q";
|
|
|
|
|
const char 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 Internal {
|
|
|
|
|
|
2011-06-27 10:37:57 +02:00
|
|
|
// To be passed through margin menu action's data
|
|
|
|
|
struct BreakpointMenuContextData : public ContextData
|
|
|
|
|
{
|
|
|
|
|
enum Mode
|
|
|
|
|
{
|
|
|
|
|
Breakpoint,
|
|
|
|
|
MessageTracePoint
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BreakpointMenuContextData() : mode(Breakpoint) {}
|
|
|
|
|
Mode mode;
|
|
|
|
|
};
|
|
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
struct TestCallBack
|
|
|
|
|
{
|
|
|
|
|
TestCallBack() : receiver(0), slot(0) {}
|
|
|
|
|
TestCallBack(QObject *ob, const char *s) : receiver(ob), slot(s) {}
|
|
|
|
|
|
|
|
|
|
QObject *receiver;
|
|
|
|
|
const char *slot;
|
|
|
|
|
QVariant cookie;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2011-06-27 10:37:57 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::BreakpointMenuContextData)
|
2012-01-25 17:28:06 +01:00
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::TestCallBack)
|
|
|
|
|
|
2011-06-27 10:37:57 +02:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-11-24 11:44:43 +01:00
|
|
|
// FIXME: Outdated?
|
|
|
|
|
// The createCdbEngine function takes a list of options pages it can add to.
|
|
|
|
|
// This allows for having a "enabled" toggle on the page independently
|
|
|
|
|
// of the engine. That's good for not enabling the related ActiveX control
|
|
|
|
|
// unnecessarily.
|
|
|
|
|
|
2011-01-12 12:10:12 +01:00
|
|
|
void addCdbOptionPages(QList<IOptionsPage*> *opts);
|
2010-11-24 11:44:43 +01:00
|
|
|
void addGdbOptionPages(QList<IOptionsPage*> *opts);
|
|
|
|
|
void addScriptOptionPages(QList<IOptionsPage*> *opts);
|
|
|
|
|
void addTcfOptionPages(QList<IOptionsPage*> *opts);
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-31 10:42:18 +02:00
|
|
|
static Abi anyAbiOfBinary(const QString &fileName)
|
2011-02-22 11:21:08 +01:00
|
|
|
{
|
2012-01-13 15:07:32 +01:00
|
|
|
QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(fileName));
|
2011-02-22 11:21:08 +01:00
|
|
|
if (abis.isEmpty())
|
|
|
|
|
return Abi();
|
|
|
|
|
return abis.at(0);
|
|
|
|
|
}
|
2010-11-23 13:44:37 +01:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// DummyEngine
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class DummyEngine : public DebuggerEngine
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-10-12 16:28:33 +02:00
|
|
|
DummyEngine() : DebuggerEngine(DebuggerStartParameters(), AnyLanguage) {}
|
2010-11-26 10:20:50 +01:00
|
|
|
~DummyEngine() {}
|
|
|
|
|
|
|
|
|
|
void setupEngine() {}
|
|
|
|
|
void setupInferior() {}
|
|
|
|
|
void runEngine() {}
|
|
|
|
|
void shutdownEngine() {}
|
|
|
|
|
void shutdownInferior() {}
|
2012-01-12 20:28:17 +01:00
|
|
|
bool hasCapability(unsigned cap) const;
|
2011-06-24 16:25:30 +02:00
|
|
|
bool acceptsBreakpoint(BreakpointModelId) const { return false; }
|
2011-02-16 12:41:06 +01:00
|
|
|
bool acceptsDebuggerCommands() const { return false; }
|
2010-11-23 13:44:37 +01:00
|
|
|
};
|
|
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
bool DummyEngine::hasCapability(unsigned cap) const
|
2012-01-12 19:32:25 +01:00
|
|
|
{
|
|
|
|
|
// This can only be a first approximation of what to expect when running.
|
2012-01-24 18:57:39 +01:00
|
|
|
Project *project = ProjectExplorerPlugin::currentProject();
|
2012-01-12 19:32:25 +01:00
|
|
|
if (!project)
|
|
|
|
|
return 0;
|
|
|
|
|
Target *target = project->activeTarget();
|
|
|
|
|
QTC_ASSERT(target, return 0);
|
|
|
|
|
RunConfiguration *activeRc = target->activeRunConfiguration();
|
|
|
|
|
QTC_ASSERT(activeRc, return 0);
|
|
|
|
|
|
|
|
|
|
// This is a non-started Cdb or Gdb engine:
|
2012-02-17 19:05:11 +01:00
|
|
|
if (activeRc->debuggerAspect()->useCppDebugger())
|
2012-01-12 20:28:17 +01:00
|
|
|
return cap & (WatchpointByAddressCapability
|
2012-01-12 19:32:25 +01:00
|
|
|
| BreakConditionCapability
|
|
|
|
|
| TracePointCapability
|
2012-01-12 20:28:17 +01:00
|
|
|
| OperateByInstructionCapability);
|
2012-01-12 19:32:25 +01:00
|
|
|
|
|
|
|
|
// This is a Qml or unknown engine.
|
2012-01-12 20:28:17 +01:00
|
|
|
return cap & AddWatcherCapability;
|
2012-01-12 19:32:25 +01:00
|
|
|
}
|
|
|
|
|
|
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:
|
2011-04-13 13:00:30 +02:00
|
|
|
DebugMode()
|
|
|
|
|
{
|
|
|
|
|
setObjectName(QLatin1String("DebugMode"));
|
|
|
|
|
setContext(Context(CC::C_EDITORMANAGER, C_DEBUGMODE, CC::C_NAVIGATION_PANE));
|
2011-04-13 16:09:04 +02:00
|
|
|
setDisplayName(DebuggerPlugin::tr("Debug"));
|
|
|
|
|
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Debug.png")));
|
2011-07-15 10:55:39 +02:00
|
|
|
setPriority(85);
|
2011-12-21 14:02:52 +01:00
|
|
|
setId(QLatin1String(MODE_DEBUG));
|
|
|
|
|
setType(QLatin1String(CC::MODE_EDIT_TYPE));
|
2011-04-13 13:00:30 +02:00
|
|
|
}
|
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-06-16 11:08:54 +02:00
|
|
|
};
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Misc
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2011-02-23 10:16:11 +01:00
|
|
|
static TextEditor::ITextEditor *currentTextEditor()
|
2011-01-04 15:54:36 +01:00
|
|
|
{
|
2011-02-23 10:16:11 +01:00
|
|
|
if (const Core::EditorManager *editorManager = Core::EditorManager::instance())
|
|
|
|
|
if (Core::IEditor *editor = editorManager->currentEditor())
|
|
|
|
|
return qobject_cast<TextEditor::ITextEditor*>(editor);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-23 10:16:11 +01:00
|
|
|
static bool currentTextEditorPosition(ContextData *data)
|
|
|
|
|
{
|
2012-01-17 16:22:05 +01:00
|
|
|
TextEditor::ITextEditor *textEditor = currentTextEditor();
|
|
|
|
|
if (!textEditor)
|
|
|
|
|
return false;
|
2012-02-14 16:43:51 +01:00
|
|
|
const Core::IDocument *document = textEditor->document();
|
|
|
|
|
QTC_ASSERT(document, return false);
|
|
|
|
|
data->fileName = document->fileName();
|
2012-01-17 16:22:05 +01:00
|
|
|
if (textEditor->property("DisassemblerView").toBool()) {
|
|
|
|
|
int lineNumber = textEditor->currentLine();
|
|
|
|
|
QString line = textEditor->contents()
|
|
|
|
|
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
|
|
|
|
|
data->address = DisassemblerLine::addressFromDisassemblyLine(line);
|
|
|
|
|
} else {
|
|
|
|
|
data->lineNumber = textEditor->currentLine();
|
2011-02-23 10:16:11 +01:00
|
|
|
}
|
2012-01-17 16:22:05 +01:00
|
|
|
return true;
|
2011-02-23 10:16:11 +01:00
|
|
|
}
|
2011-02-03 14:08:01 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2011-02-03 14:08:01 +01:00
|
|
|
// DebuggerPluginPrivate
|
2010-06-16 11:08:54 +02:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
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
|
|
|
|
2011-02-04 15:08:31 +01:00
|
|
|
/*!
|
|
|
|
|
\class Debugger::Internal::DebuggerCore
|
|
|
|
|
|
|
|
|
|
This is the "internal" interface of the debugger plugin that's
|
|
|
|
|
used by debugger views and debugger engines. The interface is
|
|
|
|
|
implemented in DebuggerPluginPrivate.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\class Debugger::Internal::DebuggerPluginPrivate
|
|
|
|
|
|
|
|
|
|
Implementation of DebuggerCore.
|
|
|
|
|
*/
|
|
|
|
|
|
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; }
|
2011-03-02 14:05:32 +01:00
|
|
|
DebuggerEngine *dummyEngine();
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2011-09-01 16:36:27 +02:00
|
|
|
void setThreads(const QStringList &list, int index)
|
|
|
|
|
{
|
|
|
|
|
const bool state = m_threadBox->blockSignals(true);
|
|
|
|
|
m_threadBox->clear();
|
|
|
|
|
foreach (const QString &item, list)
|
|
|
|
|
m_threadBox->addItem(item);
|
|
|
|
|
m_threadBox->setCurrentIndex(index);
|
|
|
|
|
m_threadBox->blockSignals(state);
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
public slots:
|
2011-02-22 12:05:25 +01:00
|
|
|
void writeSettings()
|
|
|
|
|
{
|
|
|
|
|
m_debuggerSettings->writeSettings();
|
|
|
|
|
m_mainWindow->writeSettings();
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
2011-06-28 19:20:09 +02:00
|
|
|
const BreakpointMenuContextData data =
|
|
|
|
|
action->data().value<BreakpointMenuContextData>();
|
2011-06-27 10:37:57 +02:00
|
|
|
QString message;
|
|
|
|
|
if (data.mode == BreakpointMenuContextData::MessageTracePoint) {
|
|
|
|
|
if (data.address) {
|
|
|
|
|
//: Message tracepoint: Address hit.
|
|
|
|
|
message = tr("0x%1 hit").arg(data.address, 0, 16);
|
|
|
|
|
} else {
|
|
|
|
|
//: Message tracepoint: %1 file, %2 line %3 function hit.
|
|
|
|
|
message = tr("%1:%2 %3() hit").arg(QFileInfo(data.fileName).fileName()).
|
|
|
|
|
arg(data.lineNumber).
|
|
|
|
|
arg(cppFunctionAt(data.fileName, data.lineNumber));
|
|
|
|
|
}
|
|
|
|
|
QInputDialog dialog; // Create wide input dialog.
|
|
|
|
|
dialog.setWindowFlags(dialog.windowFlags()
|
2011-06-28 19:20:09 +02:00
|
|
|
& ~(Qt::WindowContextHelpButtonHint|Qt::MSWindowsFixedSizeDialogHint));
|
2011-06-27 10:37:57 +02:00
|
|
|
dialog.resize(600, dialog.height());
|
|
|
|
|
dialog.setWindowTitle(tr("Add Message Tracepoint"));
|
|
|
|
|
dialog.setLabelText (tr("Message:"));
|
|
|
|
|
dialog.setTextValue(message);
|
|
|
|
|
if (dialog.exec() != QDialog::Accepted || dialog.textValue().isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
message = dialog.textValue();
|
|
|
|
|
}
|
2011-01-04 15:54:36 +01:00
|
|
|
if (data.address)
|
2011-06-27 10:37:57 +02:00
|
|
|
toggleBreakpointByAddress(data.address, message);
|
2011-01-04 15:54:36 +01:00
|
|
|
else
|
2011-06-27 10:37:57 +02:00
|
|
|
toggleBreakpointByFileAndLine(data.fileName, data.lineNumber, message);
|
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);
|
2011-06-24 16:25:30 +02:00
|
|
|
BreakpointModelId id = act->data().value<BreakpointModelId>();
|
2011-06-15 14:02:26 +02:00
|
|
|
m_breakHandler->removeBreakpoint(id);
|
2010-11-10 16:33:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void breakpointEnableMarginActionTriggered()
|
|
|
|
|
{
|
|
|
|
|
const QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(act, return);
|
2011-06-24 16:25:30 +02:00
|
|
|
BreakpointModelId id = act->data().value<BreakpointModelId>();
|
2011-06-15 14:02:26 +02:00
|
|
|
breakHandler()->setEnabled(id, true);
|
2010-11-10 16:33:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void breakpointDisableMarginActionTriggered()
|
|
|
|
|
{
|
|
|
|
|
const QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(act, return);
|
2011-06-24 16:25:30 +02:00
|
|
|
BreakpointModelId id = act->data().value<BreakpointModelId>();;
|
2011-06-15 14:02:26 +02:00
|
|
|
breakHandler()->setEnabled(id, 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);
|
2011-11-11 17:17:26 +01:00
|
|
|
m_returnWindow->header()->resizeSection(section, newSize);
|
2010-11-05 19:38:40 +01:00
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2011-12-08 16:31:21 +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()
|
|
|
|
|
{
|
2011-12-21 14:02:52 +01:00
|
|
|
showMessage(QLatin1String("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);
|
2011-02-04 14:36:50 +01:00
|
|
|
void updateBreakMenuItem(Core::IEditor *editor);
|
2010-06-16 11:08:54 +02:00
|
|
|
void setBusyCursor(bool busy);
|
2011-11-29 13:51:00 +01:00
|
|
|
void requestMark(TextEditor::ITextEditor *editor,
|
|
|
|
|
int lineNumber,
|
|
|
|
|
TextEditor::ITextEditor::MarkRequestKind kind);
|
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();
|
2011-06-27 10:37:57 +02:00
|
|
|
void toggleBreakpointByFileAndLine(const QString &fileName, int lineNumber,
|
|
|
|
|
const QString &tracePointMessage = QString());
|
|
|
|
|
void toggleBreakpointByAddress(quint64 address,
|
|
|
|
|
const QString &tracePointMessage = QString());
|
2010-06-16 11:08:54 +02:00
|
|
|
void onModeChanged(Core::IMode *mode);
|
2011-01-31 15:17:53 +01:00
|
|
|
void onCoreAboutToOpen();
|
2010-06-16 11:08:54 +02:00
|
|
|
void showSettingsDialog();
|
2011-10-25 18:23:37 +08:00
|
|
|
void updateDebugWithoutDeployMenu();
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-11-12 20:18:29 +01:00
|
|
|
void debugProject();
|
2011-10-25 18:23:37 +08:00
|
|
|
void debugProjectWithoutDeploy();
|
2011-05-02 18:22:32 +02:00
|
|
|
void debugProjectBreakMain();
|
2010-06-16 11:08:54 +02:00
|
|
|
void startExternalApplication();
|
2010-11-19 16:13:22 +01:00
|
|
|
void startRemoteCdbSession();
|
2011-12-06 15:39:25 +01:00
|
|
|
void startRemoteProcess();
|
|
|
|
|
void startRemoteServer();
|
2011-09-14 15:22:08 +02:00
|
|
|
bool queryRemoteParameters(DebuggerStartParameters &sp, bool useScript);
|
2011-12-05 17:21:48 +01:00
|
|
|
void attachToRemoteServer();
|
2011-12-06 15:39:25 +01:00
|
|
|
void attachToRemoteProcess();
|
2011-09-13 17:26:02 +02:00
|
|
|
void attachToQmlPort();
|
2010-12-01 15:41:08 +01:00
|
|
|
void startRemoteEngine();
|
2010-06-16 11:08:54 +02:00
|
|
|
void attachExternalApplication();
|
2012-03-05 22:30:59 +01:00
|
|
|
Q_SLOT void attachExternalApplication(ProjectExplorer::RunControl*rc);
|
2011-02-08 13:48:04 +01:00
|
|
|
void runScheduled();
|
2010-06-16 11:08:54 +02:00
|
|
|
void attachCore();
|
2011-12-05 17:21:48 +01:00
|
|
|
void attachToRemoteServer(const QString &spec);
|
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;
|
2011-02-24 16:50:15 +01:00
|
|
|
unsigned enabledEngines() const { return m_cmdLineEnabledEngines; }
|
|
|
|
|
QString debuggerForAbi(const Abi &abi, DebuggerEngineType et = NoEngineType) 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 sessionLoaded();
|
|
|
|
|
void aboutToUnloadSession();
|
|
|
|
|
void aboutToSaveSession();
|
2010-06-22 12:41:02 +02:00
|
|
|
|
2011-02-16 12:41:06 +01:00
|
|
|
void executeDebuggerCommand(const QString &command);
|
2012-02-15 12:35:43 +01:00
|
|
|
bool evaluateScriptExpression(const QString &expression);
|
2010-10-22 12:26:13 +02:00
|
|
|
void coreShutdown();
|
2010-08-26 16:02:41 +02:00
|
|
|
|
2012-01-23 16:45:00 +01:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
public slots:
|
2012-01-25 17:28:06 +01:00
|
|
|
void testLoadProject(const QString &proFile, const TestCallBack &cb);
|
2012-01-23 16:45:00 +01:00
|
|
|
void testProjectLoaded(ProjectExplorer::Project *project);
|
2012-01-25 17:28:06 +01:00
|
|
|
void testUnloadProject();
|
|
|
|
|
void testFinished();
|
|
|
|
|
|
|
|
|
|
void testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb);
|
2012-01-23 16:45:00 +01:00
|
|
|
void testRunControlFinished();
|
2012-01-25 17:28:06 +01:00
|
|
|
|
|
|
|
|
void testPythonDumpers1();
|
|
|
|
|
void testPythonDumpers2();
|
|
|
|
|
void testPythonDumpers3();
|
|
|
|
|
|
|
|
|
|
void testStateMachine1();
|
|
|
|
|
void testStateMachine2();
|
|
|
|
|
void testStateMachine3();
|
|
|
|
|
|
2012-01-26 13:14:00 +01:00
|
|
|
void testBenchmark1();
|
|
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
public:
|
|
|
|
|
bool m_testSuccess;
|
|
|
|
|
QList<TestCallBack> m_testCallbacks;
|
|
|
|
|
|
2012-01-23 16:45:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-31 16:15:48 +01:00
|
|
|
void handleAbort()
|
2010-11-23 16:42:46 +01:00
|
|
|
{
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2011-10-31 16:15:48 +01:00
|
|
|
currentEngine()->abortDebugger();
|
2010-11-23 16:42:46 +01:00
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
|
|
|
|
|
void handleExecStep()
|
|
|
|
|
{
|
2011-05-02 18:22:32 +02:00
|
|
|
if (currentEngine()->state() == DebuggerNotReady) {
|
|
|
|
|
debugProjectBreakMain();
|
|
|
|
|
} else {
|
|
|
|
|
currentEngine()->resetLocation();
|
|
|
|
|
if (boolSetting(OperateByInstruction))
|
|
|
|
|
currentEngine()->executeStepI();
|
|
|
|
|
else
|
|
|
|
|
currentEngine()->executeStep();
|
|
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecNext()
|
|
|
|
|
{
|
2011-05-02 18:22:32 +02:00
|
|
|
if (currentEngine()->state() == DebuggerNotReady) {
|
|
|
|
|
debugProjectBreakMain();
|
|
|
|
|
} else {
|
|
|
|
|
currentEngine()->resetLocation();
|
|
|
|
|
if (boolSetting(OperateByInstruction))
|
|
|
|
|
currentEngine()->executeNextI();
|
|
|
|
|
else
|
|
|
|
|
currentEngine()->executeNext();
|
|
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
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();
|
2011-02-23 10:16:11 +01:00
|
|
|
ContextData data;
|
|
|
|
|
if (currentTextEditorPosition(&data))
|
|
|
|
|
currentEngine()->executeJumpToLine(data);
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handleExecRunToLine()
|
|
|
|
|
{
|
|
|
|
|
//removeTooltip();
|
2010-12-14 12:21:29 +01:00
|
|
|
currentEngine()->resetLocation();
|
2011-02-23 10:16:11 +01:00
|
|
|
ContextData data;
|
|
|
|
|
if (currentTextEditorPosition(&data))
|
|
|
|
|
currentEngine()->executeRunToLine(data);
|
2010-11-08 15:19:13 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-02 11:52:39 +01:00
|
|
|
void handleExecRunToSelectedFunction()
|
2010-11-08 15:19:13 +01:00
|
|
|
{
|
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();
|
2011-12-21 14:02:52 +01:00
|
|
|
foreach (const QString &str, line.trimmed().split(QLatin1Char('('))) {
|
2010-11-08 16:17:59 +01:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-02 11:52:39 +01:00
|
|
|
if (functionName.isEmpty()) {
|
|
|
|
|
showStatusMessage(tr("No function selected."));
|
|
|
|
|
} else {
|
|
|
|
|
showStatusMessage(tr("Running to function \"%1\".")
|
|
|
|
|
.arg(functionName));
|
|
|
|
|
currentEngine()->resetLocation();
|
2010-11-08 16:17:59 +01:00
|
|
|
currentEngine()->executeRunToFunction(functionName);
|
2011-02-02 11:52:39 +01:00
|
|
|
}
|
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);
|
2011-06-24 16:25:30 +02:00
|
|
|
const BreakpointModelId id = act->data().value<BreakpointModelId>();
|
2010-11-10 16:33:11 +01:00
|
|
|
QTC_ASSERT(id > 0, return);
|
2012-03-29 14:20:45 +02:00
|
|
|
BreakTreeView::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);
|
2011-08-15 16:52:08 +02:00
|
|
|
const BreakpointMenuContextData data = action->data().value<BreakpointMenuContextData>();
|
2011-02-23 10:16:11 +01:00
|
|
|
currentEngine()->executeRunToLine(data);
|
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);
|
2011-08-15 16:52:08 +02:00
|
|
|
const BreakpointMenuContextData data = action->data().value<BreakpointMenuContextData>();
|
2011-02-23 10:16:11 +01:00
|
|
|
currentEngine()->executeJumpToLine(data);
|
2010-11-08 15:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
2012-02-01 17:44:07 +01:00
|
|
|
void slotDisassembleFunction()
|
|
|
|
|
{
|
|
|
|
|
const QAction *action = qobject_cast<const QAction *>(sender());
|
|
|
|
|
QTC_ASSERT(action, return);
|
|
|
|
|
const StackFrame frame = action->data().value<StackFrame>();
|
|
|
|
|
QTC_ASSERT(!frame.function.isEmpty(), return);
|
|
|
|
|
currentEngine()->openDisassemblerView(Location(frame));
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
|
2011-02-08 13:48:04 +01:00
|
|
|
bool parseArgument(QStringList::const_iterator &it,
|
|
|
|
|
const QStringList::const_iterator &cend,
|
|
|
|
|
unsigned *enabledEngines, QString *errorMessage);
|
|
|
|
|
bool parseArguments(const QStringList &args,
|
|
|
|
|
unsigned *enabledEngines, QString *errorMessage);
|
|
|
|
|
|
2011-02-11 15:00:13 +01:00
|
|
|
DebuggerToolTipManager *toolTipManager() const { return m_toolTipManager; }
|
2011-03-04 16:21:57 +01:00
|
|
|
virtual QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const { return m_globalDebuggerOptions; }
|
2011-02-11 15:00:13 +01:00
|
|
|
|
2011-09-26 12:38:17 +02:00
|
|
|
// FIXME: Remove.
|
|
|
|
|
void maybeEnrichParameters(DebuggerStartParameters *sp);
|
|
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
void gdbServerStarted(const QString &channel, const QString &sysroot, const QString &localExecutable);
|
2012-03-21 17:54:56 +01:00
|
|
|
void attachedToProcess(const QString &channel, const QString &sysroot, const QString &localExecutable);
|
2011-12-06 15:39:25 +01:00
|
|
|
|
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;
|
2011-02-08 13:48:04 +01:00
|
|
|
QList<DebuggerStartParameters> m_scheduledStarts;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-08-03 18:57:37 +02:00
|
|
|
Utils::ProxyAction *m_visibleStartAction;
|
|
|
|
|
Utils::ProxyAction *m_hiddenStopAction;
|
|
|
|
|
QAction *m_startAction;
|
2011-10-25 18:23:37 +08:00
|
|
|
QAction *m_debugWithoutDeployAction;
|
2011-12-08 16:31:21 +01:00
|
|
|
QAction *m_startLocalProcessAction;
|
2011-12-05 17:21:48 +01:00
|
|
|
QAction *m_startRemoteProcessAction;
|
2011-12-06 15:39:25 +01:00
|
|
|
QAction *m_startRemoteServerAction;
|
|
|
|
|
QAction *m_attachToRemoteProcessAction;
|
2011-09-13 17:26:02 +02:00
|
|
|
QAction *m_attachToQmlPortAction;
|
2011-12-05 17:21:48 +01:00
|
|
|
QAction *m_attachToRemoteServerAction;
|
2010-11-19 16:13:22 +01:00
|
|
|
QAction *m_startRemoteCdbAction;
|
2010-12-01 15:41:08 +01:00
|
|
|
QAction *m_startRemoteLldbAction;
|
2011-12-08 16:31:21 +01:00
|
|
|
QAction *m_attachToLocalProcessAction;
|
2011-12-05 17:21:48 +01:00
|
|
|
QAction *m_attachToCoreAction;
|
2010-06-16 11:08:54 +02:00
|
|
|
QAction *m_detachAction;
|
2011-02-03 14:08:01 +01:00
|
|
|
QAction *m_continueAction;
|
|
|
|
|
QAction *m_exitAction; // On application output button if "Stop" is possible
|
|
|
|
|
QAction *m_interruptAction; // On the fat debug button if "Pause" is possible
|
|
|
|
|
QAction *m_undisturbableAction; // On the fat debug button if nothing can be done
|
2011-10-31 16:15:48 +01:00
|
|
|
QAction *m_abortAction;
|
2011-02-03 14:08:01 +01:00
|
|
|
QAction *m_stepAction;
|
|
|
|
|
QAction *m_stepOutAction;
|
|
|
|
|
QAction *m_runToLineAction; // In the debug menu
|
|
|
|
|
QAction *m_runToSelectedFunctionAction;
|
|
|
|
|
QAction *m_jumpToLineAction; // In the Debug menu.
|
|
|
|
|
QAction *m_returnFromFunctionAction;
|
|
|
|
|
QAction *m_nextAction;
|
|
|
|
|
QAction *m_watchAction1; // In the Debug menu.
|
|
|
|
|
QAction *m_watchAction2; // In the text editor context menu.
|
|
|
|
|
QAction *m_breakAction;
|
|
|
|
|
QAction *m_reverseDirectionAction;
|
|
|
|
|
QAction *m_frameUpAction;
|
|
|
|
|
QAction *m_frameDownAction;
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
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;
|
|
|
|
|
|
2011-03-16 13:49:28 +01:00
|
|
|
Utils::StatusLabel *m_statusLabel;
|
2010-06-16 11:08:54 +02:00
|
|
|
QComboBox *m_threadBox;
|
|
|
|
|
|
2012-03-29 14:20:45 +02:00
|
|
|
BaseWindow *m_breakWindow;
|
2010-11-04 09:54:23 +01:00
|
|
|
BreakHandler *m_breakHandler;
|
2012-02-15 12:35:43 +01:00
|
|
|
QtMessageLogWindow *m_qtMessageLogWindow;
|
2012-03-29 14:20:45 +02:00
|
|
|
WatchWindow *m_returnWindow;
|
|
|
|
|
WatchWindow *m_localsWindow;
|
|
|
|
|
WatchWindow *m_watchersWindow;
|
2012-03-22 11:54:49 +01:00
|
|
|
BaseWindow *m_registerWindow;
|
|
|
|
|
BaseWindow *m_modulesWindow;
|
|
|
|
|
BaseWindow *m_snapshotWindow;
|
2012-03-29 14:20:45 +02:00
|
|
|
BaseWindow *m_sourceFilesWindow;
|
2012-03-22 11:54:49 +01:00
|
|
|
BaseWindow *m_stackWindow;
|
|
|
|
|
BaseWindow *m_threadsWindow;
|
2010-09-22 16:20:08 +02:00
|
|
|
LogWindow *m_logWindow;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
bool m_busy;
|
|
|
|
|
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;
|
2011-02-22 11:21:08 +01:00
|
|
|
QStringList m_arguments;
|
2011-02-11 15:00:13 +01:00
|
|
|
DebuggerToolTipManager *m_toolTipManager;
|
2011-02-22 12:58:32 +01:00
|
|
|
CommonOptionsPage *m_commonOptionsPage;
|
2011-03-02 14:05:32 +01:00
|
|
|
DummyEngine *m_dummyEngine;
|
2011-03-04 16:21:57 +01:00
|
|
|
const QSharedPointer<GlobalDebuggerOptions> m_globalDebuggerOptions;
|
2010-06-16 11:08:54 +02:00
|
|
|
};
|
|
|
|
|
|
2011-02-11 15:00:13 +01:00
|
|
|
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
|
2011-03-02 14:05:32 +01:00
|
|
|
m_toolTipManager(new DebuggerToolTipManager(this)),
|
2011-03-04 16:21:57 +01:00
|
|
|
m_dummyEngine(0),
|
|
|
|
|
m_globalDebuggerOptions(new GlobalDebuggerOptions)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2011-12-21 14:02:52 +01:00
|
|
|
setObjectName(QLatin1String("DebuggerCore"));
|
2011-01-04 15:54:36 +01:00
|
|
|
qRegisterMetaType<WatchData>("WatchData");
|
|
|
|
|
qRegisterMetaType<ContextData>("ContextData");
|
2011-01-07 09:44:23 +01:00
|
|
|
qRegisterMetaType<DebuggerStartParameters>("DebuggerStartParameters");
|
2011-01-04 15:54:36 +01:00
|
|
|
|
2011-07-29 12:00:11 +02:00
|
|
|
QTC_CHECK(!theDebuggerCore);
|
2010-11-10 11:39:01 +01:00
|
|
|
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;
|
2012-02-15 12:35:43 +01:00
|
|
|
m_qtMessageLogWindow = 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;
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction = 0;
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction = 0;
|
2011-12-08 16:31:21 +01:00
|
|
|
m_startLocalProcessAction = 0;
|
2011-12-05 17:21:48 +01:00
|
|
|
m_startRemoteProcessAction = 0;
|
|
|
|
|
m_attachToRemoteServerAction = 0;
|
2011-12-08 16:31:21 +01:00
|
|
|
m_attachToRemoteProcessAction = 0;
|
2011-09-13 17:26:02 +02:00
|
|
|
m_attachToQmlPortAction = 0;
|
2010-12-06 08:04:43 +01:00
|
|
|
m_startRemoteCdbAction = 0;
|
|
|
|
|
m_startRemoteLldbAction = 0;
|
2011-12-08 16:31:21 +01:00
|
|
|
m_attachToLocalProcessAction = 0;
|
2011-12-05 17:21:48 +01:00
|
|
|
m_attachToCoreAction = 0;
|
2010-12-06 08:04:43 +01:00
|
|
|
m_detachAction = 0;
|
2011-02-22 12:58:32 +01:00
|
|
|
|
|
|
|
|
m_commonOptionsPage = 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;
|
|
|
|
|
|
2011-03-15 14:52:35 +01:00
|
|
|
// Mainwindow will be deleted by debug mode.
|
2010-11-10 11:39:01 +01:00
|
|
|
|
|
|
|
|
delete m_snapshotHandler;
|
|
|
|
|
m_snapshotHandler = 0;
|
2011-02-24 13:25:30 +01:00
|
|
|
|
|
|
|
|
delete m_breakHandler;
|
|
|
|
|
m_breakHandler = 0;
|
2010-11-10 11:39:01 +01:00
|
|
|
}
|
|
|
|
|
|
2011-03-02 14:05:32 +01:00
|
|
|
DebuggerEngine *DebuggerPluginPrivate::dummyEngine()
|
|
|
|
|
{
|
|
|
|
|
if (!m_dummyEngine) {
|
|
|
|
|
m_dummyEngine = new DummyEngine;
|
|
|
|
|
m_dummyEngine->setParent(this);
|
|
|
|
|
m_dummyEngine->setObjectName(_("DummyEngine"));
|
|
|
|
|
}
|
|
|
|
|
return m_dummyEngine;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
DebuggerCore *debuggerCore()
|
|
|
|
|
{
|
|
|
|
|
return theDebuggerCore;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-08 13:48:04 +01:00
|
|
|
static QString msgParameterMissing(const QString &a)
|
|
|
|
|
{
|
|
|
|
|
return DebuggerPlugin::tr("Option '%1' is missing the parameter.").arg(a);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-26 12:38:17 +02:00
|
|
|
void DebuggerPluginPrivate::maybeEnrichParameters(DebuggerStartParameters *sp)
|
2011-09-22 09:30:50 +02:00
|
|
|
{
|
2011-09-26 12:38:17 +02:00
|
|
|
if (!boolSetting(AutoEnrichParameters))
|
2011-09-22 09:30:50 +02:00
|
|
|
return;
|
2011-12-05 17:21:48 +01:00
|
|
|
if (sp->sysroot.isEmpty() &&
|
|
|
|
|
(sp->startMode == AttachToRemoteServer
|
|
|
|
|
|| sp->startMode == StartRemoteProcess
|
|
|
|
|
|| sp->startMode == AttachToRemoteProcess)) {
|
2011-09-29 14:46:59 +02:00
|
|
|
// FIXME: Get from BaseQtVersion.
|
2011-09-26 12:38:17 +02:00
|
|
|
sp->sysroot = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_SYSROOT"));
|
2011-09-29 14:46:59 +02:00
|
|
|
showMessage(QString::fromLatin1("USING QTC_DEBUGGER_SYSROOT %1")
|
|
|
|
|
.arg(sp->sysroot), LogWarning);
|
2011-09-26 12:38:17 +02:00
|
|
|
}
|
2011-12-21 14:02:52 +01:00
|
|
|
if (sp->debugInfoLocation.isEmpty()) {
|
|
|
|
|
sp->debugInfoLocation = sp->sysroot + QLatin1String("/usr/lib/debug");
|
|
|
|
|
}
|
2011-09-29 18:53:16 +02:00
|
|
|
if (sp->debugSourceLocation.isEmpty()) {
|
2011-12-21 14:02:52 +01:00
|
|
|
QString base = sp->sysroot + QLatin1String("/usr/src/debug/");
|
|
|
|
|
sp->debugSourceLocation.append(base + QLatin1String("qt5base/src/corelib"));
|
|
|
|
|
sp->debugSourceLocation.append(base + QLatin1String("qt5base/src/gui"));
|
|
|
|
|
sp->debugSourceLocation.append(base + QLatin1String("qt5base/src/network"));
|
|
|
|
|
sp->debugSourceLocation.append(base + QLatin1String("qt5base/src/v8"));
|
2012-03-28 14:35:12 +02:00
|
|
|
sp->debugSourceLocation.append(base + QLatin1String("qt5declarative/src/qml"));
|
2011-09-22 09:30:50 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-08 13:48:04 +01:00
|
|
|
bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
|
|
|
|
const QStringList::const_iterator &cend,
|
|
|
|
|
unsigned *enabledEngines, QString *errorMessage)
|
|
|
|
|
{
|
|
|
|
|
const QString &option = *it;
|
|
|
|
|
// '-debug <pid>'
|
2012-02-17 12:32:57 +02:00
|
|
|
// '-debug <exe>[,server=<server:port>|,core=<core>][,arch=<arch>][,sysroot=<sysroot>]'
|
2011-02-08 13:48:04 +01:00
|
|
|
if (*it == _("-debug")) {
|
|
|
|
|
++it;
|
|
|
|
|
if (it == cend) {
|
|
|
|
|
*errorMessage = msgParameterMissing(*it);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
qulonglong pid = it->toULongLong();
|
|
|
|
|
if (pid) {
|
|
|
|
|
sp.startMode = AttachExternal;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = DetachAtClose;
|
2011-02-08 13:48:04 +01:00
|
|
|
sp.attachPID = pid;
|
|
|
|
|
sp.displayName = tr("Process %1").arg(sp.attachPID);
|
|
|
|
|
sp.startMessage = tr("Attaching to local process %1.").arg(sp.attachPID);
|
2011-02-22 11:21:08 +01:00
|
|
|
sp.toolChainAbi = Abi::hostAbi();
|
2011-02-08 13:48:04 +01:00
|
|
|
} else {
|
2012-02-17 12:32:57 +02:00
|
|
|
QStringList args = it->split(QLatin1Char(','));
|
|
|
|
|
sp.startMode = StartExternal;
|
|
|
|
|
foreach (const QString &arg, args) {
|
|
|
|
|
QString key = arg.section(QLatin1Char('='), 0, 0);
|
|
|
|
|
QString val = arg.section(QLatin1Char('='), 1, 1);
|
|
|
|
|
if (val.isEmpty()) {
|
|
|
|
|
if (key.isEmpty())
|
|
|
|
|
continue;
|
|
|
|
|
else if (sp.executable.isEmpty())
|
|
|
|
|
sp.executable = key;
|
|
|
|
|
else {
|
|
|
|
|
*errorMessage = DebuggerPlugin::tr("Only one executable allowed!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (key == QLatin1String("server")) {
|
|
|
|
|
sp.startMode = AttachToRemoteServer;
|
|
|
|
|
sp.remoteChannel = val;
|
|
|
|
|
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
|
|
|
|
|
sp.startMessage = tr("Attaching to remote server %1.").arg(sp.remoteChannel);
|
|
|
|
|
}
|
|
|
|
|
else if (key == QLatin1String("arch"))
|
|
|
|
|
sp.remoteArchitecture = val;
|
|
|
|
|
else if (key == QLatin1String("core")) {
|
|
|
|
|
sp.startMode = AttachCore;
|
|
|
|
|
sp.coreFile = val;
|
|
|
|
|
sp.displayName = tr("Core file \"%1\"").arg(sp.coreFile);
|
|
|
|
|
sp.startMessage = tr("Attaching to core file %1.").arg(sp.coreFile);
|
|
|
|
|
}
|
|
|
|
|
else if (key == QLatin1String("sysroot"))
|
|
|
|
|
sp.sysroot = val;
|
2011-04-19 14:30:13 +02:00
|
|
|
}
|
2012-02-17 12:32:57 +02:00
|
|
|
sp.toolChainAbi = anyAbiOfBinary(sp.executable);
|
|
|
|
|
}
|
|
|
|
|
if (sp.startMode == StartExternal) {
|
|
|
|
|
sp.displayName = tr("Executable file \"%1\"").arg(sp.executable);
|
|
|
|
|
sp.startMessage = tr("Debugging file %1.").arg(sp.executable);
|
2011-02-08 13:48:04 +01:00
|
|
|
}
|
|
|
|
|
m_scheduledStarts.append(sp);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
// -wincrashevent <event-handle>:<pid>. A handle used for
|
|
|
|
|
// a handshake when attaching to a crashed Windows process.
|
|
|
|
|
// This is created by $QTC/src/tools/qtcdebugger/main.cpp:
|
|
|
|
|
// args << QLatin1String("-wincrashevent")
|
|
|
|
|
// << QString("%1:%2").arg(argWinCrashEvent).arg(argProcessId);
|
|
|
|
|
if (*it == _("-wincrashevent")) {
|
|
|
|
|
++it;
|
|
|
|
|
if (it == cend) {
|
|
|
|
|
*errorMessage = msgParameterMissing(*it);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.startMode = AttachCrashedExternal;
|
2011-12-21 14:02:52 +01:00
|
|
|
sp.crashParameter = it->section(QLatin1Char(':'), 0, 0);
|
|
|
|
|
sp.attachPID = it->section(QLatin1Char(':'), 1, 1).toULongLong();
|
2011-02-08 13:48:04 +01:00
|
|
|
sp.displayName = tr("Crashed process %1").arg(sp.attachPID);
|
|
|
|
|
sp.startMessage = tr("Attaching to crashed process %1").arg(sp.attachPID);
|
2011-02-22 11:21:08 +01:00
|
|
|
sp.toolChainAbi = Abi::hostAbi();
|
2011-02-08 13:48:04 +01:00
|
|
|
if (!sp.attachPID) {
|
|
|
|
|
*errorMessage = DebuggerPlugin::tr("The parameter '%1' of option '%2' "
|
|
|
|
|
"does not match the pattern <handle>:<pid>.").arg(*it, option);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
m_scheduledStarts.append(sp);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
// Engine disabling.
|
|
|
|
|
if (option == _("-disable-cdb")) {
|
|
|
|
|
*enabledEngines &= ~CdbEngineType;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (option == _("-disable-gdb")) {
|
|
|
|
|
*enabledEngines &= ~GdbEngineType;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (option == _("-disable-qmldb")) {
|
|
|
|
|
*enabledEngines &= ~QmlEngineType;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (option == _("-disable-sdb")) {
|
|
|
|
|
*enabledEngines &= ~ScriptEngineType;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (option == _("-disable-lldb")) {
|
|
|
|
|
*enabledEngines &= ~LldbEngineType;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*errorMessage = DebuggerPlugin::tr("Invalid debugger option: %1").arg(option);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DebuggerPluginPrivate::parseArguments(const QStringList &args,
|
|
|
|
|
unsigned *enabledEngines, QString *errorMessage)
|
|
|
|
|
{
|
|
|
|
|
const QStringList::const_iterator cend = args.constEnd();
|
|
|
|
|
for (QStringList::const_iterator it = args.constBegin(); it != cend; ++it)
|
|
|
|
|
if (!parseArgument(it, cend, enabledEngines, errorMessage))
|
|
|
|
|
return false;
|
|
|
|
|
if (Constants::Internal::debug)
|
|
|
|
|
qDebug().nospace() << args << "engines=0x"
|
|
|
|
|
<< QString::number(*enabledEngines, 16) << '\n';
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
|
|
|
|
QString *errorMessage)
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
2011-02-22 11:21:08 +01:00
|
|
|
Q_UNUSED(errorMessage);
|
|
|
|
|
m_arguments = arguments;
|
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();
|
2011-10-28 10:15:04 +00:00
|
|
|
if (target)
|
|
|
|
|
activeRc = target->activeRunConfiguration();
|
|
|
|
|
if (!activeRc)
|
|
|
|
|
return;
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
|
|
|
|
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.
|
2011-02-03 14:08:01 +01:00
|
|
|
m_interruptAction->setEnabled(false);
|
|
|
|
|
m_continueAction->setEnabled(false);
|
|
|
|
|
m_exitAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction->setEnabled(true);
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(true);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_visibleStartAction->setAction(m_startAction);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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-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())
|
2012-01-10 19:17:24 +01:00
|
|
|
pe->runProject(pro, DebugRunMode);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-10-25 18:23:37 +08:00
|
|
|
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
if (Project *pro = pe->startupProject())
|
2012-01-10 19:17:24 +01:00
|
|
|
pe->runProject(pro, DebugRunMode, true);
|
2011-10-25 18:23:37 +08:00
|
|
|
}
|
|
|
|
|
|
2011-05-02 18:22:32 +02:00
|
|
|
void DebuggerPluginPrivate::debugProjectBreakMain()
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
if (Project *pro = pe->startupProject())
|
2012-01-10 19:17:24 +01:00
|
|
|
pe->runProject(pro, DebugRunModeWithBreakOnMain);
|
2011-05-02 18:22:32 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::startExternalApplication()
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
2012-02-06 15:15:57 +01:00
|
|
|
if (StartExternalDialog::run(mainWindow(), m_coreSettings, &sp))
|
|
|
|
|
if (RunControl *rc = m_debuggerRunControlFactory->create(sp))
|
|
|
|
|
startDebugger(rc);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::attachExternalApplication()
|
|
|
|
|
{
|
|
|
|
|
AttachExternalDialog dlg(mainWindow());
|
2011-02-25 16:03:22 +01:00
|
|
|
dlg.setAbiIndex(configValue(_("LastAttachExternalAbiIndex")).toInt());
|
2011-02-24 16:50:15 +01:00
|
|
|
|
|
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
|
|
|
|
|
2011-05-31 10:27:32 +02:00
|
|
|
if (dlg.attachPID() == 0) {
|
2010-12-02 13:20:06 +01:00
|
|
|
QMessageBox::warning(mainWindow(), tr("Warning"),
|
2011-05-31 10:27:32 +02:00
|
|
|
tr("Cannot attach to process with PID 0"));
|
2010-12-02 13:20:06 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2011-05-31 10:27:32 +02:00
|
|
|
|
|
|
|
|
setConfigValue(_("LastAttachExternalAbiIndex"), QVariant(dlg.abiIndex()));
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
DebuggerStartParameters sp;
|
2011-05-31 10:27:32 +02:00
|
|
|
sp.attachPID = dlg.attachPID();
|
|
|
|
|
sp.displayName = tr("Process %1").arg(dlg.attachPID());
|
|
|
|
|
sp.executable = dlg.executable();
|
2011-02-08 13:48:04 +01:00
|
|
|
sp.startMode = AttachExternal;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = DetachAtClose;
|
2011-05-31 10:27:32 +02:00
|
|
|
sp.toolChainAbi = dlg.abi();
|
|
|
|
|
sp.debuggerCommand = dlg.debuggerCommand();
|
2010-12-02 13:20:06 +01:00
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
void DebuggerPluginPrivate::attachExternalApplication(RunControl *rc)
|
2011-05-31 09:48:00 +02:00
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.attachPID = rc->applicationProcessHandle().pid();
|
|
|
|
|
sp.displayName = tr("Debugger attached to %1").arg(rc->displayName());
|
|
|
|
|
sp.startMode = AttachExternal;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = DetachAtClose;
|
2011-08-17 09:06:59 +02:00
|
|
|
sp.toolChainAbi = rc->abi();
|
2011-05-31 09:48:00 +02:00
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::attachCore()
|
|
|
|
|
{
|
|
|
|
|
AttachCoreDialog dlg(mainWindow());
|
|
|
|
|
dlg.setExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
|
|
|
|
|
dlg.setCoreFile(configValue(_("LastExternalCoreFile")).toString());
|
2012-01-26 20:57:00 +02:00
|
|
|
dlg.setAbiIndex(configValue(_("LastExternalAbiIndex")).toInt());
|
2011-05-30 12:56:26 +02:00
|
|
|
dlg.setSysroot(configValue(_("LastSysroot")).toString());
|
2011-05-03 14:57:05 +02:00
|
|
|
dlg.setOverrideStartScript(configValue(_("LastExternalStartScript")).toString());
|
2011-02-24 16:50:15 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
2011-02-24 16:50:15 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
setConfigValue(_("LastExternalExecutableFile"), dlg.executableFile());
|
|
|
|
|
setConfigValue(_("LastExternalCoreFile"), dlg.coreFile());
|
2012-01-26 20:57:00 +02:00
|
|
|
setConfigValue(_("LastExternalAbiIndex"), QVariant(dlg.abiIndex()));
|
2011-05-30 12:56:26 +02:00
|
|
|
setConfigValue(_("LastSysroot"), dlg.sysroot());
|
2011-05-03 14:57:05 +02:00
|
|
|
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
|
2010-07-22 10:23:27 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
DebuggerStartParameters sp;
|
2011-05-31 10:27:32 +02:00
|
|
|
sp.executable = dlg.executableFile();
|
|
|
|
|
sp.coreFile = dlg.coreFile();
|
|
|
|
|
sp.displayName = tr("Core file \"%1\"").arg(dlg.coreFile());
|
2010-12-02 13:20:06 +01:00
|
|
|
sp.startMode = AttachCore;
|
2011-05-31 10:27:32 +02:00
|
|
|
sp.debuggerCommand = dlg.debuggerCommand();
|
|
|
|
|
sp.toolChainAbi = dlg.abi();
|
|
|
|
|
sp.sysroot = dlg.sysroot();
|
|
|
|
|
sp.overrideStartScript = dlg.overrideStartScript();
|
2010-12-02 13:20:06 +01:00
|
|
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
void DebuggerPluginPrivate::attachToRemoteServer(const QString &spec)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2011-02-08 13:48:04 +01:00
|
|
|
// spec is: server:port@executable@architecture
|
2010-12-02 13:20:06 +01:00
|
|
|
DebuggerStartParameters sp;
|
2011-12-21 14:02:52 +01:00
|
|
|
sp.remoteChannel = spec.section(QLatin1Char('@'), 0, 0);
|
|
|
|
|
sp.executable = spec.section(QLatin1Char('@'), 1, 1);
|
|
|
|
|
sp.remoteArchitecture = spec.section(QLatin1Char('@'), 2, 2);
|
2010-12-02 13:20:06 +01:00
|
|
|
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
|
2011-09-16 11:04:11 +02:00
|
|
|
sp.startMode = AttachToRemoteServer;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = KillAtClose;
|
2011-05-31 10:42:18 +02:00
|
|
|
sp.toolChainAbi = anyAbiOfBinary(sp.executable);
|
2010-12-02 13:20:06 +01:00
|
|
|
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;
|
2011-02-01 18:36:00 +01:00
|
|
|
Abi hostAbi = Abi::hostAbi();
|
2011-12-06 15:39:25 +01:00
|
|
|
sp.toolChainAbi = Abi(hostAbi.architecture(), Abi::WindowsOS,
|
|
|
|
|
Abi::WindowsMsvc2010Flavor, Abi::PEFormat, hostAbi.wordWidth());
|
2011-09-16 11:04:11 +02:00
|
|
|
sp.startMode = AttachToRemoteServer;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = KillAtClose;
|
2010-12-02 13:20:06 +01:00
|
|
|
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
|
|
|
|
2011-09-14 15:22:08 +02:00
|
|
|
bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, bool useScript)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2012-02-06 15:15:57 +01:00
|
|
|
return StartRemoteDialog::run(mainWindow(),
|
|
|
|
|
m_coreSettings,
|
|
|
|
|
useScript,
|
|
|
|
|
&sp);
|
2011-09-14 15:22:08 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
void DebuggerPluginPrivate::startRemoteProcess()
|
2011-09-14 15:22:08 +02:00
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
2012-02-06 15:15:57 +01:00
|
|
|
if (StartRemoteDialog::run(mainWindow(), m_coreSettings, true, &sp)) {
|
|
|
|
|
sp.startMode = StartRemoteProcess;
|
|
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2011-09-14 15:22:08 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
void DebuggerPluginPrivate::attachToRemoteServer()
|
2011-09-14 15:22:08 +02:00
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
2012-02-06 15:15:57 +01:00
|
|
|
if (StartRemoteDialog::run(mainWindow(), m_coreSettings, false, &sp)) {
|
|
|
|
|
sp.startMode = AttachToRemoteServer;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = KillAtClose;
|
2012-02-06 15:15:57 +01:00
|
|
|
sp.useServerStartScript = false;
|
|
|
|
|
sp.serverStartScript.clear();
|
|
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
void DebuggerPluginPrivate::startRemoteServer()
|
|
|
|
|
{
|
|
|
|
|
PluginManager *pm = PluginManager::instance();
|
|
|
|
|
QTC_ASSERT(pm, return);
|
|
|
|
|
QObject *rl = pm->getObjectByName(_("RemoteLinuxPlugin"));
|
|
|
|
|
QTC_ASSERT(rl, return);
|
|
|
|
|
QMetaObject::invokeMethod(rl, "startGdbServer", Qt::QueuedConnection);
|
|
|
|
|
// Will call back gdbServerStarted() below.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::gdbServerStarted(const QString &channel,
|
|
|
|
|
const QString &sysroot, const QString &remoteCommandLine)
|
2012-03-21 17:54:56 +01:00
|
|
|
{
|
|
|
|
|
Q_UNUSED(remoteCommandLine);
|
|
|
|
|
Q_UNUSED(sysroot);
|
|
|
|
|
showStatusMessage(tr("gdbserver is now listening at %1").arg(channel));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::attachToRemoteProcess()
|
|
|
|
|
{
|
|
|
|
|
PluginManager *pm = PluginManager::instance();
|
|
|
|
|
QTC_ASSERT(pm, return);
|
|
|
|
|
QObject *rl = pm->getObjectByName(_("RemoteLinuxPlugin"));
|
|
|
|
|
QTC_ASSERT(rl, return);
|
|
|
|
|
QMetaObject::invokeMethod(rl, "attachToRemoteProcess", Qt::QueuedConnection);
|
|
|
|
|
// This will call back attachedtToProcess() below.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::attachedToProcess(const QString &channel,
|
|
|
|
|
const QString &sysroot, const QString &remoteCommandLine)
|
2011-12-06 15:39:25 +01:00
|
|
|
{
|
|
|
|
|
QString binary = remoteCommandLine.section(QLatin1Char(' '), 0, 0);
|
|
|
|
|
QString localExecutable;
|
|
|
|
|
QString candidate = sysroot + QLatin1Char('/') + binary;
|
|
|
|
|
if (QFileInfo(candidate).exists())
|
|
|
|
|
localExecutable = candidate;
|
|
|
|
|
if (localExecutable.isEmpty()) {
|
|
|
|
|
candidate = sysroot + QLatin1String("/usr/bin/") + binary;
|
|
|
|
|
if (QFileInfo(candidate).exists())
|
|
|
|
|
localExecutable = candidate;
|
|
|
|
|
}
|
|
|
|
|
if (localExecutable.isEmpty()) {
|
|
|
|
|
candidate = sysroot + QLatin1String("/bin/") + binary;
|
|
|
|
|
if (QFileInfo(candidate).exists())
|
|
|
|
|
localExecutable = candidate;
|
|
|
|
|
}
|
|
|
|
|
if (localExecutable.isEmpty()) {
|
|
|
|
|
QMessageBox::warning(mainWindow(), tr("Warning"),
|
|
|
|
|
tr("Cannot find local executable for remote process \"%1\".")
|
|
|
|
|
.arg(remoteCommandLine));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-13 15:07:32 +01:00
|
|
|
QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(localExecutable));
|
2011-12-06 15:39:25 +01:00
|
|
|
if (abis.isEmpty()) {
|
|
|
|
|
QMessageBox::warning(mainWindow(), tr("Warning"),
|
2011-12-13 16:17:43 +01:00
|
|
|
tr("Cannot find ABI for remote process \"%1\".")
|
2011-12-06 15:39:25 +01:00
|
|
|
.arg(remoteCommandLine));
|
2011-12-05 17:21:48 +01:00
|
|
|
return;
|
2011-12-06 15:39:25 +01:00
|
|
|
}
|
2011-12-05 17:21:48 +01:00
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.toolChainAbi = abis.at(0);
|
|
|
|
|
//sp.remoteArchitecture = abis.at(0).toString();
|
|
|
|
|
sp.displayName = tr("Remote: \"%1\"").arg(channel);
|
|
|
|
|
sp.remoteChannel = channel;
|
|
|
|
|
sp.sysroot = sysroot;
|
|
|
|
|
sp.executable = localExecutable;
|
|
|
|
|
sp.startMode = AttachToRemoteServer;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = KillAtClose;
|
2011-12-06 15:39:25 +01:00
|
|
|
sp.overrideStartScript.clear();
|
2011-12-05 17:21:48 +01:00
|
|
|
sp.useServerStartScript = false;
|
|
|
|
|
sp.serverStartScript.clear();
|
2011-12-06 15:39:25 +01:00
|
|
|
//sp.debugInfoLocation = dlg.debugInfoLocation();
|
2011-12-05 17:21:48 +01:00
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-13 17:26:02 +02:00
|
|
|
void DebuggerPluginPrivate::attachToQmlPort()
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
AttachToQmlPortDialog dlg(mainWindow());
|
|
|
|
|
|
|
|
|
|
const QVariant qmlServerAddress = configValue(_("LastQmlServerAddress"));
|
|
|
|
|
if (qmlServerAddress.isValid()) {
|
|
|
|
|
dlg.setHost(qmlServerAddress.toString());
|
|
|
|
|
} else {
|
|
|
|
|
dlg.setHost(sp.qmlServerAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QVariant qmlServerPort = configValue(_("LastQmlServerPort"));
|
|
|
|
|
if (qmlServerPort.isValid()) {
|
|
|
|
|
dlg.setPort(qmlServerPort.toInt());
|
|
|
|
|
} else {
|
|
|
|
|
dlg.setPort(sp.qmlServerPort);
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-11 15:21:00 +02:00
|
|
|
const QVariant sysrootPath = configValue(_("LastSysroot"));
|
|
|
|
|
if (sysrootPath.isValid())
|
|
|
|
|
dlg.setSysroot(sysrootPath.toString());
|
|
|
|
|
|
2011-09-13 17:26:02 +02:00
|
|
|
if (dlg.exec() != QDialog::Accepted)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
setConfigValue(_("LastQmlServerAddress"), dlg.host());
|
|
|
|
|
setConfigValue(_("LastQmlServerPort"), dlg.port());
|
2011-10-11 15:21:00 +02:00
|
|
|
setConfigValue(_("LastSysroot"), dlg.sysroot());
|
2011-09-13 17:26:02 +02:00
|
|
|
|
2011-09-14 16:58:10 +02:00
|
|
|
sp.qmlServerAddress = dlg.host();
|
|
|
|
|
sp.qmlServerPort = dlg.port();
|
2011-10-11 15:21:00 +02:00
|
|
|
sp.sysroot = dlg.sysroot();
|
2011-09-13 17:26:02 +02:00
|
|
|
|
2012-02-01 09:03:05 +01:00
|
|
|
sp.startMode = AttachToRemoteServer;
|
2012-03-26 16:03:25 +02:00
|
|
|
sp.closeMode = KillAtClose;
|
2012-02-21 10:13:52 +01:00
|
|
|
sp.languages = QmlLanguage;
|
2011-10-28 13:25:58 +02:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// get files from all the projects in the session
|
|
|
|
|
//
|
2011-12-06 15:39:25 +01:00
|
|
|
SessionManager *sessionManager = ProjectExplorerPlugin::instance()->session();
|
2011-10-28 13:25:58 +02:00
|
|
|
QList<Project *> projects = sessionManager->projects();
|
2011-12-06 15:39:25 +01:00
|
|
|
if (Project *startupProject = ProjectExplorerPlugin::instance()->startupProject()) {
|
2011-10-28 13:25:58 +02:00
|
|
|
// startup project first
|
2011-12-06 15:39:25 +01:00
|
|
|
projects.removeOne(ProjectExplorerPlugin::instance()->startupProject());
|
2011-10-28 13:25:58 +02:00
|
|
|
projects.insert(0, startupProject);
|
|
|
|
|
}
|
|
|
|
|
QStringList sourceFiles;
|
|
|
|
|
foreach (Project *project, projects)
|
|
|
|
|
sourceFiles << project->files(Project::ExcludeGeneratedFiles);
|
|
|
|
|
|
|
|
|
|
sp.projectSourceFiles = sourceFiles;
|
|
|
|
|
|
2011-09-13 17:26:02 +02:00
|
|
|
if (RunControl *rc = createDebugger(sp))
|
|
|
|
|
startDebugger(rc);
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
2011-02-15 13:33:52 +01:00
|
|
|
sp.connParams.userName = dlg.username();
|
|
|
|
|
sp.connParams.password = dlg.password();
|
2010-11-10 16:33:11 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
sp.connParams.timeout = 5;
|
2011-02-28 17:01:53 +01:00
|
|
|
sp.connParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword;
|
2010-12-02 13:20:06 +01:00
|
|
|
sp.connParams.port = 22;
|
2011-02-14 16:34:17 +01:00
|
|
|
sp.connParams.proxyType = Utils::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());
|
2011-02-03 14:08:01 +01:00
|
|
|
m_reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_reverseDirectionAction->setEnabled(value.toBool());
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-09-22 12:25:42 +02:00
|
|
|
|
2011-02-08 13:48:04 +01:00
|
|
|
void DebuggerPluginPrivate::runScheduled()
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2011-02-08 13:48:04 +01:00
|
|
|
foreach (const DebuggerStartParameters &sp, m_scheduledStarts) {
|
|
|
|
|
RunControl *rc = createDebugger(sp);
|
|
|
|
|
QTC_ASSERT(rc, qDebug() << "CANNOT CREATE RUN CONTROL"; continue);
|
|
|
|
|
showStatusMessage(sp.startMessage);
|
|
|
|
|
startDebugger(rc);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
{
|
2011-02-17 10:08:57 +01:00
|
|
|
if (!isEditorDebuggable(editor))
|
2010-12-02 13:20:06 +01:00
|
|
|
return;
|
|
|
|
|
ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
|
|
|
|
|
if (!textEditor)
|
|
|
|
|
return;
|
|
|
|
|
connect(textEditor,
|
2012-03-05 22:30:59 +01:00
|
|
|
SIGNAL(markRequested(TextEditor::ITextEditor*,int,TextEditor::ITextEditor::MarkRequestKind)),
|
|
|
|
|
SLOT(requestMark(TextEditor::ITextEditor*,int,TextEditor::ITextEditor::MarkRequestKind)));
|
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-02-04 14:36:50 +01:00
|
|
|
void DebuggerPluginPrivate::updateBreakMenuItem(Core::IEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
|
|
|
|
|
m_breakAction->setEnabled(textEditor != 0);
|
|
|
|
|
}
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2011-02-17 10:08:57 +01:00
|
|
|
if (!isEditorDebuggable(editor))
|
2010-12-02 13:20:06 +01:00
|
|
|
return;
|
2010-06-22 12:02:24 +02:00
|
|
|
|
2011-06-27 10:37:57 +02:00
|
|
|
BreakpointMenuContextData args;
|
2011-01-04 15:54:36 +01:00
|
|
|
args.lineNumber = lineNumber;
|
2011-02-23 10:16:11 +01:00
|
|
|
bool contextUsable = true;
|
2011-01-04 15:54:36 +01:00
|
|
|
|
2011-06-24 16:25:30 +02:00
|
|
|
BreakpointModelId id = BreakpointModelId();
|
2012-02-14 16:43:51 +01:00
|
|
|
const QString fileName = editor->document()->fileName();
|
2010-12-02 13:20:06 +01:00
|
|
|
if (editor->property("DisassemblerView").toBool()) {
|
2012-02-01 17:44:07 +01:00
|
|
|
args.fileName = fileName;
|
2010-12-02 13:20:06 +01:00
|
|
|
QString line = editor->contents()
|
2011-12-21 14:02:52 +01:00
|
|
|
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
|
2010-12-02 13:20:06 +01:00
|
|
|
BreakpointResponse needle;
|
|
|
|
|
needle.type = BreakpointByAddress;
|
2011-04-12 17:32:41 +02:00
|
|
|
needle.address = DisassemblerLine::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);
|
2011-02-23 10:16:11 +01:00
|
|
|
contextUsable = args.address != 0;
|
2010-12-02 13:20:06 +01:00
|
|
|
} else {
|
2012-02-14 16:43:51 +01:00
|
|
|
args.fileName = editor->document()->fileName();
|
2011-02-03 13:45:03 +01:00
|
|
|
id = breakHandler()
|
|
|
|
|
->findBreakpointByFileAndLine(args.fileName, lineNumber);
|
2012-01-10 13:19:46 +01:00
|
|
|
if (!id)
|
|
|
|
|
id = breakHandler()->findBreakpointByFileAndLine(args.fileName, lineNumber, false);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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);
|
2011-06-15 14:02:26 +02:00
|
|
|
act->setData(QVariant::fromValue(id));
|
|
|
|
|
act->setText(tr("Remove Breakpoint %1").arg(id.toString()));
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2011-06-15 14:02:26 +02:00
|
|
|
act->setData(QVariant::fromValue(id));
|
2010-12-02 13:20:06 +01:00
|
|
|
if (breakHandler()->isEnabled(id)) {
|
2011-06-15 14:02:26 +02:00
|
|
|
act->setText(tr("Disable Breakpoint %1").arg(id.toString()));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()),
|
|
|
|
|
SLOT(breakpointDisableMarginActionTriggered()));
|
|
|
|
|
} else {
|
2011-06-15 14:02:26 +02:00
|
|
|
act->setText(tr("Enable Breakpoint %1").arg(id.toString()));
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2011-06-15 14:02:26 +02:00
|
|
|
act->setText(tr("Edit Breakpoint %1...").arg(id.toString()));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(slotEditBreakpoint()));
|
2011-06-15 14:02:26 +02:00
|
|
|
act->setData(QVariant::fromValue(id));
|
2010-12-02 13:20:06 +01:00
|
|
|
menu->addAction(act);
|
|
|
|
|
} else {
|
|
|
|
|
// Handle non-existing breakpoint.
|
2011-02-23 10:16:11 +01:00
|
|
|
const QString text = args.address
|
|
|
|
|
? tr("Set Breakpoint at 0x%1").arg(args.address, 0, 16)
|
2012-03-20 18:05:12 +01:00
|
|
|
: tr("Set Breakpoint at Line %1").arg(lineNumber);
|
2010-12-02 13:20:06 +01:00
|
|
|
QAction *act = new QAction(text, menu);
|
2011-01-04 15:54:36 +01:00
|
|
|
act->setData(QVariant::fromValue(args));
|
2011-02-23 10:16:11 +01:00
|
|
|
act->setEnabled(contextUsable);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()),
|
|
|
|
|
SLOT(breakpointSetMarginActionTriggered()));
|
|
|
|
|
menu->addAction(act);
|
2011-06-27 10:37:57 +02:00
|
|
|
// Message trace point
|
|
|
|
|
args.mode = BreakpointMenuContextData::MessageTracePoint;
|
|
|
|
|
const QString tracePointText = args.address
|
|
|
|
|
? tr("Set Message Tracepoint at 0x%1...").arg(args.address, 0, 16)
|
2012-03-20 18:05:12 +01:00
|
|
|
: tr("Set Message Tracepoint at Line %1...").arg(lineNumber);
|
2011-06-27 10:37:57 +02:00
|
|
|
act = new QAction(tracePointText, menu);
|
|
|
|
|
act->setData(QVariant::fromValue(args));
|
|
|
|
|
act->setEnabled(contextUsable);
|
|
|
|
|
connect(act, SIGNAL(triggered()),
|
|
|
|
|
SLOT(breakpointSetMarginActionTriggered()));
|
|
|
|
|
menu->addAction(act);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
|
|
|
|
// Run to, jump to line below in stopped state.
|
2011-02-23 10:16:11 +01:00
|
|
|
if (currentEngine()->state() == InferiorStopOk && contextUsable) {
|
2010-12-02 13:20:06 +01:00
|
|
|
menu->addSeparator();
|
2012-01-12 20:28:17 +01:00
|
|
|
if (currentEngine()->hasCapability(RunToLineCapability)) {
|
2011-04-01 19:47:39 +02:00
|
|
|
const QString runText = args.address
|
|
|
|
|
? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16)
|
|
|
|
|
: DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber);
|
|
|
|
|
QAction *runToLineAction = new QAction(runText, menu);
|
|
|
|
|
runToLineAction->setData(QVariant::fromValue(args));
|
|
|
|
|
connect(runToLineAction, SIGNAL(triggered()), SLOT(slotRunToLine()));
|
|
|
|
|
menu->addAction(runToLineAction);
|
|
|
|
|
}
|
2012-01-12 20:28:17 +01:00
|
|
|
if (currentEngine()->hasCapability(JumpToLineCapability)) {
|
2011-02-23 10:16:11 +01:00
|
|
|
const QString jumpText = args.address
|
|
|
|
|
? DebuggerEngine::tr("Jump to Address 0x%1").arg(args.address, 0, 16)
|
|
|
|
|
: DebuggerEngine::tr("Jump to Line %1").arg(args.lineNumber);
|
2010-12-02 13:20:06 +01:00
|
|
|
QAction *jumpToLineAction = new QAction(jumpText, menu);
|
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);
|
|
|
|
|
}
|
2012-02-01 17:44:07 +01:00
|
|
|
// Disassemble current function in stopped state.
|
|
|
|
|
if (currentEngine()->state() == InferiorStopOk
|
|
|
|
|
&& currentEngine()->hasCapability(DisassemblerCapability)) {
|
|
|
|
|
StackFrame frame;
|
|
|
|
|
frame.function = cppFunctionAt(fileName, lineNumber);
|
|
|
|
|
frame.line = 42; // trick gdb into mixed mode.
|
|
|
|
|
if (!frame.function.isEmpty()) {
|
2012-03-20 18:05:12 +01:00
|
|
|
const QString text = tr("Disassemble Function \"%1\"")
|
|
|
|
|
.arg(frame.function);
|
2012-02-01 17:44:07 +01:00
|
|
|
QAction *disassembleAction = new QAction(text, menu);
|
|
|
|
|
disassembleAction->setData(QVariant::fromValue(frame));
|
|
|
|
|
connect(disassembleAction, SIGNAL(triggered()), SLOT(slotDisassembleFunction()));
|
|
|
|
|
menu->addAction(disassembleAction );
|
|
|
|
|
}
|
|
|
|
|
}
|
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()
|
2011-12-21 14:02:52 +01:00
|
|
|
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
|
2011-04-12 17:32:41 +02:00
|
|
|
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
|
2010-12-02 13:20:06 +01:00
|
|
|
toggleBreakpointByAddress(address);
|
|
|
|
|
} else if (lineNumber >= 0) {
|
2012-02-14 16:43:51 +01:00
|
|
|
toggleBreakpointByFileAndLine(textEditor->document()->fileName(), lineNumber);
|
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::toggleBreakpointByFileAndLine(const QString &fileName,
|
2011-06-27 10:37:57 +02:00
|
|
|
int lineNumber, const QString &tracePointMessage)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
|
|
|
|
BreakHandler *handler = m_breakHandler;
|
2011-06-24 16:25:30 +02:00
|
|
|
BreakpointModelId id =
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2011-06-27 10:37:57 +02:00
|
|
|
data.tracepoint = !tracePointMessage.isEmpty();
|
|
|
|
|
data.message = tracePointMessage;
|
2010-12-02 13:20:06 +01:00
|
|
|
data.fileName = fileName;
|
|
|
|
|
data.lineNumber = lineNumber;
|
|
|
|
|
handler->appendBreakpoint(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-06-27 10:37:57 +02:00
|
|
|
void DebuggerPluginPrivate::toggleBreakpointByAddress(quint64 address,
|
|
|
|
|
const QString &tracePointMessage)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
|
|
|
|
BreakHandler *handler = m_breakHandler;
|
2011-06-24 16:25:30 +02:00
|
|
|
BreakpointModelId 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);
|
2011-06-27 10:37:57 +02:00
|
|
|
data.tracepoint = !tracePointMessage.isEmpty();
|
|
|
|
|
data.message = tracePointMessage;
|
2010-12-02 13:20:06 +01:00
|
|
|
data.address = address;
|
|
|
|
|
handler->appendBreakpoint(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-11-09 10:23:10 +01:00
|
|
|
|
2011-11-29 13:51:00 +01:00
|
|
|
void DebuggerPluginPrivate::requestMark(ITextEditor *editor,
|
|
|
|
|
int lineNumber,
|
|
|
|
|
ITextEditor::MarkRequestKind kind)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2011-11-29 13:51:00 +01:00
|
|
|
if (kind != ITextEditor::BreakpointRequest)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (editor->property("DisassemblerView").toBool()) {
|
|
|
|
|
QString line = editor->contents()
|
2011-12-21 14:02:52 +01:00
|
|
|
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
|
2011-04-12 17:32:41 +02:00
|
|
|
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
|
2010-12-02 13:20:06 +01:00
|
|
|
toggleBreakpointByAddress(address);
|
2012-02-14 16:43:51 +01:00
|
|
|
} else if (editor->document()) {
|
|
|
|
|
toggleBreakpointByFileAndLine(editor->document()->fileName(), lineNumber);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
DebuggerRunControl *DebuggerPluginPrivate::createDebugger
|
2011-09-26 12:38:17 +02:00
|
|
|
(const DebuggerStartParameters &sp0, RunConfiguration *rc)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2011-09-26 12:38:17 +02:00
|
|
|
DebuggerStartParameters sp = sp0;
|
|
|
|
|
maybeEnrichParameters(&sp);
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2012-01-10 19:17:24 +01:00
|
|
|
ProjectExplorerPlugin::instance()->startRunControl(rc, DebugRunMode);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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());
|
2011-09-01 16:36:27 +02:00
|
|
|
//m_threadBox->setModel(engine->threadsModel());
|
|
|
|
|
//m_threadBox->setModelColumn(ThreadData::ComboNameColumn);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_watchersWindow->setModel(engine->watchersModel());
|
2012-02-15 12:35:43 +01:00
|
|
|
m_qtMessageLogWindow->setModel(engine->qtMessageLogModel());
|
2011-10-06 17:38:28 +02:00
|
|
|
|
2011-02-23 16:09:56 +01:00
|
|
|
engine->watchHandler()->rebuildModel();
|
2011-10-12 16:30:14 +02:00
|
|
|
|
|
|
|
|
mainWindow()->setEngineDebugLanguages(engine->languages());
|
2012-03-13 13:50:05 +01:00
|
|
|
mainWindow()->setCurrentEngine(engine);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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)
|
|
|
|
|
{
|
2011-04-01 12:01:14 +02:00
|
|
|
if (!boolSetting(FontSizeFollowsEditor))
|
|
|
|
|
return;
|
2010-12-02 13:20:06 +01:00
|
|
|
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()
|
|
|
|
|
{
|
2011-02-03 14:08:01 +01:00
|
|
|
m_reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_reverseDirectionAction->setEnabled(false);
|
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()
|
2012-02-14 16:43:51 +01:00
|
|
|
|| (!editor->document()->isModified()
|
2010-12-02 13:20:06 +01:00
|
|
|
&& 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);
|
|
|
|
|
}
|
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);
|
2011-02-03 14:08:01 +01:00
|
|
|
m_reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_reverseDirectionAction->setEnabled(false);
|
2011-02-11 15:00:13 +01:00
|
|
|
m_toolTipManager->closeAllToolTips();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-12-08 16:31:21 +01:00
|
|
|
m_startLocalProcessAction->setEnabled(true);
|
|
|
|
|
m_attachToLocalProcessAction->setEnabled(true);
|
2011-09-13 17:26:02 +02:00
|
|
|
m_attachToQmlPortAction->setEnabled(true);
|
2011-12-05 17:21:48 +01:00
|
|
|
m_attachToCoreAction->setEnabled(true);
|
|
|
|
|
m_startRemoteProcessAction->setEnabled(true);
|
|
|
|
|
m_attachToRemoteServerAction->setEnabled(true);
|
2011-12-08 16:31:21 +01:00
|
|
|
m_attachToRemoteProcessAction->setEnabled(true);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_detachAction->setEnabled(false);
|
2010-07-22 10:23:27 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
m_watchAction1->setEnabled(true);
|
|
|
|
|
m_watchAction2->setEnabled(true);
|
2011-02-04 14:36:50 +01:00
|
|
|
m_breakAction->setEnabled(false);
|
2011-02-03 14:08:01 +01:00
|
|
|
//m_snapshotAction->setEnabled(false);
|
2010-12-02 13:20:06 +01:00
|
|
|
action(OperateByInstruction)->setEnabled(false);
|
2010-10-05 12:47:23 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
m_exitAction->setEnabled(false);
|
2011-10-31 16:15:48 +01:00
|
|
|
m_abortAction->setEnabled(false);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-04 14:36:50 +01:00
|
|
|
m_interruptAction->setEnabled(false);
|
|
|
|
|
m_continueAction->setEnabled(false);
|
|
|
|
|
|
2011-05-02 18:22:32 +02:00
|
|
|
m_stepAction->setEnabled(true);
|
2011-02-03 14:08:01 +01:00
|
|
|
m_stepOutAction->setEnabled(false);
|
|
|
|
|
m_runToLineAction->setEnabled(false);
|
|
|
|
|
m_runToSelectedFunctionAction->setEnabled(true);
|
|
|
|
|
m_returnFromFunctionAction->setEnabled(false);
|
|
|
|
|
m_jumpToLineAction->setEnabled(false);
|
2011-05-02 18:22:32 +02:00
|
|
|
m_nextAction->setEnabled(true);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
action(AutoDerefPointers)->setEnabled(true);
|
|
|
|
|
action(ExpandStack)->setEnabled(false);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 12:35:43 +01:00
|
|
|
m_qtMessageLogWindow->setEnabled(true);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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
|
|
|
|
2011-01-04 16:05:53 +01:00
|
|
|
if (state == DebuggerNotReady) {
|
2011-08-03 18:57:37 +02:00
|
|
|
QTC_ASSERT(false, /* We use the Core's m_debugAction here */);
|
2010-12-02 13:20:06 +01:00
|
|
|
// F5 starts debugging. It is "startable".
|
2011-02-03 14:08:01 +01:00
|
|
|
m_interruptAction->setEnabled(false);
|
|
|
|
|
m_continueAction->setEnabled(false);
|
|
|
|
|
m_exitAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction->setEnabled(true);
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(true);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_visibleStartAction->setAction(m_startAction);
|
|
|
|
|
m_hiddenStopAction->setAction(m_undisturbableAction);
|
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".
|
2011-02-03 14:08:01 +01:00
|
|
|
m_interruptAction->setEnabled(false);
|
|
|
|
|
m_continueAction->setEnabled(true);
|
|
|
|
|
m_exitAction->setEnabled(true);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction->setEnabled(false);
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_visibleStartAction->setAction(m_continueAction);
|
|
|
|
|
m_hiddenStopAction->setAction(m_exitAction);
|
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".
|
2011-02-03 14:08:01 +01:00
|
|
|
m_interruptAction->setEnabled(true);
|
|
|
|
|
m_continueAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_exitAction->setEnabled(true);
|
|
|
|
|
m_startAction->setEnabled(false);
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_visibleStartAction->setAction(m_interruptAction);
|
|
|
|
|
m_hiddenStopAction->setAction(m_interruptAction);
|
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.
|
2011-02-03 14:08:01 +01:00
|
|
|
m_interruptAction->setEnabled(false);
|
|
|
|
|
m_continueAction->setEnabled(false);
|
|
|
|
|
m_exitAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction->setEnabled(true);
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(true);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_visibleStartAction->setAction(m_startAction);
|
|
|
|
|
m_hiddenStopAction->setAction(m_undisturbableAction);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_codeModelSnapshot = CPlusPlus::Snapshot();
|
|
|
|
|
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.
|
2011-02-03 14:08:01 +01:00
|
|
|
m_interruptAction->setEnabled(false);
|
|
|
|
|
m_continueAction->setEnabled(false);
|
|
|
|
|
m_exitAction->setEnabled(true);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction->setEnabled(false);
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(false);
|
2012-01-11 19:29:01 +01:00
|
|
|
m_visibleStartAction->setAction(m_undisturbableAction);
|
|
|
|
|
m_hiddenStopAction->setAction(m_exitAction);
|
2010-12-02 13:20:06 +01:00
|
|
|
} else {
|
|
|
|
|
// Everything else is "undisturbable".
|
2011-02-03 14:08:01 +01:00
|
|
|
m_interruptAction->setEnabled(false);
|
|
|
|
|
m_continueAction->setEnabled(false);
|
|
|
|
|
m_exitAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction->setEnabled(false);
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(false);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_visibleStartAction->setAction(m_undisturbableAction);
|
|
|
|
|
m_hiddenStopAction->setAction(m_undisturbableAction);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2011-12-08 16:31:21 +01:00
|
|
|
m_startLocalProcessAction->setEnabled(true);
|
2011-09-13 17:26:02 +02:00
|
|
|
m_attachToQmlPortAction->setEnabled(true);
|
2011-12-08 16:31:21 +01:00
|
|
|
m_attachToLocalProcessAction->setEnabled(true);
|
2011-12-05 17:21:48 +01:00
|
|
|
m_attachToCoreAction->setEnabled(true);
|
|
|
|
|
m_startRemoteProcessAction->setEnabled(true);
|
|
|
|
|
m_attachToRemoteServerAction->setEnabled(true);
|
2011-12-06 15:39:25 +01:00
|
|
|
m_attachToRemoteProcessAction->setEnabled(true);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-03-26 17:30:57 +02:00
|
|
|
m_threadBox->setEnabled(state == InferiorStopOk);
|
|
|
|
|
|
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
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
const bool canReverse = engine->hasCapability(ReverseSteppingCapability)
|
2010-12-02 13:20:06 +01:00
|
|
|
&& boolSetting(EnableReverseDebugging);
|
2011-02-03 14:08:01 +01:00
|
|
|
m_reverseDirectionAction->setEnabled(canReverse);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
m_watchAction1->setEnabled(true);
|
|
|
|
|
m_watchAction2->setEnabled(true);
|
|
|
|
|
m_breakAction->setEnabled(true);
|
2009-05-25 17:19:42 +02:00
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
const bool canOperateByInstruction = engine->hasCapability(OperateByInstructionCapability)
|
2011-04-01 19:47:39 +02:00
|
|
|
&& (stopped || isCore);
|
|
|
|
|
action(OperateByInstruction)->setEnabled(canOperateByInstruction);
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2011-10-31 16:15:48 +01:00
|
|
|
m_abortAction->setEnabled(state != DebuggerNotReady
|
2011-01-04 16:05:53 +01:00
|
|
|
&& state != DebuggerFinished);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-05-02 18:22:32 +02:00
|
|
|
m_stepAction->setEnabled(stopped || state == DebuggerNotReady);
|
|
|
|
|
m_nextAction->setEnabled(stopped || state == DebuggerNotReady);
|
2011-07-18 17:23:42 +02:00
|
|
|
m_stepAction->setToolTip(QString());
|
|
|
|
|
m_nextAction->setToolTip(QString());
|
2011-05-02 18:22:32 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
m_stepOutAction->setEnabled(stopped);
|
2012-01-12 20:28:17 +01:00
|
|
|
m_runToLineAction->setEnabled(stopped && engine->hasCapability(RunToLineCapability));
|
2011-02-03 14:08:01 +01:00
|
|
|
m_runToSelectedFunctionAction->setEnabled(stopped);
|
|
|
|
|
m_returnFromFunctionAction->
|
2012-01-12 20:28:17 +01:00
|
|
|
setEnabled(stopped && engine->hasCapability(ReturnFromFunctionCapability));
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
const bool canJump = stopped && engine->hasCapability(JumpToLineCapability);
|
2011-02-03 14:08:01 +01:00
|
|
|
m_jumpToLineAction->setEnabled(canJump);
|
2010-06-07 13:17:19 +02:00
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
const bool canDeref = actionsEnabled && engine->hasCapability(AutoDerefPointersCapability);
|
2010-12-02 13:20:06 +01:00
|
|
|
action(AutoDerefPointers)->setEnabled(canDeref);
|
|
|
|
|
action(AutoDerefPointers)->setEnabled(true);
|
|
|
|
|
action(ExpandStack)->setEnabled(actionsEnabled);
|
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
|
|
|
}
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::updateDebugActions()
|
|
|
|
|
{
|
2011-10-13 13:22:26 +02:00
|
|
|
//if we're currently debugging the actions are controlled by engine
|
|
|
|
|
if (m_currentEngine->state() != DebuggerNotReady)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
Project *project = pe->startupProject();
|
2012-01-10 19:17:24 +01:00
|
|
|
const bool canRun = pe->canRun(project, DebugRunMode);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_startAction->setEnabled(canRun);
|
2012-01-10 19:17:24 +01:00
|
|
|
m_startAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, DebugRunMode));
|
2011-10-25 18:23:37 +08:00
|
|
|
m_debugWithoutDeployAction->setEnabled(canRun);
|
2011-07-18 17:23:42 +02:00
|
|
|
|
|
|
|
|
// Step into/next: Start and break at 'main' unless a debugger is running.
|
|
|
|
|
if (m_snapshotHandler->currentIndex() < 0) {
|
2012-01-10 19:17:24 +01:00
|
|
|
const bool canRunAndBreakMain = pe->canRun(project, DebugRunModeWithBreakOnMain);
|
2011-07-18 17:23:42 +02:00
|
|
|
m_stepAction->setEnabled(canRunAndBreakMain);
|
|
|
|
|
m_nextAction->setEnabled(canRunAndBreakMain);
|
|
|
|
|
QString toolTip;
|
|
|
|
|
if (canRunAndBreakMain) {
|
|
|
|
|
QTC_ASSERT(project, return ; );
|
|
|
|
|
toolTip = tr("Start '%1' and break at function 'main()'")
|
|
|
|
|
.arg(project->displayName());
|
|
|
|
|
} else {
|
2012-01-10 19:17:24 +01:00
|
|
|
// Do not display long tooltip saying run mode is not supported
|
|
|
|
|
// for project for projects to which 'break at main' is not applicable.
|
2011-07-18 17:23:42 +02:00
|
|
|
if (!canRun)
|
2012-01-10 19:17:24 +01:00
|
|
|
toolTip = pe->cannotRunReason(project, DebugRunModeWithBreakOnMain);
|
2011-07-18 17:23:42 +02:00
|
|
|
}
|
|
|
|
|
m_stepAction->setToolTip(toolTip);
|
|
|
|
|
m_nextAction->setToolTip(toolTip);
|
|
|
|
|
}
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-01-31 15:17:53 +01:00
|
|
|
void DebuggerPluginPrivate::onCoreAboutToOpen()
|
|
|
|
|
{
|
2012-01-26 01:18:02 +01:00
|
|
|
m_mainWindow->onModeChanged(ModeManager::currentMode());
|
2011-01-31 15:17:53 +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
|
|
|
|
2011-12-21 14:02:52 +01:00
|
|
|
if (mode->id() != QLatin1String(Constants::MODE_DEBUG)) {
|
2011-02-11 15:00:13 +01:00
|
|
|
m_toolTipManager->leavingDebugMode();
|
2010-12-02 13:20:06 +01:00
|
|
|
return;
|
2011-02-11 15:00:13 +01:00
|
|
|
}
|
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();
|
2011-02-11 15:00:13 +01:00
|
|
|
m_toolTipManager->debugModeEntered();
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-11-26 15:10:10 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::showSettingsDialog()
|
|
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
ICore::showOptionsDialog(
|
2010-12-02 13:20:06 +01:00
|
|
|
_(DEBUGGER_SETTINGS_CATEGORY),
|
|
|
|
|
_(DEBUGGER_COMMON_SETTINGS_ID));
|
|
|
|
|
}
|
2010-04-06 16:42:24 +02:00
|
|
|
|
2011-10-25 18:23:37 +08:00
|
|
|
void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
|
|
|
|
|
{
|
|
|
|
|
const bool state = ProjectExplorerPlugin::instance()->projectExplorerSettings().deployBeforeRun;
|
|
|
|
|
m_debugWithoutDeployAction->setVisible(state);
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
2011-03-30 15:15:15 +02:00
|
|
|
Utils::FileSaver saver(fileName);
|
|
|
|
|
if (!saver.hasError()) {
|
|
|
|
|
QTextStream ts(saver.file());
|
|
|
|
|
ts << m_logWindow->inputContents();
|
|
|
|
|
ts << "\n\n=======================================\n\n";
|
|
|
|
|
ts << m_logWindow->combinedContents();
|
|
|
|
|
saver.setResult(&ts);
|
|
|
|
|
}
|
|
|
|
|
saver.finalize(mainWindow());
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2009-01-13 18:15:24 +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()
|
|
|
|
|
{
|
2012-01-26 01:18:02 +01:00
|
|
|
if (ModeManager::currentMode() == ModeManager::mode(QLatin1String(MODE_DEBUG))
|
2010-12-02 13:20:06 +01:00
|
|
|
&& !m_previousMode.isEmpty()) {
|
2012-01-26 01:18:02 +01:00
|
|
|
ModeManager::activateMode(m_previousMode);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_previousMode.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::activateDebugMode()
|
|
|
|
|
{
|
2011-02-03 14:08:01 +01:00
|
|
|
m_reverseDirectionAction->setChecked(false);
|
|
|
|
|
m_reverseDirectionAction->setEnabled(false);
|
2012-01-26 01:18:02 +01:00
|
|
|
m_previousMode = ModeManager::currentMode()->id();
|
|
|
|
|
ModeManager::activateMode(_(MODE_DEBUG));
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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();
|
2011-02-11 15:00:13 +01:00
|
|
|
m_toolTipManager->loadSessionData();
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
void DebuggerPluginPrivate::aboutToUnloadSession()
|
|
|
|
|
{
|
|
|
|
|
m_breakHandler->removeSessionData();
|
2011-02-11 15:00:13 +01:00
|
|
|
m_toolTipManager->sessionAboutToChange();
|
2010-12-02 13:20:06 +01:00
|
|
|
// 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()
|
|
|
|
|
{
|
2011-02-28 18:48:06 +01:00
|
|
|
dummyEngine()->watchHandler()->saveSessionData();
|
2011-02-11 15:00:13 +01:00
|
|
|
m_toolTipManager->saveSessionData();
|
2010-12-02 13:20:06 +01:00
|
|
|
m_breakHandler->saveSessionData();
|
|
|
|
|
}
|
2009-02-27 11:41:19 +01:00
|
|
|
|
2011-02-16 12:41:06 +01:00
|
|
|
void DebuggerPluginPrivate::executeDebuggerCommand(const QString &command)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2011-02-16 12:41:06 +01:00
|
|
|
if (currentEngine()->acceptsDebuggerCommands())
|
|
|
|
|
currentEngine()->executeDebuggerCommand(command);
|
|
|
|
|
else
|
|
|
|
|
showStatusMessage(tr("User commands are not accepted in the current state."));
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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;
|
2011-03-16 13:49:28 +01:00
|
|
|
msg.remove(QLatin1Char('\n'));
|
|
|
|
|
m_statusLabel->showStatusMessage(msg, timeout);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-03-11 11:07:16 +01:00
|
|
|
|
2012-02-15 12:35:43 +01:00
|
|
|
bool DebuggerPluginPrivate::evaluateScriptExpression(const QString &expression)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
2012-02-15 12:35:43 +01:00
|
|
|
return currentEngine()->evaluateScriptExpression(expression);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
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)
|
2011-04-19 12:17:48 +02:00
|
|
|
currentEngine()->openMemoryView(dialog.address(), 0, QList<MemoryMarkup>(), QPoint());
|
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;
|
2012-02-22 12:46:47 +01:00
|
|
|
case LogError:
|
|
|
|
|
m_logWindow->showInput(LogError, QLatin1String("ERROR: ") + msg);
|
|
|
|
|
m_logWindow->showOutput(LogError, QLatin1String("ERROR: ") + msg);
|
2010-12-02 13:20:06 +01:00
|
|
|
break;
|
2012-02-15 12:35:43 +01:00
|
|
|
case QtMessageLogStatus:
|
|
|
|
|
QTC_ASSERT(m_qtMessageLogWindow, return);
|
|
|
|
|
m_qtMessageLogWindow->showStatus(msg, timeout);
|
|
|
|
|
break;
|
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());
|
2011-10-31 15:58:21 +01:00
|
|
|
QPushButton *qtPref = dialog.addButton(tr("Open Qt Options"),
|
2010-12-02 13:20:06 +01:00
|
|
|
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. "
|
2012-02-07 00:39:34 +01:00
|
|
|
"In the Qt Creator Build and Run preferences page, select a Qt version, "
|
|
|
|
|
"expand the Details section and click Build All."));
|
2010-12-02 13:20:06 +01:00
|
|
|
if (!details.isEmpty())
|
|
|
|
|
dialog.setDetailedText(details);
|
|
|
|
|
dialog.exec();
|
|
|
|
|
if (dialog.clickedButton() == qtPref) {
|
2012-01-24 15:36:40 +01:00
|
|
|
ICore::showOptionsDialog(
|
2011-09-15 19:20:50 +02:00
|
|
|
_(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
|
2011-05-20 21:40:53 +02:00
|
|
|
_(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
|
2010-12-02 13:20:06 +01:00
|
|
|
} 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
|
|
|
|
2011-02-25 13:43:06 +01:00
|
|
|
static QString formatStartParameters(DebuggerStartParameters &sp)
|
|
|
|
|
{
|
|
|
|
|
QString rc;
|
|
|
|
|
QTextStream str(&rc);
|
|
|
|
|
str << "Start parameters: '" << sp.displayName << "' mode: " << sp.startMode
|
|
|
|
|
<< "\nABI: " << sp.toolChainAbi.toString() << '\n';
|
2012-02-01 09:03:05 +01:00
|
|
|
str << "Languages: ";
|
|
|
|
|
if (sp.languages == AnyLanguage)
|
|
|
|
|
str << "any";
|
|
|
|
|
if (sp.languages & CppLanguage)
|
|
|
|
|
str << "c++ ";
|
|
|
|
|
if (sp.languages & QmlLanguage)
|
|
|
|
|
str << "qml";
|
|
|
|
|
str << '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
if (!sp.executable.isEmpty()) {
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "Executable: " << QDir::toNativeSeparators(sp.executable)
|
|
|
|
|
<< ' ' << sp.processArgs;
|
2011-02-25 13:43:06 +01:00
|
|
|
if (sp.useTerminal)
|
|
|
|
|
str << " [terminal]";
|
|
|
|
|
str << '\n';
|
|
|
|
|
if (!sp.workingDirectory.isEmpty())
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "Directory: " << QDir::toNativeSeparators(sp.workingDirectory)
|
|
|
|
|
<< '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
if (sp.executableUid) {
|
|
|
|
|
str << "UID: 0x";
|
|
|
|
|
str.setIntegerBase(16);
|
|
|
|
|
str << sp.executableUid << '\n';
|
|
|
|
|
str.setIntegerBase(10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!sp.debuggerCommand.isEmpty())
|
|
|
|
|
str << "Debugger: " << QDir::toNativeSeparators(sp.debuggerCommand) << '\n';
|
|
|
|
|
if (!sp.coreFile.isEmpty())
|
|
|
|
|
str << "Core: " << QDir::toNativeSeparators(sp.coreFile) << '\n';
|
|
|
|
|
if (sp.attachPID > 0)
|
|
|
|
|
str << "PID: " << sp.attachPID << ' ' << sp.crashParameter << '\n';
|
2011-04-26 09:46:05 +02:00
|
|
|
if (!sp.projectSourceDirectory.isEmpty()) {
|
|
|
|
|
str << "Project: " << QDir::toNativeSeparators(sp.projectSourceDirectory);
|
|
|
|
|
if (!sp.projectBuildDirectory.isEmpty())
|
2011-09-26 12:38:17 +02:00
|
|
|
str << " (built: " << QDir::toNativeSeparators(sp.projectBuildDirectory)
|
|
|
|
|
<< ')';
|
2011-02-25 13:43:06 +01:00
|
|
|
str << '\n';
|
|
|
|
|
}
|
2011-03-18 10:02:07 +01:00
|
|
|
if (!sp.qtInstallPath.isEmpty())
|
|
|
|
|
str << "Qt: " << QDir::toNativeSeparators(sp.qtInstallPath) << '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
if (!sp.qmlServerAddress.isEmpty())
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "QML server: " << sp.qmlServerAddress << ':'
|
|
|
|
|
<< sp.qmlServerPort << '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
if (!sp.remoteChannel.isEmpty()) {
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "Remote: " << sp.remoteChannel << ", "
|
|
|
|
|
<< sp.remoteArchitecture << '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
if (!sp.remoteDumperLib.isEmpty())
|
|
|
|
|
str << "Remote dumpers: " << sp.remoteDumperLib << '\n';
|
|
|
|
|
if (!sp.remoteSourcesDir.isEmpty())
|
|
|
|
|
str << "Remote sources: " << sp.remoteSourcesDir << '\n';
|
|
|
|
|
if (!sp.remoteMountPoint.isEmpty())
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "Remote mount point: " << sp.remoteMountPoint
|
|
|
|
|
<< " Local: " << sp.localMountDir << '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
}
|
|
|
|
|
if (!sp.gnuTarget.isEmpty())
|
|
|
|
|
str << "Gnu target: " << sp.gnuTarget << '\n';
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "Sysroot: " << sp.sysroot << '\n';
|
2011-12-21 14:02:52 +01:00
|
|
|
str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1String(":")) << '\n';
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "Symbol file: " << sp.symbolFileName << '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
if (sp.useServerStartScript)
|
|
|
|
|
str << "Using server start script: " << sp.serverStartScript;
|
2011-09-26 12:38:17 +02:00
|
|
|
str << "Dumper libraries: " << QDir::toNativeSeparators(sp.dumperLibrary);
|
|
|
|
|
foreach (const QString &dl, sp.dumperLibraryLocations)
|
|
|
|
|
str << ' ' << QDir::toNativeSeparators(dl);
|
|
|
|
|
str << '\n';
|
2011-02-25 13:43:06 +01:00
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 10:01:29 +01:00
|
|
|
void DebuggerPluginPrivate::runControlStarted(DebuggerEngine *engine)
|
2010-12-02 13:20:06 +01:00
|
|
|
{
|
|
|
|
|
activateDebugMode();
|
2012-03-07 16:40:54 +01:00
|
|
|
const QString message = tr("Starting debugger \"%1\" for ABI \"%2\"...")
|
2011-02-01 18:36:00 +01:00
|
|
|
.arg(engine->objectName())
|
|
|
|
|
.arg(engine->startParameters().toolChainAbi.toString());
|
2012-03-07 16:40:54 +01:00
|
|
|
showStatusMessage(message);
|
2011-02-25 13:43:06 +01:00
|
|
|
showMessage(formatStartParameters(engine->startParameters()), LogDebug);
|
2010-12-02 13:20:06 +01:00
|
|
|
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
|
|
|
{
|
2011-02-22 18:45:52 +01:00
|
|
|
showStatusMessage(tr("Debugger finished."));
|
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);
|
|
|
|
|
}
|
2011-05-02 15:05:16 +02:00
|
|
|
action(OperateByInstruction)->setValue(QVariant(false));
|
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;
|
|
|
|
|
|
2011-02-08 13:48:04 +01:00
|
|
|
if (!parseArguments(options, &enabledEngines, &errorMessage)) {
|
2010-12-02 13:20:06 +01:00
|
|
|
qWarning("%s", qPrintable(errorMessage));
|
2010-06-16 11:08:54 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2011-02-08 13:48:04 +01:00
|
|
|
runScheduled();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
QString DebuggerPluginPrivate::debuggerForAbi(const Abi &abi, DebuggerEngineType et) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-02-25 09:34:31 +01:00
|
|
|
enum { debug = 0 };
|
2011-03-22 10:22:55 +01:00
|
|
|
QList<Abi> searchAbis;
|
|
|
|
|
searchAbis.push_back(abi);
|
2011-03-16 17:59:43 +01:00
|
|
|
// Pick the right tool chain in case cdb/gdb were started with other tool chains.
|
2011-02-24 16:50:15 +01:00
|
|
|
// Also, lldb should be preferred over gdb.
|
2011-12-06 15:39:25 +01:00
|
|
|
if (abi.os() == Abi::WindowsOS) {
|
2011-02-24 16:50:15 +01:00
|
|
|
switch (et) {
|
|
|
|
|
case CdbEngineType:
|
2011-03-22 10:22:55 +01:00
|
|
|
searchAbis.clear();
|
2011-09-26 12:38:17 +02:00
|
|
|
searchAbis.push_back(Abi(abi.architecture(), abi.os(),
|
|
|
|
|
Abi::WindowsMsvc2010Flavor, abi.binaryFormat(), abi.wordWidth()));
|
|
|
|
|
searchAbis.push_back(Abi(abi.architecture(), abi.os(),
|
|
|
|
|
Abi::WindowsMsvc2008Flavor, abi.binaryFormat(), abi.wordWidth()));
|
|
|
|
|
searchAbis.push_back(Abi(abi.architecture(), abi.os(),
|
|
|
|
|
Abi::WindowsMsvc2005Flavor, abi.binaryFormat(), abi.wordWidth()));
|
2011-02-24 16:50:15 +01:00
|
|
|
break;
|
|
|
|
|
case GdbEngineType:
|
2011-03-22 10:22:55 +01:00
|
|
|
searchAbis.clear();
|
2011-09-26 12:38:17 +02:00
|
|
|
searchAbis.push_back(Abi(abi.architecture(), abi.os(),
|
|
|
|
|
Abi::WindowsMSysFlavor, abi.binaryFormat(), abi.wordWidth()));
|
2011-02-24 16:50:15 +01:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-25 09:34:31 +01:00
|
|
|
if (debug)
|
2011-03-22 10:22:55 +01:00
|
|
|
qDebug() << "debuggerForAbi" << abi.toString() << searchAbis.size()
|
|
|
|
|
<< searchAbis.front().toString() << et;
|
|
|
|
|
|
|
|
|
|
foreach (const Abi &searchAbi, searchAbis) {
|
2011-09-26 12:38:17 +02:00
|
|
|
const QList<ToolChain *> toolchains =
|
|
|
|
|
ToolChainManager::instance()->findToolChains(searchAbi);
|
2011-03-22 10:22:55 +01:00
|
|
|
// Find manually configured ones first
|
|
|
|
|
for (int i = toolchains.size() - 1; i >= 0; i--) {
|
2012-01-13 16:50:08 +01:00
|
|
|
const QString debugger = toolchains.at(i)->debuggerCommand().toString();
|
2011-03-22 10:22:55 +01:00
|
|
|
if (debug)
|
|
|
|
|
qDebug() << i << toolchains.at(i)->displayName() << debugger;
|
|
|
|
|
if (!debugger.isEmpty())
|
|
|
|
|
return debugger;
|
|
|
|
|
}
|
2011-02-23 14:57:52 +01:00
|
|
|
}
|
|
|
|
|
return QString();
|
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
|
|
|
{
|
2011-02-03 14:08:01 +01:00
|
|
|
return m_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
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
m_coreSettings = ICore::settings();
|
2011-07-08 15:33:13 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
m_debuggerSettings = new DebuggerSettings(m_coreSettings);
|
2011-07-08 15:33:13 +02:00
|
|
|
m_debuggerSettings->readSettings();
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2012-01-24 15:36:40 +01:00
|
|
|
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown()));
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2012-01-24 15:36:40 +01:00
|
|
|
ActionManager *am = ICore::actionManager();
|
2010-12-02 13:20:06 +01:00
|
|
|
QTC_ASSERT(am, return);
|
2010-12-01 15:41:08 +01:00
|
|
|
|
2011-05-31 09:48:00 +02:00
|
|
|
m_plugin->addObject(this);
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
const Context globalcontext(CC::C_GLOBAL);
|
|
|
|
|
const Context cppDebuggercontext(C_CPPDEBUGGER);
|
|
|
|
|
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"));
|
2012-02-16 11:12:02 +01:00
|
|
|
m_startIcon.addFile(QLatin1String(":/debugger/images/debugger_start.png"));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_exitIcon = QIcon(_(":/debugger/images/debugger_stop_small.png"));
|
2012-02-16 11:12:02 +01:00
|
|
|
m_exitIcon.addFile(QLatin1String(":/debugger/images/debugger_stop.png"));
|
|
|
|
|
m_continueIcon = QIcon(QLatin1String(":/debugger/images/debugger_continue_small.png"));
|
|
|
|
|
m_continueIcon.addFile(QLatin1String(":/debugger/images/debugger_continue.png"));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_interruptIcon = QIcon(_(":/debugger/images/debugger_interrupt_small.png"));
|
2012-02-16 11:12:02 +01:00
|
|
|
m_interruptIcon.addFile(QLatin1String(":/debugger/images/debugger_interrupt.png"));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_locationMarkIcon = QIcon(_(":/debugger/images/location_16.png"));
|
|
|
|
|
|
|
|
|
|
m_busy = false;
|
|
|
|
|
|
2011-03-16 13:49:28 +01:00
|
|
|
m_statusLabel = new Utils::StatusLabel;
|
2010-12-02 13:20:06 +01:00
|
|
|
|
|
|
|
|
m_breakHandler = new BreakHandler;
|
|
|
|
|
m_breakWindow = new BreakWindow;
|
2011-12-21 14:02:52 +01:00
|
|
|
m_breakWindow->setObjectName(QLatin1String(DOCKWIDGET_BREAK));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_breakWindow->setModel(m_breakHandler->model());
|
|
|
|
|
|
2012-02-15 12:35:43 +01:00
|
|
|
m_qtMessageLogWindow = new QtMessageLogWindow();
|
|
|
|
|
m_qtMessageLogWindow->setObjectName(QLatin1String(DOCKWIDGET_QML_SCRIPTCONSOLE));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_modulesWindow = new ModulesWindow;
|
2011-12-21 14:02:52 +01:00
|
|
|
m_modulesWindow->setObjectName(QLatin1String(DOCKWIDGET_MODULES));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_logWindow = new LogWindow;
|
2011-12-21 14:02:52 +01:00
|
|
|
m_logWindow->setObjectName(QLatin1String(DOCKWIDGET_OUTPUT));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_registerWindow = new RegisterWindow;
|
2011-12-21 14:02:52 +01:00
|
|
|
m_registerWindow->setObjectName(QLatin1String(DOCKWIDGET_REGISTER));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_stackWindow = new StackWindow;
|
2011-12-21 14:02:52 +01:00
|
|
|
m_stackWindow->setObjectName(QLatin1String(DOCKWIDGET_STACK));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_sourceFilesWindow = new SourceFilesWindow;
|
2011-12-21 14:02:52 +01:00
|
|
|
m_sourceFilesWindow->setObjectName(QLatin1String(DOCKWIDGET_SOURCE_FILES));
|
2010-12-02 13:20:06 +01:00
|
|
|
m_threadsWindow = new ThreadsWindow;
|
2011-12-21 14:02:52 +01:00
|
|
|
m_threadsWindow->setObjectName(QLatin1String(DOCKWIDGET_THREADS));
|
2012-03-29 14:20:45 +02:00
|
|
|
m_returnWindow = new WatchWindow(WatchTreeView::ReturnType);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_returnWindow->setObjectName(QLatin1String("CppDebugReturn"));
|
2012-03-29 14:20:45 +02:00
|
|
|
m_localsWindow = new WatchWindow(WatchTreeView::LocalsType);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_localsWindow->setObjectName(QLatin1String("CppDebugLocals"));
|
2012-03-29 14:20:45 +02:00
|
|
|
m_watchersWindow = new WatchWindow(WatchTreeView::WatchersType);
|
2010-12-02 13:20:06 +01:00
|
|
|
m_watchersWindow->setObjectName(QLatin1String("CppDebugWatchers"));
|
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);
|
2011-12-21 14:02:52 +01:00
|
|
|
m_snapshotWindow->setObjectName(QLatin1String(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
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_continueAction = new QAction(tr("Continue"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
act->setIcon(m_continueIcon);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecContinue()));
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_exitAction = new QAction(tr("Exit Debugger"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
act->setIcon(m_exitIcon);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecExit()));
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_interruptAction = new QAction(tr("Interrupt"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
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.
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_undisturbableAction = new QAction(tr("Debugger is Busy"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
act->setIcon(m_interruptIcon);
|
|
|
|
|
act->setEnabled(false);
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2011-10-31 16:15:48 +01:00
|
|
|
act = m_abortAction = new QAction(tr("Abort Debugging"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
act->setToolTip(tr("Aborts debugging and "
|
|
|
|
|
"resets the debugger to the initial state."));
|
2011-10-31 16:15:48 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleAbort()));
|
2010-11-10 16:33:11 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_nextAction = new QAction(tr("Step Over"), this);
|
2012-02-16 11:12:02 +01:00
|
|
|
act->setIcon(QIcon(QLatin1String(":/debugger/images/debugger_stepover_small.png")));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecNext()));
|
2009-04-28 15:08:52 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_stepAction = new QAction(tr("Step Into"), this);
|
2012-02-16 11:12:02 +01:00
|
|
|
act->setIcon(QIcon(QLatin1String(":/debugger/images/debugger_stepinto_small.png")));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecStep()));
|
2010-11-24 18:36:17 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_stepOutAction = new QAction(tr("Step Out"), this);
|
2012-02-16 11:12:02 +01:00
|
|
|
act->setIcon(QIcon(QLatin1String(":/debugger/images/debugger_stepout_small.png")));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecStepOut()));
|
2010-11-24 18:36:17 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_runToLineAction = new QAction(tr("Run to Line"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecRunToLine()));
|
2010-06-11 12:38:54 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_runToSelectedFunctionAction =
|
2011-02-02 11:52:39 +01:00
|
|
|
new QAction(tr("Run to Selected Function"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecRunToSelectedFunction()));
|
2010-11-24 18:36:17 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_returnFromFunctionAction =
|
2010-12-02 13:20:06 +01:00
|
|
|
new QAction(tr("Immediately Return From Inner Function"), this);
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecReturn()));
|
|
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_jumpToLineAction = new QAction(tr("Jump to Line"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleExecJumpToLine()));
|
|
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_breakAction = new QAction(tr("Toggle Breakpoint"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_watchAction1 = new QAction(tr("Add to Watch Window"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleAddToWatchWindow()));
|
|
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_watchAction2 = new QAction(tr("Add to Watch Window"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleAddToWatchWindow()));
|
|
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
//m_snapshotAction = new QAction(tr("Create Snapshot"), this);
|
|
|
|
|
//m_snapshotAction->setProperty(Role, RequestCreateSnapshotRole);
|
|
|
|
|
//m_snapshotAction->setIcon(
|
2010-12-02 13:20:06 +01:00
|
|
|
// QIcon(__(":/debugger/images/debugger_snapshot_small.png")));
|
|
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_reverseDirectionAction =
|
2010-12-02 13:20:06 +01:00
|
|
|
new QAction(tr("Reverse Direction"), this);
|
|
|
|
|
act->setCheckable(true);
|
|
|
|
|
act->setChecked(false);
|
|
|
|
|
act->setCheckable(false);
|
2012-02-16 11:12:02 +01:00
|
|
|
act->setIcon(QIcon(QLatin1String(":/debugger/images/debugger_reversemode_16.png")));
|
2010-12-02 13:20:06 +01:00
|
|
|
act->setIconVisibleInMenu(false);
|
2010-06-11 12:38:54 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_frameDownAction = new QAction(tr("Move to Called Frame"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(handleFrameDown()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
act = m_frameUpAction = new QAction(tr("Move to Calling Frame"), this);
|
2010-12-02 13:20:06 +01:00
|
|
|
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 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);
|
2012-02-15 12:35:43 +01:00
|
|
|
m_mainWindow->createDockWidget(QmlLanguage, m_qtMessageLogWindow);
|
2010-12-03 15:55:17 +01:00
|
|
|
m_mainWindow->createDockWidget(CppLanguage, m_snapshotWindow);
|
|
|
|
|
m_mainWindow->createDockWidget(CppLanguage, m_stackWindow);
|
|
|
|
|
m_mainWindow->createDockWidget(CppLanguage, m_threadsWindow);
|
2010-03-29 18:44:02 +02:00
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
QSplitter *localsAndWatchers = new MiniSplitter(Qt::Vertical);
|
2011-12-21 14:02:52 +01:00
|
|
|
localsAndWatchers->setObjectName(QLatin1String(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
|
|
|
|
2012-01-12 17:04:14 +01:00
|
|
|
m_mainWindow->addStagedMenuEntries();
|
|
|
|
|
|
2011-02-22 11:21:08 +01:00
|
|
|
// Do not fail to load the whole plugin if something goes wrong here.
|
|
|
|
|
QString errorMessage;
|
|
|
|
|
if (!parseArguments(m_arguments, &m_cmdLineEnabledEngines, &errorMessage)) {
|
|
|
|
|
errorMessage = tr("Error evaluating command line arguments: %1")
|
|
|
|
|
.arg(errorMessage);
|
|
|
|
|
qWarning("%s\n", qPrintable(errorMessage));
|
|
|
|
|
}
|
|
|
|
|
|
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.
|
2011-08-03 18:57:37 +02:00
|
|
|
act = m_startAction = new QAction(this);
|
2011-12-21 14:02:52 +01:00
|
|
|
QIcon debuggerIcon(QLatin1String(":/projectexplorer/images/debugger_start_small.png"));
|
|
|
|
|
debuggerIcon.addFile(QLatin1String(":/projectexplorer/images/debugger_start.png"));
|
2010-12-02 13:20:06 +01:00
|
|
|
act->setIcon(debuggerIcon);
|
|
|
|
|
act->setText(tr("Start Debugging"));
|
|
|
|
|
connect(act, SIGNAL(triggered()), this, SLOT(debugProject()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2011-10-25 18:23:37 +08:00
|
|
|
act = m_debugWithoutDeployAction = new QAction(this);
|
2011-12-08 16:31:21 +01:00
|
|
|
act->setText(tr("Start Debugging Without Deployment"));
|
2011-10-25 18:23:37 +08:00
|
|
|
connect(act, SIGNAL(triggered()), this, SLOT(debugProjectWithoutDeploy()));
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
// Handling of external applications.
|
2011-12-08 16:31:21 +01:00
|
|
|
act = m_startLocalProcessAction = new QAction(this);
|
2010-12-02 13:20:06 +01:00
|
|
|
act->setText(tr("Start and Debug External Application..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(startExternalApplication()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2011-04-07 17:30:06 +02:00
|
|
|
#ifdef WITH_LLDB
|
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()));
|
2011-04-07 17:30:06 +02:00
|
|
|
#endif
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2011-12-08 16:31:21 +01:00
|
|
|
act = m_attachToLocalProcessAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Attach to Running Local Application..."));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachExternalApplication()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
act = m_attachToCoreAction = new QAction(this);
|
2011-12-08 16:31:21 +01:00
|
|
|
act->setText(tr("Load Core File..."));
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachCore()));
|
2010-07-05 17:08:30 +02:00
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
act = m_startRemoteProcessAction = new QAction(this);
|
2011-09-14 15:22:08 +02:00
|
|
|
act->setText(tr("Start and Debug Remote Application..."));
|
2011-12-06 15:39:25 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(startRemoteProcess()));
|
2010-09-24 16:55:22 +02:00
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
act = m_attachToRemoteServerAction = new QAction(this);
|
2011-09-14 15:22:08 +02:00
|
|
|
act->setText(tr("Attach to Remote Debug Server..."));
|
2011-12-05 17:21:48 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachToRemoteServer()));
|
|
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
act = m_startRemoteServerAction = new QAction(this);
|
2012-03-21 17:54:56 +01:00
|
|
|
act->setText(tr("Start Remote Debug Server Attached to Process..."));
|
2011-12-06 15:39:25 +01:00
|
|
|
connect(act, SIGNAL(triggered()), SLOT(startRemoteServer()));
|
|
|
|
|
|
|
|
|
|
act = m_attachToRemoteProcessAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Attach to Running Remote Process..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachToRemoteProcess()));
|
2011-09-14 15:22:08 +02:00
|
|
|
|
2011-09-13 17:26:02 +02:00
|
|
|
act = m_attachToQmlPortAction = new QAction(this);
|
|
|
|
|
act->setText(tr("Attach to QML Port..."));
|
|
|
|
|
connect(act, SIGNAL(triggered()), SLOT(attachToQmlPort()));
|
|
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
m_startRemoteCdbAction = new QAction(tr("Attach to Remote CDB Session..."), this);
|
2011-02-03 14:17:23 +01:00
|
|
|
connect(m_startRemoteCdbAction, SIGNAL(triggered()),
|
|
|
|
|
SLOT(startRemoteCdbSession()));
|
2010-12-02 13:20:06 +01:00
|
|
|
#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
|
|
|
|
2011-10-10 13:38:58 +02:00
|
|
|
// "Start Debugging" sub-menu
|
|
|
|
|
// groups:
|
|
|
|
|
// G_DEFAULT_ONE
|
2011-10-19 11:51:51 +02:00
|
|
|
// G_START_LOCAL
|
|
|
|
|
// G_START_REMOTE
|
2011-10-10 13:38:58 +02:00
|
|
|
// G_START_QML
|
|
|
|
|
|
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
|
|
|
|
2011-08-03 18:57:37 +02:00
|
|
|
cmd = am->registerAction(m_startAction, Constants::DEBUG, globalcontext);
|
2012-01-06 17:13:18 +01:00
|
|
|
cmd->setDescription(tr("Start Debugging"));
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::DEBUG_KEY)));
|
2011-05-26 19:57:07 +02:00
|
|
|
cmd->setAttribute(Command::CA_UpdateText);
|
2011-10-10 13:38:58 +02:00
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
2010-06-23 14:11:52 +02:00
|
|
|
|
2011-08-03 18:57:37 +02:00
|
|
|
m_visibleStartAction = new Utils::ProxyAction(this);
|
|
|
|
|
m_visibleStartAction->initialize(m_startAction);
|
|
|
|
|
m_visibleStartAction->setAttribute(Utils::ProxyAction::UpdateText);
|
|
|
|
|
m_visibleStartAction->setAttribute(Utils::ProxyAction::UpdateIcon);
|
|
|
|
|
m_visibleStartAction->setAction(cmd->action());
|
2011-02-03 14:17:23 +01:00
|
|
|
|
2012-01-26 01:18:02 +01:00
|
|
|
ModeManager::addAction(m_visibleStartAction, Constants::P_ACTION_DEBUG);
|
2010-10-28 08:55:50 +02:00
|
|
|
|
2011-10-25 18:23:37 +08:00
|
|
|
cmd = am->registerAction(m_debugWithoutDeployAction,
|
|
|
|
|
"Debugger.DebugWithoutDeploy", globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
|
|
|
|
|
|
2011-12-08 16:31:21 +01:00
|
|
|
cmd = am->registerAction(m_attachToLocalProcessAction,
|
|
|
|
|
"Debugger.AttachToLocalProcess", globalcontext);
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-10-19 11:51:51 +02:00
|
|
|
mstart->addAction(cmd, Constants::G_START_LOCAL);
|
|
|
|
|
|
2011-12-08 16:31:21 +01:00
|
|
|
cmd = am->registerAction(m_startLocalProcessAction,
|
|
|
|
|
"Debugger.StartLocalProcess", globalcontext);
|
2011-10-19 11:51:51 +02:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-12-08 16:31:21 +01:00
|
|
|
mstart->addAction(cmd, Debugger::Constants::G_START_LOCAL);
|
2009-09-24 10:08:17 +02:00
|
|
|
|
2012-01-07 17:18:52 +01:00
|
|
|
// FIXME: The following actions should some be less
|
|
|
|
|
// visible in the start menu, but still be "there".
|
|
|
|
|
// m_startLocalProcessAction->setVisible(on);
|
|
|
|
|
// m_attachToRemoteServerAction->setVisible(on);
|
|
|
|
|
// m_startRemoteProcessAction->setVisible(on);
|
|
|
|
|
// m_startRemoteServerAction->setVisible(on);
|
|
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
cmd = am->registerAction(m_attachToCoreAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.AttachCore", globalcontext);
|
2011-10-19 11:51:51 +02:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, Constants::G_START_LOCAL);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
cmd = am->registerAction(m_attachToRemoteServerAction,
|
|
|
|
|
"Debugger.AttachToRemoteServer", globalcontext);
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-12-05 17:21:48 +01:00
|
|
|
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-12-05 17:21:48 +01:00
|
|
|
cmd = am->registerAction(m_startRemoteProcessAction,
|
|
|
|
|
"Debugger.StartRemoteProcess", globalcontext);
|
2011-09-14 15:22:08 +02:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-12-08 16:31:21 +01:00
|
|
|
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
|
2010-10-05 12:47:23 +02:00
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
cmd = am->registerAction(m_startRemoteServerAction,
|
|
|
|
|
"Debugger.StartRemoteServer", globalcontext);
|
2012-01-06 17:13:18 +01:00
|
|
|
cmd->setDescription(tr("Start Gdbserver"));
|
2011-12-08 16:31:21 +01:00
|
|
|
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
|
2011-12-06 15:39:25 +01:00
|
|
|
|
|
|
|
|
cmd = am->registerAction(m_attachToRemoteProcessAction,
|
|
|
|
|
"Debugger.AttachToRemoteProcess", globalcontext);
|
2012-01-06 17:13:18 +01:00
|
|
|
cmd->setDescription(tr("Attach to Remote Process"));
|
2011-12-06 15:39:25 +01:00
|
|
|
mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE);
|
2011-09-13 17:26:02 +02:00
|
|
|
|
2011-04-08 09:20:14 +02:00
|
|
|
#ifdef WITH_LLDB
|
2011-02-24 16:50:15 +01:00
|
|
|
cmd = am->registerAction(m_startRemoteLldbAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.RemoteLldb", globalcontext);
|
2011-02-24 16:50:15 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2012-01-20 18:11:33 +01:00
|
|
|
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
|
2011-04-08 09:20:14 +02:00
|
|
|
#endif
|
2011-02-24 16:50:15 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
if (m_startRemoteCdbAction) {
|
|
|
|
|
cmd = am->registerAction(m_startRemoteCdbAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.AttachRemoteCdb", globalcontext);
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-12-05 17:21:48 +01:00
|
|
|
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
|
2010-12-02 13:20:06 +01:00
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-10-10 13:38:58 +02:00
|
|
|
QAction *sep = new QAction(mstart);
|
2011-09-22 11:18:14 +02:00
|
|
|
sep->setSeparator(true);
|
2011-10-10 13:38:58 +02:00
|
|
|
cmd = am->registerAction(sep,
|
|
|
|
|
"Debugger.Start.Qml", globalcontext);
|
|
|
|
|
mstart->addAction(cmd, Constants::G_START_QML);
|
|
|
|
|
|
|
|
|
|
cmd = am->registerAction(m_attachToQmlPortAction,
|
|
|
|
|
"Debugger.AttachToQmlPort", globalcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
mstart->addAction(cmd, Constants::G_START_QML);
|
2011-09-22 11:18:14 +02:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd = am->registerAction(m_detachAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.Detach", globalcontext);
|
2010-12-02 13:20:06 +01:00
|
|
|
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
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_interruptAction,
|
2011-01-12 16:36:29 +01:00
|
|
|
Constants::INTERRUPT, globalcontext);
|
2012-01-06 17:13:18 +01:00
|
|
|
cmd->setDescription(tr("Interrupt Debugger"));
|
2011-01-12 16:36:29 +01:00
|
|
|
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
|
|
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_continueAction,
|
2011-01-12 16:36:29 +01:00
|
|
|
Constants::CONTINUE, globalcontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::DEBUG_KEY)));
|
2011-01-12 16:36:29 +01:00
|
|
|
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
|
|
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_exitAction,
|
2010-12-02 13:20:06 +01:00
|
|
|
Constants::STOP, globalcontext);
|
2012-01-06 17:13:18 +01:00
|
|
|
cmd->setDescription(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
|
|
|
|
2011-08-03 18:57:37 +02:00
|
|
|
m_hiddenStopAction = new Utils::ProxyAction(this);
|
|
|
|
|
m_hiddenStopAction->initialize(m_exitAction);
|
|
|
|
|
m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateText);
|
|
|
|
|
m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateIcon);
|
|
|
|
|
|
|
|
|
|
cmd = am->registerAction(m_hiddenStopAction,
|
|
|
|
|
Constants::HIDDEN_STOP, globalcontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::STOP_KEY)));
|
2011-08-03 18:57:37 +02:00
|
|
|
|
2011-10-31 16:15:48 +01:00
|
|
|
cmd = am->registerAction(m_abortAction,
|
|
|
|
|
Constants::ABORT, globalcontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::RESET_KEY)));
|
2012-01-06 17:13:18 +01:00
|
|
|
cmd->setDescription(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
|
|
|
|
2011-09-22 11:18:14 +02:00
|
|
|
sep = new QAction(this);
|
2010-12-02 13:20:06 +01:00
|
|
|
sep->setSeparator(true);
|
2011-08-03 19:04:51 +02:00
|
|
|
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
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_nextAction,
|
2011-05-02 18:22:32 +02:00
|
|
|
Constants::NEXT, globalcontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::NEXT_KEY)));
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-07-18 17:23:42 +02:00
|
|
|
cmd->setAttribute(Command::CA_UpdateText);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-09-24 16:55:22 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_stepAction,
|
2011-05-02 18:22:32 +02:00
|
|
|
Constants::STEP, globalcontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::STEP_KEY)));
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-07-18 17:23:42 +02:00
|
|
|
cmd->setAttribute(Command::CA_UpdateText);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-11-12 20:18:29 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_stepOutAction,
|
2010-12-02 13:20:06 +01:00
|
|
|
Constants::STEPOUT, cppDebuggercontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::STEPOUT_KEY)));
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2010-11-23 16:42:46 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_runToLineAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.RunToLine", cppDebuggercontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::RUN_TO_LINE_KEY)));
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-05-25 18:21:31 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_runToSelectedFunctionAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.RunToSelectedFunction", cppDebuggercontext);
|
2011-02-02 11:52:39 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(
|
2011-12-21 14:02:52 +01:00
|
|
|
QLatin1String(Constants::RUN_TO_SELECTED_FUNCTION_KEY)));
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-02-02 11:52:39 +01:00
|
|
|
// Don't add to menu by default as keeping its enabled state
|
|
|
|
|
// and text up-to-date is a lot of hassle.
|
|
|
|
|
// debugMenu->addAction(cmd);
|
2009-01-13 18:15:24 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_jumpToLineAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.JumpToLine", cppDebuggercontext);
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-02-27 11:41:19 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_returnFromFunctionAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.ReturnFromFunction", cppDebuggercontext);
|
2010-12-02 13:20:06 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2009-06-16 13:44:45 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_reverseDirectionAction,
|
2010-12-02 13:20:06 +01:00
|
|
|
Constants::REVERSE, cppDebuggercontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::REVERSE_KEY)));
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2011-08-03 19:04:51 +02:00
|
|
|
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
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
//cmd = am->registerAction(m_snapshotAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
// "Debugger.Snapshot", cppDebuggercontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
//cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::SNAPSHOT_KEY)));
|
2010-12-02 13:20:06 +01:00
|
|
|
//cmd->setAttribute(Command::CA_Hide);
|
2010-12-02 18:21:39 +01:00
|
|
|
//debugMenu->addAction(cmd);
|
2009-09-30 12:27:03 +02:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_frameDownAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.FrameDown", cppDebuggercontext);
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_frameUpAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.FrameUp", 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
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_breakAction,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.ToggleBreak", globalcontext);
|
2011-12-21 14:02:52 +01:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::TOGGLE_BREAK_KEY)));
|
2010-12-02 18:21:39 +01:00
|
|
|
debugMenu->addAction(cmd);
|
2011-02-03 14:08:01 +01:00
|
|
|
connect(m_breakAction, SIGNAL(triggered()),
|
2010-12-02 13:20:06 +01:00
|
|
|
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);
|
2011-08-03 19:04:51 +02:00
|
|
|
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
|
|
|
|
2011-08-04 10:31:15 +02:00
|
|
|
// Don't add '1' to the string as it shows up in the shortcut dialog.
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_watchAction1,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.AddToWatch", cppeditorcontext);
|
2010-12-02 13:20:06 +01:00
|
|
|
//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
|
|
|
|
2011-01-06 14:57:21 +01:00
|
|
|
// If the CppEditor plugin is there, we want to add something to
|
|
|
|
|
// the editor context menu.
|
|
|
|
|
if (ActionContainer *editorContextMenu =
|
|
|
|
|
am->actionContainer(CppEditor::Constants::M_CONTEXT)) {
|
2011-08-03 19:04:51 +02:00
|
|
|
cmd = am->registerAction(sep, "Debugger.Sep.Views",
|
2011-01-06 14:57:21 +01:00
|
|
|
cppDebuggercontext);
|
|
|
|
|
editorContextMenu->addAction(cmd);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2010-11-10 12:38:29 +01:00
|
|
|
|
2011-02-03 14:08:01 +01:00
|
|
|
cmd = am->registerAction(m_watchAction2,
|
2011-08-04 10:31:15 +02:00
|
|
|
"Debugger.AddToWatch2", cppDebuggercontext);
|
2011-01-06 14:57:21 +01:00
|
|
|
cmd->action()->setEnabled(true);
|
|
|
|
|
editorContextMenu->addAction(cmd);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2011-08-04 10:31:15 +02:00
|
|
|
cmd->setAttribute(Command::CA_NonConfigurable);
|
|
|
|
|
// Debugger.AddToWatch is enough.
|
2011-01-06 14:57:21 +01:00
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
QList<IOptionsPage *> engineOptionPages;
|
2010-12-02 13:20:06 +01:00
|
|
|
if (m_cmdLineEnabledEngines & GdbEngineType)
|
|
|
|
|
addGdbOptionPages(&engineOptionPages);
|
2011-01-12 12:10:12 +01:00
|
|
|
addCdbOptionPages(&engineOptionPages);
|
2010-12-02 13:20:06 +01:00
|
|
|
#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);
|
2011-12-06 15:39:25 +01:00
|
|
|
|
|
|
|
|
foreach (IOptionsPage *op, engineOptionPages)
|
2010-12-02 13:20:06 +01:00
|
|
|
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*)));
|
2011-01-31 15:17:53 +01:00
|
|
|
connect(ICore::instance(), SIGNAL(coreAboutToOpen()),
|
2011-02-03 14:17:23 +01:00
|
|
|
SLOT(onCoreAboutToOpen()));
|
2011-12-06 15:39:25 +01:00
|
|
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
2011-10-25 18:23:37 +08:00
|
|
|
this, SLOT(updateDebugWithoutDeployMenu()));
|
2010-12-03 15:23:23 +01:00
|
|
|
|
|
|
|
|
// Debug mode setup
|
2011-04-13 13:00:30 +02:00
|
|
|
DebugMode *debugMode = new DebugMode;
|
|
|
|
|
QWidget *widget = m_mainWindow->createContents(debugMode);
|
|
|
|
|
widget->setFocusProxy(EditorManager::instance());
|
|
|
|
|
debugMode->setWidget(widget);
|
|
|
|
|
|
|
|
|
|
m_plugin->addAutoReleasedObject(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
|
|
|
|
2011-02-22 12:05:25 +01:00
|
|
|
// Core
|
2012-01-24 15:36:40 +01:00
|
|
|
connect(ICore::instance(), SIGNAL(saveSettingsRequested()), SLOT(writeSettings()));
|
2011-02-22 12:05:25 +01: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
|
2012-02-10 12:46:33 +01:00
|
|
|
connect(sessionManager(), SIGNAL(sessionLoaded(QString)),
|
2010-12-02 13:20:06 +01:00
|
|
|
SLOT(sessionLoaded()));
|
|
|
|
|
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
|
|
|
|
|
SLOT(aboutToSaveSession()));
|
2012-02-10 12:46:33 +01:00
|
|
|
connect(sessionManager(), SIGNAL(aboutToUnloadSession(QString)),
|
2010-12-02 13:20:06 +01:00
|
|
|
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
|
2012-01-24 15:36:40 +01:00
|
|
|
QObject *editorManager = ICore::editorManager();
|
2010-12-02 13:20:06 +01:00
|
|
|
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
|
|
|
|
SLOT(editorOpened(Core::IEditor*)));
|
2011-02-04 14:36:50 +01:00
|
|
|
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
|
|
|
|
SLOT(updateBreakMenuItem(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);
|
2011-08-03 18:57:37 +02:00
|
|
|
hbox->addWidget(toolButton(m_visibleStartAction));
|
|
|
|
|
hbox->addWidget(toolButton(m_exitAction));
|
|
|
|
|
hbox->addWidget(toolButton(m_nextAction));
|
|
|
|
|
hbox->addWidget(toolButton(m_stepAction));
|
|
|
|
|
hbox->addWidget(toolButton(m_stepOutAction));
|
|
|
|
|
hbox->addWidget(toolButton(action(OperateByInstruction)));
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2010-12-02 13:20:06 +01:00
|
|
|
//hbox->addWidget(new Utils::StyledSeparator);
|
2011-08-03 18:57:37 +02:00
|
|
|
m_reverseToolButton = toolButton(m_reverseDirectionAction);
|
2010-12-02 13:20:06 +01:00
|
|
|
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;
|
2011-09-01 16:36:27 +02:00
|
|
|
m_threadBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
2010-12-02 13:20:06 +01:00
|
|
|
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));
|
2010-11-10 11:39:01 +01:00
|
|
|
|
2011-02-16 10:02:30 +01:00
|
|
|
m_mainWindow->setToolBar(CppLanguage, toolbarContainer);
|
2012-03-26 17:30:57 +02:00
|
|
|
m_mainWindow->setToolBar(AnyLanguage, m_statusLabel);
|
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
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
m_commonOptionsPage = new CommonOptionsPage(m_globalDebuggerOptions);
|
|
|
|
|
m_plugin->addAutoReleasedObject(m_commonOptionsPage);
|
|
|
|
|
|
2011-07-29 12:00:11 +02:00
|
|
|
QTC_CHECK(m_coreSettings);
|
2011-03-04 16:21:57 +01:00
|
|
|
m_globalDebuggerOptions->fromSettings(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
|
|
|
|
2011-02-08 13:48:04 +01:00
|
|
|
// time gdb -i mi -ex 'b debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
|
|
|
|
|
if (!m_scheduledStarts.isEmpty())
|
|
|
|
|
QTimer::singleShot(0, this, SLOT(runScheduled()));
|
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;
|
2011-12-19 17:18:58 +01:00
|
|
|
w->setUniformRowHeights(true);
|
2010-11-26 09:58:34 +01:00
|
|
|
w->setColumnCount(5);
|
|
|
|
|
w->setRootIsDecorated(false);
|
|
|
|
|
w->setAlternatingRowColors(true);
|
|
|
|
|
w->setSortingEnabled(true);
|
2011-12-21 14:02:52 +01:00
|
|
|
w->setObjectName(QLatin1String("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()
|
|
|
|
|
{
|
2011-05-31 09:48:00 +02:00
|
|
|
m_plugin->removeObject(this);
|
2010-12-06 08:25:29 +01:00
|
|
|
disconnect(sessionManager(),
|
|
|
|
|
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
|
|
|
|
this, 0);
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
|
2011-02-04 15:08:31 +01:00
|
|
|
/*!
|
|
|
|
|
\class Debugger::DebuggerPlugin
|
|
|
|
|
|
|
|
|
|
This is the "external" interface of the debugger plugin that's visible
|
|
|
|
|
from Qt Creator core. The internal interface to global debugger
|
|
|
|
|
functionality that is used by debugger views and debugger engines
|
|
|
|
|
is DebuggerCore, implemented in DebuggerPluginPrivate. */
|
|
|
|
|
|
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
|
|
|
{
|
2011-10-10 13:38:58 +02:00
|
|
|
// Menu groups
|
|
|
|
|
const Context globalcontext(CC::C_GLOBAL);
|
|
|
|
|
|
2012-01-24 15:36:40 +01:00
|
|
|
ActionManager *am = ICore::actionManager();
|
2011-10-10 13:38:58 +02:00
|
|
|
ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING);
|
|
|
|
|
|
2011-10-19 11:51:51 +02:00
|
|
|
mstart->appendGroup(Constants::G_START_LOCAL);
|
2011-12-05 17:21:48 +01:00
|
|
|
mstart->appendGroup(Constants::G_MANUAL_REMOTE);
|
|
|
|
|
mstart->appendGroup(Constants::G_AUTOMATIC_REMOTE);
|
2011-10-10 13:38:58 +02:00
|
|
|
mstart->appendGroup(Constants::G_START_QML);
|
|
|
|
|
|
2011-10-19 11:51:51 +02:00
|
|
|
// Separators
|
2011-10-10 13:38:58 +02:00
|
|
|
QAction *sep = new QAction(mstart);
|
|
|
|
|
sep->setSeparator(true);
|
2011-10-19 11:51:51 +02:00
|
|
|
Command *cmd = am->registerAction(sep, "Debugger.Local.Cpp", globalcontext);
|
|
|
|
|
mstart->addAction(cmd, Constants::G_START_LOCAL);
|
2011-12-05 17:21:48 +01:00
|
|
|
|
2011-10-19 11:51:51 +02:00
|
|
|
sep = new QAction(mstart);
|
|
|
|
|
sep->setSeparator(true);
|
2011-12-05 17:21:48 +01:00
|
|
|
cmd = am->registerAction(sep, "Debugger.StartRemote.Cpp", globalcontext);
|
|
|
|
|
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
|
|
|
|
|
|
|
|
|
|
sep = new QAction(mstart);
|
|
|
|
|
sep->setSeparator(true);
|
|
|
|
|
cmd = am->registerAction(sep, "Debugger.AttachRemote.Cpp", globalcontext);
|
|
|
|
|
mstart->addAction(cmd, Constants::G_AUTOMATIC_REMOTE);
|
2011-10-10 13:38:58 +02:00
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
return theDebuggerCore->initialize(arguments, errorMessage);
|
2010-06-16 11:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-06 15:39:25 +01:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-16 10:47:06 +01:00
|
|
|
QAction *DebuggerPlugin::visibleDebugAction()
|
|
|
|
|
{
|
2011-08-03 18:57:37 +02:00
|
|
|
return theDebuggerCore->m_visibleStartAction;
|
2011-02-16 10:47:06 +01:00
|
|
|
}
|
|
|
|
|
|
2012-01-23 16:45:00 +01:00
|
|
|
|
|
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
void DebuggerPluginPrivate::testLoadProject(const QString &proFile, const TestCallBack &cb)
|
2012-01-23 16:45:00 +01:00
|
|
|
{
|
|
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
connect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
|
|
|
|
this, SLOT(testProjectLoaded(ProjectExplorer::Project*)));
|
|
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
m_testCallbacks.append(cb);
|
2012-01-23 16:45:00 +01:00
|
|
|
QString error;
|
2012-01-25 17:28:06 +01:00
|
|
|
if (pe->openProject(proFile, &error))
|
|
|
|
|
return; // Will end up in callback.
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
// Eat the unused callback.
|
|
|
|
|
qWarning("Cannot open %s: %s", qPrintable(proFile), qPrintable(error));
|
|
|
|
|
QVERIFY(false);
|
|
|
|
|
m_testCallbacks.pop_back();
|
2012-01-23 16:45:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testProjectLoaded(Project *project)
|
|
|
|
|
{
|
|
|
|
|
if (!project) {
|
|
|
|
|
qWarning("Changed to null project.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-01-25 17:28:06 +01:00
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
disconnect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
|
|
|
|
this, SLOT(testProjectLoaded(ProjectExplorer::Project*)));
|
|
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
QString fileName = project->document()->fileName();
|
2012-01-23 16:45:00 +01:00
|
|
|
QVERIFY(!fileName.isEmpty());
|
|
|
|
|
qWarning("Project %s loaded", qPrintable(fileName));
|
|
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
QVERIFY(!m_testCallbacks.isEmpty());
|
|
|
|
|
TestCallBack cb = m_testCallbacks.takeLast();
|
|
|
|
|
invoke<void>(cb.receiver, cb.slot);
|
|
|
|
|
}
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
void DebuggerPluginPrivate::testUnloadProject()
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
|
|
|
invoke<void>(pe, "unloadProject");
|
|
|
|
|
}
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
static Project *currentProject()
|
|
|
|
|
{
|
|
|
|
|
return ProjectExplorerPlugin::instance()->currentProject();
|
|
|
|
|
}
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
static Target *activeTarget()
|
|
|
|
|
{
|
|
|
|
|
Project *project = currentProject();
|
|
|
|
|
return project->activeTarget();
|
|
|
|
|
}
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
static BuildConfiguration *activeBuildConfiguration()
|
|
|
|
|
{
|
|
|
|
|
return activeTarget()->activeBuildConfiguration();
|
|
|
|
|
}
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
static RunConfiguration *activeRunConfiguration()
|
|
|
|
|
{
|
|
|
|
|
return activeTarget()->activeRunConfiguration();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ToolChain *currentToolChain()
|
|
|
|
|
{
|
|
|
|
|
return activeBuildConfiguration()->toolChain();
|
|
|
|
|
}
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
static LocalApplicationRunConfiguration *activeLocalRunConfiguration()
|
|
|
|
|
{
|
|
|
|
|
return qobject_cast<LocalApplicationRunConfiguration *>(activeRunConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb)
|
|
|
|
|
{
|
|
|
|
|
m_testCallbacks.append(cb);
|
2012-01-23 16:45:00 +01:00
|
|
|
RunControl *rctl = createDebugger(sp);
|
|
|
|
|
QVERIFY(rctl);
|
|
|
|
|
connect(rctl, SIGNAL(finished()), this, SLOT(testRunControlFinished()));
|
|
|
|
|
ProjectExplorerPlugin::instance()->startRunControl(rctl, DebugRunMode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testRunControlFinished()
|
|
|
|
|
{
|
2012-01-25 17:28:06 +01:00
|
|
|
QVERIFY(!m_testCallbacks.isEmpty());
|
|
|
|
|
TestCallBack cb = m_testCallbacks.takeLast();
|
|
|
|
|
ExtensionSystem::invoke<void>(cb.receiver, cb.slot);
|
|
|
|
|
}
|
2012-01-23 16:45:00 +01:00
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
void DebuggerPluginPrivate::testFinished()
|
|
|
|
|
{
|
2012-01-23 16:45:00 +01:00
|
|
|
QTestEventLoop::instance().exitLoop();
|
2012-01-25 17:28:06 +01:00
|
|
|
QVERIFY(m_testSuccess);
|
2012-01-23 16:45:00 +01:00
|
|
|
}
|
|
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-01-23 16:45:00 +01:00
|
|
|
void DebuggerPlugin::testPythonDumpers()
|
|
|
|
|
{
|
2012-01-25 17:28:06 +01:00
|
|
|
theDebuggerCore->testPythonDumpers1();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testPythonDumpers1()
|
|
|
|
|
{
|
|
|
|
|
m_testSuccess = true;
|
|
|
|
|
QString proFile = ICore::resourcePath()
|
|
|
|
|
+ "/../../tests/manual/debugger/simple/simple.pro";
|
|
|
|
|
testLoadProject(proFile, TestCallBack(this, "testPythonDumpers2"));
|
|
|
|
|
QVERIFY(m_testSuccess);
|
|
|
|
|
QTestEventLoop::instance().enterLoop(20);
|
2012-01-23 16:45:00 +01:00
|
|
|
}
|
|
|
|
|
|
2012-01-25 17:28:06 +01:00
|
|
|
void DebuggerPluginPrivate::testPythonDumpers2()
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.toolChainAbi = currentToolChain()->targetAbi();
|
|
|
|
|
sp.executable = activeLocalRunConfiguration()->executable();
|
|
|
|
|
testRunProject(sp, TestCallBack(this, "testPythonDumpers3"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testPythonDumpers3()
|
|
|
|
|
{
|
|
|
|
|
testUnloadProject();
|
|
|
|
|
testFinished();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::testStateMachine()
|
|
|
|
|
{
|
|
|
|
|
theDebuggerCore->testStateMachine1();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testStateMachine1()
|
|
|
|
|
{
|
|
|
|
|
m_testSuccess = true;
|
|
|
|
|
QString proFile = ICore::resourcePath()
|
|
|
|
|
+ "/../../tests/manual/debugger/simple/simple.pro";
|
|
|
|
|
testLoadProject(proFile, TestCallBack(this, "testStateMachine2"));
|
|
|
|
|
QVERIFY(m_testSuccess);
|
|
|
|
|
QTestEventLoop::instance().enterLoop(20);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testStateMachine2()
|
|
|
|
|
{
|
|
|
|
|
DebuggerStartParameters sp;
|
|
|
|
|
sp.toolChainAbi = currentToolChain()->targetAbi();
|
|
|
|
|
sp.executable = activeLocalRunConfiguration()->executable();
|
|
|
|
|
sp.testCase = TestNoBoundsOfCurrentFunction;
|
|
|
|
|
testRunProject(sp, TestCallBack(this, "testStateMachine3"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testStateMachine3()
|
|
|
|
|
{
|
|
|
|
|
testUnloadProject();
|
|
|
|
|
testFinished();
|
|
|
|
|
}
|
2012-01-26 13:14:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void DebuggerPlugin::testBenchmark()
|
|
|
|
|
{
|
|
|
|
|
theDebuggerCore->testBenchmark1();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum FakeEnum { FakeDebuggerCommonSettingsId };
|
|
|
|
|
|
|
|
|
|
void DebuggerPluginPrivate::testBenchmark1()
|
|
|
|
|
{
|
|
|
|
|
#ifdef WITH_BENCHMARK
|
|
|
|
|
CALLGRIND_START_INSTRUMENTATION;
|
|
|
|
|
volatile Core::Id id1 = Core::Id(DEBUGGER_COMMON_SETTINGS_ID);
|
|
|
|
|
CALLGRIND_STOP_INSTRUMENTATION;
|
|
|
|
|
CALLGRIND_DUMP_STATS;
|
|
|
|
|
|
|
|
|
|
CALLGRIND_START_INSTRUMENTATION;
|
|
|
|
|
volatile FakeEnum id2 = FakeDebuggerCommonSettingsId;
|
|
|
|
|
CALLGRIND_STOP_INSTRUMENTATION;
|
|
|
|
|
CALLGRIND_DUMP_STATS;
|
2012-01-23 16:45:00 +01:00
|
|
|
#endif
|
2012-01-26 13:14:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // if WITH_TESTS
|
2012-01-23 16:45:00 +01:00
|
|
|
|
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)
|