Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
817dbabd
Commit
817dbabd
authored
Jun 22, 2010
by
hjk
Browse files
debugger: work on action handling
parent
0b55b716
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggerconstants.h
View file @
817dbabd
...
...
@@ -213,6 +213,7 @@ enum ModelRoles
LocalsPointerValueRole
,
// Pointer value (address) as quint64
LocalsIsWatchpointAtAddressRole
,
LocalsIsWatchpointAtPointerValueRole
,
RequestWatchPointRole
,
RequestToggleWatchRole
,
RequestClearCppCodeModelSnapshotRole
,
RequestAssignValueRole
,
...
...
src/plugins/debugger/debuggerengine.cpp
View file @
817dbabd
...
...
@@ -45,6 +45,9 @@
#include "threadshandler.h"
#include "watchhandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/debugginghelper.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/project.h>
...
...
@@ -55,11 +58,11 @@
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <texteditor/itexteditor.h>
#include <utils/savedaction.h>
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
...
...
@@ -69,14 +72,19 @@
#include <QtGui/QStandardItemModel>
#include <QtGui/QAction>
#include <QtGui/QMessageBox>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QPushButton>
#include <QtGui/QTextBlock>
#include <QtGui/QTextCursor>
#include <QtGui/QTextDocument>
#include <QtGui/QTreeWidget>
using
namespace
ProjectExpl
ore
r
;
using
namespace
C
ore
;
using
namespace
Debugger
;
using
namespace
Debugger
::
Internal
;
using
namespace
ProjectExplorer
;
using
namespace
TextEditor
;
///////////////////////////////////////////////////////////////////////
...
...
@@ -239,12 +247,10 @@ public:
DebuggerEngine
::
DebuggerEngine
(
const
DebuggerStartParameters
&
startParameters
)
:
d
(
new
DebuggerEnginePrivate
(
this
,
startParameters
))
{
//loadSessionData();
}
DebuggerEngine
::~
DebuggerEngine
()
{
//saveSessionData();
}
void
DebuggerEngine
::
showStatusMessage
(
const
QString
&
msg
,
int
timeout
)
const
...
...
@@ -298,13 +304,11 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
break
;
case
RequestExecRunToLineRole
:
//executeRunToLine();
QTC_ASSERT
(
false
,
/* FIXME ABC */
);
executeRunToLine
();
break
;
case
RequestExecRunToFunctionRole
:
//executeRunToFunction();
QTC_ASSERT
(
false
,
/* FIXME ABC */
);
executeRunToFunction
();
break
;
case
RequestExecReturnFromFunctionRole
:
...
...
@@ -312,8 +316,7 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
break
;
case
RequestExecJumpToLineRole
:
//executeJumpToLine();
QTC_ASSERT
(
false
,
/* FIXME ABC */
);
executeJumpToLine
();
break
;
case
RequestExecWatchRole
:
...
...
@@ -344,6 +347,12 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
case
RequestExecuteCommandRole
:
executeDebuggerCommand
(
value
.
toString
());
break
;
case
RequestWatchPointRole
:
//if (QAction *action = qobject_cast<QAction *>(sender()))
// watchPoint(action->data().toPoint());
QTC_ASSERT
(
false
,
/* FIXME ABC */
);
break
;
}
}
...
...
@@ -523,7 +532,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
theDebuggerAction
(
OperateByInstruction
)
->
setEnabled
(
engineCapabilities
&
DisassemblerCapability
);
//loadSessionData();
startDebugger
();
}
...
...
@@ -611,29 +619,30 @@ void DebuggerEngine::executeReturnX()
executeReturn
();
}
void
DebuggerEngine
::
executeWatchPointX
()
static
TextEditor
::
ITextEditor
*
currentTextEditor
()
{
if
(
QAction
*
action
=
qobject_cast
<
QAction
*>
(
sender
()))
watchPoint
(
action
->
data
().
toPoint
());
EditorManager
*
editorManager
=
EditorManager
::
instance
();
if
(
!
editorManager
)
return
0
;
Core
::
IEditor
*
editor
=
editorManager
->
currentEditor
();
return
qobject_cast
<
ITextEditor
*>
(
editor
);
}
/*
void DebuggerManager::executeRunToLine()
void
DebuggerEngine
::
executeRunToLine
()
{
ITextEditor *textEditor =
d->m_plugin->
currentTextEditor();
ITextEditor
*
textEditor
=
currentTextEditor
();
QTC_ASSERT
(
textEditor
,
return
);
QString
fileName
=
textEditor
->
file
()
->
fileName
();
if
(
fileName
.
isEmpty
())
return
;
int
lineNumber
=
textEditor
->
currentLine
();
if (d->m_engine && !fileName.isEmpty()) {
STATE_DEBUG(fileName << lineNumber);
resetLocation();
d->m_engine->executeRunToLine(fileName, lineNumber);
}
resetLocation
();
executeRunToLine
(
fileName
,
lineNumber
);
}
void Debugger
Manager
::executeRunToFunction()
void
Debugger
Engine
::
executeRunToFunction
()
{
ITextEditor *textEditor =
d->m_plugin->
currentTextEditor();
ITextEditor
*
textEditor
=
currentTextEditor
();
QTC_ASSERT
(
textEditor
,
return
);
QString
fileName
=
textEditor
->
file
()
->
fileName
();
QPlainTextEdit
*
ed
=
qobject_cast
<
QPlainTextEdit
*>
(
textEditor
->
widget
());
...
...
@@ -657,26 +666,23 @@ void DebuggerManager::executeRunToFunction()
}
}
}
STATE_DEBUG(functionName);
if (
d->m_engine && !
functionName.isEmpty())
{
re
setLocation()
;
d->m_engine->executeRunToFunction(functionName
);
}
if
(
functionName
.
isEmpty
())
re
turn
;
resetLocation
(
);
executeRunToFunction
(
functionName
);
}
void Debugger
Manager
::executeJumpToLine()
void
Debugger
Engine
::
executeJumpToLine
()
{
ITextEditor *textEditor =
d->m_plugin->
currentTextEditor();
ITextEditor
*
textEditor
=
currentTextEditor
();
QTC_ASSERT
(
textEditor
,
return
);
QString
fileName
=
textEditor
->
file
()
->
fileName
();
int
lineNumber
=
textEditor
->
currentLine
();
if (d->m_engine && !fileName.isEmpty()) {
STATE_DEBUG(fileName << lineNumber);
d->m_engine->executeJumpToLine(fileName, lineNumber);
}
if
(
fileName
.
isEmpty
())
return
;
executeJumpToLine
(
fileName
,
lineNumber
);
}
*/
// Called from RunControl.
void
DebuggerEngine
::
handleFinished
()
...
...
@@ -907,7 +913,6 @@ void DebuggerEngine::startSuccessful()
void
DebuggerEngine
::
notifyInferiorPid
(
qint64
pid
)
{
//STATE_DEBUG(d->m_inferiorPid << pid);
if
(
d
->
m_inferiorPid
==
pid
)
return
;
d
->
m_inferiorPid
=
pid
;
...
...
src/plugins/debugger/debuggerengine.h
View file @
817dbabd
...
...
@@ -229,7 +229,6 @@ public:
void
executeStepOutX
();
void
executeStepNextX
();
void
executeReturnX
();
void
executeWatchPointX
();
DebuggerState
state
()
const
;
...
...
@@ -259,6 +258,11 @@ public slots:
protected:
void
setState
(
DebuggerState
state
,
bool
forced
=
false
);
private:
void
executeRunToLine
();
void
executeRunToFunction
();
void
executeJumpToLine
();
DebuggerEnginePrivate
*
d
;
};
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
817dbabd
...
...
@@ -293,6 +293,8 @@ static QToolButton *toolButton(QAction *action)
namespace
Debugger
{
namespace
Internal
{
static
const
char
*
Role
=
"ROLE"
;
// 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
...
...
@@ -851,7 +853,6 @@ public slots:
void
sessionLoaded
();
void
aboutToUnloadSession
();
void
aboutToSaveSession
();
void
watchPoint
()
{
QTC_ASSERT
(
false
,
/**/
);
}
// FIXME
void
executeDebuggerCommand
();
...
...
@@ -1044,59 +1045,59 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
QIcon
continueIcon
=
QIcon
(
":/debugger/images/debugger_continue_small.png"
);
continueIcon
.
addFile
(
":/debugger/images/debugger_continue.png"
);
m_actions
.
continueAction
->
setIcon
(
continueIcon
);
m_actions
.
continueAction
->
set
Data
(
RequestExecContinueRole
);
m_actions
.
continueAction
->
set
Property
(
Role
,
RequestExecContinueRole
);
m_actions
.
stopAction
=
new
QAction
(
tr
(
"Interrupt"
),
this
);
m_actions
.
stopAction
->
setIcon
(
m_interruptIcon
);
m_actions
.
stopAction
->
set
Data
(
RequestExecInterruptRole
);
m_actions
.
stopAction
->
set
Property
(
Role
,
RequestExecInterruptRole
);
m_actions
.
resetAction
=
new
QAction
(
tr
(
"Abort Debugging"
),
this
);
m_actions
.
resetAction
->
set
Data
(
RequestExecResetRole
);
m_actions
.
resetAction
->
set
Property
(
Role
,
RequestExecResetRole
);
m_actions
.
resetAction
->
setToolTip
(
tr
(
"Aborts debugging and "
"resets the debugger to the initial state."
));
m_actions
.
nextAction
=
new
QAction
(
tr
(
"Step Over"
),
this
);
m_actions
.
nextAction
->
set
Data
(
RequestExecNextRole
);
m_actions
.
nextAction
->
set
Property
(
Role
,
RequestExecNextRole
);
m_actions
.
nextAction
->
setIcon
(
QIcon
(
":/debugger/images/debugger_stepover_small.png"
));
m_actions
.
stepAction
=
new
QAction
(
tr
(
"Step Into"
),
this
);
m_actions
.
stepAction
->
set
Data
(
RequestExecStepRole
);
m_actions
.
stepAction
->
set
Property
(
Role
,
RequestExecStepRole
);
m_actions
.
stepAction
->
setIcon
(
QIcon
(
":/debugger/images/debugger_stepinto_small.png"
));
m_actions
.
stepOutAction
=
new
QAction
(
tr
(
"Step Out"
),
this
);
m_actions
.
stepOutAction
->
set
Data
(
RequestExecStepOutRole
);
m_actions
.
stepOutAction
->
set
Property
(
Role
,
RequestExecStepOutRole
);
m_actions
.
stepOutAction
->
setIcon
(
QIcon
(
":/debugger/images/debugger_stepout_small.png"
));
m_actions
.
runToLineAction1
=
new
QAction
(
tr
(
"Run to Line"
),
this
);
m_actions
.
runToLineAction1
->
set
Data
(
RequestExecRunToLineRole
);
m_actions
.
runToLineAction1
->
set
Property
(
Role
,
RequestExecRunToLineRole
);
m_actions
.
runToLineAction2
=
new
QAction
(
tr
(
"Run to Line"
),
this
);
m_actions
.
runToLineAction2
->
set
Data
(
RequestExecRunToLineRole
);
m_actions
.
runToLineAction2
->
set
Property
(
Role
,
RequestExecRunToLineRole
);
m_actions
.
runToFunctionAction
=
new
QAction
(
tr
(
"Run to Outermost Function"
),
this
);
m_actions
.
runToFunctionAction
->
set
Data
(
RequestExecRunToFunctionRole
);
m_actions
.
runToFunctionAction
->
set
Property
(
Role
,
RequestExecRunToFunctionRole
);
m_actions
.
returnFromFunctionAction
=
new
QAction
(
tr
(
"Immediately Return From Inner Function"
),
this
);
m_actions
.
returnFromFunctionAction
->
set
Data
(
RequestExecReturnFromFunctionRole
);
m_actions
.
returnFromFunctionAction
->
set
Property
(
Role
,
RequestExecReturnFromFunctionRole
);
m_actions
.
jumpToLineAction1
=
new
QAction
(
tr
(
"Jump to Line"
),
this
);
m_actions
.
jumpToLineAction1
->
set
Data
(
RequestExecJumpToLineRole
);
m_actions
.
jumpToLineAction1
->
set
Property
(
Role
,
RequestExecJumpToLineRole
);
m_actions
.
jumpToLineAction2
=
new
QAction
(
tr
(
"Jump to Line"
),
this
);
m_actions
.
jumpToLineAction1
->
set
Data
(
RequestExecJumpToLineRole
);
m_actions
.
jumpToLineAction1
->
set
Property
(
Role
,
RequestExecJumpToLineRole
);
m_actions
.
breakAction
=
new
QAction
(
tr
(
"Toggle Breakpoint"
),
this
);
m_actions
.
watchAction1
=
new
QAction
(
tr
(
"Add to Watch Window"
),
this
);
m_actions
.
watchAction1
->
set
Data
(
RequestExecWatchRole
);
m_actions
.
watchAction1
->
set
Property
(
Role
,
RequestExecWatchRole
);
m_actions
.
watchAction2
=
new
QAction
(
tr
(
"Add to Watch Window"
),
this
);
m_actions
.
watchAction2
->
set
Data
(
RequestExecWatchRole
);
m_actions
.
watchAction2
->
set
Property
(
Role
,
RequestExecWatchRole
);
m_actions
.
snapshotAction
=
new
QAction
(
tr
(
"Snapshot"
),
this
);
m_actions
.
snapshotAction
->
set
Data
(
RequestExecSnapshotRole
);
m_actions
.
snapshotAction
->
set
Property
(
Role
,
RequestExecSnapshotRole
);
m_actions
.
snapshotAction
->
setIcon
(
QIcon
(
":/debugger/images/debugger_snapshot_small.png"
));
...
...
@@ -1110,14 +1111,15 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
m_actions
.
frameDownAction
=
new
QAction
(
tr
(
"Move to Called Frame"
),
this
);
m_actions
.
frameDownAction
->
set
Data
(
RequestExecFrameDownRole
);
m_actions
.
frameDownAction
->
set
Property
(
Role
,
RequestExecFrameDownRole
);
m_actions
.
frameUpAction
=
new
QAction
(
tr
(
"Move to Calling Frame"
),
this
);
m_actions
.
frameUpAction
->
set
Data
(
RequestExecFrameUpRole
);
m_actions
.
frameUpAction
->
set
Property
(
Role
,
RequestExecFrameUpRole
);
m_actions
.
reverseDirectionAction
->
setCheckable
(
false
);
theDebuggerAction
(
OperateByInstruction
)
->
setData
(
RequestOperatedByInstructionTriggeredRole
);
setProperty
(
Role
,
RequestOperatedByInstructionTriggeredRole
);
theDebuggerAction
(
WatchPoint
)
->
setProperty
(
Role
,
RequestWatchPointRole
);
connect
(
m_actions
.
continueAction
,
SIGNAL
(
triggered
()),
SLOT
(
onAction
()));
connect
(
m_actions
.
nextAction
,
SIGNAL
(
triggered
()),
SLOT
(
onAction
()));
...
...
@@ -1138,7 +1140,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
connect
(
m_actions
.
resetAction
,
SIGNAL
(
triggered
()),
SLOT
(
onAction
()));
connect
(
&
m_statusTimer
,
SIGNAL
(
timeout
()),
SLOT
(
clearStatusMessage
()));
connect
(
theDebuggerAction
(
WatchPoint
),
SIGNAL
(
triggered
()),
SLOT
(
watchPoint
()));
connect
(
theDebuggerAction
(
WatchPoint
),
SIGNAL
(
triggered
()),
SLOT
(
onAction
()));
connect
(
theDebuggerAction
(
ExecuteCommand
),
SIGNAL
(
triggered
()),
SLOT
(
executeDebuggerCommand
()));
...
...
@@ -1251,7 +1253,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
m_detachAction
=
new
QAction
(
this
);
m_detachAction
->
setText
(
tr
(
"Detach Debugger"
));
m_detachAction
->
set
Data
(
RequestExecDetachRole
);
m_detachAction
->
set
Property
(
Role
,
RequestExecDetachRole
);
connect
(
m_detachAction
,
SIGNAL
(
triggered
()),
SLOT
(
onAction
()));
Core
::
Command
*
cmd
=
0
;
...
...
@@ -1544,7 +1546,7 @@ void DebuggerPluginPrivate::onAction()
{
QAction
*
act
=
qobject_cast
<
QAction
*>
(
sender
());
QTC_ASSERT
(
act
,
return
);
const
int
role
=
act
->
data
(
).
toInt
();
const
int
role
=
act
->
property
(
Role
).
toInt
();
notifyCurrentEngine
(
role
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment