Skip to content

Instantly share code, notes, and snippets.

@kcmannem
Last active November 27, 2016 01:21
Show Gist options
  • Save kcmannem/032aa7b568f82297ba2f88041518085d to your computer and use it in GitHub Desktop.
Save kcmannem/032aa7b568f82297ba2f88041518085d to your computer and use it in GitHub Desktop.
.text
.type _test, @function
.globl _test
_test:
call *%rdi
ret
@_silgen_name("_test")
func testing(x: () -> Void)
/*func testing(x: () -> Void) {
x()
}*/
func hello() {
print("hello")
}
testing(x: hello)
* thread #1: tid = 16017, 0x00007ffff7bb5fc2 libswiftCore.so`generic specialization <preserving fragile attribute, Any, Swift._TeeStream<Swift.String, Swift._Stdout> with Swift._TeeStream<Swift.String, Swift._Stdout> : Swift.TextOutputStream in Swift> of Swift._print_unlocked <A, B where B: Swift.TextOutputStream> (A, inout B) -> () + 578, name = 'main', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
* frame #0: 0x00007ffff7bb5fc2 libswiftCore.so`generic specialization <preserving fragile attribute, Any, Swift._TeeStream<Swift.String, Swift._Stdout> with Swift._TeeStream<Swift.String, Swift._Stdout> : Swift.TextOutputStream in Swift> of Swift._print_unlocked <A, B where B: Swift.TextOutputStream> (A, inout B) -> () + 578
frame #1: 0x00007ffff7c8d253 libswiftCore.so`function signature specialization <preserving fragile attribute, Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed and Exploded, Arg[2] = Owned To Guaranteed and Exploded> of generic specialization <preserving fragile attribute, Swift._TeeStream<Swift.String, Swift._Stdout> with Swift._TeeStream<Swift.String, Swift._Stdout> : Swift.TextOutputStream in Swift> of Swift._print <A where A: Swift.TextOutputStream> (Swift.Array<Any>, separator : Swift.String, terminator : Swift.String, to : inout A) -> () with unmangled suffix "_merged" + 387
frame #2: 0x00007ffff7c8d02a libswiftCore.so`function signature specialization <preserving fragile attribute, Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed and Exploded, Arg[2] = Owned To Guaranteed and Exploded> of generic specialization <preserving fragile attribute, Swift._TeeStream<Swift.String, Swift._Stdout> with Swift._TeeStream<Swift.String, Swift._Stdout> : Swift.TextOutputStream in Swift> of Swift._print <A where A: Swift.TextOutputStream> (Swift.Array<Any>, separator : Swift.String, terminator : Swift.String, to : inout A) -> () + 42
frame #3: 0x00007ffff7c8d69f libswiftCore.so`function signature specialization <preserving fragile attribute, Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed and Exploded, Arg[2] = Owned To Guaranteed and Exploded> of Swift.print (Swift.Array<Any>, separator : Swift.String, terminator : Swift.String) -> () with unmangled suffix "_merged" + 175
frame #4: 0x00007ffff7c8d08d libswiftCore.so`function signature specialization <preserving fragile attribute, Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed and Exploded, Arg[2] = Owned To Guaranteed and Exploded> of Swift.print (Swift.Array<Any>, separator : Swift.String, terminator : Swift.String) -> () + 45
frame #5: 0x00007ffff7bba49d libswiftCore.so`Swift.print (Swift.Array<Any>, separator : Swift.String, terminator : Swift.String) -> () + 29
frame #6: 0x0000000000400e08 main`hello() -> () + 152 at func.swift:9
frame #7: 0x0000000000400e12 main`_test + 2
frame #8: 0x0000000000400d61 main`main + 81 at func.swift:12
frame #9: 0x00007ffff6e6cf45 libc.so.6`__libc_start_main + 245
frame #10: 0x0000000000400c49 main`_start + 41
0000000000400d10 <main>:
400d10: 55 push %rbp
400d11: 48 89 e5 mov %rsp,%rbp
400d14: 48 83 ec 10 sub $0x10,%rsp
400d18: 48 8b 05 d1 32 20 00 mov 0x2032d1(%rip),%rax # 603ff0 <_DYNAMIC+0x250>
400d1f: 48 8b 0d b2 32 20 00 mov 0x2032b2(%rip),%rcx # 603fd8 <_DYNAMIC+0x238>
400d26: 48 8b 15 a3 32 20 00 mov 0x2032a3(%rip),%rdx # 603fd0 <_DYNAMIC+0x230>
400d2d: 89 3a mov %edi,(%rdx)
400d2f: 48 89 c7 mov %rax,%rdi
400d32: 48 89 75 f8 mov %rsi,-0x8(%rbp)
400d36: 48 89 ce mov %rcx,%rsi
400d39: e8 62 fe ff ff callq 400ba0 <swift_once@plt>
400d3e: 48 8d 05 cb 00 00 00 lea 0xcb(%rip),%rax # 400e10 <_TToF4main5helloFT_T_>
400d45: 48 8b 0d 94 32 20 00 mov 0x203294(%rip),%rcx # 603fe0 <_DYNAMIC+0x240>
400d4c: 48 8b 55 f8 mov -0x8(%rbp),%rdx
400d50: 48 89 11 mov %rdx,(%rcx)
400d53: 48 89 c7 mov %rax,%rdi
400d56: e8 c1 00 00 00 callq 400e1c <_test>
400d5b: 31 c0 xor %eax,%eax
400d5d: 48 83 c4 10 add $0x10,%rsp
400d61: 5d pop %rbp
400d62: c3 retq
400d63: 66 66 66 66 2e 0f 1f data32 data32 data32 nopw %cs:0x0(%rax,%rax,1)
0000000000400e10 <_TToF4main5helloFT_T_>:
400e10: 55 push %rbp
400e11: 48 89 e5 mov %rsp,%rbp
400e14: e8 57 ff ff ff callq 400d70 <_TF4main5helloFT_T_>
400e19: 5d pop %rbp
400e1a: c3 retq
400e1b: 90 nop
0000000000400e1c <_test>:
400e1c: ff d7 callq *%rdi
400e1e: c3 retq
400e1f: 90 nop
0000000000400d90 <main>:
400d90: 55 push %rbp
400d91: 48 89 e5 mov %rsp,%rbp
400d94: 48 83 ec 10 sub $0x10,%rsp
400d98: 48 8b 05 51 32 20 00 mov 0x203251(%rip),%rax # 603ff0 <_DYNAMIC+0x260>
400d9f: 48 8b 0d 22 32 20 00 mov 0x203222(%rip),%rcx # 603fc8 <_DYNAMIC+0x238>
400da6: 48 8b 15 13 32 20 00 mov 0x203213(%rip),%rdx # 603fc0 <_DYNAMIC+0x230>
400dad: 89 3a mov %edi,(%rdx)
400daf: 48 89 c7 mov %rax,%rdi
400db2: 48 89 75 f8 mov %rsi,-0x8(%rbp)
400db6: 48 89 ce mov %rcx,%rsi
400db9: e8 62 fe ff ff callq 400c20 <swift_once@plt>
400dbe: 48 8d 05 6b 00 00 00 lea 0x6b(%rip),%rax # 400e30 <_TF4main5helloFT_T_>
400dc5: 45 31 c0 xor %r8d,%r8d
400dc8: 44 89 c6 mov %r8d,%esi
400dcb: 48 8b 0d 06 32 20 00 mov 0x203206(%rip),%rcx # 603fd8 <_DYNAMIC+0x248>
400dd2: 48 8b 55 f8 mov -0x8(%rbp),%rdx
400dd6: 48 89 11 mov %rdx,(%rcx)
400dd9: 48 89 c7 mov %rax,%rdi
400ddc: e8 0f 00 00 00 callq 400df0 <_TF4main7testingFT1xFT_T__T_>
400de1: 31 c0 xor %eax,%eax
400de3: 48 83 c4 10 add $0x10,%rsp
400de7: 5d pop %rbp
400de8: c3 retq
400de9: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
0000000000400df0 <_TF4main7testingFT1xFT_T__T_>:
400df0: 55 push %rbp
400df1: 48 89 e5 mov %rsp,%rbp
400df4: 48 83 ec 20 sub $0x20,%rsp
400df8: 48 89 7d f0 mov %rdi,-0x10(%rbp)
400dfc: 48 89 75 f8 mov %rsi,-0x8(%rbp)
400e00: 48 89 7d e8 mov %rdi,-0x18(%rbp)
400e04: 48 89 f7 mov %rsi,%rdi
400e07: 48 89 75 e0 mov %rsi,-0x20(%rbp)
400e0b: e8 c0 00 00 00 callq 400ed0 <rt_swift_retain>
400e10: 48 8b 7d e0 mov -0x20(%rbp),%rdi
400e14: 48 8b 75 e8 mov -0x18(%rbp),%rsi
400e18: ff d6 callq *%rsi
400e1a: 48 8b 7d e0 mov -0x20(%rbp),%rdi
400e1e: e8 bd 00 00 00 callq 400ee0 <rt_swift_release>
400e23: 48 83 c4 20 add $0x20,%rsp
400e27: 5d pop %rbp
400e28: c3 retq
400e29: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment