Skip to content

Commit

Permalink
Merge pull request #4 from timholy/teh/fix0.5
Browse files Browse the repository at this point in the history
Fixes for recent julia-0.5
  • Loading branch information
timholy authored Jun 25, 2016
2 parents 0095dde + 634cdd9 commit 728db12
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ os:
- linux
- osx
julia:
- release
- 0.4
- nightly
notifications:
email: false
Expand Down
42 changes: 25 additions & 17 deletions src/DebuggingUtilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,39 @@ DebuggingUtilities

## @showln

btvalid(lkup) = !isempty(lkup)
btfrom_c(lkup) = lkup[length(lkup)-1]
# look up an instruction pointer

if VERSION < v"0.5.0-dev"
btvalid(lkup) = !isempty(lkup)
lookup(ip) = ccall(:jl_lookup_code_address, Any, (Ptr{Void}, Int32), ip, 0)
btfrom_c(lkup) = lkup[length(lkup)-1]
funcname(lkup) = lkup[1]
function print_btinfo(io, lkup)
funcname, file, line = lkup
print(io, "in ", funcname, " at ", file, ", line ", line)
end
else
function print_btinfo(io, lkup)
funcname = lkup[1]
print(io, "in ", funcname)
for i = 2:2:length(lkup)-3
print(io, " at ", lkup[i], ":", lkup[i+1])
function show_backtrace1(io, bt)
for t in bt
lkup = lookup(t)
if btvalid(lkup) && !btfrom_c(lkup)
funname = funcname(lkup)
if funname != :backtrace
print_btinfo(io, lkup)
break
end
end
end
end
end

function show_backtrace1(io, bt)
for t in bt
lkup = ccall(:jl_lookup_code_address, Any, (Ptr{Void}, Int32), t, 0)
if btvalid(lkup) && !btfrom_c(lkup)
funcname = lkup[1]
if funcname != :backtrace
print_btinfo(io, lkup)
else
function print_btinfo(io, frm)
print(io, "in ", frm.func, " at ", frm.file, ":", frm.line)
end
function show_backtrace1(io, bt)
st = stacktrace(bt)
for frm in st
funcname = frm.func
if funcname != :backtrace && funcname != Symbol("macro expansion")
print_btinfo(io, frm)
break
end
end
Expand Down

0 comments on commit 728db12

Please sign in to comment.