Open Quintus opened 11 years ago
Here’s a GDB stacktrace of the whole thing (recompiled debugger
with GCC’s -g
):
% gdb ruby
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /opt/rubies/ruby-1.9.3-p286/bin/ruby...done.
(gdb) r foo.rb
Starting program: /opt/rubies/ruby-1.9.3-p286/bin/ruby foo.rb
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff7ff9700 (LWP 22353)]
foo.rb:5
raise "boom"
(rdb:post-mortem) bt
-->
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5d5c584 in context_frame_file (argc=<optimized out>, argv=<optimized out>, self=<optimized out>) at ruby_debug.c:1823
1823 return(GET_FRAME->info.runtime.cfp->iseq->filename);
(gdb) bt
#0 0x00007ffff5d5c584 in context_frame_file (argc=<optimized out>, argv=<optimized out>, self=<optimized out>) at ruby_debug.c:1823
#1 0x00007ffff7b1284c in vm_call_cfunc (me=0xaca450, blockptr=<optimized out>, recv=<optimized out>, num=1, reg_cfp=0x7ffff7fc6880,
th=0x602520) at vm_insnhelper.c:404
#2 vm_call_method (th=th@entry=0x602520, cfp=cfp@entry=0x7ffff7fc6880, num=1, blockptr=<optimized out>, flag=<optimized out>,
flag@entry=0, id=<optimized out>, me=0xaca450, recv=13877040) at vm_insnhelper.c:534
#3 0x00007ffff7b0a8ab in vm_exec_core (th=0x602520, initial=initial@entry=0) at insns.def:1018
#4 0x00007ffff7b0efbc in vm_exec (th=th@entry=0x602520) at vm.c:1223
#5 0x00007ffff7b13eca in invoke_block_from_c (cref=0x0, blockptr=0x0, argv=0x7fffffffce18, argc=1, self=13938280, block=0x7ffff7fc6a08,
th=0x602520) at vm.c:627
#6 vm_yield (argv=0x7fffffffce18, argc=1, th=0x602520) at vm.c:657
#7 rb_yield_0 (argv=0x7fffffffce18, argc=1) at vm_eval.c:760
#8 rb_yield (val=val@entry=1) at vm_eval.c:770
#9 0x00007ffff7a7010e in range_each (range=14057800) at range.c:491
#10 0x00007ffff7b1284c in vm_call_cfunc (me=0x6d9c20, blockptr=<optimized out>, recv=<optimized out>, num=0, reg_cfp=0x7ffff7fc69e0,
th=0x602520) at vm_insnhelper.c:404
#11 vm_call_method (th=th@entry=0x602520, cfp=cfp@entry=0x7ffff7fc69e0, num=0, blockptr=<optimized out>, flag=<optimized out>,
flag@entry=0, id=<optimized out>, me=0x6d9c20, recv=14057800) at vm_insnhelper.c:534
#12 0x00007ffff7b0a8ab in vm_exec_core (th=0x602520, initial=initial@entry=0) at insns.def:1018
#13 0x00007ffff7b0efbc in vm_exec (th=th@entry=0x602520) at vm.c:1223
#14 0x00007ffff7b13eca in invoke_block_from_c (cref=0x0, blockptr=0x0, argv=0x7fffffffd198, argc=1, self=13890440, block=0x7ffff7fc6bc0,
th=0x602520) at vm.c:627
#15 vm_yield (argv=0x7fffffffd198, argc=1, th=0x602520) at vm.c:657
#16 rb_yield_0 (argv=0x7fffffffd198, argc=1) at vm_eval.c:760
#17 rb_yield (val=1) at vm_eval.c:770
#18 0x00007ffff79b6112 in rb_ary_each (array=14063800) at array.c:1478
#19 0x00007ffff7b1284c in vm_call_cfunc (me=0x6c5bf0, blockptr=<optimized out>, recv=<optimized out>, num=0, reg_cfp=0x7ffff7fc6b98,
th=0x602520) at vm_insnhelper.c:404
#20 vm_call_method (th=th@entry=0x602520, cfp=cfp@entry=0x7ffff7fc6b98, num=0, blockptr=<optimized out>, flag=<optimized out>,
flag@entry=0, id=<optimized out>, me=0x6c5bf0, recv=14063800) at vm_insnhelper.c:534
#21 0x00007ffff7b0a8ab in vm_exec_core (th=0x602520, initial=initial@entry=0) at insns.def:1018
#22 0x00007ffff7b0efbc in vm_exec (th=th@entry=0x602520) at vm.c:1223
#23 0x00007ffff7b13a62 in invoke_block_from_c (cref=0x0, blockptr=0x0, argv=0x7fffffffd4f8, argc=1, self=13890440, block=0x7ffff7fc6cc8,
th=0x602520) at vm.c:627
#24 vm_yield (argv=0x7fffffffd4f8, argc=1, th=0x602520) at vm.c:657
#25 rb_yield_0 (argv=0x7fffffffd4f8, argc=1) at vm_eval.c:760
#26 catch_i (tag=1, tag@entry=6264846, data=data@entry=0) at vm_eval.c:1479
#27 0x00007ffff7b0808a in rb_catch_obj (tag=6264846, func=func@entry=0x7ffff7b138f0 <catch_i>, data=data@entry=0) at vm_eval.c:1554
#28 0x00007ffff7b0812e in rb_f_catch (argc=<optimized out>, argv=<optimized out>) at vm_eval.c:1530
---Type <return> to continue, or q <return> to quit---
#29 0x00007ffff7b1284c in vm_call_cfunc (me=0x690a30, blockptr=<optimized out>, recv=<optimized out>, num=1, reg_cfp=0x7ffff7fc6ca0,
th=0x602520) at vm_insnhelper.c:404
#30 vm_call_method (th=th@entry=0x602520, cfp=cfp@entry=0x7ffff7fc6ca0, num=1, blockptr=<optimized out>, flag=<optimized out>,
flag@entry=8, id=<optimized out>, me=0x690a30, recv=13890440) at vm_insnhelper.c:534
#31 0x00007ffff7b0a8ab in vm_exec_core (th=0x602520, initial=initial@entry=0) at insns.def:1018
#32 0x00007ffff7b0efbc in vm_exec (th=0x602520) at vm.c:1223
#33 0x00007ffff7b0fd81 in rb_vm_invoke_proc (th=0x20, proc=0xeadf00, self=6554560, argc=0, argv=0x0, blockptr=0x0) at vm.c:673
#34 0x00007ffff7b101db in vm_call0 (th=0x602520, recv=<optimized out>, id=6008, argc=0, argv=0x0, me=0x707040) at vm_eval.c:79
#35 0x00007ffff7b11817 in rb_call0 (self=6, scope=CALL_FCALL, argv=0x0, argc=0, mid=6008, recv=13878280) at vm_eval.c:236
#36 rb_call (scope=CALL_FCALL, argv=0x0, argc=0, mid=6008, recv=13878280) at vm_eval.c:456
#37 rb_funcall (recv=13878280, mid=6008, n=0) at vm_eval.c:658
#38 0x00007ffff79f3b66 in rb_ensure (b_proc=b_proc@entry=0x7ffff5d5ad90 <debug_at_exit_c>, data1=data1@entry=13878280,
e_proc=e_proc@entry=0x7ffff5d5d560 <set_current_skipped_status>, data2=data2@entry=0) at eval.c:744
#39 0x00007ffff5d5d9ce in debug_at_exit_i (proc=13878280) at ruby_debug.c:1572
#40 0x00007ffff79f4d0f in rb_exec_end_proc () at eval_jump.c:126
#41 0x00007ffff79f4dba in ruby_finalize_0 () at eval.c:92
#42 0x00007ffff79f4f31 in ruby_cleanup (ex=6) at eval.c:133
#43 0x00007ffff79f5273 in ruby_run_node (n=0x858a90) at eval.c:244
#44 0x000000000040088b in main (argc=2, argv=0x7fffffffe368) at main.c:38
(gdb) q
A debugging session is active.
Inferior 1 [process 22349] will be killed.
Quit anyway? (y or n) y
(1148) [21:01:55 quintus@roma] /tmp
%
Yup, commands 'edit', 'frame', 'where'/'backtrace' and 'jump' fail with Segfaults.
The problem is inside context_frame_file(), no idea how to fix it though. :(
@Quintus Thanks for the detailed bug report. Patches are welcome as I won't be getting to this.
Is there a workaround or another approach for post mortem in "debugger"? Or how do you guys debug uncaught exceptions deep in external libraries' code?
@moll My question exactly. @cldwalker This is a serious problem (still present with debugger 1.6.1 and Ruby 2). Why won't you be getting to it? And what do you recommend we do instead?
@moll, @marnen Post-mortem debugging works just fine in byebug. Ruby 2 only though. Salud!
With
debugger
from today’s master:Ruby version: ` ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux] OS: Arch Linux 64-bits
Vale, Quintus