From 0ea407fef990abab3ba3fca4101e5bac3bca0c87 Mon Sep 17 00:00:00 2001 From: Jiaxiang Chen Date: Tue, 5 Nov 2019 13:55:00 -0800 Subject: [PATCH] debug information test: handle vm resume correctly. --- .../localVariables/destructuringInLambdas.kt | 6 ++--- .../testData/debug/localVariables/localFun.kt | 2 +- .../debug/localVariables/underscoreNames.kt | 22 +++++++++---------- .../debugInformation/AbstractDebugTest.kt | 13 ++++++----- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/compiler/testData/debug/localVariables/destructuringInLambdas.kt b/compiler/testData/debug/localVariables/destructuringInLambdas.kt index ca1c252bc6c..16a619004d7 100644 --- a/compiler/testData/debug/localVariables/destructuringInLambdas.kt +++ b/compiler/testData/debug/localVariables/destructuringInLambdas.kt @@ -12,9 +12,9 @@ fun box() { // TestKt:8: // A:3: x:java.lang.String, y:int // TestKt:8: -// TestKt:5: $dstr$x$y:A -// TestKt$box$1:8: -// TestKt$box$1.invoke(java.lang.Object)+8: a:A, block:TestKt$box$1 +// TestKt:5: a:A, block:TestKt$box$1 +// TestKt$box$1:8: $dstr$x$y:A +// TestKt$box$1.invoke(java.lang.Object)+8: // TestKt:5: a:A, block:TestKt$box$1 // TestKt:8: // TestKt:9: \ No newline at end of file diff --git a/compiler/testData/debug/localVariables/localFun.kt b/compiler/testData/debug/localVariables/localFun.kt index d74602f1f24..2e8c7ba7997 100644 --- a/compiler/testData/debug/localVariables/localFun.kt +++ b/compiler/testData/debug/localVariables/localFun.kt @@ -11,6 +11,6 @@ fun box() { // IGNORE_BACKEND: JVM_IR // LOCAL VARIABLES // TestKt:9: -// TestKt:4: $fun$bar$1:TestKt$foo$1 +// TestKt:4: // TestKt:6: $fun$bar$1:TestKt$foo$1 // TestKt:10: \ No newline at end of file diff --git a/compiler/testData/debug/localVariables/underscoreNames.kt b/compiler/testData/debug/localVariables/underscoreNames.kt index 4eeb479658d..95853ee7baf 100644 --- a/compiler/testData/debug/localVariables/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/underscoreNames.kt @@ -28,22 +28,22 @@ fun box() { // A:3: x:double, y:java.lang.String, z:char // A:3: // TestKt:11: -// TestKt:5: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int -// TestKt$box$1:14: +// TestKt:5: a:A, block:TestKt$box$1 +// TestKt$box$1:14: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int +// A:3: // A:3: x:double, y:java.lang.String, z:char // A:3: -// A:3: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char -// TestKt$box$1:14: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char -// TestKt$box$1:15: +// TestKt$box$1:14: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char +// TestKt$box$1:15: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char +// A:3: // A:3: x:double, y:java.lang.String, z:char // A:3: -// A:3: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char -// TestKt$box$1:15: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char, _:java.lang.String, d:char -// TestKt$box$1:17: -// TestKt:7: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char, _:java.lang.String, d:char +// TestKt$box$1:15: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char // TestKt$box$1:17: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char, _:java.lang.String, d:char -// TestKt$box$1:21: -// TestKt$box$1.invoke(java.lang.Object, java.lang.Object, java.lang.Object)+19: a:A, block:TestKt$box$1 +// TestKt:7: +// TestKt$box$1:17: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char, _:java.lang.String, d:char +// TestKt$box$1:21: $dstr$x$_u24__u24$y:A, $noName_1:java.lang.String, w:int, x:double, y:char, a:double, c:char, _:java.lang.String, d:char +// TestKt$box$1.invoke(java.lang.Object, java.lang.Object, java.lang.Object)+19: // TestKt:5: a:A, block:TestKt$box$1 // TestKt:11: // TestKt:23: \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt index b98f3466a39..6f7adfa5bd0 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt @@ -170,6 +170,9 @@ abstract class AbstractDebugTest : CodegenTestCase() { val classLoader = createGeneratedClassLoader(classesDir) val aClass = getGeneratedClass(classLoader, TEST_CLASS) + if (virtualMachine.allThreads().any { it.isSuspended }) { + virtualMachine.resume() + } invokeBoxInSeparateProcess(classLoader, aClass, proxyPort) val manager = virtualMachine.eventRequestManager() @@ -178,7 +181,7 @@ abstract class AbstractDebugTest : CodegenTestCase() { var inBoxMethod = false vmLoop@ while (true) { - val eventSet = virtualMachine.eventQueue().remove(1000) + val eventSet = virtualMachine.eventQueue().remove(1000) ?: continue for (event in eventSet) { when (event) { is VMDeathEvent, is VMDisconnectEvent -> { @@ -201,33 +204,31 @@ abstract class AbstractDebugTest : CodegenTestCase() { inBoxMethod = true storeStep(loggedItems, event) } - virtualMachine.resume() } is StepEvent -> { // Handle the case where an Exception causing program to exit without MethodExitEvent. if (inBoxMethod && event.location().method().name() == "run") { - virtualMachine.resume() + manager.stepRequests().map { it.disable() } break@vmLoop } if (inBoxMethod) { storeStep(loggedItems, event) } - virtualMachine.resume() } is MethodExitEvent -> { if (event.location().method().name() == BOX_METHOD) { manager.stepRequests().map { it.disable() } - virtualMachine.resume() break@vmLoop } - virtualMachine.resume() } else -> { throw IllegalStateException("event not handled: $event") } } } + eventSet.resume() } + virtualMachine.resume() checkResult(wholeFile, loggedItems) }