Class: Johnson::TraceMonkey::Debugger
- Inherits:
-
Object
- Object
- Johnson::TraceMonkey::Debugger
- Defined in:
- lib/johnson/tracemonkey/debugger.rb
Overview
native
Constant Summary collapse
- JSTRAP_ERROR =
0
- JSTRAP_CONTINUE =
1
- JSTRAP_RETURN =
2
- JSTRAP_THROW =
3
- JSTRAP_LIMIT =
4
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#call_hook(before, ok) ⇒ Object
call_hook
is called before and after a function call. - #debug_error_hook(message) ⇒ Object
- #debugger_handler(context, script, bytecode) ⇒ Object
- #destroy_script_hook ⇒ Object
-
#execute_hook(context, stack_frame, before, ok) ⇒ Object
call_hook
is called before and after script execution. -
#initialize(logger) ⇒ Debugger
constructor
A new instance of Debugger.
- #interrupt_handler(context, script, bytecode) ⇒ Object
- #new_script_hook(filename, linenum) ⇒ Object
- #object_hook(is_new) ⇒ Object
- #source_handler(filename, line_number, str) ⇒ Object
-
#throw_hook(bytecode) ⇒ Object
This hook can change the control.
Constructor Details
#initialize(logger) ⇒ Debugger
Returns a new instance of Debugger.
10 11 12 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 10 def initialize(logger) @logger = logger end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
9 10 11 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 9 def logger @logger end |
Instance Method Details
#call_hook(before, ok) ⇒ Object
call_hook
is called before and after a function call. before
is true
if before, false
otherwise.
48 49 50 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 48 def call_hook(before, ok) logger.debug("call_hook: #{before} #{ok}") end |
#debug_error_hook(message) ⇒ Object
62 63 64 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 62 def debug_error_hook() logger.debug("debug_error_hook: #{}") end |
#debugger_handler(context, script, bytecode) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 29 def debugger_handler(context, script, bytecode) line_num = line_number(context, script, bytecode) f_name = file_name(context, script) logger.debug("debugger_handler: #{bytecode}") JSTRAP_CONTINUE end |
#destroy_script_hook ⇒ Object
25 26 27 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 25 def destroy_script_hook logger.debug("destroy_script_hook") end |
#execute_hook(context, stack_frame, before, ok) ⇒ Object
call_hook
is called before and after script execution. before
is true
if before, false
otherwise.
42 43 44 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 42 def execute_hook(context, stack_frame, before, ok) logger.debug("execute_hook: #{before} #{ok}") end |
#interrupt_handler(context, script, bytecode) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 14 def interrupt_handler(context, script, bytecode) line_num = line_number(context, script, bytecode) f_name = file_name(context, script) logger.debug("interrupt_handler #{f_name} #{line_num}") JSTRAP_CONTINUE end |
#new_script_hook(filename, linenum) ⇒ Object
21 22 23 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 21 def new_script_hook(filename, linenum) logger.debug("new_script_hook: #{filename} #{linenum}") end |
#object_hook(is_new) ⇒ Object
52 53 54 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 52 def object_hook(is_new) logger.debug("object_hook: #{is_new}") end |
#source_handler(filename, line_number, str) ⇒ Object
36 37 38 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 36 def source_handler(filename, line_number, str) logger.debug("source_handler: #{filename}(#{line_number}): #{str}") end |
#throw_hook(bytecode) ⇒ Object
This hook can change the control
57 58 59 60 |
# File 'lib/johnson/tracemonkey/debugger.rb', line 57 def throw_hook(bytecode) logger.debug("throw_hook: #{bytecode}") JSTRAP_CONTINUE end |