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
8d411686
Commit
8d411686
authored
Apr 07, 2009
by
hjk
Browse files
debugger: make assignment in watch window look nicer, also make it work in
script debugger
parent
851fb975
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggermanager.cpp
View file @
8d411686
...
...
@@ -278,7 +278,7 @@ void DebuggerManager::init()
connect
(
m_watchHandler
,
SIGNAL
(
setSessionValueRequested
(
QString
,
QVariant
)),
this
,
SIGNAL
(
setSessionValueRequested
(
QString
,
QVariant
)));
connect
(
theDebuggerAction
(
AssignValue
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
assignValueInDebugger
()));
this
,
SLOT
(
assignValueInDebugger
())
,
Qt
::
QueuedConnection
);
// Tooltip
QTreeView
*
tooltipView
=
qobject_cast
<
QTreeView
*>
(
m_tooltipWindow
);
...
...
src/plugins/debugger/scriptengine.cpp
View file @
8d411686
...
...
@@ -69,6 +69,7 @@ using namespace Debugger::Constants;
#else
# define SDEBUG(s)
#endif
# define XSDEBUG(s) qDebug() << s
///////////////////////////////////////////////////////////////////////
//
...
...
@@ -194,7 +195,7 @@ ScriptEngine::~ScriptEngine()
void
ScriptEngine
::
executeDebuggerCommand
(
const
QString
&
command
)
{
Q_UNUSED
(
command
);
SDEBUG
(
"FIXME: ScriptEngine::executeDebuggerCommand()"
);
X
SDEBUG
(
"FIXME: ScriptEngine::executeDebuggerCommand()"
);
}
void
ScriptEngine
::
shutdown
()
...
...
@@ -247,40 +248,40 @@ void ScriptEngine::interruptInferior()
{
m_stopped
=
false
;
m_stopOnNextLine
=
true
;
SDEBUG
(
"
FIXME:
ScriptEngine::interruptInferior()"
);
X
SDEBUG
(
"ScriptEngine::interruptInferior()"
);
}
void
ScriptEngine
::
stepExec
()
{
//SDEBUG("
FIXME:
ScriptEngine::stepExec()");
//SDEBUG("ScriptEngine::stepExec()");
m_stopped
=
false
;
m_stopOnNextLine
=
true
;
}
void
ScriptEngine
::
stepIExec
()
{
//SDEBUG("
FIXME:
ScriptEngine::stepIExec()");
//SDEBUG("ScriptEngine::stepIExec()");
m_stopped
=
false
;
m_stopOnNextLine
=
true
;
}
void
ScriptEngine
::
stepOutExec
()
{
//SDEBUG("
FIXME:
ScriptEngine::stepOutExec()");
//SDEBUG("ScriptEngine::stepOutExec()");
m_stopped
=
false
;
m_stopOnNextLine
=
true
;
}
void
ScriptEngine
::
nextExec
()
{
//SDEBUG("
FIXME:
ScriptEngine::nextExec()");
//SDEBUG("ScriptEngine::nextExec()");
m_stopped
=
false
;
m_stopOnNextLine
=
true
;
}
void
ScriptEngine
::
nextIExec
()
{
//SDEBUG("
FIXME:
ScriptEngine::nextIExec()");
//SDEBUG("ScriptEngine::nextIExec()");
m_stopped
=
false
;
m_stopOnNextLine
=
true
;
}
...
...
@@ -295,14 +296,14 @@ void ScriptEngine::runToLineExec(const QString &fileName, int lineNumber)
void
ScriptEngine
::
runToFunctionExec
(
const
QString
&
functionName
)
{
Q_UNUSED
(
functionName
);
SDEBUG
(
"FIXME: ScriptEngine::runToFunctionExec()"
);
X
SDEBUG
(
"FIXME: ScriptEngine::runToFunctionExec()"
);
}
void
ScriptEngine
::
jumpToLineExec
(
const
QString
&
fileName
,
int
lineNumber
)
{
Q_UNUSED
(
fileName
);
Q_UNUSED
(
lineNumber
);
SDEBUG
(
"FIXME: ScriptEngine::jumpToLineExec()"
);
X
SDEBUG
(
"FIXME: ScriptEngine::jumpToLineExec()"
);
}
void
ScriptEngine
::
activateFrame
(
int
index
)
...
...
@@ -468,8 +469,9 @@ void ScriptEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
void
ScriptEngine
::
assignValueInDebugger
(
const
QString
&
expression
,
const
QString
&
value
)
{
Q_UNUSED
(
expression
);
Q_UNUSED
(
value
);
XSDEBUG
(
"ASSIGNING: "
<<
expression
+
'='
+
value
);
m_scriptEngine
->
evaluate
(
expression
+
'='
+
value
);
updateLocals
();
}
void
ScriptEngine
::
maybeBreakNow
(
bool
byFunction
)
...
...
@@ -521,7 +523,12 @@ void ScriptEngine::maybeBreakNow(bool byFunction)
qq
->
notifyInferiorStopped
();
q
->
gotoLocation
(
fileName
,
lineNumber
,
true
);
updateLocals
();
}
void
ScriptEngine
::
updateLocals
()
{
QScriptContext
*
context
=
m_scriptEngine
->
currentContext
();
qq
->
watchHandler
()
->
reinitializeWatchers
();
//SDEBUG("UPDATE LOCALS");
...
...
@@ -647,6 +654,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
it
.
next
();
WatchData
data1
;
data1
.
iname
=
data
.
iname
+
"."
+
it
.
name
();
data1
.
exp
=
it
.
name
();
data1
.
name
=
it
.
name
();
data1
.
scriptValue
=
it
.
value
();
if
(
qq
->
watchHandler
()
->
isExpandedIName
(
data1
.
iname
))
...
...
src/plugins/debugger/scriptengine.h
View file @
8d411686
...
...
@@ -110,6 +110,7 @@ private:
bool
supportsThreads
()
const
{
return
true
;
}
void
maybeBreakNow
(
bool
byFunction
);
void
updateWatchModel
();
void
updateLocals
();
void
updateSubItem
(
const
WatchData
&
data0
);
private:
...
...
src/plugins/debugger/watchhandler.cpp
View file @
8d411686
...
...
@@ -493,6 +493,14 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
return
QVariant
();
}
bool
WatchHandler
::
setData
(
const
QModelIndex
&
index
,
const
QVariant
&
value
,
int
role
)
{
Q_UNUSED
(
role
);
Q_UNUSED
(
value
);
emit
dataChanged
(
index
,
index
);
return
true
;
}
Qt
::
ItemFlags
WatchHandler
::
flags
(
const
QModelIndex
&
idx
)
const
{
using
namespace
Qt
;
...
...
src/plugins/debugger/watchhandler.h
View file @
8d411686
...
...
@@ -149,6 +149,7 @@ public:
// QAbstractItemModel
//
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
bool
setData
(
const
QModelIndex
&
index
,
const
QVariant
&
value
,
int
role
);
QModelIndex
index
(
int
,
int
,
const
QModelIndex
&
idx
)
const
;
QModelIndex
parent
(
const
QModelIndex
&
idx
)
const
;
int
rowCount
(
const
QModelIndex
&
idx
)
const
;
...
...
src/plugins/debugger/watchwindow.cpp
View file @
8d411686
...
...
@@ -64,6 +64,7 @@ public:
QWidget
*
createEditor
(
QWidget
*
parent
,
const
QStyleOptionViewItem
&
,
const
QModelIndex
&
)
const
{
qDebug
()
<<
"CREATE EDITOR"
;
return
new
QLineEdit
(
parent
);
}
...
...
@@ -77,13 +78,15 @@ public:
lineEdit
->
setText
(
index
.
model
()
->
data
(
index
,
ExpressionRole
).
toString
());
}
void
setModelData
(
QWidget
*
editor
,
QAbstractItemModel
*
,
void
setModelData
(
QWidget
*
editor
,
QAbstractItemModel
*
model
,
const
QModelIndex
&
index
)
const
{
//qDebug() << "SET MODEL DATA";
QLineEdit
*
lineEdit
=
qobject_cast
<
QLineEdit
*>
(
editor
);
QTC_ASSERT
(
lineEdit
,
return
);
QString
value
=
lineEdit
->
text
();
QString
exp
=
index
.
model
()
->
data
(
index
,
ExpressionRole
).
toString
();
QString
exp
=
model
->
data
(
index
,
ExpressionRole
).
toString
();
model
->
setData
(
index
,
value
,
Qt
::
EditRole
);
if
(
index
.
column
()
==
1
)
{
// the value column
theDebuggerAction
(
AssignValue
)
->
trigger
(
exp
+
'='
+
value
);
...
...
@@ -147,7 +150,9 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev)
QModelIndex
idx1
=
idx
.
sibling
(
idx
.
row
(),
0
);
QString
exp
=
model
()
->
data
(
idx1
).
toString
();
theDebuggerAction
(
RemoveWatchExpression
)
->
trigger
(
exp
);
}
else
if
(
ev
->
key
()
==
Qt
::
Key_Return
&&
m_type
==
LocalsType
)
{
}
else
if
(
ev
->
key
()
==
Qt
::
Key_Return
&&
ev
->
modifiers
()
==
Qt
::
ControlModifier
&&
m_type
==
LocalsType
)
{
QModelIndex
idx
=
currentIndex
();
QModelIndex
idx1
=
idx
.
sibling
(
idx
.
row
(),
0
);
QString
exp
=
model
()
->
data
(
idx1
).
toString
();
...
...
@@ -264,4 +269,3 @@ void WatchWindow::resetHelper(const QModelIndex &idx)
collapse
(
idx
);
}
}
tests/manual/gdbdebugger/script/math.js
View file @
8d411686
...
...
@@ -29,7 +29,8 @@
function
cube
(
a
)
{
return
a
*
a
*
a
;
var
x
=
a
*
a
*
a
;
return
x
;
}
var
a
=
cube
(
3
);
Write
Preview
Supports
Markdown
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