Lines 17-22
Link Here
|
17 |
require 'dbgp/thread_manager' |
17 |
require 'dbgp/thread_manager' |
18 |
require 'context' |
18 |
require 'context' |
19 |
|
19 |
|
|
|
20 |
module Kernel |
21 |
alias_method(:xored_debugger_set_trace_func, :set_trace_func) |
22 |
def set_trace_func(proc) |
23 |
raise "Cannot call 'set_trace_func' method during debugging session." |
24 |
end |
25 |
end |
26 |
|
20 |
module XoredDebugger |
27 |
module XoredDebugger |
21 |
class DebuggerThread < Thread |
28 |
class DebuggerThread < Thread |
22 |
end |
29 |
end |
Lines 85-92
Link Here
|
85 |
@depth = 0 |
92 |
@depth = 0 |
86 |
catch(:done) do |
93 |
catch(:done) do |
87 |
begin |
94 |
begin |
88 |
log("Setting trace function...") |
95 |
log("Setting trace function...") |
89 |
set_trace_func proc { |event, file, line, id, binding, klass, *rest| |
96 |
xored_debugger_set_trace_func proc { |event, file, line, id, binding, klass, *rest| |
90 |
trace(event, file, line, id, binding, klass) |
97 |
trace(event, file, line, id, binding, klass) |
91 |
} |
98 |
} |
92 |
end |
99 |
end |
Lines 95-101
Link Here
|
95 |
|
102 |
|
96 |
|
103 |
|
97 |
def terminate |
104 |
def terminate |
98 |
set_trace_func nil |
105 |
xored_debugger_set_trace_func nil |
99 |
log("Tracing function was unset") |
106 |
log("Tracing function was unset") |
100 |
super |
107 |
super |
101 |
end |
108 |
end |
Lines 122-135
Link Here
|
122 |
# Absolute path |
129 |
# Absolute path |
123 |
ex_file = File.expand_path(file) # Absolute file path |
130 |
ex_file = File.expand_path(file) # Absolute file path |
124 |
|
131 |
|
125 |
# Skipping startup and shutdown code |
|
|
126 |
if (skip_startup_and_shutdown?(ex_file)) |
127 |
return |
128 |
end |
129 |
|
130 |
# Output handling |
132 |
# Output handling |
131 |
case event |
133 |
case event |
132 |
when 'line' |
134 |
when 'line' |
|
|
135 |
# Skipping startup and shutdown code |
136 |
if (skip_startup_and_shutdown?(ex_file)) |
137 |
return |
138 |
end |
139 |
|
133 |
# Don't debug debugger :) |
140 |
# Don't debug debugger :) |
134 |
if (in_debugger_code?(thread)) |
141 |
if (in_debugger_code?(thread)) |
135 |
return |
142 |
return |
Lines 158-166
Link Here
|
158 |
|
165 |
|
159 |
when 'call' |
166 |
when 'call' |
160 |
thread.stack_manager.stack.push(binding, ex_file, line) |
167 |
thread.stack_manager.stack.push(binding, ex_file, line) |
161 |
|
168 |
if (Thread.current == Thread.main) |
|
|
169 |
@depth += 1 |
170 |
end |
171 |
|
162 |
when 'return' |
172 |
when 'return' |
163 |
thread.stack_manager.stack.pop |
173 |
thread.stack_manager.stack.pop |
|
|
174 |
if (Thread.current == Thread.main) |
175 |
@depth -= 1 |
176 |
end |
164 |
|
177 |
|
165 |
when 'c-call' |
178 |
when 'c-call' |
166 |
if (Thread.current == Thread.main) |
179 |
if (Thread.current == Thread.main) |