Ignore intervals that has no mapping for origin line (KT-12896)
This commit is contained in:
@@ -352,6 +352,10 @@ data class RangeMapping(val source: Int, val dest: Int, var range: Int = 1, var
|
|||||||
return skip || (dest <= destLine && destLine < dest + range)
|
return skip || (dest <= destLine && destLine < dest + range)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasMappingForSource(sourceLine: Int): Boolean {
|
||||||
|
return skip || (source <= sourceLine && sourceLine < source + range)
|
||||||
|
}
|
||||||
|
|
||||||
fun mapDestToSource(destLine: Int): Int {
|
fun mapDestToSource(destLine: Int): Int {
|
||||||
return if (skip) -1 else source + (destLine - dest)
|
return if (skip) -1 else source + (destLine - dest)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,15 @@ private fun inlinedLinesNumbers(
|
|||||||
val smap = smapData.kotlinStrata ?: return listOf()
|
val smap = smapData.kotlinStrata ?: return listOf()
|
||||||
|
|
||||||
val mappingsToInlinedFile = smap.fileMappings.filter() { it.name == inlineFileName }
|
val mappingsToInlinedFile = smap.fileMappings.filter() { it.name == inlineFileName }
|
||||||
return mappingsToInlinedFile.flatMap { it.lineMappings.map { it.mapSourceToDest(inlineLineNumber) } }
|
val mappingIntervals = mappingsToInlinedFile.flatMap { it.lineMappings }
|
||||||
|
|
||||||
|
val mappedLines = mappingIntervals.asSequence().
|
||||||
|
filter { rangeMapping -> rangeMapping.hasMappingForSource(inlineLineNumber) }.
|
||||||
|
map { rangeMapping -> rangeMapping.mapSourceToDest(inlineLineNumber) }.
|
||||||
|
filter { line -> line != -1 }.
|
||||||
|
toList()
|
||||||
|
|
||||||
|
return mappedLines
|
||||||
}
|
}
|
||||||
|
|
||||||
@Volatile var emulateDexDebugInTests: Boolean = false
|
@Volatile var emulateDexDebugInTests: Boolean = false
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:5
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:23
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:29
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:34
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:41
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:46
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:53
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:60
|
||||||
|
LineBreakpoint created at dexSeveralInlineFunctionsInOneFile.kt:66
|
||||||
|
!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! dexSeveralInlineFunctionsInOneFile.DexSeveralInlineFunctionsInOneFileKt
|
||||||
|
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:5
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:23
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:29
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:41
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:66
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:34
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:46
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:53
|
||||||
|
dexSeveralInlineFunctionsInOneFile.kt:60
|
||||||
|
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
|
||||||
|
Process finished with exit code 0
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
package dexSeveralInlineFunctionsInOneFile
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
//Breakpoint!
|
||||||
|
inlineCalls() // line 5
|
||||||
|
}
|
||||||
|
|
||||||
|
fun inlineCalls() {
|
||||||
|
one() // line 23
|
||||||
|
ObjectOne.one() // line 29
|
||||||
|
ClassOne().one() // line 41
|
||||||
|
|
||||||
|
two() // line 66
|
||||||
|
ObjectOne.two() // line 34
|
||||||
|
ClassOne().two() // line 46
|
||||||
|
|
||||||
|
ObjectTwo.one() // line 53
|
||||||
|
ClassTwo().one() // line 60
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun one() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
|
||||||
|
object ObjectOne {
|
||||||
|
inline fun one() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun two() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassOne {
|
||||||
|
inline fun one() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun two() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object ObjectTwo {
|
||||||
|
inline fun one() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassTwo {
|
||||||
|
inline fun one() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun two() {
|
||||||
|
//Breakpoint!
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun some() = 1
|
||||||
|
|
||||||
|
// RESUME: 9
|
||||||
@@ -613,6 +613,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
doCustomTest(fileName);
|
doCustomTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dexSeveralInlineFunctionsInOneFile.kt")
|
||||||
|
public void testDexSeveralInlineFunctionsInOneFile() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/dexSeveralInlineFunctionsInOneFile.kt");
|
||||||
|
doCustomTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("funLiteral.kt")
|
@TestMetadata("funLiteral.kt")
|
||||||
public void testFunLiteral() throws Exception {
|
public void testFunLiteral() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/funLiteral.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/funLiteral.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user