Skip to content

Commit cf3f29a

Browse files
authored
Merge pull request #473 from JuliaDebug/kc/fix
update test based on the removal of Base.replaceuserpath
2 parents b2702ba + 5bbf213 commit cf3f29a

File tree

6 files changed

+119
-59
lines changed

6 files changed

+119
-59
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ jobs:
1414
matrix:
1515
version:
1616
- '1.0'
17-
- '1.1'
18-
- '1.2'
19-
- '1.3'
20-
- '1.4'
2117
- '1.5'
18+
- '1'
2219
- 'nightly'
2320
os:
2421
- ubuntu-latest

docs/Manifest.toml

Lines changed: 75 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,78 @@
11
# This file is machine-generated - editing it directly is not advised
22

3+
[[ArgTools]]
4+
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
5+
6+
[[Artifacts]]
7+
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
8+
39
[[Base64]]
410
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
511

612
[[CodeTracking]]
713
deps = ["InteractiveUtils", "UUIDs"]
8-
git-tree-sha1 = "9c173f62af93cce8af2bd3527d160b6ddd6eaf81"
14+
git-tree-sha1 = "8ad457cfeb0bca98732c97958ef81000a543e73e"
915
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
10-
version = "1.0.0"
16+
version = "1.0.5"
1117

1218
[[Dates]]
1319
deps = ["Printf"]
1420
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
1521

16-
[[Distributed]]
17-
deps = ["Random", "Serialization", "Sockets"]
18-
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
19-
2022
[[DocStringExtensions]]
2123
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
22-
git-tree-sha1 = "50ddf44c53698f5e784bbebb3f4b21c5807401b1"
24+
git-tree-sha1 = "9d4f64f79012636741cf01133158a54b24924c32"
2325
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
24-
version = "0.8.3"
26+
version = "0.8.4"
2527

2628
[[Documenter]]
27-
deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
28-
git-tree-sha1 = "395fa1554c69735802bba37d9e7d9586fd44326c"
29+
deps = ["Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
30+
git-tree-sha1 = "3ebb967819b284dc1e3c0422229b58a40a255649"
2931
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
30-
version = "0.24.11"
32+
version = "0.26.3"
33+
34+
[[Downloads]]
35+
deps = ["ArgTools", "LibCURL", "NetworkOptions"]
36+
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
37+
38+
[[IOCapture]]
39+
deps = ["Logging"]
40+
git-tree-sha1 = "377252859f740c217b936cebcd918a44f9b53b59"
41+
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
42+
version = "0.1.1"
3143

3244
[[InteractiveUtils]]
3345
deps = ["Markdown"]
3446
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
3547

3648
[[JSON]]
3749
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
38-
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
50+
git-tree-sha1 = "81690084b6198a2e1da36fcfda16eeca9f9f24e4"
3951
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
40-
version = "0.21.0"
52+
version = "0.21.1"
4153

4254
[[JuliaInterpreter]]
4355
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
4456
path = ".."
4557
uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
46-
version = "0.8.0"
58+
version = "0.8.11"
59+
60+
[[LibCURL]]
61+
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
62+
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
63+
64+
[[LibCURL_jll]]
65+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
66+
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
4767

4868
[[LibGit2]]
49-
deps = ["Printf"]
69+
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
5070
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
5171

72+
[[LibSSH2_jll]]
73+
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
74+
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
75+
5276
[[Libdl]]
5377
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
5478

@@ -59,25 +83,35 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
5983
deps = ["Base64"]
6084
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
6185

86+
[[MbedTLS_jll]]
87+
deps = ["Artifacts", "Libdl"]
88+
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
89+
6290
[[Mmap]]
6391
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
6492

93+
[[MozillaCACerts_jll]]
94+
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
95+
96+
[[NetworkOptions]]
97+
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
98+
6599
[[Parsers]]
66-
deps = ["Dates", "Test"]
67-
git-tree-sha1 = "8077624b3c450b15c087944363606a6ba12f925e"
100+
deps = ["Dates"]
101+
git-tree-sha1 = "c8abc88faa3f7a3950832ac5d6e690881590d6dc"
68102
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
69-
version = "1.0.10"
103+
version = "1.1.0"
70104

71105
[[Pkg]]
72-
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
106+
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
73107
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
74108

75109
[[Printf]]
76110
deps = ["Unicode"]
77111
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
78112

79113
[[REPL]]
80-
deps = ["InteractiveUtils", "Markdown", "Sockets"]
114+
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
81115
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
82116

83117
[[Random]]
@@ -93,8 +127,16 @@ uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
93127
[[Sockets]]
94128
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
95129

130+
[[TOML]]
131+
deps = ["Dates"]
132+
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
133+
134+
[[Tar]]
135+
deps = ["ArgTools", "SHA"]
136+
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
137+
96138
[[Test]]
97-
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
139+
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
98140
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
99141

100142
[[UUIDs]]
@@ -103,3 +145,15 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
103145

104146
[[Unicode]]
105147
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
148+
149+
[[Zlib_jll]]
150+
deps = ["Libdl"]
151+
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
152+
153+
[[nghttp2_jll]]
154+
deps = ["Artifacts", "Libdl"]
155+
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
156+
157+
[[p7zip_jll]]
158+
deps = ["Artifacts", "Libdl"]
159+
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"

docs/src/index.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Using this package as an interpreter is straightforward:
1313
julia> using JuliaInterpreter
1414
1515
julia> list = [1, 2, 5]
16-
3-element Array{Int64,1}:
16+
3-element Vector{Int64}:
1717
1
1818
2
1919
5
@@ -53,11 +53,12 @@ julia> @interpret sum([1,2,3]) # no element bigger than 4, breakpoint should no
5353
6
5454
5555
julia> frame, bpref = @interpret sum([1,2,5]) # should trigger breakpoint
56-
(Frame for sum(a::AbstractArray; dims) in Base at reducedim.jl:652
57-
c 1* 652 1 ─ nothing
58-
2 652 │ %2 = (Base.#sum#583)(Colon(), #self#, a)
59-
3 652 └── return %2
60-
a = [1, 2, 5], breakpoint(sum(a::AbstractArray; dims) in Base at reducedim.jl:652, line 652))
56+
(Frame for sum(a::AbstractArray; dims, kw...) in Base at reducedim.jl:873
57+
c 1* 873 1 ─ nothing
58+
2 873 │ %2 = ($(QuoteNode(NamedTuple)))()
59+
3 873 │ %3 = Base.pairs(%2)
60+
61+
a = [1, 2, 5], breakpoint(sum(a::AbstractArray; dims, kw...) in Base at reducedim.jl:873, line 873))
6162
```
6263

6364
`frame` is described in more detail on the next page; for now, suffice it to say
@@ -74,11 +75,12 @@ julia> @interpret sum([1,2,5])
7475
julia> enable(bp)
7576
7677
julia> @interpret sum([1,2,5])
77-
(Frame for sum(a::AbstractArray; dims) in Base at reducedim.jl:652
78-
c 1* 652 1 ─ nothing
79-
2 652 │ %2 = (Base.#sum#583)(Colon(), #self#, a)
80-
3 652 └── return %2
81-
a = [1, 2, 5], breakpoint(sum(a::AbstractArray; dims) in Base at reducedim.jl:652, line 652))
78+
(Frame for sum(a::AbstractArray; dims, kw...) in Base at reducedim.jl:873
79+
c 1* 873 1 ─ nothing
80+
2 873 │ %2 = ($(QuoteNode(NamedTuple)))()
81+
3 873 │ %3 = Base.pairs(%2)
82+
83+
a = [1, 2, 5], breakpoint(sum(a::AbstractArray; dims, kw...) in Base at reducedim.jl:873, line 873))
8284
```
8385

8486
[`disable`](@ref) and [`enable`](@ref) allow you to turn breakpoints off and on without losing any
@@ -107,17 +109,17 @@ julia> break_on(:error)
107109
108110
julia> fr, pc = @interpret f_outer()
109111
before error
110-
(Frame for f_outer() in Main at none:2
111-
1 2 1 ─ (println)("before error")
112-
2* 3 │ (f_inner)()
113-
3 4 │ %3 = (println)("after error")
112+
(Frame for f_outer() in Main at none:1
113+
1 2 1 ─ Base.println("before error")
114+
2* 3 │ f_inner()
115+
3 4 │ %3 = Base.println("after error")
114116
4 4 └── return %3
115117
callee: f_inner() in Main at none:1, breakpoint(error(s::AbstractString) in Base at error.jl:33, line 33, ErrorException("inner error")))
116118
117119
julia> leaf(fr)
118120
Frame for error(s::AbstractString) in Base at error.jl:33
119-
1 33 1 ─ %1 = (ErrorException)(s)
120-
2* 33 │ %2 = (throw)(%1)
121+
1 33 1 ─ %1 = ($(QuoteNode(ErrorException)))(_2)
122+
2* 33 │ %2 = Core.throw(%1)
121123
3 33 └── return %2
122124
s = "inner error"
123125
caller: f_inner() in Main at none:1
@@ -152,18 +154,18 @@ julia> @interpret myfunction(1, 2)
152154
6
153155
154156
julia> @interpret myfunction(5, 6)
155-
(Frame for myfunction(x, y) in Main at none:2
157+
(Frame for myfunction(x, y) in Main at none:1
156158
157-
3 4 │ %3 = (>)(x, 3)
159+
3 4 │ %3 = _2 > 3
158160
4 4 └── goto #3 if not %3
159161
b 5* 4 2 ─ nothing
160162
6 4 └── goto #3
161-
7 5 3 ┄ %7 = (+)(a, b, x, y)
163+
7 5 3 ┄ %7 = _5 + _4 + _2 + _3
162164
163165
x = 5
164166
y = 6
165-
a = 1
166-
b = 2, breakpoint(myfunction(x, y) in Main at none:2, line 4))
167+
b = 2
168+
a = 1, breakpoint(myfunction(x, y) in Main at none:1, line 4))
167169
```
168170

169171
Here the breakpoint is marked with a `b` indicating that it is an unconditional breakpoint.

src/construct.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,15 @@ julia> framecode
240240
1 1 1 ─ return 1
241241
242242
julia> frameargs
243-
2-element Array{Any,1}:
243+
2-element Vector{Any}:
244244
mymethod (generic function with 1 method)
245245
[1.0, 2.0]
246246
247247
julia> lenv
248248
svec(Float64)
249249
250250
julia> argtypes
251-
Tuple{typeof(mymethod),Array{Float64,1}}
251+
Tuple{typeof(mymethod), Vector{Float64}}
252252
```
253253
"""
254254
function prepare_call(@nospecialize(f), allargs; enter_generated = false)
@@ -616,20 +616,20 @@ mymethod (generic function with 1 method)
616616
617617
julia> JuliaInterpreter.enter_call_expr(:(\$mymethod(1)))
618618
Frame for mymethod(x) in Main at none:1
619-
1* 1 1 ─ %1 = (+)(x, 1)
619+
1* 1 1 ─ %1 = _2 + 1
620620
2 1 └── return %1
621621
x = 1
622622
623623
julia> mymethod(x::Vector{T}) where T = 1
624624
mymethod (generic function with 2 methods)
625625
626626
julia> a = [1.0, 2.0]
627-
2-element Array{Float64,1}:
627+
2-element Vector{Float64}:
628628
1.0
629629
2.0
630630
631631
julia> JuliaInterpreter.enter_call_expr(:(\$mymethod(\$a)))
632-
Frame for mymethod(x::Array{T,1}) where T in Main at none:1
632+
Frame for mymethod(x::Vector{T}) where T in Main at none:1
633633
1* 1 1 ─ return 1
634634
x = [1.0, 2.0]
635635
T = Float64
@@ -659,15 +659,15 @@ mymethod (generic function with 1 method)
659659
660660
julia> JuliaInterpreter.enter_call(mymethod, 1)
661661
Frame for mymethod(x) in Main at none:1
662-
1* 1 1 ─ %1 = (+)(x, 1)
662+
1* 1 1 ─ %1 = _2 + 1
663663
2 1 └── return %1
664664
x = 1
665665
666666
julia> mymethod(x::Vector{T}) where T = 1
667667
mymethod (generic function with 2 methods)
668668
669669
julia> JuliaInterpreter.enter_call(mymethod, [1.0, 2.0])
670-
Frame for mymethod(x::Array{T,1}) where T in Main at none:1
670+
Frame for mymethod(x::Vector{T}) where T in Main at none:1
671671
1* 1 1 ─ return 1
672672
x = [1.0, 2.0]
673673
T = Float64
@@ -753,7 +753,7 @@ Evaluate `f` on the specified arguments using the interpreter.
753753
754754
```jldoctest
755755
julia> a = [1, 7]
756-
2-element Array{Int64,1}:
756+
2-element Vector{Int64}:
757757
1
758758
7
759759

src/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ julia> JuliaInterpreter.step_expr!(frame);
596596
julia> JuliaInterpreter.step_expr!(frame);
597597
598598
julia> JuliaInterpreter.locals(frame)
599-
2-element Array{JuliaInterpreter.Variable,1}:
599+
2-element Vector{JuliaInterpreter.Variable}:
600600
#self# = capture
601601
x = Core.Box(1)
602602
@@ -607,7 +607,7 @@ julia> JuliaInterpreter.eval_code(frame, "x = 2")
607607
2
608608
609609
julia> JuliaInterpreter.locals(frame)
610-
2-element Array{JuliaInterpreter.Variable,1}:
610+
2-element Vector{JuliaInterpreter.Variable}:
611611
#self# = capture
612612
x = Core.Box(2)
613613
```

test/interpret.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,13 @@ g_1(x) = g_2(x)
495495
g_2(x) = g_3(x)
496496
g_3(x) = error("foo")
497497
line_g = @__LINE__
498+
499+
if isdefined(Base, :replaceuserpath)
500+
_contractuser = Base.replaceuserpath
501+
else
502+
_contractuser = Base.contractuser
503+
end
504+
498505
try
499506
break_on(:error)
500507
local frame, bp = @interpret g_1(2.0)
@@ -503,7 +510,7 @@ try
503510
if isdefined(Base, :print_stackframe)
504511
@test occursin("[1] error(s::String)", stacktrace_lines[3])
505512
@test occursin("[2] g_3(x::Float64)", stacktrace_lines[5])
506-
thefile = Base.replaceuserpath(@__FILE__)
513+
thefile = _contractuser(@__FILE__)
507514
@test occursin("$thefile:$(line_g - 1)", stacktrace_lines[6])
508515
@test occursin("[3] g_2(x::Float64)", stacktrace_lines[7])
509516
@test occursin("$thefile:$(line_g - 2)", stacktrace_lines[8])
@@ -531,7 +538,7 @@ try
531538
@test occursin(string("ERROR: ", sprint(showerror, ErrorException("foo"))), stacktrace_lines[1])
532539
if isdefined(Base, :print_stackframe)
533540
@test occursin("[1] error(s::String)", stacktrace_lines[3])
534-
thefile = Base.replaceuserpath(@__FILE__)
541+
thefile = _contractuser(@__FILE__)
535542
@test occursin("[2] g_3(x::Float64)", stacktrace_lines[5])
536543
@test occursin("$thefile:$(line_g - 1)", stacktrace_lines[6])
537544
@test occursin("[3] g_2(x::Float64)", stacktrace_lines[7])

0 commit comments

Comments
 (0)