From d13bcef4f24f3fb5e02fa240771dab14b486f745 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 29 Jul 2020 17:04:25 +0200 Subject: [PATCH] [test][dwarfdump] todo --- .../kotlin/native/test/debugger/DwarfTests.kt | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/backend.native/tests/debugger/src/test/kotlin/org/jetbrains/kotlin/native/test/debugger/DwarfTests.kt b/backend.native/tests/debugger/src/test/kotlin/org/jetbrains/kotlin/native/test/debugger/DwarfTests.kt index b04b41badb3..3913f88ba9d 100644 --- a/backend.native/tests/debugger/src/test/kotlin/org/jetbrains/kotlin/native/test/debugger/DwarfTests.kt +++ b/backend.native/tests/debugger/src/test/kotlin/org/jetbrains/kotlin/native/test/debugger/DwarfTests.kt @@ -1,7 +1,6 @@ package org.jetbrains.kotlin.native.test.debugger -import junit.framework.Assert.assertEquals -import junit.framework.Assert.assertNotSame +import junit.framework.Assert.* import org.junit.Ignore import org.junit.Test @@ -63,36 +62,8 @@ class DwarfTests { } """.trimIndent().binary("poisoned", "-g", "-l", poisonLibrary.toString(), "-l", callbackLibrary.toString(), "-l", trapLibrary.toString()) - /** - * TODO: this has been address teken from lldb session: - * (lldb) r - * Process 25687 launched: '/var/folders/56/ldwtkqhx2t5g06z1s3tt9gth0000gp/T/dwarfdump_test_complex6078130564175092652/poisoned.kexe' (x86_64) - * Process 25687 stopped - * * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) - * frame #0: 0x0000000100092964 poisoned.kexe`trap_trap_wrapper0 + 4 - * poisoned.kexe`trap_trap_wrapper0: - * -> 0x100092964 <+4>: ud2 - * 0x100092966: nop - * 0x100092967: nop - * 0x100092968: nop - * Target 0: (poisoned.kexe) stopped. - * (lldb) bt - * * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) - * * frame #0: 0x0000000100092964 poisoned.kexe`trap_trap_wrapper0 + 4 - * frame #1: 0x000000010005403c poisoned.kexe`kfun:main$_1#internal(a=-559038737) at poisoned.kt:5:126 - * frame #2: 0x00000001000540f9 poisoned.kexe`_706f69736f6e6564_knbridge0(p0=-559038737) at poisoned.kt:5:93 - * frame #3: 0x0000000100092949 poisoned.kexe`callback_callback_wrapper0 + 25 - * frame #4: 0x0000000100053f47 poisoned.kexe`kfun:#main(){} [inlined] execute at poison.kt:8:10 - * frame #5: 0x0000000100053f3b poisoned.kexe`kfun:#main(){} at poisoned.kt:4 - * frame #6: 0x00000001000541b0 poisoned.kexe`Konan_start(args=0x0000000100309818) at poisoned.kt:3:1 - * frame #7: 0x000000010005edeb poisoned.kexe`Init_and_run_start + 107 - * frame #8: 0x00007fff700abcc9 libdyld.dylib`start + 1 - * (lldb) - * On mac we can replace with calculating address with otool(1) - * > otool -tv -p '_kfun:main$_1#internal' ../poisoned.kexe - * on other platforms with corresponding tools (objdump) - */ - binary.dwarfDumpLookup(0x000000010005403c) { + binary.dwarfDumpLookup("kfun:main\$_1#internal") { + assertFalse(this.isEmpty()) val subprogram = single { it.tag == DwarfTag.Tag.DW_TAG_subprogram } as DwarfTagSubprogram assertEquals(subprogram.file!!.name, "poison.kt") }