Cthulhu.jl icon indicating copy to clipboard operation
Cthulhu.jl copied to clipboard

Infiltrator example in readme not working

Open jaemolihm opened this issue 4 years ago • 0 comments

I tried the Infiltrator example in README, but got ERROR: LoadError: UndefVarError: @descend not defined.

using Infiltrator: @infiltrate
using Cthulhu: @descend
using Base: @noinline # already exported, but be explcit

function foo(n)
    x = n < 2 ? 2 * n : 2.5 * n
    y = n < 4 ? 3 * n : 3.5 * n
    z = n < 5 ? 4 * n : 4.5 * n
    # on Julia v1.6, there is no union splitting for this number of cases.
    @infiltrate
    bar(x, y, z)
end

@noinline function bar(x, y, z)
    string(x + y + z)
end

julia> foo(4)
Infiltrating foo(n::Int64) at REPL[4]:6:

infil> @descend bar(x, y, z)
ERROR: LoadError: UndefVarError: @descend not defined
in expression starting at none:1

infil> Cthulhu.@descend bar(x, y, z)
ERROR: LoadError: UndefVarError: Cthulhu not defined
in expression starting at none:1
julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, haswell)
Environment:
  JULIA = /home/jmlim/appl/julia-1.7.0/bin/julia

(@v1.7) pkg> status Cthulhu
      Status `~/.julia/environments/v1.7/Project.toml`
  [f68482b8] Cthulhu v2.4.6

(@v1.7) pkg> status Infiltrator
      Status `~/.julia/environments/v1.7/Project.toml`
  [5903a43b] Infiltrator v1.2.0

Also, I think https://github.com/JuliaDebug/Cthulhu.jl/blob/4937437857d818b46b4af29f31031ea259457d29/README.md?plain=1#L152 should be @descend foo(5).

jaemolihm avatar Feb 16 '22 05:02 jaemolihm