Class: Debase::Context
- Defined in:
- lib/debase/context.rb,
lib/debase/rbx/context.rb
Constant Summary collapse
- @@max_thread_num =
1
Instance Attribute Summary collapse
-
#thnum ⇒ Object
readonly
Returns the value of attribute thnum.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #at_breakpoint(breakpoint) ⇒ Object
- #at_catchpoint(excpt) ⇒ Object
- #at_line(file, line) ⇒ Object
- #at_return(file, line) ⇒ Object
- #at_tracing(file, line) ⇒ Object
- #clear_frame_info ⇒ Object
- #dead? ⇒ Boolean
- #fill_frame_info(locations) ⇒ Object
- #frame_args_info(frame_no = 0) ⇒ Object
- #frame_binding(frame = 0) ⇒ Object
- #frame_class(frame_no = 0) ⇒ Object
- #frame_file(frame = 0) ⇒ Object
- #frame_line(frame = 0) ⇒ Object
- #frame_locals(frame_no = 0) ⇒ Object
- #frame_self(frame = 0) ⇒ Object
- #handler ⇒ Object
- #ignored? ⇒ Boolean
-
#initialize(thread) ⇒ Context
constructor
A new instance of Context.
- #stack_size ⇒ Object
- #stop_reason ⇒ Object
Constructor Details
#initialize(thread) ⇒ Context
Returns a new instance of Context.
8 9 10 11 12 |
# File 'lib/debase/rbx/context.rb', line 8 def initialize(thread) @thread = thread @thnum = @@max_thread_num @@max_thread_num = @@max_thread_num + 1 end |
Instance Attribute Details
#thnum ⇒ Object (readonly)
Returns the value of attribute thnum.
6 7 8 |
# File 'lib/debase/rbx/context.rb', line 6 def thnum @thnum end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
6 7 8 |
# File 'lib/debase/rbx/context.rb', line 6 def thread @thread end |
Instance Method Details
#at_breakpoint(breakpoint) ⇒ Object
21 22 23 |
# File 'lib/debase/context.rb', line 21 def at_breakpoint(breakpoint) handler.at_breakpoint(self, breakpoint) end |
#at_catchpoint(excpt) ⇒ Object
25 26 27 |
# File 'lib/debase/context.rb', line 25 def at_catchpoint(excpt) handler.at_catchpoint(self, excpt) end |
#at_line(file, line) ⇒ Object
34 35 36 |
# File 'lib/debase/context.rb', line 34 def at_line(file, line) handler.at_line(self, file, line) end |
#at_return(file, line) ⇒ Object
38 39 40 |
# File 'lib/debase/context.rb', line 38 def at_return(file, line) handler.at_return(self, file, line) end |
#at_tracing(file, line) ⇒ Object
29 30 31 32 |
# File 'lib/debase/context.rb', line 29 def at_tracing(file, line) @tracing_started = true if File.identical?(file, File.join(Debugger::INITIAL_DIR, Debugger::PROG_SCRIPT)) handler.at_tracing(self, file, line) if @tracing_started end |
#clear_frame_info ⇒ Object
42 43 44 |
# File 'lib/debase/rbx/context.rb', line 42 def clear_frame_info @frames = nil end |
#dead? ⇒ Boolean
54 55 56 |
# File 'lib/debase/rbx/context.rb', line 54 def dead? !@thread.alive? end |
#fill_frame_info(locations) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/debase/rbx/context.rb', line 34 def fill_frame_info(locations) @frames = [] locations.each do |loc| @frames << Frame.new(loc) end @frames end |
#frame_args_info(frame_no = 0) ⇒ Object
13 14 15 |
# File 'lib/debase/context.rb', line 13 def frame_args_info(frame_no=0) nil end |
#frame_binding(frame = 0) ⇒ Object
22 23 24 |
# File 'lib/debase/rbx/context.rb', line 22 def frame_binding(frame=0) @frames[frame].binding end |
#frame_class(frame_no = 0) ⇒ Object
9 10 11 |
# File 'lib/debase/context.rb', line 9 def frame_class(frame_no=0) frame_self(frame_no).class end |
#frame_file(frame = 0) ⇒ Object
14 15 16 |
# File 'lib/debase/rbx/context.rb', line 14 def frame_file(frame=0) @frames[frame].file end |
#frame_line(frame = 0) ⇒ Object
18 19 20 |
# File 'lib/debase/rbx/context.rb', line 18 def frame_line(frame=0) @frames[frame].line end |
#frame_locals(frame_no = 0) ⇒ Object
3 4 5 6 7 |
# File 'lib/debase/context.rb', line 3 def frame_locals(frame_no=0) frame_binding(frame_no).eval('local_variables.inject({}){|__h, __v| __h[__v.to_s] = eval(__v.to_s); __h}') rescue => e {'debase-debug' => "*Evaluation error: '#{e}'" } end |
#frame_self(frame = 0) ⇒ Object
26 27 28 |
# File 'lib/debase/rbx/context.rb', line 26 def frame_self(frame=0) @frames[frame].self end |
#handler ⇒ Object
17 18 19 |
# File 'lib/debase/context.rb', line 17 def handler Debase.handler or raise "No interface loaded" end |
#ignored? ⇒ Boolean
50 51 52 |
# File 'lib/debase/rbx/context.rb', line 50 def ignored? thread.is_a? DebugThread end |
#stack_size ⇒ Object
30 31 32 |
# File 'lib/debase/rbx/context.rb', line 30 def stack_size @frames.size end |
#stop_reason ⇒ Object
46 47 48 |
# File 'lib/debase/rbx/context.rb', line 46 def stop_reason :breakpoint end |