Sha256: d731546d24ce5f9d3d9598219bd56ee9e07142a331fd9346800f4923e4d48218

Contents?: true

Size: 1.91 KB

Versions: 10

Compression:

Stored size: 1.91 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
require_relative '../base/subcmd'

class Trepan::Subcommand::SetHidelevel < Trepan::Subcommand
  unless defined?(HELP)
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    HELP = "
#{PREFIX.join(' ')} [NUM]

Hide this many stack frames from the bottom (or least-recent) frame.

Often the bottom-most frames are setup frames that one doesn't think
of as being part of one's program but are part of the overhead loading
or debugging the program. As such generally they are unintersting in
a backtrace command and one wants these omitted.

If NUM is 0, no stack frames are hidden. If NUM is < 0 or omitted,
then use value the program sets automatically. If the value is larger
than the current number of entries in the stack, i.e. the stack shown
would be otherwise be, empty then we show all entries, or take NUM to
be 0.

Examples:
   #{PREFIX.join(' ')}     # Use the default value and hide 'uninteresting' ones
   #{PREFIX.join(' ')} 0   # Show all stack entries, even from loading the program
                     # or initial stack entries the debugger created to 
                     # debug the program.
   #{PREFIX.join(' ')} 1   # Hide only the bottom-most or least-recent stack frame.

See also 'backtrace' and 'show hidelevel'. 
."

    IN_LIST      = true
    MIN_ABBREV   = 'hide'.size
    SHORT_HELP   = "Set the number of bottom frames to hide."
  end

  def run(args)
    if args.size == 2
      val = nil
    else
      val = @proc.get_an_int(args[2])
      return unless val
    end
    @proc.hide_level = @proc.settings[:hidelevel] = val
    @proc.run_command('show hidelevel')
  end

end

if __FILE__ == $0
  # Demo it.
  $0 = __FILE__ + 'notagain' # So we don't run this agin
  require_relative '../../mock'
  cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetHidelevel, false)
  cmd.run(cmd.prefix + %w(10))
  cmd.run(cmd.prefix)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
trepanning-2.15.35 processor/command/set_subcmd/hidelevel.rb
trepanning-1.93.35 processor/command/set_subcmd/hidelevel.rb
trepanning-2.15.33 processor/command/set_subcmd/hidelevel.rb
trepanning-1.93.32 processor/command/set_subcmd/hidelevel.rb
trepanning-0.1.6 processor/command/set_subcmd/hidelevel.rb
trepanning-0.1.4 processor/command/set_subcmd/hidelevel.rb
trepanning-0.1.3 processor/command/set_subcmd/hidelevel.rb
trepanning-0.1.2 processor/command/set_subcmd/hidelevel.rb
trepanning-0.1.1 processor/command/set_subcmd/hidelevel.rb
trepanning-0.1.0 processor/command/set_subcmd/hidelevel.rb