Last active
December 24, 2020 01:26
-
-
Save kivikakk/3aaca18c136f6681146e777451fe4014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tapioca ~/C/s/z/se (master|…) $ ~/Code/zig/build/bin/zig build-exe example.zig | |
tapioca ~/C/s/z/se (master|…) $ lldb example | |
(lldb) target create "example" | |
Current executable set to '/Users/kameliya/Code/snep/zy/se/example' (x86_64). | |
(lldb) run | |
Process 61165 launched: '/Users/kameliya/Code/snep/zy/se/example' (x86_64) | |
hi | |
hi | |
hi | |
Process 61165 stopped | |
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x100049d58) | |
frame #0: 0x0000000100001569 example`main at example.zig:21:27 | |
18 | |
19 var sub_var = sub_const; | |
20 inspect(0, S{ .u = U{ .S = &sub_var } }); | |
-> 21 inspect(0, .{ .u = U{ .S = &sub_var } }); | |
22 } | |
Target 0: (example) stopped. | |
(lldb) bt | |
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x100049d58) | |
* frame #0: 0x0000000100001569 example`main at example.zig:21:27 | |
frame #1: 0x0000000100001773 example`std.start.main [inlined] std.start.callMain at start.zig:345:37 | |
frame #2: 0x0000000100001767 example`std.start.main [inlined] std.start.initEventLoopAndCallMain at start.zig:287 | |
frame #3: 0x0000000100001767 example`std.start.main [inlined] std.start.callMainWithArgs(argc=1, argv=0x0000000304188848, envp=[][*:0]u8 @ 0x00000003041886f0) at start.zig:250 | |
frame #4: 0x0000000100001706 example`std.start.main(c_argc=1, c_argv=0x0000000304188848, c_envp=0x0000000304188858) at start.zig:257 | |
frame #5: 0x00007fff20380621 libdyld.dylib`start + 1 | |
frame #6: 0x00007fff20380621 libdyld.dylib`start + 1 | |
(lldb) disas | |
example`main: | |
0x100001510 <+0>: pushq %rbp | |
0x100001511 <+1>: movq %rsp, %rbp | |
0x100001514 <+4>: subq $0x30, %rsp | |
0x100001518 <+8>: movq 0x4b5a1(%rip), %rax ; (void *)0x00007fff889999b0: __stack_chk_guard | |
0x10000151f <+15>: movq (%rax), %rax | |
0x100001522 <+18>: movq %rax, -0x8(%rbp) | |
0x100001526 <+22>: leaq 0x4b0bb(%rip), %rdi ; __unnamed_6 | |
0x10000152d <+29>: callq 0x1000015b0 ; inspect at example.zig:10 | |
0x100001532 <+34>: leaq 0x4b0bf(%rip), %rdi ; __unnamed_7 | |
0x100001539 <+41>: callq 0x1000015b0 ; inspect at example.zig:10 | |
0x10000153e <+46>: movq 0x487fb(%rip), %rax ; __unnamed_8 | |
0x100001545 <+53>: movq %rax, -0x18(%rbp) | |
0x100001549 <+57>: movq 0x487f8(%rip), %rax ; __unnamed_8 + 8 | |
0x100001550 <+64>: movq %rax, -0x10(%rbp) | |
0x100001554 <+68>: movb $0x1, -0x20(%rbp) | |
0x100001558 <+72>: leaq -0x18(%rbp), %rax | |
0x10000155c <+76>: movq %rax, -0x28(%rbp) | |
0x100001560 <+80>: leaq -0x28(%rbp), %rdi | |
0x100001564 <+84>: callq 0x1000015b0 ; inspect at example.zig:10 | |
-> 0x100001569 <+89>: movb $0x1, 0x487e8(%rip) ; __unnamed_9 + 7 | |
0x100001570 <+96>: leaq -0x18(%rbp), %rax | |
0x100001574 <+100>: movq %rax, 0x487d5(%rip) ; __unnamed_9 | |
0x10000157b <+107>: leaq 0x487de(%rip), %rdi ; __unnamed_10 | |
0x100001582 <+114>: callq 0x1000015b0 ; inspect at example.zig:10 | |
0x100001587 <+119>: movw $0x0, -0x2a(%rbp) | |
0x10000158d <+125>: movq 0x4b52c(%rip), %rax ; (void *)0x00007fff889999b0: __stack_chk_guard | |
0x100001594 <+132>: movq (%rax), %rax | |
0x100001597 <+135>: movq -0x8(%rbp), %rcx | |
0x10000159b <+139>: cmpq %rcx, %rax | |
0x10000159e <+142>: jne 0x1000015a8 ; <+152> at example.zig | |
0x1000015a0 <+144>: xorl %eax, %eax | |
0x1000015a2 <+146>: addq $0x30, %rsp | |
0x1000015a6 <+150>: popq %rbp | |
0x1000015a7 <+151>: retq | |
0x1000015a8 <+152>: callq 0x1000497cc | |
0x1000015ad <+157>: ud2 | |
0x1000015af <+159>: nop | |
(lldb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tapioca ~/C/s/z/se (master|…) $ zig build-exe example.zig | |
tapioca ~/C/s/z/se (master|…) $ lldb example | |
(lldb) target create "example" | |
Current executable set to '/Users/kameliya/Code/snep/zy/se/example' (arm64). | |
(lldb) run | |
warning: (arm64) /Users/kameliya/Code/snep/zy/se/example(0x0000000100000000) address 0x0000000100000000 maps to more than one section: example.__TEXT and example.__TEXT | |
warning: (arm64) /Users/kameliya/Code/snep/zy/se/example(0x0000000100000000) address 0x0000000100048000 maps to more than one section: example.__DATA and example.__DATA | |
Process 61033 launched: '/Users/kameliya/Code/snep/zy/se/example' (arm64) | |
warning: (arm64) /Users/kameliya/Code/snep/zy/se/example(0x0000000100000000) address 0x0000000100000000 maps to more than one section: example.__TEXT and example.__TEXT | |
warning: (arm64) /Users/kameliya/Code/snep/zy/se/example(0x0000000100000000) address 0x0000000100048000 maps to more than one section: example.__DATA and example.__DATA | |
hi | |
hi | |
hi | |
Process 61033 stopped | |
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x100046da8) | |
frame #0: 0x000000010000454c example`main at example.zig:21:27 | |
18 | |
19 var sub_var = sub_const; | |
20 inspect(0, S{ .u = U{ .S = &sub_var } }); | |
-> 21 inspect(0, .{ .u = U{ .S = &sub_var } }); | |
22 } | |
Target 0: (example) stopped. | |
(lldb) bt | |
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x100046da8) | |
* frame #0: 0x000000010000454c example`main at example.zig:21:27 | |
frame #1: 0x0000000100004720 example`std.start.main [inlined] std.start.callMain at start.zig:345:37 | |
frame #2: 0x0000000100004718 example`std.start.main [inlined] std.start.initEventLoopAndCallMain at start.zig:287 | |
frame #3: 0x0000000100004718 example`std.start.main [inlined] std.start.callMainWithArgs(argc=1, argv=0x000000016fdff7c0, envp=[][*:0]u8 @ 0x000000016fdff640) at start.zig:250 | |
frame #4: 0x00000001000046cc example`std.start.main(c_argc=1, c_argv=0x000000016fdff7c0, c_envp=0x000000016fdff7d0) at start.zig:257 | |
frame #5: 0x00000001a4cd0f34 libdyld.dylib`start + 4 | |
(lldb) disas | |
example`main: | |
0x1000044c4 <+0>: sub sp, sp, #0x60 ; =0x60 | |
0x1000044c8 <+4>: stp x29, x30, [sp, #0x50] | |
0x1000044cc <+8>: add x29, sp, #0x50 ; =0x50 | |
0x1000044d0 <+12>: adrp x8, 66 | |
0x1000044d4 <+16>: add x8, x8, #0xda0 ; =0xda0 | |
0x1000044d8 <+20>: adrp x9, 69 | |
0x1000044dc <+24>: ldr x9, [x9, #0x9e0] | |
0x1000044e0 <+28>: ldr x9, [x9] | |
0x1000044e4 <+32>: stur x9, [x29, #-0x8] | |
0x1000044e8 <+36>: adrp x9, 69 | |
0x1000044ec <+40>: add x9, x9, #0x5e8 ; =0x5e8 | |
0x1000044f0 <+44>: mov x0, x9 | |
0x1000044f4 <+48>: str x8, [sp, #0x10] | |
0x1000044f8 <+52>: bl 0x10000459c ; inspect at example.zig:10 | |
0x1000044fc <+56>: adrp x0, 69 | |
0x100004500 <+60>: add x0, x0, #0x5f8 ; =0x5f8 | |
0x100004504 <+64>: bl 0x10000459c ; inspect at example.zig:10 | |
0x100004508 <+68>: adrp x8, 66 | |
0x10000450c <+72>: add x8, x8, #0xd90 ; =0xd90 | |
0x100004510 <+76>: ldr q0, [x8] | |
0x100004514 <+80>: sub x8, x29, #0x20 ; =0x20 | |
0x100004518 <+84>: stur q0, [x29, #-0x20] | |
0x10000451c <+88>: add x9, sp, #0x20 ; =0x20 | |
0x100004520 <+92>: mov w10, #0x1 | |
0x100004524 <+96>: and w11, w10, #0x1 | |
0x100004528 <+100>: strb w11, [x9, #0x8] | |
0x10000452c <+104>: str x8, [sp, #0x20] | |
0x100004530 <+108>: mov x0, x9 | |
0x100004534 <+112>: str x8, [sp, #0x8] | |
0x100004538 <+116>: str w10, [sp, #0x4] | |
0x10000453c <+120>: bl 0x10000459c ; inspect at example.zig:10 | |
0x100004540 <+124>: ldr w10, [sp, #0x4] | |
0x100004544 <+128>: and w11, w10, w10 | |
0x100004548 <+132>: ldr x8, [sp, #0x10] | |
-> 0x10000454c <+136>: strb w11, [x8, #0x8] | |
0x100004550 <+140>: ldr x9, [sp, #0x8] | |
0x100004554 <+144>: str x9, [x8] | |
0x100004558 <+148>: adrp x0, 66 | |
0x10000455c <+152>: add x0, x0, #0xdb0 ; =0xdb0 | |
0x100004560 <+156>: bl 0x10000459c ; inspect at example.zig:10 | |
0x100004564 <+160>: mov w10, #0x0 | |
0x100004568 <+164>: strh w10, [sp, #0x1e] | |
0x10000456c <+168>: adrp x8, 69 | |
0x100004570 <+172>: ldr x8, [x8, #0x9e0] | |
0x100004574 <+176>: ldr x8, [x8] | |
0x100004578 <+180>: ldur x9, [x29, #-0x8] | |
0x10000457c <+184>: subs x8, x8, x9 | |
0x100004580 <+188>: b.ne 0x100004598 ; <+212> at example.zig | |
0x100004584 <+192>: mov w8, #0x0 | |
0x100004588 <+196>: mov x0, x8 | |
0x10000458c <+200>: ldp x29, x30, [sp, #0x50] | |
0x100004590 <+204>: add sp, sp, #0x60 ; =0x60 | |
0x100004594 <+208>: ret | |
0x100004598 <+212>: bl 0x100045f94 | |
(lldb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment