Skip to content

Commit ab5e8b4

Browse files
committed
Prevent step next break on innner recursive call
1 parent 2bc800c commit ab5e8b4

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

hld/Debugger.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,11 @@ class Debugger {
595595
cleanup();
596596
return r;
597597
}
598-
// fix for recursive methods that are breaking on the return we put
598+
// fix recursive methods that are breaking on the inner function
599599
if( (mode == Out || mode == Next) && currentStack.length > depth ) {
600600
var isRecursive = false;
601601
for( b in breakPoints )
602-
if( b.fid == -2 && nextStep == b.codePos ) {
602+
if( (b.fid == -2 || b.fid == -1) && nextStep == b.codePos ) {
603603
isRecursive = true;
604604
break;
605605
}

tests/unit/TestStepRecursive/Test.hx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Test {
2+
static function foo( x : Int ) {
3+
if( x > 0 ) {
4+
trace(x);
5+
foo(x-1);
6+
trace(x);
7+
}
8+
}
9+
10+
static function main() {
11+
foo(3);
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--ci
2+
test.hl
3+
"b Test.hx:11"
4+
r
5+
s
6+
"p x"
7+
n
8+
n
9+
n
10+
"p x"
11+
n
12+
n
13+
q
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
> b Test.hx:11
2+
Breakpoint set line 11
3+
> r
4+
Thread paused Test.hx:11 ($Test::main)
5+
> s
6+
Thread paused Test.hx:3 ($Test::foo)
7+
> p x
8+
3 : Int
9+
> n
10+
Thread paused Test.hx:4 ($Test::foo)
11+
> n
12+
Thread paused Test.hx:5 ($Test::foo)
13+
> n
14+
Thread paused Test.hx:6 ($Test::foo)
15+
> p x
16+
3 : Int
17+
> n
18+
Thread paused Test.hx:7 ($Test::foo)
19+
> n
20+
Thread paused Test.hx:11 ($Test::main)
21+
> q

0 commit comments

Comments
 (0)