Class: Debugger::EventProcessor
- Inherits:
-
Object
- Object
- Debugger::EventProcessor
- Defined in:
- lib/ruby-debug-ide/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.
9 10 11 12 13 14 15 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 9 def initialize(interface) @printer = XmlPrinter.new(interface) @interface = interface @line = nil @file = nil @last_breakpoint = nil end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
7 8 9 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 7 def context @context end |
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 7 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
7 8 9 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 7 def line @line end |
Instance Method Details
#at_breakpoint(context, breakpoint) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 17 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
24 25 26 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 24 def at_catchpoint(context, excpt) @printer.print_catchpoint(excpt) end |
#at_line(context, file, line) ⇒ Object
32 33 34 35 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 32 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
66 67 68 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 66 def at_line? @line end |
#at_return(context, file, line) ⇒ Object
37 38 39 40 41 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 37 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
28 29 30 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 28 def at_tracing(context, file, line) @printer.print_trace(context, file, line) end |
#line_event(context, file, line) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ruby-debug-ide/event_processor.rb', line 43 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 (%s)", context.thread.to_s, Process.pid.to_s) @printer.print_debug("Threads equal: %s", Thread.current == context.thread) IdeCommandProcessor.new(@interface).process_commands InspectCommand.clear_references @printer.print_debug("Resumed Thread %s", context.thread.to_s) @line = nil @file = nil @context = nil end |