Closed takatea closed 1 year ago
I asked the issue in the ruby-jp slack channel (#debugger
) and found that the problem caused by the shared using Reline::HISTORY
between irb and debug. (thanks to @ima1zumi and @tompng for their helpful insights!)
Therefore, the following steps are carried out to confirm that both irb and debug share the same Reline::HISTORY
.
Remove .irb_history and .rdbg_history to clean up
Run irb
Run the following commands on irb
require "./test"
puts "irb 1"
puts "irb 2"
puts "irb 3"
Test.new.run
Debugger started
Puts Reline::HISTORY
, and then I got:
["require \"./test\"",
"puts \"irb 1\"",
"puts \"irb 2\"",
"puts \"irb 3\"",
"Test.new.run",
"Reline::HISTORY"]
When the debugger loads (appends) histories while running on irb, duplicate histories are currently stored in Reline::HISTORY
because both the irb and debug history files contain the same saved content.
As a result, repeatedly saving and loading the same content leads to the history looks broken and bloating of the files.
Looking forward to this one being released 😅 ❤️
Your environment
ruby -v
: ruby 3.3.0preview1 (2023-05-12 master a1b01e7701) [x86_64-darwin22]rdbg -v
: rdbg 1.8.0Describe the bug
Broken command histories (both
.irb_history
and.rdbg_history
), when I execute debugger on irb.To Reproduce
Prepare a ruby script
test.rb
like this:Remove
.irb_history
and.rdbg_history
to clean upRun irb
Run the following commands on irb
Debugger started
Run the following commands on debugger console
Debugger finished (then I return to irb console)
Run quit to exit irb
Run irb again
Run the following commands on irb
Debugger started
Run the following commands on debugger console
Run quit to exit irb
Look at
.irb_history
and.rdbg_history
Actual behavior
I got:
[.irb_history]
[.rdbg_history]
Expected behavior
Both history
.irb_history
and.rdbg_history
should have same contents:I do not know where
Today's OMIKUJI
should appear at.Additional context
This problem dose not appear with:
Remove
.irb_history
and.rdbg_history
to clean upRun irb
Run the following commands on irb
Debugger started
Run the following commands on debugger console
Debugger finished (then I return to irb console)
Do not exit irb console here!!!
Run the following commands on irb
Debugger started
Run the following commands on debugger console
Run quit to exit irb
Look at
.irb_history
and.rdbg_history
I got:
[.irb_history]
[.rdbg_history]