Better search for inlined strings in strata: there might me several file mappings to the same file (KT-12896)

#KT-12896 In Progress
This commit is contained in:
Nikolay Krasko
2016-08-01 15:51:59 +03:00
parent ace58e8aa2
commit 2dd7470cdc
12 changed files with 128 additions and 2 deletions
@@ -81,8 +81,8 @@ private fun inlinedLinesNumbers(
val smap = smapData.kotlinStrata ?: return listOf()
val mappingToInlinedFile = smap.fileMappings.firstOrNull() { it.name == inlineFileName } ?: return listOf()
return mappingToInlinedFile.lineMappings.map { it.mapSourceToDest(inlineLineNumber) }
val mappingsToInlinedFile = smap.fileMappings.filter() { it.name == inlineFileName }
return mappingsToInlinedFile.flatMap { it.lineMappings.map { it.mapSourceToDest(inlineLineNumber) } }
}
@Volatile var emulateDexDebugInTests: Boolean = false
@@ -0,0 +1,8 @@
LineBreakpoint created at dexInlineInClass.Other.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 !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! dexInlineInClass.DexInlineInClassKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
dexInlineInClass.Other.kt:6
dexInlineInClass.Other.kt:7
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 dexInlineInObject.Other.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 !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! dexInlineInObject.DexInlineInObjectKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
dexInlineInObject.Other.kt:6
dexInlineInObject.Other.kt:7
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,10 @@
LineBreakpoint created at dexInlineInObjectSameFile.kt:5
LineBreakpoint created at dexInlineInObjectSameFile.kt:11
!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! dexInlineInObjectSameFile.DexInlineInObjectSameFileKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
dexInlineInObjectSameFile.kt:5
dexInlineInObjectSameFile.kt:11
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
+10
View File
@@ -0,0 +1,10 @@
LineBreakpoint created at inlineInObject.kt:5
LineBreakpoint created at inlineInObject.kt:11
!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! inlineInObject.InlineInObjectKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
inlineInObject.kt:5
inlineInObject.kt:11
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,15 @@
package dexInlineInObjectSameFile
fun main(args: Array<String>) {
//Breakpoint!
OtherWithInline.one()
}
object OtherWithInline {
inline fun one() {
//Breakpoint!
println()
}
}
// RESUME: 1
@@ -0,0 +1,15 @@
package inlineInObject
fun main(args: Array<String>) {
//Breakpoint!
OtherWithInline.one()
}
object OtherWithInline {
inline fun one() {
//Breakpoint!
println()
}
}
// RESUME: 1
@@ -0,0 +1,11 @@
package dexInlineInClass.other
class TestDexInlineInClass {
inline fun inlineFun() {
// Breakpoint 1
some()
some()
}
fun some() {}
}
@@ -0,0 +1,7 @@
package dexInlineInClass
fun main(args: Array<String>) {
dexInlineInClass.other.TestDexInlineInClass().inlineFun()
}
// ADDITIONAL_BREAKPOINT: dexInlineInClass.Other.kt: Breakpoint 1
@@ -0,0 +1,11 @@
package dexInlineInObject.other
object TestDexInlineInObject {
inline fun inlineFun() {
// Breakpoint 1
some()
some()
}
fun some() {}
}
@@ -0,0 +1,7 @@
package dexInlineInObject
fun main(args: Array<String>) {
dexInlineInObject.other.TestDexInlineInObject.inlineFun()
}
// ADDITIONAL_BREAKPOINT: dexInlineInObject.Other.kt: Breakpoint 1
@@ -373,6 +373,18 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/stepping/stepOver"), Pattern.compile("^([^.]+)\\.kt$"), true);
}
@TestMetadata("dexInlineInClass.kt")
public void testDexInlineInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/dexInlineInClass.kt");
doStepOverTest(fileName);
}
@TestMetadata("dexInlineInObject.kt")
public void testDexInlineInObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/dexInlineInObject.kt");
doStepOverTest(fileName);
}
@TestMetadata("dexStopInInlineFun.kt")
public void testDexStopInInlineFun() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/dexStopInInlineFun.kt");
@@ -577,6 +589,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
doCustomTest(fileName);
}
@TestMetadata("dexInlineInObjectSameFile.kt")
public void testDexInlineInObjectSameFile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/dexInlineInObjectSameFile.kt");
doCustomTest(fileName);
}
@TestMetadata("dexManyFilesWithInlineCalls1.kt")
public void testDexManyFilesWithInlineCalls1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/dexManyFilesWithInlineCalls1.kt");
@@ -625,6 +643,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
doCustomTest(fileName);
}
@TestMetadata("inlineInObject.kt")
public void testInlineInObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/inlineInObject.kt");
doCustomTest(fileName);
}
@TestMetadata("severalFunLiterals.kt")
public void testSeveralFunLiterals() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/severalFunLiterals.kt");