Can't change workspace after entering `debug`

Đang mở
#952 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ruby
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu tại lib/irb/debug/ui.rb, khoảng dòng 59, sau đó tái hiện chuỗi thao tác đã được báo cáo về việc thay đổi một workspace hoặc push một workspace vào stack trước và sau khi vào chế độ debug. Xác minh rằng các lệnh và câu lệnh của workspace vẫn tiếp tục sử dụng workspace đã chọn sau khi vào chế độ debug, kể cả sau khi thay đổi workspace hoặc push một workspace vào stack.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

After entering debug mode, all workspace functionality stops working. It's no longer possible to perform commands or statements under a different workspace after changing the workspace or pushing a workspace to the stack.

This happens because under debug mode, the current workspace is replaced and lines are always read with the context of the debug binding or the top level binding.

https://github.com/ruby/irb/blob/66318d0a343552715f214f07c57bc4a60552ccfd/lib/irb/debug/ui.rb#L59

Since it's not possible to exit debug mode, the workspace functionality is lost within irb for the remaining of the process.

irb(main):001> chws
Current workspace: main
=> nil
irb(main):002> chws foo
Current workspace: #<Foo:0x000000010a8ef250>
=> nil
irb(#<Foo:0x000000010a8ef250>):003> bar
=> "I'm a private method"
irb(#<Foo:0x000000010a8ef250>):004> chws
Current workspace: main
=> nil
irb(main):005> debug
irb:rdbg(main):006> chws foo
Current workspace: #<Foo:0x000000010a8ef250>
=> nil
irb:rdbg(#<Foo:0x000000010a8ef250>):007> bar
eval error: undefined local variable or method `bar' for main
  (rdbg)/test.rb:1:in `<main>'
nil
irb:rdbg(main):008> 

Result of irb_info

irb:rdbg(main):009> irb_info
Ruby version: 3.3.0
IRB version: irb 1.13.0 (2024-05-01)
InputMethod: RelineInputMethod with Reline 0.5.5
Completion: Autocomplete, RegexpCompletor
RUBY_PLATFORM: x86_64-darwin23
LANG env: en_CA.UTF-8
East Asian Ambiguous Width: 1

Terminal Emulator

kitty terminal

Setting Files

No settings file

Ngôn ngữ chính
Ruby
Star
477
Fork
165
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ruby/irb

Tất cả issue của ruby/irb

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.