Skip to content

Commit 196147c

Browse files
committed
Set @tc ivar the moment tc is received
We should pass tc (ThreadClient)'s data in the Session in a uniformed way: either all with ivar or all with local variable. And since the local variable approach has been rejects (#293), we may want to go with @ivar. This change for unification is needed for later changes.
1 parent 0b9f6b5 commit 196147c

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

lib/debug/session.rb

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def session_server_main
204204

205205
def process_event evt
206206
# variable `@internal_info` is only used for test
207-
tc, output, ev, @internal_info, *ev_args = evt
207+
@tc, output, ev, @internal_info, *ev_args = evt
208208

209209
capture_tui_data if @ui.tui?
210210

@@ -219,20 +219,20 @@ def process_event evt
219219
q << true
220220

221221
when :init
222-
wait_command_loop tc
222+
wait_command_loop
223223

224224
when :load
225225
iseq, src = ev_args
226226
on_load iseq, src
227227
@ui.event :load
228-
tc << :continue
228+
@tc << :continue
229229

230230
when :trace
231231
trace_id, msg = ev_args
232232
if t = @tracers.values.find{|t| t.object_id == trace_id}
233233
t.puts msg
234234
end
235-
tc << :continue
235+
@tc << :continue
236236

237237
when :suspend
238238
enter_subsession if ev_args.first != :replay
@@ -242,22 +242,22 @@ def process_event evt
242242
when :breakpoint
243243
bp, i = bp_index ev_args[1]
244244
clean_bps unless bp
245-
@ui.event :suspend_bp, i, bp, tc.id
245+
@ui.event :suspend_bp, i, bp, @tc.id
246246
when :trap
247-
@ui.event :suspend_trap, sig = ev_args[1], tc.id
247+
@ui.event :suspend_trap, sig = ev_args[1], @tc.id
248248

249249
if sig == :SIGINT && (@intercepted_sigint_cmd.kind_of?(Proc) || @intercepted_sigint_cmd.kind_of?(String))
250250
@ui.puts "#{@intercepted_sigint_cmd.inspect} is registered as SIGINT handler."
251251
@ui.puts "`sigint` command execute it."
252252
end
253253
else
254-
@ui.event :suspended, tc.id
254+
@ui.event :suspended, @tc.id
255255
end
256256

257257
if @displays.empty?
258-
wait_command_loop tc
258+
wait_command_loop
259259
else
260-
tc << [:eval, :display, @displays]
260+
@tc << [:eval, :display, @displays]
261261
end
262262
when :result
263263
raise "[BUG] not in subsession" unless @subsession
@@ -289,14 +289,14 @@ def process_event evt
289289
# ignore
290290
end
291291

292-
wait_command_loop tc
292+
wait_command_loop
293293

294294
when :dap_result
295295
dap_event ev_args # server.rb
296-
wait_command_loop tc
296+
wait_command_loop
297297
when :cdp_result
298298
cdp_event ev_args
299-
wait_command_loop tc
299+
wait_command_loop
300300
end
301301
end
302302

@@ -329,9 +329,7 @@ def inspect
329329
"DEBUGGER__::SESSION"
330330
end
331331

332-
def wait_command_loop tc
333-
@tc = tc
334-
332+
def wait_command_loop
335333
loop do
336334
case wait_command
337335
when :retry

0 commit comments

Comments
 (0)