Samsung / netcoredbg

NetCoreDbg is a managed code debugger with GDB/MI, VSCode DAP and CLI interfaces for CoreCLR.
MIT License
838 stars 103 forks source link

Stepping issues #154

Closed qgindi closed 8 months ago

qgindi commented 11 months ago

Issues in steppers.cpp.

  1. Always steps into cast operators. Fix: In g_operatorMethodNames add op_Implicit and op_Explicit.

  2. If stopped in property code (eg breakpoint), next step-over or step-in behaves like step-out (unless disabled step filtering). Fix: in methodShouldBeFltered lambda add as the first statement: if (reason != CorDebugStepReason::STEP_CALL) return false;

  3. If function arguments contains > 1 call to functions, a step-in behaves like step-over (does not step into the function; also into third+ argument functions).

4 (not important): If disabled Just My Code, need 2 step-in for a call to a function with [DebuggerStepThrough].

Repro code for 3 and 4:

C.M3(C.P1, C.P2); //does not step into M3
C.M4(C.M1(), C.M2(), C.M1()); //does not step into M4 and the last M1
C.M3(C.M5(C.P1), C.M5(C.P1)); //does not step into M3 and the last M5

C.M6(); //(4) need 2 step-in if disabled JMC
C.M3(C.M6(), C.M6()); //(4) need 2 step-in if disabled JMC
;

class C {
    public static int P1 => 1;
    public static int P2 => 2;

    public static int M1() => 1;
    public static int M2() => 2;

    public static void M3(int a, int b) {
        ;
    }
    public static void M4(int a, int b, int c = 0, int d = 0) {
        ;
    }
    public static int M5(int k) => k + 1;

    [DebuggerStepThrough]
    public static int M6() { return 1; }
}
  1. If there is using statement, a step-over may behave like step-in. Repro:
    
    using var c = new C();
    ;
    //here always steps into Dispose

class C : IDisposable { public void Dispose() { ; } }


6. If there is `using` statement, a step-in may behave like step-over.
Repro:
```csharp
C.M();
;

class C : IDisposable {
    public void Dispose() {
        ;
    }

    public static void M() {
        using var c = new C();
        ;
    } //here never steps into Dispose
}
gbalykov commented 11 months ago

Thanks for reporting this! We'll take a look.

gbalykov commented 8 months ago

This should be fixed in latest release. Feel free to reopen if you see any more related issues.