diff --git a/annotations/com/intellij/debugger/settings/annotations.xml b/annotations/com/intellij/debugger/settings/annotations.xml
new file mode 100644
index 00000000000..07670e88314
--- /dev/null
+++ b/annotations/com/intellij/debugger/settings/annotations.xml
@@ -0,0 +1,5 @@
+
+ -
+
+
+
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/jet/plugin/PluginStartupComponent.java b/idea/src/org/jetbrains/jet/plugin/PluginStartupComponent.java
index 730a42d0927..f4ebc2e2a66 100644
--- a/idea/src/org/jetbrains/jet/plugin/PluginStartupComponent.java
+++ b/idea/src/org/jetbrains/jet/plugin/PluginStartupComponent.java
@@ -19,6 +19,7 @@ package org.jetbrains.jet.plugin;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.components.ApplicationComponent;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jet.plugin.debugger.filter.FilterPackage;
import org.jetbrains.jet.plugin.quickfix.QuickFixRegistrar;
import org.jetbrains.jet.utils.PathUtil;
@@ -35,6 +36,8 @@ public class PluginStartupComponent implements ApplicationComponent {
public void initComponent() {
registerPathVariable();
QuickFixRegistrar.registerQuickFixes();
+
+ FilterPackage.addKotlinStdlibDebugFilterIfNeeded();
}
private static void registerPathVariable() {
diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/KotlinDebuggerSettings.kt b/idea/src/org/jetbrains/jet/plugin/debugger/KotlinDebuggerSettings.kt
index 4e7f89e27df..1a316250151 100644
--- a/idea/src/org/jetbrains/jet/plugin/debugger/KotlinDebuggerSettings.kt
+++ b/idea/src/org/jetbrains/jet/plugin/debugger/KotlinDebuggerSettings.kt
@@ -35,6 +35,7 @@ import java.util.Arrays
State(name = "KotlinDebuggerSettings", storages = array(Storage(file = StoragePathMacros.APP_CONFIG + "/kotlin_debug.xml")))
public class KotlinDebuggerSettings : XDebuggerSettings("kotlin_debugger"), Getter {
public var DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES: Boolean = true
+ public var DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED: Boolean = false
class object {
public fun getInstance(): KotlinDebuggerSettings {
diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/filter/DebuggerFiltersUtil.kt b/idea/src/org/jetbrains/jet/plugin/debugger/filter/DebuggerFiltersUtil.kt
new file mode 100644
index 00000000000..9661bb37255
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/debugger/filter/DebuggerFiltersUtil.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2010-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.debugger.filter
+
+import com.intellij.debugger.settings.DebuggerSettings
+import com.intellij.ui.classFilter.ClassFilter
+import org.jetbrains.jet.plugin.debugger.KotlinDebuggerSettings
+
+private val KOTLIN_STDLIB_FILTER = "kotlin.*"
+
+public fun addKotlinStdlibDebugFilterIfNeeded() {
+ if (!KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED) {
+ val settings = DebuggerSettings.getInstance()!!
+ val newFilters = (settings.getSteppingFilters() + ClassFilter(KOTLIN_STDLIB_FILTER)).copyToArray()
+
+ settings.setSteppingFilters(newFilters)
+
+ KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = true
+ }
+}
+
diff --git a/idea/testData/debugger/tinyApp/outs/stdlibStep.out b/idea/testData/debugger/tinyApp/outs/stdlibStep.out
new file mode 100644
index 00000000000..a0261823e47
--- /dev/null
+++ b/idea/testData/debugger/tinyApp/outs/stdlibStep.out
@@ -0,0 +1,8 @@
+LineBreakpoint created at stdlibStep.kt:6
+!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! stdlibStep.StdlibStepPackage
+Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
+stdlibStep.kt:5
+stdlibStep.kt:6
+Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
+
+Process finished with exit code 0
diff --git a/idea/testData/debugger/tinyApp/src/filters/stdlibStep.kt b/idea/testData/debugger/tinyApp/src/filters/stdlibStep.kt
new file mode 100644
index 00000000000..56164e96901
--- /dev/null
+++ b/idea/testData/debugger/tinyApp/src/filters/stdlibStep.kt
@@ -0,0 +1,8 @@
+package stdlibStep
+
+fun main(args: Array) {
+ val a = intArray(1)
+ //Breakpoint!
+ a.withIndices()
+ val b = 1
+}
diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/AbstractKotlinSteppingTest.kt b/idea/tests/org/jetbrains/jet/plugin/debugger/AbstractKotlinSteppingTest.kt
index 0b30488c8ff..d766564890a 100644
--- a/idea/tests/org/jetbrains/jet/plugin/debugger/AbstractKotlinSteppingTest.kt
+++ b/idea/tests/org/jetbrains/jet/plugin/debugger/AbstractKotlinSteppingTest.kt
@@ -34,6 +34,8 @@ import com.intellij.debugger.settings.DebuggerSettings
public abstract class AbstractKotlinSteppingTest : KotlinDebuggerTestCase() {
private var oldSettings: DebuggerSettings by Delegates.notNull()
+ private var oldIsFilterForStdlibAlreadyAdded: Boolean by Delegates.notNull()
+ private var oldDisableKoltinInternalClasses: Boolean by Delegates.notNull()
override fun initApplication() {
super.initApplication()
@@ -67,17 +69,30 @@ public abstract class AbstractKotlinSteppingTest : KotlinDebuggerTestCase() {
}
private fun configureSettings(fileText: String) {
+ val kotlinSettings = KotlinDebuggerSettings.getInstance()
+ kotlinSettings.DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = false
+ kotlinSettings.DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES = fileText.getValueForSetting("DISABLE_KOTLIN_INTERNAL_CLASSES", oldDisableKoltinInternalClasses)
+
val debuggerSettings = DebuggerSettings.getInstance()!!
- debuggerSettings.SKIP_CONSTRUCTORS = findStringWithPrefixes(fileText, "// SKIP_CONSTRUCTORS: ")?.toBoolean() ?: oldSettings.SKIP_CONSTRUCTORS
- debuggerSettings.SKIP_CLASSLOADERS = findStringWithPrefixes(fileText, "// SKIP_CLASSLOADERS: ")?.toBoolean() ?: oldSettings.SKIP_CLASSLOADERS
- debuggerSettings.TRACING_FILTERS_ENABLED = findStringWithPrefixes(fileText, "// TRACING_FILTERS_ENABLED: ")?.toBoolean() ?: oldSettings.TRACING_FILTERS_ENABLED
+ debuggerSettings.SKIP_CONSTRUCTORS = fileText.getValueForSetting("SKIP_CONSTRUCTORS", oldSettings.SKIP_CONSTRUCTORS)
+ debuggerSettings.SKIP_CLASSLOADERS = fileText.getValueForSetting("SKIP_CLASSLOADERS", oldSettings.SKIP_CLASSLOADERS)
+ debuggerSettings.TRACING_FILTERS_ENABLED = fileText.getValueForSetting("TRACING_FILTERS_ENABLED", oldSettings.TRACING_FILTERS_ENABLED)
+ }
+
+ private fun String.getValueForSetting(name: String, defaultValue: Boolean): Boolean {
+ return findStringWithPrefixes(this, "// $name: ")?.toBoolean() ?: defaultValue
}
private fun saveDefaultSettings() {
+ oldIsFilterForStdlibAlreadyAdded = KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED
+ oldDisableKoltinInternalClasses = KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES
oldSettings = DebuggerSettings.getInstance()!!.clone()
}
private fun restoreDefaultSettings() {
+ KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = oldIsFilterForStdlibAlreadyAdded
+ KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES = oldDisableKoltinInternalClasses
+
val debuggerSettings = DebuggerSettings.getInstance()!!
debuggerSettings.SKIP_CONSTRUCTORS = oldSettings.SKIP_CONSTRUCTORS
debuggerSettings.SKIP_CLASSLOADERS = oldSettings.SKIP_CLASSLOADERS
diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java
index f497675b75d..2942da04fee 100644
--- a/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java
+++ b/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java
@@ -206,6 +206,11 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
doStepIntoTest("idea/testData/debugger/tinyApp/src/filters/skipConstructors.kt");
}
+ @TestMetadata("stdlibStep.kt")
+ public void testStdlibStep() throws Exception {
+ doStepIntoTest("idea/testData/debugger/tinyApp/src/filters/stdlibStep.kt");
+ }
+
}
public static Test suite() {