@@ -202,6 +202,10 @@ def session_server_main
202202 deactivate
203203 end
204204
205+ def request_tc ( req )
206+ @tc << req
207+ end
208+
205209 def process_event evt
206210 # variable `@internal_info` is only used for test
207211 @tc , output , ev , @internal_info , *ev_args = evt
@@ -225,14 +229,14 @@ def process_event evt
225229 iseq , src = ev_args
226230 on_load iseq , src
227231 @ui . event :load
228- @tc << :continue
232+ request_tc :continue
229233
230234 when :trace
231235 trace_id , msg = ev_args
232236 if t = @tracers . values . find { |t | t . object_id == trace_id }
233237 t . puts msg
234238 end
235- @tc << :continue
239+ request_tc :continue
236240
237241 when :suspend
238242 enter_subsession if ev_args . first != :replay
@@ -257,7 +261,7 @@ def process_event evt
257261 if @displays . empty?
258262 wait_command_loop
259263 else
260- @tc << [ :eval , :display , @displays ]
264+ request_tc [ :eval , :display , @displays ]
261265 end
262266 when :result
263267 raise "[BUG] not in subsession" unless @subsession
@@ -640,15 +644,15 @@ def process_command line
640644 when 'bt' , 'backtrace'
641645 case arg
642646 when /\A (\d +)\z /
643- @tc << [ :show , :backtrace , arg . to_i , nil ]
647+ request_tc [ :show , :backtrace , arg . to_i , nil ]
644648 when /\A \/ (.*)\/ \z /
645649 pattern = $1
646- @tc << [ :show , :backtrace , nil , Regexp . compile ( pattern ) ]
650+ request_tc [ :show , :backtrace , nil , Regexp . compile ( pattern ) ]
647651 when /\A (\d +)\s +\/ (.*)\/ \z /
648652 max , pattern = $1, $2
649- @tc << [ :show , :backtrace , max . to_i , Regexp . compile ( pattern ) ]
653+ request_tc [ :show , :backtrace , max . to_i , Regexp . compile ( pattern ) ]
650654 else
651- @tc << [ :show , :backtrace , nil , nil ]
655+ request_tc [ :show , :backtrace , nil , nil ]
652656 end
653657
654658 # * `l[ist]`
@@ -661,13 +665,13 @@ def process_command line
661665 when 'l' , 'list'
662666 case arg ? arg . strip : nil
663667 when /\A (\d +)\z /
664- @tc << [ :show , :list , { start_line : arg . to_i - 1 } ]
668+ request_tc [ :show , :list , { start_line : arg . to_i - 1 } ]
665669 when /\A -\z /
666- @tc << [ :show , :list , { dir : -1 } ]
670+ request_tc [ :show , :list , { dir : -1 } ]
667671 when /\A (\d +)-(\d +)\z /
668- @tc << [ :show , :list , { start_line : $1. to_i - 1 , end_line : $2. to_i } ]
672+ request_tc [ :show , :list , { start_line : $1. to_i - 1 , end_line : $2. to_i } ]
669673 when nil
670- @tc << [ :show , :list ]
674+ request_tc [ :show , :list ]
671675 else
672676 @ui . puts "Can not handle list argument: #{ arg } "
673677 return :retry
@@ -691,7 +695,7 @@ def process_command line
691695 return :retry
692696 end
693697
694- @tc << [ :show , :edit , arg ]
698+ request_tc [ :show , :edit , arg ]
695699
696700 # * `i[nfo]`
697701 # * Show information about current frame (local/instance variables and defined constants).
@@ -718,15 +722,15 @@ def process_command line
718722
719723 case sub
720724 when nil
721- @tc << [ :show , :default , pat ] # something useful
725+ request_tc [ :show , :default , pat ] # something useful
722726 when 'l' , /^locals?/
723- @tc << [ :show , :locals , pat ]
727+ request_tc [ :show , :locals , pat ]
724728 when 'i' , /^ivars?/i , /^instance[_ ]variables?/i
725- @tc << [ :show , :ivars , pat ]
729+ request_tc [ :show , :ivars , pat ]
726730 when 'c' , /^consts?/i , /^constants?/i
727- @tc << [ :show , :consts , pat ]
731+ request_tc [ :show , :consts , pat ]
728732 when 'g' , /^globals?/i , /^global[_ ]variables?/i
729- @tc << [ :show , :globals , pat ]
733+ request_tc [ :show , :globals , pat ]
730734 when 'th' , /threads?/
731735 thread_list
732736 return :retry
@@ -742,7 +746,7 @@ def process_command line
742746 # * Show you available methods and instance variables of the given object.
743747 # * If the object is a class/module, it also lists its constants.
744748 when 'outline' , 'o' , 'ls'
745- @tc << [ :show , :outline , arg ]
749+ request_tc [ :show , :outline , arg ]
746750
747751 # * `display`
748752 # * Show display setting.
@@ -751,9 +755,9 @@ def process_command line
751755 when 'display'
752756 if arg && !arg . empty?
753757 @displays << arg
754- @tc << [ :eval , :try_display , @displays ]
758+ request_tc [ :eval , :try_display , @displays ]
755759 else
756- @tc << [ :eval , :display , @displays ]
760+ request_tc [ :eval , :display , @displays ]
757761 end
758762
759763 # * `undisplay`
@@ -766,7 +770,7 @@ def process_command line
766770 if @displays [ n = $1. to_i ]
767771 @displays . delete_at n
768772 end
769- @tc << [ :eval , :display , @displays ]
773+ request_tc [ :eval , :display , @displays ]
770774 when nil
771775 if ask "clear all?" , 'N'
772776 @displays . clear
@@ -781,29 +785,29 @@ def process_command line
781785 # * `f[rame] <framenum>`
782786 # * Specify a current frame. Evaluation are run on specified frame.
783787 when 'frame' , 'f'
784- @tc << [ :frame , :set , arg ]
788+ request_tc [ :frame , :set , arg ]
785789
786790 # * `up`
787791 # * Specify the upper frame.
788792 when 'up'
789- @tc << [ :frame , :up ]
793+ request_tc [ :frame , :up ]
790794
791795 # * `down`
792796 # * Specify the lower frame.
793797 when 'down'
794- @tc << [ :frame , :down ]
798+ request_tc [ :frame , :down ]
795799
796800 ### Evaluate
797801
798802 # * `p <expr>`
799803 # * Evaluate like `p <expr>` on the current frame.
800804 when 'p'
801- @tc << [ :eval , :p , arg . to_s ]
805+ request_tc [ :eval , :p , arg . to_s ]
802806
803807 # * `pp <expr>`
804808 # * Evaluate like `pp <expr>` on the current frame.
805809 when 'pp'
806- @tc << [ :eval , :pp , arg . to_s ]
810+ request_tc [ :eval , :pp , arg . to_s ]
807811
808812 # * `eval <expr>`
809813 # * Evaluate `<expr>` on the current frame.
@@ -813,7 +817,7 @@ def process_command line
813817 @ui . puts "\n To evaluate the variable `#{ cmd } `, use `pp #{ cmd } ` instead."
814818 return :retry
815819 else
816- @tc << [ :eval , :call , arg ]
820+ request_tc [ :eval , :call , arg ]
817821 end
818822
819823 # * `irb`
@@ -823,7 +827,7 @@ def process_command line
823827 @ui . puts "not supported on the remote console."
824828 return :retry
825829 end
826- @tc << [ :eval , :irb ]
830+ request_tc [ :eval , :irb ]
827831
828832 # don't repeat irb command
829833 @repl_prev_line = nil
@@ -880,7 +884,7 @@ def process_command line
880884 return :retry
881885
882886 when /\A object\s +(.+)/
883- @tc << [ :trace , :object , $1. strip , { pattern : pattern , into : into } ]
887+ request_tc [ :trace , :object , $1. strip , { pattern : pattern , into : into } ]
884888
885889 when /\A off\s +(\d +)\z /
886890 if t = @tracers . values [ $1. to_i ]
@@ -918,7 +922,7 @@ def process_command line
918922 when 'record'
919923 case arg
920924 when nil , 'on' , 'off'
921- @tc << [ :record , arg &.to_sym ]
925+ request_tc [ :record , arg &.to_sym ]
922926 else
923927 @ui . puts "unknown command: #{ arg } "
924928 return :retry
@@ -1026,7 +1030,7 @@ def process_command line
10261030 return :retry
10271031 ### END
10281032 else
1029- @tc << [ :eval , :pp , line ]
1033+ request_tc [ :eval , :pp , line ]
10301034=begin
10311035 @repl_prev_line = nil
10321036 @ui.puts "unknown command: #{line}"
@@ -1083,7 +1087,7 @@ def step_command type, arg
10831087 case arg
10841088 when nil , /\A \d +\z /
10851089 if type == :in && @tc . recorder &.replaying?
1086- @tc << [ :step , type , arg &.to_i ]
1090+ request_tc [ :step , type , arg &.to_i ]
10871091 else
10881092 leave_subsession [ :step , type , arg &.to_i ]
10891093 end
@@ -1092,7 +1096,7 @@ def step_command type, arg
10921096 @ui . puts "only `step #{ arg } ` is supported."
10931097 :retry
10941098 else
1095- @tc << [ :step , arg . to_sym ]
1099+ request_tc [ :step , arg . to_sym ]
10961100 end
10971101 else
10981102 @ui . puts "Unknown option: #{ arg } "
@@ -1335,7 +1339,7 @@ def repl_add_breakpoint arg
13351339 when /\A (.+)[:\s +](\d +)\z /
13361340 add_line_breakpoint $1, $2. to_i , cond : cond , command : cmd
13371341 when /\A (.+)([\. \# ])(.+)\z /
1338- @tc << [ :breakpoint , :method , $1, $2, $3, cond , cmd , path ]
1342+ request_tc [ :breakpoint , :method , $1, $2, $3, cond , cmd , path ]
13391343 return :noretry
13401344 when nil
13411345 add_check_breakpoint cond , path
@@ -1362,7 +1366,7 @@ def repl_add_watch_breakpoint arg
13621366 cmd = [ 'watch' , expr [ :pre ] , expr [ :do ] ] if expr [ :pre ] || expr [ :do ]
13631367 path = Regexp . compile ( expr [ :path ] ) if expr [ :path ]
13641368
1365- @tc << [ :breakpoint , :watch , expr [ :sig ] , cond , cmd , path ]
1369+ request_tc [ :breakpoint , :watch , expr [ :sig ] , cond , cmd , path ]
13661370 end
13671371
13681372 def add_catch_breakpoint pat
@@ -1546,7 +1550,7 @@ def get_thread_client th = Thread.current
15461550
15471551 waiting_thread_clients . each { |tc |
15481552 next if @tc == tc
1549- tc << :continue
1553+ request_tc :continue
15501554 }
15511555 end
15521556
@@ -1562,7 +1566,7 @@ def get_thread_client th = Thread.current
15621566 DEBUGGER__ . info "leave_subsession"
15631567 @process_group . unlock
15641568 restart_all_threads
1565- @tc << type if type
1569+ request_tc type if type
15661570 @tc = nil
15671571 @subsession = false
15681572 rescue Exception => e
0 commit comments