diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt index 30b17683ebf..f3bb351f6f1 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt @@ -16,6 +16,7 @@ import com.sun.jdi.AbsentInformationException import com.sun.jdi.ReferenceType import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME import org.jetbrains.kotlin.idea.debugger.isDexDebug +import org.jetbrains.kotlin.idea.debugger.safeSourceName import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType import org.jetbrains.kotlin.util.containingNonLocalDeclaration @@ -50,14 +51,15 @@ class KotlinLineBreakpoint( val lineNumber = sourcePosition.line + 1 for (location in allLineLocations) { - try { - val kotlinFileName = location.sourceName(KOTLIN_STRATA_NAME) - val kotlinLineNumber = location.lineNumber(KOTLIN_STRATA_NAME) + val kotlinFileName = location.safeSourceName(KOTLIN_STRATA_NAME) + val kotlinLineNumber = location.lineNumber(KOTLIN_STRATA_NAME) + + if (kotlinFileName != null) { if (kotlinFileName == fileName && kotlinLineNumber == lineNumber) { return true } - } catch (e: AbsentInformationException) { - if (location.sourceName() == fileName && location.lineNumber() == lineNumber) { + } else { + if (location.safeSourceName() == fileName && location.lineNumber() == lineNumber) { return true } } diff --git a/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/safeUtil.kt b/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/safeUtil.kt index e7b9a10bfe7..d7c406a2392 100644 --- a/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/safeUtil.kt +++ b/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/safeUtil.kt @@ -62,7 +62,11 @@ fun StackFrameProxy.safeLocation(): Location? { } fun Location.safeSourceName(): String? { - return DebuggerUtilsEx.getSourceName(this) { null } + return wrapAbsentInformationException { this.sourceName() } +} + +fun Location.safeSourceName(stratum: String): String? { + return wrapAbsentInformationException { this.sourceName(stratum) } } fun Location.safeLineNumber(): Int { @@ -92,6 +96,8 @@ private inline fun wrapAbsentInformationException(block: () -> T): T? { null } catch (e: AbsentInformationEvaluateException) { null + } catch (e: InternalException) { + null } }