Skip to content

Instantly share code, notes, and snippets.

@shyouhei
Created May 9, 2017 02:08
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 shyouhei/e12db84f9256ad3b70a37e4408b53512 to your computer and use it in GitHub Desktop.
Save shyouhei/e12db84f9256ad3b70a37e4408b53512 to your computer and use it in GitHub Desktop.
% lldb -- ./miniruby -e0
(lldb) target create "./miniruby"
Current executable set to './miniruby' (x86_64).
(lldb) settings set -- target.run-args "-e0"
(lldb) env DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib
(lldb) env MALLOC_CHECK_HARDER=1
(lldb) env MALLOC_PROTECT_BEFORE=1
(lldb) env RUBY_DEBUG=gc_stress
(lldb) run
Process 11348 launched: './miniruby' (x86_64)
GuardMalloc[miniruby-11348]: Allocations will be placed on 16 byte boundaries.
GuardMalloc[miniruby-11348]: - Some buffer overruns may not be noticed.
GuardMalloc[miniruby-11348]: - Applications using vector instructions (e.g., SSE) should work.
GuardMalloc[miniruby-11348]: version 108
Process 11348 stopped
* thread #1: tid = 0x80594, 0x00000001000877c9 miniruby`gc_sweep_step(objspace=0x0000000100cab000, heap=0x0000000100cab020) + 409 at gc.c:3371, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100ecc010)
frame #0: 0x00000001000877c9 miniruby`gc_sweep_step(objspace=0x0000000100cab000, heap=0x0000000100cab020) + 409 at gc.c:3371
3368 p = offset + i * BITS_BITLENGTH;
3369 do {
3370 if (bitset & 1) {
-> 3371 switch (BUILTIN_TYPE(p)) {
3372 default: { /* majority case */
3373 gc_report(2, objspace, "page_sweep: free %s\n", obj_info((VALUE)p));
3374 #if USE_RGENGC && RGENGC_CHECK_MODE
(lldb) bt
* thread #1: tid = 0x80594, 0x00000001000877c9 miniruby`gc_sweep_step(objspace=0x0000000100cab000, heap=0x0000000100cab020) + 409 at gc.c:3371, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100ecc010)
* frame #0: 0x00000001000877c9 miniruby`gc_sweep_step(objspace=0x0000000100cab000, heap=0x0000000100cab020) + 409 at gc.c:3371
frame #1: 0x00000001000861db miniruby`gc_sweep + 20 at gc.c:3608
frame #2: 0x00000001000861c7 miniruby`gc_sweep(objspace=0x0000000100cab000) + 311
frame #3: 0x0000000100086d5c miniruby`gc_start(objspace=0x0000000100cab000, full_mark=<unavailable>, immediate_mark=<unavailable>, reason=<unavailable>, immediate_sweep=<unavailable>) + 1724 at gc.c:5457
frame #4: 0x0000000100087293 miniruby`garbage_collect_with_gvl(objspace=0x0000000100cab000, full_mark=0, immediate_mark=1, immediate_sweep=1, reason=4608) + 131 at gc.c:6394
frame #5: 0x0000000100089bd8 miniruby`objspace_xmalloc [inlined] objspace_malloc_gc_stress(objspace=0x0000000100cab000) + 152 at gc.c:7531
frame #6: 0x0000000100089ba9 miniruby`objspace_xmalloc [inlined] objspace_malloc_gc_stress(objspace=<unavailable>)
frame #7: 0x0000000100089ba9 miniruby`objspace_xmalloc(objspace=0x0000000100cab000, size=<unavailable>) + 105
frame #8: 0x000000010015d3eb miniruby`st_init_numtable + 10 at st.c:222
frame #9: 0x000000010015d3e1 miniruby`st_init_numtable [inlined] st_init_table(type=<unavailable>)
frame #10: 0x000000010015d3e1 miniruby`st_init_numtable + 1
frame #11: 0x000000010008a291 miniruby`Init_heap + 481 at gc.c:2269
frame #12: 0x0000000100062ecb miniruby`ruby_setup + 43 at eval.c:55
frame #13: 0x0000000100062f89 miniruby`ruby_init + 9 at eval.c:76
frame #14: 0x000000010020fe5d miniruby`main(argc=<unavailable>, argv=<unavailable>) + 77 at main.c:35
frame #15: 0x00007fff972a35ad libdyld.dylib`start + 1
frame #16: 0x00007fff972a35ad libdyld.dylib`start + 1
(lldb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment