File tree Expand file tree Collapse file tree 2 files changed +36
-7
lines changed Expand file tree Collapse file tree 2 files changed +36
-7
lines changed Original file line number Diff line number Diff line change @@ -62,15 +62,23 @@ di_body(const rb_debug_inspector_t *dc, void *ptr)
62
62
long i ;
63
63
64
64
for (i = 1 ; i < len ; i ++ ) {
65
- VALUE loc , e ;
65
+ VALUE e ;
66
66
VALUE iseq = rb_debug_inspector_frame_iseq_get (dc , i );
67
+ VALUE loc = RARRAY_AREF (locs , i );
68
+ VALUE path ;
67
69
68
70
if (!NIL_P (iseq )) {
69
- VALUE path = iseq_realpath (iseq );
70
- if (!NIL_P (path ) && !NIL_P (skip_path_prefix ) && str_start_with (path , skip_path_prefix )) continue ;
71
+ path = iseq_realpath (iseq );
72
+ }
73
+ else {
74
+ // C frame
75
+ path = rb_funcall (loc , rb_intern ("path" ), 0 );
76
+ }
77
+
78
+ if (!NIL_P (path ) && !NIL_P (skip_path_prefix ) && str_start_with (path , skip_path_prefix )) {
79
+ continue ;
71
80
}
72
81
73
- loc = RARRAY_AREF (locs , i );
74
82
e = di_entry (loc ,
75
83
rb_debug_inspector_frame_self_get (dc , i ),
76
84
rb_debug_inspector_frame_binding_get (dc , i ),
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ def program
10
10
2| b = a + 1 # break
11
11
3| end
12
12
4| def bar
13
- 5| x = 1 # break
13
+ 5| x = 1 # break
14
14
6| end
15
15
7| bar
16
16
8| x = 2
@@ -35,7 +35,7 @@ def test_nested_break
35
35
type 'p a'
36
36
assert_line_text ( /42/ )
37
37
type 'c'
38
- assert_line_num 7
38
+ assert_line_num 7 # because restored `up` line
39
39
end
40
40
41
41
# pop nested break
@@ -48,6 +48,27 @@ def test_nested_break
48
48
end
49
49
end
50
50
51
+ def test_nested_break_bt
52
+ debug_code program do
53
+ type 'break 2'
54
+ type 'break 5'
55
+ type 'c'
56
+
57
+ assert_line_num 5
58
+ type 'p foo(42)'
59
+
60
+ if TracePoint . respond_to? :allow_reentry
61
+ # nested break
62
+ assert_line_num 2
63
+ type 'bt'
64
+ assert_no_line_text 'thread_client.rb'
65
+ type 'c'
66
+ end
67
+
68
+ type 'c'
69
+ end
70
+ end
71
+
51
72
def test_multiple_nested_break
52
73
debug_code program do
53
74
type 'break 2'
@@ -62,7 +83,7 @@ def test_multiple_nested_break
62
83
assert_line_num 2
63
84
type 'p foo(142)'
64
85
type 'bt'
65
- assert_line_text ( /\# 9 / ) # TODO: can be changed
86
+ assert_line_text ( /\# 7 \s +<main> / ) # TODO: can be changed
66
87
67
88
type 'c'
68
89
assert_line_text ( /143/ )
You can’t perform that action at this time.
0 commit comments