Class: WebTools::Debugger

Inherits:
Tool
  • Object
show all
Defined in:
lib/web_tools/debugger.rb

Instance Method Summary collapse

Methods inherited from Tool

display_name, dont_show!, dont_show?, file_name, inherited, subclasses

Methods included from Support::ServiceHelper

included

Instance Method Details

#method_data_from_frame(frame) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/web_tools/debugger.rb', line 67

def method_data_from_frame(frame)
  dict = frame.method.defining_class.nesting[1]
  dict = dict ? dict.name : ""
  { "source" => frame.method.source,
    "stepPoints" => frame.method.step_offsets,
    "sends" => frame.method.send_offsets,
    "nowAt" => frame.step_offset,
    "dictionaryName" => dict || "",
    "className" => frame.method.defining_class.name,
    "isMeta" => frame.method.defining_class.singleton_class? }
rescue Exception
  return { "source" => "", "stepPoints" => "", "sends" => "", "nowAt" => 0,
    "dictionaryName" => "", "className" => "", "isMeta" => "" }
end

#str_report_for(process_mirror) ⇒ Object



106
107
108
109
110
111
112
113
114
115
# File 'lib/web_tools/debugger.rb', line 106

def str_report_for(process_mirror)
  process_mirror.stack.collect do |f|
    str = ""
    if f.method
      separator = f.method.defining_class.singleton_class? ? '.' : '#'
      str = "#{f.method.defining_class.name}#{separator}"
    end
    str += (f.name || "block in #{f.selector}")
  end
end

#variables_data_from_frame(frame) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/web_tools/debugger.rb', line 82

def variables_data_from_frame(frame)
  list = [{ "name" => "self",
            "string" => frame.self.name,
            "oop" => frame.self.reflectee.object_id }]
  if frame.self != frame.receiver
    list << { "name" => "receiver",
      "string" => frame.receiver.name,
      "oop" => frame.receiver.reflectee.object_id }
  end
  frame.arguments.each do |k, v|
    list << { "name" => k.to_s,
      "string" => v.name,
      "oop" => v.reflectee.object_id }
  end
  frame.locals.each do |k, v|
    list << { "name" => k.to_s,
      "string" => v.name,
      "oop" => v.reflectee.object_id }
  end
  list
rescue Exception
  return []
end