Skip to content

Instantly share code, notes, and snippets.

@LLFourn
Created July 11, 2016 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LLFourn/96b8101af227fe6e08a647cf55709025 to your computer and use it in GitHub Desktop.
Save LLFourn/96b8101af227fe6e08a647cf55709025 to your computer and use it in GitHub Desktop.
I've been getting segfaults in this area recently. The trace is a bit different but I guess it's related. It seems that flag_map in gc_mark is no longer allocated so I get segfault.
(lldb) r
There is a running process, kill it and restart?: [Y/n] y
Process 75673 exited with status = 9 (0x00000009)
Process 75691 launched: '/Users/llfourn/src/rakudo/install/bin/moar' (x86_64)
Process 75691 stopped
* thread #1: tid = 0x23cfc68, 0x0000000100063ca4 libmoar.dylib`gc_mark(tc=0x0000000100500290, st=0x0000000101004f40, data=<unavailable>, worklist=0x000000010d27c1a0) + 84 at MVMCallCapture.c:55, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10a72533)
frame #0: 0x0000000100063ca4 libmoar.dylib`gc_mark(tc=0x0000000100500290, st=0x0000000101004f40, data=<unavailable>, worklist=0x000000010d27c1a0) + 84 at MVMCallCapture.c:55
52 MVMuint16 count = ctx->arg_count;
53 MVMuint16 i, flag;
54 for (i = 0, flag = 0; i < count; i++, flag++) {
-> 55 if (flag_map[flag] & MVM_CALLSITE_ARG_NAMED) {
56 /* Current position is name, then next is value. */
57 MVM_gc_worklist_add(tc, worklist, &ctx->args[i].s);
58 i++;
(lldb) bt
* thread #1: tid = 0x23cfc68, 0x0000000100063ca4 libmoar.dylib`gc_mark(tc=0x0000000100500290, st=0x0000000101004f40, data=<unavailable>, worklist=0x000000010d27c1a0) + 84 at MVMCallCapture.c:55, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10a72533)
* frame #0: 0x0000000100063ca4 libmoar.dylib`gc_mark(tc=0x0000000100500290, st=0x0000000101004f40, data=<unavailable>, worklist=0x000000010d27c1a0) + 84 at MVMCallCapture.c:55
frame #1: 0x000000010003f002 libmoar.dylib`MVM_gc_mark_collectable(tc=<unavailable>, worklist=<unavailable>, new_addr=<unavailable>) + 1714 at collect.c:399
frame #2: 0x000000010003e883 libmoar.dylib`process_worklist(tc=0x0000000100500290, worklist=0x000000010d27c1a0, wtp=0x00007fff5fbff468, gen='\0') + 899 at collect.c:313
frame #3: 0x000000010003e324 libmoar.dylib`MVM_gc_collect(tc=0x0000000100500290, what_to_do=<unavailable>, gen=<unavailable>) + 820 at collect.c:129
frame #4: 0x000000010003b703 libmoar.dylib`run_gc(tc=0x0000000100500290, what_to_do='\0') + 131 at orchestrate.c:304
frame #5: 0x000000010003b4c8 libmoar.dylib`MVM_gc_enter_from_allocator(tc=0x0000000100500290) + 984 at orchestrate.c:438
frame #6: 0x000000010003bca8 libmoar.dylib`MVM_gc_allocate_zeroed [inlined] MVM_gc_allocate_nursery(tc=<unavailable>, size=<unavailable>) + 52 at allocation.c:32
frame #7: 0x000000010003bc74 libmoar.dylib`MVM_gc_allocate_zeroed [inlined] MVM_gc_allocate(tc=<unavailable>) + 23 at allocation.h:13
frame #8: 0x000000010003bc5d libmoar.dylib`MVM_gc_allocate_zeroed(tc=0x0000000100500290, size=40) + 13 at allocation.c:49
frame #9: 0x000000010003bf44 libmoar.dylib`MVM_gc_allocate_object(tc=0x0000000100500290, st=<unavailable>) + 84 at allocation.c:86
frame #10: 0x000000010005813f libmoar.dylib`allocate(tc=<unavailable>, st=<unavailable>) + 15 at P6opaque.c:60
frame #11: 0x0000000100050d27 libmoar.dylib`MVM_repr_box_str [inlined] MVM_repr_alloc_init(tc=0x0000000100500290, type=0x0000000101626fc0) + 14 at reprconv.c:13
frame #12: 0x0000000100050d19 libmoar.dylib`MVM_repr_box_str(tc=0x0000000100500290, type=0x0000000101626fc0, val=<unavailable>) + 73 at reprconv.c:586
frame #13: 0x0000000100009c07 libmoar.dylib`MVM_exception_backtrace(tc=0x0000000100500290, ex_obj=<unavailable>) + 1111 at exceptions.c:407
frame #14: 0x0000000100017488 libmoar.dylib`MVM_interp_run(tc=0x0000000100500290, initial_invoke=<unavailable>, invoke_data=<unavailable>) + 47320 at interp.c:3830
frame #15: 0x00000001000c8305 libmoar.dylib`MVM_vm_run_file(instance=<unavailable>, filename=<unavailable>) + 181 at moar.c:304
frame #16: 0x000000010000170a moar`main(argc=<unavailable>, argv=0x00007fff5fbff8e8) + 666 at main.c:191
frame #17: 0x00007fff900c05ad libdyld.dylib`start + 1
frame #18: 0x00007fff900c05ad libdyld.dylib`start + 1
(lldb) fr v
(MVMThreadContext *) tc = 0x0000000100500290
(MVMSTable *) st = 0x0000000101004f40
(void *) data = <variable not available>
(MVMGCWorklist *) worklist = 0x000000010d27c1a0
(MVMCallCaptureBody *) body = <no location, value may have been optimized out>
(MVMArgProcContext *) ctx = 0x000000010a6f3c00
(MVMuint16) flag = 0
(MVMuint16) i = 0
(MVMuint16) count = <variable not available>
(MVMuint8 *) flag_map = 0x0000000010a72533 ""
(lldb) p flag_map
(MVMuint8 *) $6 = 0x0000000010a72533 ""
(lldb) p flag_map[0]
error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory
By flag_map I mean ctx->callsite->arg_flags:
(lldb) p ctx->arg_flags
(MVMCallsiteEntry *) $8 = 0x0000000000000000
(lldb) p ctx->callsite->arg_flags
(MVMCallsiteEntry *) $9 = 0x0000000010a72533 ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment