Class: Debugger::TraceCommand

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

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



25
26
27
28
29
30
# File 'lib/ruby-debug/commands/trace.rb', line 25

def help(cmd)
  %{
    tr[ace] (on|off)\tset trace mode of current thread
    tr[ace] (on|off) all\tset trace mode of all threads
  }
end

.help_commandObject



21
22
23
# File 'lib/ruby-debug/commands/trace.rb', line 21

def help_command
  'trace'
end

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruby-debug/commands/trace.rb', line 7

def execute
  if @match[2]
    Debugger.tracing = @match[1] == 'on'
  elsif @match[1]
    Debugger.current_context.tracing = @match[1] == 'on'
  end
  if Debugger.tracing || Debugger.current_context.tracing
    print "Trace on.\n"
  else
    print "Trace off.\n"
  end
end

#regexpObject



3
4
5
# File 'lib/ruby-debug/commands/trace.rb', line 3

def regexp
  /^\s*tr(?:ace)?(?:\s+(on|off))?(?:\s+(all))?$/
end