Project

General

Profile

Actions

Feature #17638

open

Support backtracing with the libbacktrace library

Added by xtkoba (Tee KOBAYASHI) 7 months ago. Updated 7 months ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:102560]

Description

It seems that Ruby's current addr2line.c has trouble with the DWARF 5 debugging format (Bug #17585).

I propose that there be an option to use the libbacktrace library instead of addr2line.c.

A patch is attached for that. When using libbacktrace, the C level backtrace information looks as follows:

-- C level backtrace information -------------------------------------------
0x7f0cc2b3b372 rb_vm_bugreport
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_dump.c:1047
0x7f0cc291e188 rb_bug_for_fatal_signal
    /var/tmp/ruby.build/ruby-devel-x86_64/error.c:801
0x7f0cc2a8a137 sigsegv
    /var/tmp/ruby.build/ruby-devel-x86_64/signal.c:960
0x7f0cc281a9bf ???
    ???:0
0x7f0cc247ddf7 ???
    ???:0
0x7f0cc2a8990d rb_f_kill
    /var/tmp/ruby.build/ruby-devel-x86_64/signal.c:481
0x7f0cc2a2e684 proc_rb_f_kill
    /var/tmp/ruby.build/ruby-devel-x86_64/process.c:8604
0x7f0cc2b0f2a4 ractor_safe_call_cfunc_m1
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_insnhelper.c:2734
0x7f0cc2b0fecb vm_call_cfunc_with_frame
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_insnhelper.c:2924
0x7f0cc2b10088 vm_call_cfunc
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_insnhelper.c:2945
0x7f0cc2b11b3b vm_call_method_each_type
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_insnhelper.c:3414
0x7f0cc2b11fde vm_call_method
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_insnhelper.c:3507
0x7f0cc2b121ca vm_call_general
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_insnhelper.c:3550
0x7f0cc2b144e7 vm_sendish
    /var/tmp/ruby.build/ruby-devel-x86_64/vm_insnhelper.c:4525
0x7f0cc2b1b196 vm_exec_core
    /var/tmp/ruby.build/ruby-devel-x86_64/insns.def:789
0x7f0cc2b308f5 rb_vm_exec
    /var/tmp/ruby.build/ruby-devel-x86_64/vm.c:2162
0x7f0cc2b316e8 rb_iseq_eval_main
    /var/tmp/ruby.build/ruby-devel-x86_64/vm.c:2419
0x7f0cc292778d rb_ec_exec_node
    /var/tmp/ruby.build/ruby-devel-x86_64/eval.c:317
0x7f0cc29278d3 ruby_run_node
    /var/tmp/ruby.build/ruby-devel-x86_64/eval.c:375
0x55ad53234234 main
    ./main.c:47
0x7f0cc2468e59 ???
    ???:0
0x55ad532340f9 ???
    ???:0
0xffffffffffffffff ???
    ???:0

The source code of libbacktrace is available from: https://github.com/ianlancetaylor/libbacktrace


Files

ruby-libbacktrace.patch (1.72 KB) ruby-libbacktrace.patch xtkoba (Tee KOBAYASHI), 02/17/2021 12:51 PM
ruby-libbacktrace-using-backtrace.patch (2.05 KB) ruby-libbacktrace-using-backtrace.patch xtkoba (Tee KOBAYASHI), 02/27/2021 10:44 PM
ruby-cygwin-backtrace.patch (1.24 KB) ruby-cygwin-backtrace.patch xtkoba (Tee KOBAYASHI), 02/27/2021 10:48 PM
Actions

Also available in: Atom PDF