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
23 24 25 |
# File 'lib/debase/context.rb', line 23 def at_breakpoint(breakpoint) handler.at_breakpoint(self, breakpoint) end |
#at_catchpoint(excpt) ⇒ Object
27 28 29 |
# File 'lib/debase/context.rb', line 27 def at_catchpoint(excpt) handler.at_catchpoint(self, excpt) end |
#at_line(file, line) ⇒ Object
36 37 38 |
# File 'lib/debase/context.rb', line 36 def at_line(file, line) handler.at_line(self, file, line) end |
#at_return(file, line) ⇒ Object
40 41 42 |
# File 'lib/debase/context.rb', line 40 def at_return(file, line) handler.at_return(self, file, line) end |
#at_tracing(file, line) ⇒ Object
31 32 33 34 |
# File 'lib/debase/context.rb', line 31 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
15 16 17 |
# File 'lib/debase/context.rb', line 15 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
11 12 13 |
# File 'lib/debase/context.rb', line 11 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 8 9 |
# File 'lib/debase/context.rb', line 3 def frame_locals(frame_no=0) result = {} binding = frame_binding(frame_no) locals = eval("local_variables", binding) locals.each {|local| result[local.to_s] = eval(local.to_s, binding)} result 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
19 20 21 |
# File 'lib/debase/context.rb', line 19 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 |