Class: Debugger::EventProcessor
- Inherits:
-
Object
- Object
- Debugger::EventProcessor
- Defined in:
- lib/ruby-debug/event_processor.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
- #at_breakpoint(context, breakpoint) ⇒ Object
- #at_catchpoint(context, excpt) ⇒ Object
- #at_line(context, file, line) ⇒ Object
- #at_line? ⇒ Boolean
- #at_return(context, file, line) ⇒ Object
- #at_tracing(context, file, line) ⇒ Object
-
#initialize(interface) ⇒ EventProcessor
constructor
A new instance of EventProcessor.
- #line_event(context, file, line) ⇒ Object
Constructor Details
#initialize(interface) ⇒ EventProcessor
Returns a new instance of EventProcessor.
12 13 14 15 16 17 |
# File 'lib/ruby-debug/event_processor.rb', line 12 def initialize(interface) @printer = XmlPrinter.new(interface) @line = nil @file = nil @last_breakpoint = nil end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
10 11 12 |
# File 'lib/ruby-debug/event_processor.rb', line 10 def context @context end |
#file ⇒ Object
Returns the value of attribute file.
10 11 12 |
# File 'lib/ruby-debug/event_processor.rb', line 10 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
10 11 12 |
# File 'lib/ruby-debug/event_processor.rb', line 10 def line @line end |
Instance Method Details
#at_breakpoint(context, breakpoint) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/ruby-debug/event_processor.rb', line 19 def at_breakpoint(context, breakpoint) raise "@last_breakpoint supposed to be nil. is #{@last_breakpoint}" if @last_breakpoint # at_breakpoint is immediately followed by #at_line event in # ruby-debug-base. So postpone breakpoint printing until #at_line. @last_breakpoint = breakpoint end |
#at_catchpoint(context, excpt) ⇒ Object
26 27 28 |
# File 'lib/ruby-debug/event_processor.rb', line 26 def at_catchpoint(context, excpt) @printer.print_catchpoint(excpt) end |
#at_line(context, file, line) ⇒ Object
34 35 36 37 |
# File 'lib/ruby-debug/event_processor.rb', line 34 def at_line(context, file, line) @printer.print_at_line(context, file, line) if context.nil? || context.stop_reason == :step line_event(context, file, line) end |
#at_line? ⇒ Boolean
69 70 71 |
# File 'lib/ruby-debug/event_processor.rb', line 69 def at_line? @line end |
#at_return(context, file, line) ⇒ Object
39 40 41 42 43 |
# File 'lib/ruby-debug/event_processor.rb', line 39 def at_return(context, file, line) @printer.print_at_line(context, file, line) context.stop_frame = -1 line_event(context, file, line) end |
#at_tracing(context, file, line) ⇒ Object
30 31 32 |
# File 'lib/ruby-debug/event_processor.rb', line 30 def at_tracing(context, file, line) @printer.print_trace(context, file, line) end |
#line_event(context, file, line) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ruby-debug/event_processor.rb', line 45 def line_event(context, file, line) @line = line @file = file @context = context if @last_breakpoint # followed after #at_breakpoint in the same thread. Print breakpoint # now when @line, @file and @context are correctly set to prevent race # condition with `control thread'. n = Debugger.breakpoints.index(@last_breakpoint) + 1 @printer.print_breakpoint n, @last_breakpoint @last_breakpoint = nil end raise "DebuggerThread are not supposed to be traced (#{context.thread})" if context.thread.is_a?(Debugger::DebugThread) @printer.print_debug("Stopping Thread %s", context.thread.to_s) @printer.print_debug("Threads equal: %s", Thread.current == context.thread) # will be resumed by commands like `step', `next', `continue', `finish' # from `control thread' Thread.stop @printer.print_debug("Resumed Thread %s", context.thread.to_s) @line = nil @file = nil @context = nil end |