Skip to content
  • Aaron Patterson's avatar
    8a06af5f
    Mostly recover a Ruby stack trace from a core file · 8a06af5f
    Aaron Patterson authored
    Update the lldb script so it can mostly recover a Ruby stack trace from
    a core file.  It's still missing line numbers and dealing with CFUNCs,
    but you use it like this:
    
    ```
    (lldb) rbbt ec
    rb_control_frame_t TYPE
    0x7f6fd6555fa0     EVAL   ./bootstraptest/runner.rb error!!
    0x7f6fd6555f68     METHOD ./bootstraptest/runner.rb main
    0x7f6fd6555f30     METHOD ./bootstraptest/runner.rb in_temporary_working_directory
    0x7f6fd6555ef8     METHOD /home/aaron/git/ruby/lib/tmpdir.rb mktmpdir
    0x7f6fd6555ec0     BLOCK  ./bootstraptest/runner.rb block in in_temporary_working_directory
    0x7f6fd6555e88     CFUNC
    0x7f6fd6555e50     BLOCK  ./bootstraptest/runner.rb block (2 levels) in in_temporary_working_directory
    0x7f6fd6555e18     BLOCK  ./bootstraptest/runner.rb block in main
    0x7f6fd6555de0     METHOD ./bootstraptest/runner.rb exec_test
    0x7f6fd6555da8     CFUNC
    0x7f6fd6555d70     BLOCK  ./bootstraptest/runner.rb block in exec_test
    0x7f6fd6555d38     CFUNC
    0x7f6fd6555d00     TOP    /home/aaron/git/ruby/bootstraptest/test_insns.rb error!!
    0x7f6fd6555cc8     CFUNC
    0x7f6fd6555c90     BLOCK  /home/aaron/git/ruby/bootstraptest/test_insns.rb block in <top (required)>
    0x7f6fd6555c58     METHOD ./bootstraptest/runner.rb assert_equal
    0x7f6fd6555c20     METHOD ./bootstraptest/runner.rb assert_check
    0x7f6fd6555be8     METHOD ./bootstraptest/runner.rb show_progress
    0x7f6fd6555bb0     METHOD ./bootstraptest/runner.rb with_stderr
    0x7f6fd6555b78     BLOCK  ./bootstraptest/runner.rb block in show_progress
    0x7f6fd6555b40     BLOCK  ./bootstraptest/runner.rb block in assert_check
    0x7f6fd6555b08     METHOD ./bootstraptest/runner.rb get_result_string
    0x7f6fd6555ad0     METHOD ./bootstraptest/runner.rb make_srcfile
    0x7f6fd6555a98     CFUNC
    0x7f6fd6555a60     BLOCK  ./bootstraptest/runner.rb block in make_srcfile
    ```
    
    Getting the main execution context is difficult (it is stored in a
    thread local) so for now you must supply an ec and this will make a
    backtrace
    8a06af5f
    Mostly recover a Ruby stack trace from a core file
    Aaron Patterson authored
    Update the lldb script so it can mostly recover a Ruby stack trace from
    a core file.  It's still missing line numbers and dealing with CFUNCs,
    but you use it like this:
    
    ```
    (lldb) rbbt ec
    rb_control_frame_t TYPE
    0x7f6fd6555fa0     EVAL   ./bootstraptest/runner.rb error!!
    0x7f6fd6555f68     METHOD ./bootstraptest/runner.rb main
    0x7f6fd6555f30     METHOD ./bootstraptest/runner.rb in_temporary_working_directory
    0x7f6fd6555ef8     METHOD /home/aaron/git/ruby/lib/tmpdir.rb mktmpdir
    0x7f6fd6555ec0     BLOCK  ./bootstraptest/runner.rb block in in_temporary_working_directory
    0x7f6fd6555e88     CFUNC
    0x7f6fd6555e50     BLOCK  ./bootstraptest/runner.rb block (2 levels) in in_temporary_working_directory
    0x7f6fd6555e18     BLOCK  ./bootstraptest/runner.rb block in main
    0x7f6fd6555de0     METHOD ./bootstraptest/runner.rb exec_test
    0x7f6fd6555da8     CFUNC
    0x7f6fd6555d70     BLOCK  ./bootstraptest/runner.rb block in exec_test
    0x7f6fd6555d38     CFUNC
    0x7f6fd6555d00     TOP    /home/aaron/git/ruby/bootstraptest/test_insns.rb error!!
    0x7f6fd6555cc8     CFUNC
    0x7f6fd6555c90     BLOCK  /home/aaron/git/ruby/bootstraptest/test_insns.rb block in <top (required)>
    0x7f6fd6555c58     METHOD ./bootstraptest/runner.rb assert_equal
    0x7f6fd6555c20     METHOD ./bootstraptest/runner.rb assert_check
    0x7f6fd6555be8     METHOD ./bootstraptest/runner.rb show_progress
    0x7f6fd6555bb0     METHOD ./bootstraptest/runner.rb with_stderr
    0x7f6fd6555b78     BLOCK  ./bootstraptest/runner.rb block in show_progress
    0x7f6fd6555b40     BLOCK  ./bootstraptest/runner.rb block in assert_check
    0x7f6fd6555b08     METHOD ./bootstraptest/runner.rb get_result_string
    0x7f6fd6555ad0     METHOD ./bootstraptest/runner.rb make_srcfile
    0x7f6fd6555a98     CFUNC
    0x7f6fd6555a60     BLOCK  ./bootstraptest/runner.rb block in make_srcfile
    ```
    
    Getting the main execution context is difficult (it is stored in a
    thread local) so for now you must supply an ec and this will make a
    backtrace
Loading