Skip to content

Instantly share code, notes, and snippets.

@kulp
Created March 27, 2020 20:02
Show Gist options
  • Save kulp/1766ae286441880d93b312178d75b803 to your computer and use it in GitHub Desktop.
Save kulp/1766ae286441880d93b312178d75b803 to your computer and use it in GitHub Desktop.
A backtrace from a bitvec/bitbox debugging session
kulp@libra debug_bitbox(scripted) $ lldb --batch --one-line 'b malloc_error_break' --one-line 'r' --one-line 'bt' -- target/debug/deps/debug_bitbox-776d3300cd651276
(lldb) target create "target/debug/deps/debug_bitbox-776d3300cd651276"
Current executable set to 'target/debug/deps/debug_bitbox-776d3300cd651276' (x86_64).
(lldb) b malloc_error_break
Breakpoint 1: where = libsystem_malloc.dylib`malloc_error_break, address = 0x0000000000017972
(lldb) r
running 1 test
debug_bitbox-776d3300cd651276(79728,0x700009362000) malloc: *** error for object 0x101000000: pointer being freed was not allocated
debug_bitbox-776d3300cd651276(79728,0x700009362000) malloc: *** set a breakpoint in malloc_error_break to debug
Process 79728 stopped
* thread #2, name = 'debug_bitbox', stop reason = breakpoint 1.1
frame #0: 0x00007fff65b01972 libsystem_malloc.dylib`malloc_error_break
libsystem_malloc.dylib`malloc_error_break:
-> 0x7fff65b01972 <+0>: pushq %rbp
0x7fff65b01973 <+1>: movq %rsp, %rbp
0x7fff65b01976 <+4>: nop
0x7fff65b01977 <+5>: nopl (%rax)
Target 0: (debug_bitbox-776d3300cd651276) stopped.
Process 79728 launched: '/Users/kulp/Documents/Code/Rust/debug_bitbox/target/debug/deps/debug_bitbox-776d3300cd651276' (x86_64)
(lldb) bt
error: need to add support for DW_TAG_base_type '()' encoded with DW_ATE = 0x7, bit_size = 0
* thread #2, name = 'debug_bitbox', stop reason = breakpoint 1.1
* frame #0: 0x00007fff65b01972 libsystem_malloc.dylib`malloc_error_break
frame #1: 0x00007fff65af500b libsystem_malloc.dylib`malloc_vreport + 437
frame #2: 0x00007fff65af4e38 libsystem_malloc.dylib`malloc_report + 151
frame #3: 0x0000000100002caa debug_bitbox-776d3300cd651276`alloc::alloc::dealloc::h273165950859e262(ptr="", layout=Layout @ 0x0000700009361130) at alloc.rs:103:4
frame #4: 0x0000000100002b46 debug_bitbox-776d3300cd651276`_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Alloc$GT$::dealloc::h2a237a99965f593b(self=0x00007000093613b8, ptr=(pointer = ""), layout=Layout @ 0x0000700009361170) at alloc.rs:174:8
frame #5: 0x0000000100003456 debug_bitbox-776d3300cd651276`alloc::raw_vec::RawVec$LT$T$C$A$GT$::dealloc_buffer::h971634481a62de79(self=0x00007000093613b8) at raw_vec.rs:709:16
frame #6: 0x0000000100003196 debug_bitbox-776d3300cd651276`alloc::raw_vec::RawVec$LT$T$C$A$GT$::shrink_to_fit::h7ea74fe3717c766a(self=0x00007000093613b8, amount=0) at raw_vec.rs:582:16
frame #7: 0x000000010000805b debug_bitbox-776d3300cd651276`alloc::vec::Vec$LT$T$GT$::shrink_to_fit::h6d40443a4da61d20(self=0x00007000093613b8) at vec.rs:615:12
frame #8: 0x000000010000813d debug_bitbox-776d3300cd651276`alloc::vec::Vec$LT$T$GT$::into_boxed_slice::hac223467a7c9bb43(self=Vec<usize> @ 0x00007000093613b8) at vec.rs:673:12
frame #9: 0x000000010000579e debug_bitbox-776d3300cd651276`bitvec::boxed::ops::_$LT$impl$u20$core..ops..drop..Drop$u20$for$u20$bitvec..boxed..BitBox$LT$O$C$T$GT$$GT$::drop::ha5df38b3a7bb05c2(self=0x0000700009361430) at ops.rs:129:7
frame #10: 0x0000000100002565 debug_bitbox-776d3300cd651276`core::ptr::drop_in_place::h4586720a9192a1e1((null)=0x0000700009361430) at mod.rs:174
frame #11: 0x0000000100003dc7 debug_bitbox-776d3300cd651276`debug_bitbox::debug_bitbox::h24f007a049d275ba at lib.rs:11:29
frame #12: 0x0000000100004891 debug_bitbox-776d3300cd651276`debug_bitbox::debug_bitbox::_$u7b$$u7b$closure$u7d$$u7d$::hb30009005b7792b3((null)=0x00007000093614a0) at lib.rs:5
frame #13: 0x0000000100002451 debug_bitbox-776d3300cd651276`core::ops::function::FnOnce::call_once::h1d3463bc82f049e7((null)=closure-0 @ 0x00007000093614a0, (null)=<unavailable>) at function.rs:232:4
frame #14: 0x0000000100014b7e debug_bitbox-776d3300cd651276`_$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h27d1322c81491638 at boxed.rs:1015:8 [opt]
frame #15: 0x000000010005c77b debug_bitbox-776d3300cd651276`__rust_maybe_catch_panic at lib.rs:86:7 [opt]
frame #16: 0x000000010002eaa5 debug_bitbox-776d3300cd651276`test::run_test::run_test_inner::_$u7b$$u7b$closure$u7d$$u7d$::h71c25705e981f4bd [inlined] std::panicking::try::h64fe1944bde3d8ca at panicking.rs:281:12 [opt]
frame #17: 0x000000010002ea60 debug_bitbox-776d3300cd651276`test::run_test::run_test_inner::_$u7b$$u7b$closure$u7d$$u7d$::h71c25705e981f4bd [inlined] std::panic::catch_unwind::he2328e79964636c4 at panic.rs:394 [opt]
frame #18: 0x000000010002ea60 debug_bitbox-776d3300cd651276`test::run_test::run_test_inner::_$u7b$$u7b$closure$u7d$$u7d$::h71c25705e981f4bd [inlined] test::run_test_in_process::h316addbc1cb07abe at lib.rs:539 [opt]
frame #19: 0x000000010002ea48 debug_bitbox-776d3300cd651276`test::run_test::run_test_inner::_$u7b$$u7b$closure$u7d$$u7d$::h71c25705e981f4bd at lib.rs:452 [opt]
frame #20: 0x0000000100008dfb debug_bitbox-776d3300cd651276`std::sys_common::backtrace::__rust_begin_short_backtrace::hfde8bd6e56b0c899 at backtrace.rs:129:4 [opt]
frame #21: 0x000000010000d4fb debug_bitbox-776d3300cd651276`std::panicking::try::do_call::hb5b064d52913f725 [inlined] std::thread::Builder::spawn_unchecked::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::hd839c9ae7715b537 at mod.rs:475:16 [opt]
frame #22: 0x000000010000d4e6 debug_bitbox-776d3300cd651276`std::panicking::try::do_call::hb5b064d52913f725 [inlined] _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::h37ac3fabcd45fa01 at panic.rs:318 [opt]
frame #23: 0x000000010000d4e6 debug_bitbox-776d3300cd651276`std::panicking::try::do_call::hb5b064d52913f725 at panicking.rs:305 [opt]
frame #24: 0x000000010005c77b debug_bitbox-776d3300cd651276`__rust_maybe_catch_panic at lib.rs:86:7 [opt]
frame #25: 0x000000010000e1b6 debug_bitbox-776d3300cd651276`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::hdf8bbeeed49234cf [inlined] std::panicking::try::h5cadccbfd19fc144 at panicking.rs:281:12 [opt]
frame #26: 0x000000010000e17b debug_bitbox-776d3300cd651276`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::hdf8bbeeed49234cf [inlined] std::panic::catch_unwind::h046ca8a6018c411f at panic.rs:394 [opt]
frame #27: 0x000000010000e17b debug_bitbox-776d3300cd651276`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::hdf8bbeeed49234cf [inlined] std::thread::Builder::spawn_unchecked::_$u7b$$u7b$closure$u7d$$u7d$::h96a4708b76aef308 at mod.rs:474 [opt]
frame #28: 0x000000010000e147 debug_bitbox-776d3300cd651276`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::hdf8bbeeed49234cf at function.rs:232 [opt]
frame #29: 0x000000010004b60e debug_bitbox-776d3300cd651276`_$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h606f2dced48ff3c4 at boxed.rs:1015:8 [opt]
frame #30: 0x000000010005c18e debug_bitbox-776d3300cd651276`std::sys::unix::thread::Thread::new::thread_start::h7199626a1bd56873 [inlined] _$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h0ece8cce658c93ae at boxed.rs:1015:8 [opt]
frame #31: 0x000000010005c182 debug_bitbox-776d3300cd651276`std::sys::unix::thread::Thread::new::thread_start::h7199626a1bd56873 [inlined] std::sys_common::thread::start_thread::h30bbd9f3fb79e88c at thread.rs:13 [opt]
frame #32: 0x000000010005c10e debug_bitbox-776d3300cd651276`std::sys::unix::thread::Thread::new::thread_start::h7199626a1bd56873 at thread.rs:80 [opt]
frame #33: 0x00007fff65b352eb libsystem_pthread.dylib`_pthread_body + 126
frame #34: 0x00007fff65b38249 libsystem_pthread.dylib`_pthread_start + 66
frame #35: 0x00007fff65b3440d libsystem_pthread.dylib`thread_start + 13
kulp@libra debug_bitbox(scripted) $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment