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

Add compiler support for expression breakpoints #42579

Closed
gafter opened this issue Mar 19, 2020 · 5 comments
Closed

Add compiler support for expression breakpoints #42579

gafter opened this issue Mar 19, 2020 · 5 comments

Comments

@gafter
Copy link
Member

gafter commented Mar 19, 2020

Add support in the compiler for breakpoints within expressions, for example

  1. On the when clause and arm expression of a switch expression;
  2. On each initializer of an object initializer expression;
  3. On the second and third operands of a conditional expression; and
  4. On the second operand of &&, ||, and ??.

@tmat Has analyzed what we need to produce to make this happen, and it requires we produce a special kind of synthetic sequence point at the end of the instrumented subexpression to direct the debugger's attention back to the enclosing statement. The synthetic sequence point is produced as a sequence of existing sequence points and IL to produce the intended result:

Goto L
SequencePoint SpanOfEnclosingStatement
nop
SequencePoint Hidden
L:

The proposal is to represent this as a single bound node to ensure we will emit the (unreachable) nop instruction.

@gafter
Copy link
Member Author

gafter commented Mar 19, 2020

it might be obvious, but it might be worth adding a comment to the compiler on the implementation that we have to make sure that the IL offset of the unreachable [SequencePoint Enclosing] is greater than the IL offset of the sequence point that actually represents the enclosing "statement".

this will allow the debugger to disambiguate between these two sequence points that have the same span but different IL offsets

@gafter
Copy link
Member Author

gafter commented Mar 19, 2020

See also #22016

@gafter
Copy link
Member Author

gafter commented Apr 1, 2020

Addressed in #42711

@gafter gafter closed this as completed Apr 1, 2020
@Suchiman
Copy link
Contributor

Suchiman commented Apr 1, 2020

@gafter the issue names 4 constructs to be supported but the PR seems to be specifically about switch expressions only, should this be kept open or are these points tracked separately for later?

@gafter
Copy link
Member Author

gafter commented Apr 2, 2020

This issue represents adding support in the compiler internals necessary for instrumenting expressions. Actually instrumenting specific expression forms will be tracked by separate issues and decided separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants