Skip to content

Commit 0d5acba

Browse files
committed
Add a test for profile deserialization (#21575)
xref #21025 which is fixed on master, and a one-character fix on release-0.5, but should be tested on both branches (cherry picked from commit 4ddd9fa) change Int64 to UInt64 in deserialize method, and UInt64 to UInt in test, for release-0.5
1 parent ea795ec commit 0d5acba

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

base/stacktraces.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Stack information representing execution context, with the following fields:
3737
3838
True if the code is from an inlined frame.
3939
40-
- `pointer::Int64`
40+
- `pointer::UInt64`
4141
4242
Representation of the pointer to the execution context as returned by `backtrace`.
4343
@@ -109,7 +109,7 @@ function deserialize(s::AbstractSerializer, ::Type{StackFrame})
109109
line = read(s.io, Int)
110110
from_c = read(s.io, Bool)
111111
inlined = read(s.io, Bool)
112-
pointer = read(s.io, Int64)
112+
pointer = read(s.io, UInt64)
113113
return StackFrame(func, file, line, Nullable{LambdaInfo}(), from_c, inlined, pointer)
114114
end
115115

test/profile.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ end
1111

1212
Profile.clear()
1313
@profile busywait(1, 20)
14+
15+
let r = Profile.retrieve()
16+
mktemp() do path, io
17+
serialize(io, r)
18+
close(io)
19+
open(path) do io
20+
@test isa(deserialize(io), Tuple{Vector{UInt},Dict{UInt,Vector{StackFrame}}})
21+
end
22+
end
23+
end
24+
1425
let iobuf = IOBuffer()
1526
Profile.print(iobuf, format=:tree, C=true)
1627
str = takebuf_string(iobuf)

0 commit comments

Comments
 (0)