aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4debugging.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-12-05 13:16:14 +0100
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2014-12-09 11:55:04 +0100
commit8397f640e81f0eff1f6f32ae4a35d40f115ea339 (patch)
tree2bb50bc6be262979cb9e7c49f02d96cbc5c50be5 /src/qml/jsruntime/qv4debugging.cpp
parent4524856ae21f85d572155c8a399d43116143e25c (diff)
QML Debugging: Fix crash when stepping through try-catch block.
Also fix the stack-trace generation, otherwise the debugger engine would report a breakpoint hit on the wrong line. Task-number: QTBUG-42723 Change-Id: I1f655a5174b28a1c9c31c85bbe023fbce5ddbb96 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4debugging.cpp')
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index 6a8d364a08..a835d835fb 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -509,7 +509,6 @@ void Debugger::maybeBreakAtInstruction()
return;
QMutexLocker locker(&m_lock);
- int lineNumber = engine()->currentContext()->d()->lineNumber;
if (m_gatherSources) {
m_gatherSources->run();
@@ -533,8 +532,12 @@ void Debugger::maybeBreakAtInstruction()
if (m_pauseRequested) { // Serve debugging requests from the agent
m_pauseRequested = false;
pauseAndWait(PauseRequest);
- } else if (m_haveBreakPoints && reallyHitTheBreakPoint(getFunction()->sourceFile(), lineNumber)) {
- pauseAndWait(BreakPoint);
+ } else if (m_haveBreakPoints) {
+ if (Function *f = getFunction()) {
+ const int lineNumber = engine()->currentContext()->d()->lineNumber;
+ if (reallyHitTheBreakPoint(f->sourceFile(), lineNumber))
+ pauseAndWait(BreakPoint);
+ }
}
}
@@ -579,12 +582,10 @@ void Debugger::aboutToThrow()
Function *Debugger::getFunction() const
{
ExecutionContext *context = m_engine->currentContext();
- if (CallContext *callCtx = context->asCallContext())
- return callCtx->d()->function->function();
- else {
- Q_ASSERT(context->d()->type == QV4::ExecutionContext::Type_GlobalContext);
+ if (const FunctionObject *function = context->getFunctionObject())
+ return function->function();
+ else
return context->d()->engine->globalCode;
- }
}
void Debugger::pauseAndWait(PauseReason reason)