aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_moth.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-04 10:35:11 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-07 16:55:12 +0100
commit39b54d7293741c712116010b33f0d9823ab2ab1c (patch)
tree0af462863604bc130b1232a53477185b9d59c158 /src/qml/compiler/qv4isel_moth.cpp
parent245f5ce7bb194438fc643e5c928382f47556e2f2 (diff)
Fixes to breakpoint handling
Make sure stepping works correctly, and we always break at a valid breakpoint. Change-Id: I6a3032b3ae204484b8a92b2031904a7f681c7f80 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_moth.cpp')
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 3993bc9acc..921af76151 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -385,8 +385,9 @@ void InstructionSelection::run(int functionIndex)
push.value = quint32(locals);
addInstruction(push);
- uint currentLine = -1;
+ currentLine = -1;
for (int i = 0, ei = _function->basicBlocks.size(); i != ei; ++i) {
+ blockNeedsDebugInstruction = irModule->debugMode;
_block = _function->basicBlocks[i];
_nextBlock = (i < ei - 1) ? _function->basicBlocks[i + 1] : 0;
_addrs.insert(_block, _codeNext - _codeStart);
@@ -408,6 +409,7 @@ void InstructionSelection::run(int functionIndex)
if (s->location.isValid()) {
if (s->location.startLine != currentLine) {
+ blockNeedsDebugInstruction = false;
currentLine = s->location.startLine;
if (irModule->debugMode) {
Instruction::Debug debug;
@@ -423,11 +425,6 @@ void InstructionSelection::run(int functionIndex)
s->accept(this);
}
- if (irModule->debugMode) {
- Instruction::Debug debug;
- debug.lineNumber = currentLine;
- addInstruction(debug);
- }
}
// TODO: patch stack size (the push instruction)
@@ -1039,6 +1036,12 @@ void InstructionSelection::visitJump(IR::Jump *s)
if (_removableJumps.contains(s))
return;
+ if (blockNeedsDebugInstruction) {
+ Instruction::Debug debug;
+ debug.lineNumber = currentLine;
+ addInstruction(debug);
+ }
+
Instruction::Jump jump;
jump.offset = 0;
ptrdiff_t loc = addInstruction(jump) + (((const char *)&jump.offset) - ((const char *)&jump));
@@ -1048,6 +1051,12 @@ void InstructionSelection::visitJump(IR::Jump *s)
void InstructionSelection::visitCJump(IR::CJump *s)
{
+ if (blockNeedsDebugInstruction) {
+ Instruction::Debug debug;
+ debug.lineNumber = currentLine;
+ addInstruction(debug);
+ }
+
Param condition;
if (IR::Temp *t = s->cond->asTemp()) {
condition = getResultParam(t);