Skip to content

Commit 53f3160

Browse files
committed
Make internal info an official data channel
Because TUI also uses it to retrieve background information about the ThreadClient, it's not for test-only anymore. So this commit makes that clear by removing comments, renaming methods and add a key to test-related info.
1 parent 664b047 commit 53f3160

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

lib/debug/local.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def ask prompt
5252
end
5353
end
5454

55-
def puts_internal_info(internal_info)
55+
def puts_internal_test_info(internal_info)
5656
$stdout.puts("INTERNAL_INFO: #{internal_info}")
5757
end
5858

lib/debug/session.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,9 @@ def request_tc(req)
218218
end
219219

220220
def process_event evt
221-
# variable `@internal_info` is only used for test
222221
@tc, output, ev, @internal_info, *ev_args = evt
223222

224-
capture_tui_data(@internal_info[:tui]) if @ui.tui?
223+
capture_tui_data(@internal_info[:tui]) if @ui.tui? && @internal_info
225224

226225
output.each{|str| @ui.puts str} if ev != :suspend
227226

@@ -385,7 +384,7 @@ def wait_command
385384
@ui.puts "(rdbg:#{@preset_command.source}) #{line}"
386385
end
387386
else
388-
@ui.puts_internal_info(JSON.generate(@internal_info)) if ENV['RUBY_DEBUG_TEST_MODE']
387+
@ui.puts_internal_test_info(JSON.generate(@internal_info[:test])) if ENV['RUBY_DEBUG_TEST_MODE']
389388
line = @ui.readline prompt
390389
end
391390

@@ -1920,7 +1919,7 @@ def event type, *args
19201919
end
19211920
end
19221921

1923-
def puts_internal_info(internal_info)
1922+
def puts_internal_test_info(internal_info)
19241923
puts("INTERNAL_INFO: #{internal_info}")
19251924
end
19261925
end

lib/debug/thread_client.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,8 @@ def generate_tui_data(metadata)
208208
def generate_info
209209
return {} unless current_frame
210210

211-
result = { location: current_frame.location_str, line: current_frame.location.lineno }
212-
213-
if @tui_metadata
214-
result[:tui] = generate_tui_data(@tui_metadata)
215-
end
211+
result = { test: { location: current_frame.location_str, line: current_frame.location.lineno } }
212+
result[:tui] = generate_tui_data(@tui_metadata) if @tui_metadata
216213

217214
result
218215
end

0 commit comments

Comments
 (0)