Skip to content

Commit

Permalink
Update tasks.jl. Fix prof and bt tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton committed Aug 11, 2015
1 parent 9e71ba4 commit 8a94a36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions base/profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ clear_malloc_data() = ccall(:jl_clear_malloc_data, Void, ())
immutable LineInfo
func::ByteString
file::ByteString
context::ByteString
line::Int
fromC::Bool
ip::Int64 # large enough that this struct can be losslessly read on any machine (32 or 64 bit)
end

const UNKNOWN = LineInfo("?", "?", -1, true, 0)
const UNKNOWN = LineInfo("?", "?", "?", -1, true, 0)

#
# If the LineInfo has function and line information, we consider two of them the same
Expand Down Expand Up @@ -134,8 +135,8 @@ maxlen_data() = convert(Int, ccall(:jl_profile_maxlen_data, Csize_t, ()))

function lookup(ip::Ptr{Void})
info = ccall(:jl_lookup_code_address, Any, (Ptr{Void},Cint), ip, false)
if length(info) == 5
return LineInfo(string(info[1]), string(info[2]), Int(info[3]), info[4], Int64(info[5]))
if length(info) == 6
return LineInfo(string(info[1]), string(info[2]), string(info[3]), Int(info[4]), info[5], Int64(info[6]))
else
return UNKNOWN
end
Expand Down
2 changes: 1 addition & 1 deletion base/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type CapturedException

# Process bt_raw so that it can be safely serialized
bt_lines = Any[]
process_func(name, file, line, n) = push!(bt_lines, (name, file, line, n))
process_func(name, file, context, line, n) = push!(bt_lines, (name, file, context, line, n))
process_backtrace(process_func, :(:), bt_raw, 1:100) # Limiting this to 100 lines.

new(ex, bt_lines)
Expand Down
2 changes: 1 addition & 1 deletion test/backtrace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ have_backtrace = false
for l in bt
lkup = ccall(:jl_lookup_code_address, Any, (Ptr{Void},), l)
if lkup[1] == :backtrace
@test lkup[4] == false # fromC
@test lkup[5] == false # fromC
have_backtrace = true
break
end
Expand Down

0 comments on commit 8a94a36

Please sign in to comment.