Debugger: do not put breakpoints at lines from another file in case of inline function

This commit is contained in:
Natalia Ukhorskaya
2016-02-16 15:30:51 +03:00
parent 42927bb078
commit c5d788d049
6 changed files with 33 additions and 2 deletions
@@ -299,7 +299,7 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq
try {
val line = position.line + 1
val locations = if (myDebugProcess.virtualMachineProxy.versionHigher("1.4"))
type.locationsOfLine("Kotlin", null, line)
type.locationsOfLine("Kotlin", null, line).filter { it.sourceName("Kotlin") == position.file.name }
else
type.locationsOfLine(line)
if (locations == null || locations.isEmpty()) throw NoDataException.INSTANCE
@@ -0,0 +1,7 @@
LineBreakpoint created at inlineFunctionWithBreakpoint.kt:4
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! inlineFunctionBreakpointAnotherFile.InlineFunctionBreakpointAnotherFileKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
inlineFunctionWithBreakpoint.kt:4
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -1,9 +1,9 @@
LineBreakpoint created at functionInLibrary.kt:4
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! stepIntoStdlibInlineFun2step.StepIntoStdlibInlineFun2stepKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
stepIntoStdlibInlineFun2step.kt:4
functionInLibrary.kt:4
functionInLibrary.kt:8
stepIntoStdlibInlineFun2step.kt:5
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,13 @@
package inlineFunctionBreakpointAnotherFile
fun main(args: Array<String>) {
val a1 = 1
val a2 = 1
val a3 = 1
inlineFunctionWithBreakpoint.myFun {
val a = 1
}
}
// ADDITIONAL_BREAKPOINT: inlineFunctionWithBreakpoint.kt:inline fun myFun
@@ -0,0 +1,5 @@
package inlineFunctionWithBreakpoint
inline fun myFun(f: (Int) -> Unit) {
f(1)
}
@@ -169,6 +169,12 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
doSingleBreakpointTest(fileName);
}
@TestMetadata("inlineFunctionBreakpointAnotherFile.kt")
public void testInlineFunctionBreakpointAnotherFile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/inlineFunctionBreakpointAnotherFile.kt");
doSingleBreakpointTest(fileName);
}
@TestMetadata("inlineFunctionBreakpointVariants.kt")
public void testInlineFunctionBreakpointVariants() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/inlineFunctionBreakpointVariants.kt");