Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Support Stepping Granularities #110

Closed
auott opened this issue May 4, 2020 · 7 comments
Closed

Proposal: Support Stepping Granularities #110

auott opened this issue May 4, 2020 · 7 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@auott
Copy link
Member

auott commented May 4, 2020

Stepping Granularities


A stepping granularity allows specifying how far a specific step (Next, StepIn, StepOut, StepBack) should go.
An adapter can take this as a suggestion and does not need to support them as distinct granularities.
For example, some adapters may consider statement and line equivalent.

export interface Capabilities {
    // ...

    /** The debug adapter supports stepping granularities */
    supportsSteppingGranularity?: boolean;
}

type SteppingGranularity = 'statement' | 'line' | 'instruction';

export interface NextArguments {
    // ...

    /** Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed. */
    granularity?: SteppingGranularity;
}

export interface StepInArguments {
    // ...

    /** Optional granularity to step If no granularity is specified, a granularity of 'statement' is assumed. */
    granularity?: SteppingGranularity;
}

export interface StepOutArguments {
    // ...

    /** Optional granularity to step If no granularity is specified, a granularity of 'statement' is assumed. */
    granularity?: SteppingGranularity;
}

export interface StepBackArguments {
    // ...

    /** Optional granularity to step If no granularity is specified, a granularity of 'statement' is assumed. */
    granularity?: SteppingGranularity;
}

CC: @andrewcrawley, @weinand

@weinand
Copy link
Contributor

weinand commented May 4, 2020

Some questions/comments:

  • is the type StepGranularity exhaustive or could there be more?
  • if a DA supports "Stepping Granularities", does it support the three granularities in addition to the existing unspecified (resulting in a total of four), or are there only three in total?
  • I think I understand what "Stepping Granularities" mean for "Next" and "StepBack". But do they really make sense for "StepIn" and "StepOut"?
  • naming inconsistency between "stepping" and step": supportsSteppingGranularity vs StepGranularity. I prefer "stepping".

@weinand weinand self-assigned this May 4, 2020
@weinand weinand added the feature-request Request for new features or functionality label May 4, 2020
@auott
Copy link
Member Author

auott commented May 4, 2020

  • is the type StepGranularity exhaustive or could there be more?

These three have historically been sufficient for our usage, however I don't see why a different DA couldn't have other granularities.

  • if a DA supports "Stepping Granularities", does it support the three granularities in addition to the existing unspecified (resulting in a total of four), or are there only three in total?

In my mind there are only three granularities, but a DA that supports stepping granularities would still support steps that don't specify a granularity. For requests that are made without specifying a granularity the DA would have an implicit granularity that doesn't need to be communicated with the client.

  • I think I understand what "Stepping Granularities" mean for "Next" and "StepBack". But do they really make sense for "StepIn" and "StepOut"?

StepIn and StepOut can have meaningful differences - most notably with Instruction granularity.
For C++ StepIn-Instruction on a "call" instruction would execute one instruction and would take you to the direct next instruction. Statement or Line would take you past the prolog of the function being called.
Similarly, StepOut-Instruction would go just to the instruction after the return, where Line/Statement would go past any cleanup associated with the line (i.e. destructors for temporaries, or extracting return values).

  • naming inconsistency between "stepping" and step": supportsSteppingGranularity vs StepGranularity. I prefer "stepping".

Updated!

@chuckries
Copy link
Member

I think it's worth noting that these are essentially "hints". If they are not provided, an adapter would do exactly what it does today when it receives a step. If they are provided, the adapter can be smarter about how "far" to step.

@weinand
Copy link
Contributor

weinand commented May 5, 2020

@auott thanks for your comments:

if we agree that there are three granularities, and the implicit (not specified) granularity is one of the three, then we should make the implicit granularity explicit, e.g. by saying something like "if no granularity is specified, a SteppingGranularity of 'line' is assumed. In this case we should make the value 'line' the first of the three. If we think that 'line' is not always the default, then I suggest that we introduce another granularity 'natural' or 'default' as the default (and make it the first for the four).

@gregg-miskelly
Copy link
Member

The C# debugger uses 'statement' as the default today. That is also the default option value in Visual Studio. So if we want the first option to be the default, I think the proposal is already correct.

@auott
Copy link
Member Author

auott commented May 5, 2020

Updated to explicitly indicate that statement is the default granularity.

@weinand
Copy link
Contributor

weinand commented May 7, 2020

@auott since you are using the proposed feature already I assume that you have an updated JSON schema for it. Could you please submit a PR for that?

@weinand weinand closed this as completed May 14, 2020
@weinand weinand added this to the May 2020 milestone May 14, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants