Sha256: 17261a38180e9fb501f1655bcaa94e84675dc1a85a7821455b7821926bd321f9

Contents?: true

Size: 856 Bytes

Versions: 6

Compression:

Stored size: 856 Bytes

Contents

module Byebug
  #
  # Setting to enable/disable post_mortem mode, i.e., a debugger prompt after
  # program termination by unhandled exception.
  #
  class PostMortemSetting < Setting
    def initialize
      Byebug.post_mortem = DEFAULT
    end

    def banner
      'Enable/disable post-mortem mode'
    end

    def value=(v)
      Byebug.post_mortem = v
    end

    def value
      Byebug.post_mortem?
    end
  end

  #
  # Saves information about the unhandled exception and gives a byebug
  # prompt back to the user before program termination.
  #
  def self.handle_post_mortem
    context = Byebug.raised_exception.__bb_context
    file    = Byebug.raised_exception.__bb_file
    line    = Byebug.raised_exception.__bb_line
    Byebug.handler.at_line(context, file, line)
  end

  at_exit { Byebug.handle_post_mortem if Byebug.post_mortem? }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
byebug-3.5.1 lib/byebug/settings/post_mortem.rb
byebug-3.5.0 lib/byebug/settings/post_mortem.rb
byebug-3.4.2 lib/byebug/settings/post_mortem.rb
byebug-3.4.1 lib/byebug/settings/post_mortem.rb
byebug-3.4.0 lib/byebug/settings/post_mortem.rb
byebug-3.3.0 lib/byebug/settings/post_mortem.rb