Getting a ruby line number from a crashed process



  • I have a core dump of a process with an embedded ruby interpreter that crashed. How do I get a function name or line number or anything that would identify where the problem is in my code?

    Reading symbols from libs/Dwarf_Fortress...(no debugging symbols found)...done.
    [New LWP 22392]
    [New LWP 22394]
    [New LWP 22393]
    [New LWP 22386]
    [New LWP 22395]
    [New LWP 22391]
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    Core was generated by `./libs/Dwarf_Fortress'.
    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  0xf3bb3e73 in rb_dfmemory_read_int8(unsigned long, unsigned long) ()
       from /home/ben/df_linux/hack/plugins/ruby.plug.so
    (gdb) bt
    #0  0xf3bb3e73 in rb_dfmemory_read_int8(unsigned long, unsigned long) ()
       from /home/ben/df_linux/hack/plugins/ruby.plug.so
    #1  0xf394aa13 in ?? () from hack/libruby.so
    #2  0xf39561c1 in ?? () from hack/libruby.so
    #3  0xf395635a in ?? () from hack/libruby.so
    #4  0xf39535bb in ?? () from hack/libruby.so
    #5  0xf3952952 in ?? () from hack/libruby.so
    #6  0xf3956071 in ?? () from hack/libruby.so
    #7  0xf395635a in ?? () from hack/libruby.so
    #8  0xf39535bb in ?? () from hack/libruby.so
    #9  0xf3954b8b in ?? () from hack/libruby.so
    #10 0xf3955144 in ?? () from hack/libruby.so
    #11 0xf3955b38 in ?? () from hack/libruby.so
    #12 0xf395635a in ?? () from hack/libruby.so
    #13 0xf39535bb in ?? () from hack/libruby.so
    #14 0xf3950c6b in ?? () from hack/libruby.so
    #15 0xf3952c49 in ?? () from hack/libruby.so
    #16 0xf3950b6b in ?? () from hack/libruby.so
    #17 0xf3954b8b in ?? () from hack/libruby.so
    #18 0xf3960197 in rb_yield () from hack/libruby.so
    #19 0xf3942332 in ?? () from hack/libruby.so
    #20 0xf39547f5 in ?? () from hack/libruby.so
    #21 0xf3960197 in rb_yield () from hack/libruby.so
    #22 0xf3931441 in rb_ary_each () from hack/libruby.so
    ---Type <return> to continue, or q <return> to quit---
    #23 0xf394aa1d in ?? () from hack/libruby.so
    #24 0xf39561c1 in ?? () from hack/libruby.so
    #25 0xf395635a in ?? () from hack/libruby.so
    #26 0xf3956fec in ?? () from hack/libruby.so
    #27 0xf3957174 in rb_funcall () from hack/libruby.so
    #28 0xf3943627 in rb_each () from hack/libruby.so
    #29 0xf394c6e9 in rb_iterate () from hack/libruby.so
    #30 0xf3943493 in ?? () from hack/libruby.so
    #31 0xf394aa38 in ?? () from hack/libruby.so
    #32 0xf39561c1 in ?? () from hack/libruby.so
    #33 0xf395635a in ?? () from hack/libruby.so
    #34 0xf39535bb in ?? () from hack/libruby.so
    #35 0xf3954073 in ?? () from hack/libruby.so
    #36 0xf3952952 in ?? () from hack/libruby.so
    #37 0xf3956071 in ?? () from hack/libruby.so
    #38 0xf395635a in ?? () from hack/libruby.so
    #39 0xf39534cc in ?? () from hack/libruby.so
    #40 0xf3952c68 in ?? () from hack/libruby.so
    #41 0xf39522ff in ?? () from hack/libruby.so
    #42 0xf3954b8b in ?? () from hack/libruby.so
    #43 0xf3960197 in rb_yield () from hack/libruby.so
    #44 0xf39a5193 in ?? () from hack/libruby.so
    #45 0xf394aa1d in ?? () from hack/libruby.so
    #46 0xf39561c1 in ?? () from hack/libruby.so
    ---Type <return> to continue, or q <return> to quit---
    #47 0xf395635a in ?? () from hack/libruby.so
    #48 0xf39535bb in ?? () from hack/libruby.so
    #49 0xf3954073 in ?? () from hack/libruby.so
    #50 0xf3954b8b in ?? () from hack/libruby.so
    #51 0xf3960197 in rb_yield () from hack/libruby.so
    #52 0xf39a5193 in ?? () from hack/libruby.so
    #53 0xf394aa1d in ?? () from hack/libruby.so
    #54 0xf39561c1 in ?? () from hack/libruby.so
    #55 0xf395635a in ?? () from hack/libruby.so
    #56 0xf39535bb in ?? () from hack/libruby.so
    #57 0xf3954073 in ?? () from hack/libruby.so
    #58 0xf3954b8b in ?? () from hack/libruby.so
    #59 0xf3960197 in rb_yield () from hack/libruby.so
    #60 0xf39a5193 in ?? () from hack/libruby.so
    #61 0xf394aa1d in ?? () from hack/libruby.so
    #62 0xf39561c1 in ?? () from hack/libruby.so
    #63 0xf395635a in ?? () from hack/libruby.so
    #64 0xf39535bb in ?? () from hack/libruby.so
    #65 0xf3954073 in ?? () from hack/libruby.so
    #66 0xf3956071 in ?? () from hack/libruby.so
    #67 0xf395635a in ?? () from hack/libruby.so
    #68 0xf39535bb in ?? () from hack/libruby.so
    #69 0xf3956071 in ?? () from hack/libruby.so
    #70 0xf395635a in ?? () from hack/libruby.so
    ---Type <return> to continue, or q <return> to quit---
    #71 0xf39534cc in ?? () from hack/libruby.so
    #72 0xf39522ff in ?? () from hack/libruby.so
    #73 0xf3954b8b in ?? () from hack/libruby.so
    #74 0xf3960197 in rb_yield () from hack/libruby.so
    #75 0xf3980201 in ?? () from hack/libruby.so
    #76 0xf394aa1d in ?? () from hack/libruby.so
    #77 0xf39561c1 in ?? () from hack/libruby.so
    #78 0xf395635a in ?? () from hack/libruby.so
    #79 0xf39535bb in ?? () from hack/libruby.so
    #80 0xf3954073 in ?? () from hack/libruby.so
    #81 0xf3956071 in ?? () from hack/libruby.so
    #82 0xf395635a in ?? () from hack/libruby.so
    #83 0xf3950dff in ?? () from hack/libruby.so
    #84 0xf3952c68 in ?? () from hack/libruby.so
    #85 0xf3954b8b in ?? () from hack/libruby.so
    #86 0xf3955144 in ?? () from hack/libruby.so
    #87 0xf394aa5e in ?? () from hack/libruby.so
    #88 0xf39561c1 in ?? () from hack/libruby.so
    #89 0xf395635a in ?? () from hack/libruby.so
    #90 0xf39535bb in ?? () from hack/libruby.so
    #91 0xf3953b08 in ?? () from hack/libruby.so
    #92 0xf3956071 in ?? () from hack/libruby.so
    #93 0xf395635a in ?? () from hack/libruby.so
    #94 0xf39535bb in ?? () from hack/libruby.so
    ---Type <return> to continue, or q <return> to quit---
    #95 0xf3954b8b in ?? () from hack/libruby.so
    #96 0xf3960197 in rb_yield () from hack/libruby.so
    #97 0xf3931441 in rb_ary_each () from hack/libruby.so
    #98 0xf394aa1d in ?? () from hack/libruby.so
    #99 0xf39561c1 in ?? () from hack/libruby.so
    #100 0xf395635a in ?? () from hack/libruby.so
    #101 0xf39535bb in ?? () from hack/libruby.so
    #102 0xf3954073 in ?? () from hack/libruby.so
    #103 0xf3956071 in ?? () from hack/libruby.so
    #104 0xf395635a in ?? () from hack/libruby.so
    #105 0xf39535bb in ?? () from hack/libruby.so
    #106 0xf3961ea2 in ?? () from hack/libruby.so
    #107 0xf39628af in rb_eval_string () from hack/libruby.so
    #108 0xf394c481 in rb_protect () from hack/libruby.so
    #109 0xf394c4be in rb_eval_string_protect () from hack/libruby.so
    #110 0xf3bb6669 in df_rubythread(void*) ()
       from /home/ben/df_linux/hack/plugins/ruby.plug.so
    #111 0xf3bba0b1 in tthread::thread::wrapper_function(void*) ()
       from /home/ben/df_linux/hack/plugins/ruby.plug.so
    #112 0xf7232f70 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
    #113 0xf733447e in clone () from /lib/i386-linux-gnu/libc.so.6
    (gdb)


  • StackOverflow is suggesting to use Pry.

    How/whether you can shoehorn that into DF though, you may be on your own there? :/



  • @ben_lubar said:

    Reading symbols from libs/Dwarf_Fortress

    Found the problem...



  • Ok, here's the answer:

    1. up until p *node gives an answer other than "optimized out"
    2. p (*node)->nd_file is the filename.
    3. p (*node)->flags >> 19 is the line number.

Log in to reply