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

[kotlin][debugger] Remove bytecode inspection for coroutine method switch check #2842

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nikita-nazarov
Copy link
Contributor

When checking if a suspend method has a state machine, the debugger inspected bytecode trying to find an instruction like getfield com/example/MainKt$foo$1.label:I. This approach didn't work in Android Studio, which resulted in a stepping difference between IDEs. This commit introduces a simpler way of detecting if a state machine is generated for a suspend function.

@zuevmaxim

When checking if a suspend method has a state machine, the debugger inspected bytecode trying to find an instruction like `getfield com/example/MainKt$foo$1.label:I`. This approach didn't work in Android Studio, which resulted in a stepping difference between IDEs. This commit introduces a simpler way of detecting if a state machine is generated for a suspend function.
@mvicsokolova
Copy link
Contributor

Probably this approach will not work for the cases with tail call optimization, when no state machine is generated for a suspend lambda. I'll check the cases like this.

@nikita-nazarov maybe you could share an example of code, where the behavior was different?

@nikita-nazarov
Copy link
Contributor Author

Tests that fail on Android without this inspection:
testSiSuspendFun
testStepIntoSuspendFunctionSimple

@nikita-nazarov
Copy link
Contributor Author

Hi @mvicsokolova! Can you please take a look at this pr?

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

Successfully merging this pull request may close these issues.

2 participants