Class: Debugger::DeleteBreakpointCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/breakpoints.rb

Overview

Implements debugger “delete” command.

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



146
147
148
149
150
# File 'lib/ruby-debug/commands/breakpoints.rb', line 146

def help(cmd)
  %{
    del[ete][ nnn...]\tdelete some or all breakpoints
  }
end

.help_commandObject



142
143
144
# File 'lib/ruby-debug/commands/breakpoints.rb', line 142

def help_command
  'delete'
end

Instance Method Details

#executeObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/ruby-debug/commands/breakpoints.rb', line 120

def execute
  unless @state.context
    errmsg "We are not in a state we can delete breakpoints.\n"
    return 
  end
  brkpts = @match[1]
  unless brkpts
    if confirm("Delete all breakpoints? (y or n) ")
      Debugger.breakpoints.clear
    end
  else
    brkpts.split(/[ \t]+/).each do |pos|
      pos = get_int(pos, "Delete", 1)
      return unless pos
      unless Debugger.remove_breakpoint(pos)
        errmsg "No breakpoint number %d\n", pos
      end
    end
  end
end

#regexpObject



116
117
118
# File 'lib/ruby-debug/commands/breakpoints.rb', line 116

def regexp
  /^\s *del(?:ete)? (?:\s+(.*))?$/ix
end