Replace return with nop to avoid merging line instructions (KT-18949)

Dex ignores subsequent line numbers for same instructions and interprets
instruction after inline as if they were inlined. This makes debugger
behaves as if there's nowhere to stop on line with breakpoint.

This also makes stepping through inline function consistent with
non-inline analog. In both context debugger now stops on '}'.

 #KT-18949 Fixed
 #KT-17120 Fixed
This commit is contained in:
Nikolay Krasko
2017-07-10 15:41:57 +03:00
parent fc685aa03f
commit ce4f923ba0
30 changed files with 76 additions and 15 deletions
@@ -5,4 +5,4 @@ fun main(args: Array<String>) {
}
// ADDITIONAL_BREAKPOINT: functionInLibrary.kt:public inline fun simpleFun()
// STEP_INTO: 2
// STEP_INTO: 4
@@ -3,6 +3,8 @@ Run Java
Connected to the target VM
functionInLibrary.kt:4
functionInLibrary.kt:8
functionInLibrary.kt:9
functionInLibrary.kt:5
stepIntoStdlibInlineFun2step.kt:5
Disconnected from the target VM
@@ -14,4 +14,4 @@ inline fun foo(f: () -> Unit) {
f()
}
// STEP_OVER: 2
// STEP_OVER: 3
@@ -3,6 +3,7 @@ Run Java
Connected to the target VM
soInlineCallInLastStatementInInline.kt:9
soInlineCallInLastStatementInInline.kt:10
soInlineCallInLastStatementInInline.kt:11
soInlineCallInLastStatementInInline.kt:5
Disconnected from the target VM
@@ -3,6 +3,7 @@ Run Java
Connected to the target VM
soInlineCallInLastStatementInInlineDex.kt:10
soInlineCallInLastStatementInInlineDex.kt:11
soInlineCallInLastStatementInInlineDex.kt:12
soInlineCallInLastStatementInInlineDex.kt:5
soInlineCallInLastStatementInInlineDex.kt:6
Disconnected from the target VM
@@ -3,6 +3,7 @@ Run Java
Connected to the target VM
soInlineCallInLastStatementInInlineFunctionArgument.kt:7
soInlineCallInLastStatementInInlineFunctionArgument.kt:8
soInlineCallInLastStatementInInlineFunctionArgument.kt:14
soInlineCallInLastStatementInInlineFunctionArgument.kt:9
Disconnected from the target VM
@@ -4,7 +4,7 @@ fun main(args: Array<String>) {
bar {
nop()
//Breakpoint!
foo()
foo() // <-- Should not stop here twice
}
}
@@ -2,7 +2,7 @@ LineBreakpoint created at soInlineCallInLastStatementInInlineFunctionArgumentDex
Run Java
Connected to the target VM
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:7
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:8
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:7
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:9
Disconnected from the target VM
@@ -2,6 +2,8 @@ LineBreakpoint created at soInlineCallInLastStatementInInlineInInline.kt:15
Run Java
Connected to the target VM
soInlineCallInLastStatementInInlineInInline.kt:15
soInlineCallInLastStatementInInlineInInline.kt:16
soInlineCallInLastStatementInInlineInInline.kt:11
soInlineCallInLastStatementInInlineInInline.kt:5
soInlineCallInLastStatementInInlineInInline.kt:6
Disconnected from the target VM
@@ -17,4 +17,4 @@ inline fun foo(f1: () -> Unit, f2: () -> Unit) {
f2()
}
// STEP_OVER 5
// STEP_OVER: 5
@@ -2,6 +2,7 @@ LineBreakpoint created at soInlineFunCallInLastStatementOfInlineWithArgumentFrom
Run Java
Connected to the target VM
soInlineFunCallInLastStatementOfInlineWithArgumentFromCalleeAndOwn.kt:11
soInlineFunCallInLastStatementOfInlineWithArgumentFromCalleeAndOwn.kt:13
soInlineFunCallInLastStatementOfInlineWithArgumentFromCalleeAndOwn.kt:7
Disconnected from the target VM
@@ -14,4 +14,4 @@ inline fun bar(f: (Int) -> Unit) {
f(1)
}
// STEP_OVER: 1
// STEP_OVER: 2
@@ -2,6 +2,7 @@ LineBreakpoint created at soInlineFunWithLastStatementMultilineArgumentCall.kt:1
Run Java
Connected to the target VM
soInlineFunWithLastStatementMultilineArgumentCall.kt:14
soInlineFunWithLastStatementMultilineArgumentCall.kt:15
soInlineFunWithLastStatementMultilineArgumentCall.kt:9
Disconnected from the target VM
@@ -2,6 +2,7 @@ LineBreakpoint created at soInlineFunWithLastStatementOneLineArgumentCall.kt:11
Run Java
Connected to the target VM
soInlineFunWithLastStatementOneLineArgumentCall.kt:11
soInlineFunWithLastStatementOneLineArgumentCall.kt:12
soInlineFunWithLastStatementOneLineArgumentCall.kt:6
soInlineFunWithLastStatementOneLineArgumentCall.kt:7
Disconnected from the target VM
@@ -4,6 +4,7 @@ Connected to the target VM
soInlineIfConditionLambdaFalse.kt:11
soInlineIfConditionLambdaFalse.kt:15
soInlineIfConditionLambdaFalse.kt:18
soInlineIfConditionLambdaFalse.kt:19
soInlineIfConditionLambdaFalse.kt:7
Disconnected from the target VM
@@ -4,6 +4,7 @@ Connected to the target VM
soInlineIfConditionLambdaTrue.kt:11
soInlineIfConditionLambdaTrue.kt:12
soInlineIfConditionLambdaTrue.kt:18
soInlineIfConditionLambdaTrue.kt:19
soInlineIfConditionLambdaTrue.kt:7
Disconnected from the target VM
@@ -0,0 +1,17 @@
package soInlineUnitFunDex
fun main(args: Array<String>) {
process()
}
fun process(): String {
simple()
//Breakpoint!
return "Constant" // 1
}
inline fun simple() {
inner()
}
fun inner() {}
@@ -0,0 +1,8 @@
LineBreakpoint created at soInlineUnitFunDex.kt:10
Run Java
Connected to the target VM
soInlineUnitFunDex.kt:10
soInlineUnitFunDex.kt:4
Disconnected from the target VM
Process finished with exit code 0
@@ -16,4 +16,4 @@ inline fun bar(f: (Int) -> Unit) {
fun foo() {}
// STEP_OVER: 4
// STEP_OVER: 5
@@ -5,6 +5,7 @@ stepOverInsideInlineFun.kt:11
stepOverInsideInlineFun.kt:12
stepOverInsideInlineFun.kt:13
stepOverInsideInlineFun.kt:14
stepOverInsideInlineFun.kt:15
stepOverInsideInlineFun.kt:7
Disconnected from the target VM