Pending MethodBreakpoint

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
ruby
Lĩnh vực
devtools

Hướng nghiên cứu

Reproduce the b o.s and b not_lvar.foo examples in target.rb using exe/rdbg, then read the breakpoint handling behind the break command. Done means the behavior clearly distinguishes current-context expressions from singleton-method expressions and defines when an invalid expression may remain pending.

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

Mô tả

When we set a method breakpoint with break C.foo and If the C or C.foo is not defined, it will be a pending breakpoint and when C.foo is activated, it will be activated.

We can set breakpoint with any expression like:

[1, 7] in target.rb
      1|
      2| def (o = '').s
      3|   :s
      4| end
      5|
=>    6| p o.s
      7| __END__
=>#0    <main> at target.rb:6
(rdbg:commands) b o.s
#0  BP - Method  o.s at target.rb:2

(rdbg) c
[1, 7] in target.rb
      1|
      2| def (o = '').s
=>    3|   :s
      4| end
      5|
      6| p o.s
      7| __END__
=>#0    .s at target.rb:3
  #1    <main> at target.rb:6

Stop by #0  BP - Method  o.s at target.rb:2

In this case, user can set a breakpoint with current context (lvar o).

The problem is, if we write an expression which does not valid, the breakpoint will be registered as a pending breakpoint.

(rdbg) b not_lvar.foo
undefined local variable or method `not_lvar' for "":String
#1  BP - Method (pending)  not_lvar.foo

Maybe it will not be activated in future.

This is useful for singleton method:

[master]$ exe/rdbg target.rb  -e 'b C.foo'
DEBUGGER: Session start (pid: 19219)
[1, 7] in target.rb
      1|
=>    2| class C
      3|   def self.foo
      4|   end
      5| end
      6|
      7| __END__
=>#0    <main> at target.rb:2
(rdbg:commands) b C.foo
uninitialized constant C
#0  BP - Method (pending)  C.foo

(rdbg) c
DEBUGGER:  BP - Method  C.foo at target.rb:3 is activated.

At first, C is not defined so it will be a pending breakpoint. After that C.foo is defined and the breakpoint will be activated.

b expr.method has two usecases:

  • (1) want to set breakpoint to the current context
  • (2) want to set singleton class

For (1), it should not make a pending breakpoint.
For (2),, it should.

We can not recognize the purpose for (1) and (2) now.

Ideas:

  • If the expression is like Constant, allow to make pending.
    • It saves (2).
    • Not complete for (1)
  • Add option to recognize 1 and 2.
    • break --allow-pending C.foo for (2).
    • Too long...
Ngôn ngữ chính
Ruby
Star
1.3k
Fork
146
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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/debug

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

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.