Commit Graph

22 Commits

Author SHA1 Message Date
Kristoffer Andersen 43b61a618d [IR+Tests] Improve Local Function Debugging Experience
This change improves the debugging experience around local functions
on the IR backend. The changes include moving old
checkLocalVariablesTable (cLVT) tests to the new stepping/local variable
infrastructure in order to refine the tests and further define the
behavior of the two JVM backends, and their differences.

The primary ported test case is cLVT/localFun.kt that documents the
discrepancy in implementation strategy for local functions on the two
backends. The old backend implements local functions as lambdas
assigned to a local variable while the IR backend lifts them out as
static funtions on the surrounding class. The discrepancies and their
consequences are documented in bytecodeListing, idea-stepping,
localVariableTable and debugStepping tests.

The only _code change_ is disabling the captured variable name
mangling for captured variables on the IR backend. Captured variables
are passed as arguments to the static function, so in the debugger,
they really just are local variables. For them to show properly in the
debugger and be detectable by evaluate expression, they simply need no
mangling.

Finally, this change cleans 3 redundant cLVT tests, copyFunction.kt
and destructuringInlineLambda.kt and destructuringInFor.kt, that are
all covered in the new suite. The stepping behavior needs to be made
precise around for loops, but that is an entirely seperate issue.
2021-01-11 18:21:23 +01:00
Kristoffer Andersen 8a5f260d04 [IR] Align debugging of suspend lambdas with old BE
The existing backend restores LVs and parameters from the suspend lambda
fields used for spilling between suspension points, hence they are
visible in the debugger as local variables, plain and simple.

This PR introduces the same pattern to the IR backend, to bring the
debugging experience in line with the existing backend.

Both backends are still at the mercy of the liveness analysis
performed in the coroutine transformer where a liveness analysis
minimizes live ranges of entries in the LVT. E.g. an unused parameter
will be dropped entirely.

Adjusted existing test expectations accounting for the differences in
LV behavior.
2020-12-12 11:48:47 +01:00
Kristoffer Andersen 5967e8295e [IR] Align captured receiver variable naming with old BE 2020-11-18 15:18:10 +01:00
Mads Ager a37f16d7a2 [IR] Do not generate line numbers for synthesized data class members.
Fixes KT-41903.
2020-10-06 19:53:47 +02:00
Steven Schäfer 39736868bf JVM IR: Allow debugger to evaluate expressions involving IR dependencies 2020-10-01 14:35:05 +02:00
Steven Schäfer 48b736e551 JVM IR: Enable evaluate expression tests for the JVM IR backend 2020-10-01 14:35:05 +02:00
Ilmir Usmanov 4fb5f8603a Keep $continuation in LVT
in case of suspend functions and `this` is case of lambdas, since they
are used in async stack trace generation.
Update tests.
 #KT-40661 Open
2020-07-29 00:01:12 +02:00
Yan Zhulanow bf890a1540 Debugger, tests: Change ADDITIONAL_BREAKPOINT directive format
- Make it extendable and easier to parse
- Allow to create additional function breakpoints
2020-05-27 02:38:43 +09:00
Yan Zhulanow 0afd73b95c Debugger: Pass files with inline functions to backend (KT-36404) 2020-05-27 02:38:42 +09:00
Yan Zhulanow 7490c229ac EA-219152 (partially): Support KClass 'unboxing' in debugger
KClass can be 'unboxed' to a plain Java class. Debugger should be aware of this.
Unfortunately, this commit is not enough to fully support this scenario, as it's impossible to invoke KClass methods/extension on java.lang.Class instance. There should be an additional diagnostic that will forbid such calls.
2020-02-14 17:35:18 +09:00
Yan Zhulanow 3027fab238 EA-218160: Force-box only assignment l-values 2020-02-14 17:35:18 +09:00
Yan Zhulanow dc71ab5bb3 EA-211010: Fix receiver parameter name for lambdas passed as value arguments 2020-02-14 17:35:18 +09:00
Yan Zhulanow f129ab55c5 Debugger: Rewrite step out action
This commit fixes the following tests:
 - KotlinSteppingTestGenerated.Custom.testStepOutInlineFunctionStdlib
 - KotlinSteppingTestGenerated.StepOut.testStepOutSeveralInlineArgumentDeepest
2020-02-14 17:35:17 +09:00
Alexander Udalov 9187a85aaf Rename UseExperimental->OptIn, Experimental->RequiresOptIn in quickfix and IDE tests 2020-01-14 21:04:43 +01:00
Yan Zhulanow ab0f841642 Debugger: Provide fixed implementation of 'toString()' for lambdas (KT-32691) 2019-11-25 17:26:27 +09:00
Yan Zhulanow 82a1750d26 Debugger: Forbid 'Nothing' constructor calls in evaluated code (KT-33093) 2019-11-25 17:26:27 +09:00
Vladimir Ilmov 25acb1e191 [coroutine][debugger] removed and regenerated tests for not-ready-to-be-tested logic, kt* tests are failing due to KT-32691 2019-11-20 13:17:56 +03:00
Aleksandr Prokopyev 1dc44b4000 Debugger: Tests refactor 2019-11-19 12:29:53 +03:00
Yan Zhulanow 87e0a2d98c Debugger: Fix evaluation of function declarations with expression bodies (KT-32704)
Before this commit, the substituted FunctionDescriptor didn't have a source element.
As a result, 'CodeFragmentParameterAnalyzer.isCodeFragmentDeclaration' failed to recognize such a descriptor as fragment-local, and it was erroneously captured.
2019-10-24 21:33:00 +09:00
Yan Zhulanow 716c9f79f7 Debugger: Do not use expression code fragments for evaluator (KT-32736, KT-32741)
It seems like it doesn't make much sense to create expression code fragments.
People type statements or several expressions separated with a semicolon to a single-line expression line.
That is exactly what block code fragment was designed for.
2019-10-24 21:33:00 +09:00
Yan Zhulanow 472ec72eb9 Refactor debugger tests
1. Move tests to their own module
2. Avoid sharing the 'tinyApp' project between tests
3. Clean up option directive handling
2019-10-08 19:13:56 +09:00
Yan Zhulanow d8d81c51d7 Move debugger test data to the new location 2019-10-08 19:13:55 +09:00