Make breakpoints work in local functions in secondary constructors

This commit is contained in:
Nikolay Krasko
2016-11-22 17:40:52 +03:00
committed by Nikolay Krasko
parent 1889f4f7b1
commit 60e3c8eecd
6 changed files with 74 additions and 1 deletions
@@ -216,7 +216,8 @@ class DebuggerClassNameProvider(val myDebugProcess: DebugProcess, val scopes: Li
KtNamedFunction::class.java,
KtPropertyAccessor::class.java,
KtProperty::class.java,
KtClassInitializer::class.java)
KtClassInitializer::class.java,
KtSecondaryConstructor::class.java)
private fun getElementToCalculateClassName(notPositionedElement: PsiElement?): KtElement? {
if (notPositionedElement?.javaClass as Class<*> in TYPES_TO_CALCULATE_CLASSNAME) return notPositionedElement as KtElement
@@ -0,0 +1,8 @@
LineBreakpoint created at stopInLocalFunInSecondaryConstructor.kt:7
!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! stopInLocalFunInSecondaryConstructor.StopInLocalFunInSecondaryConstructorKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
stopInLocalFunInSecondaryConstructor.kt:7
stopInLocalFunInSecondaryConstructor.kt:8
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,8 @@
LineBreakpoint created at stopInlineCallInLocalFunInSecondaryConstructor.kt:8
!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! stopInlineCallInLocalFunInSecondaryConstructor.StopInlineCallInLocalFunInSecondaryConstructorKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
stopInlineCallInLocalFunInSecondaryConstructor.kt:8
stopInlineCallInLocalFunInSecondaryConstructor.kt:9
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,19 @@
package stopInLocalFunInSecondaryConstructor
class Foo(bar: Any) {
constructor() : this(12) {
fun some() {
//Breakpoint!
nop()
nop()
}
some()
}
fun nop() {}
}
fun main(args: Array<String>) {
Foo()
}
@@ -0,0 +1,25 @@
package stopInlineCallInLocalFunInSecondaryConstructor
class Foo(bar: Any) {
constructor() : this(12) {
fun test() {
inlineFun {
//Breakpoint!
nop()
nop()
}
}
test()
}
fun nop() {}
}
fun main(args: Array<String>) {
Foo()
}
inline fun inlineFun(f: () -> Any) {
f()
}
@@ -752,6 +752,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
doStepOverTest(fileName);
}
@TestMetadata("stopInLocalFunInSecondaryConstructor.kt")
public void testStopInLocalFunInSecondaryConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInLocalFunInSecondaryConstructor.kt");
doStepOverTest(fileName);
}
@TestMetadata("stopInLocalFunInlineCallLambda.kt")
public void testStopInLocalFunInlineCallLambda() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInLocalFunInlineCallLambda.kt");
@@ -781,6 +787,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInObjectLiteralInInlineCallWithClosure.kt");
doStepOverTest(fileName);
}
@TestMetadata("stopInlineCallInLocalFunInSecondaryConstructor.kt")
public void testStopInlineCallInLocalFunInSecondaryConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInlineCallInLocalFunInSecondaryConstructor.kt");
doStepOverTest(fileName);
}
}
@TestMetadata("idea/testData/debugger/tinyApp/src/stepping/filters")