@@ -3,6 +3,7 @@ module Debugging
33using Test
44using DAECompiler
55using DAECompiler. Intrinsics
6+ using InteractiveUtils: @code_typed
67using Sundials
78using SciMLBase
89using OrdinaryDiffEq
2627 bt = catch_backtrace ()
2728 end
2829 @test isa (exc, BoundsError)
29- buffer = IOBuffer ()
30- Base. show_backtrace (buffer, bt)
31- output = String (take! (seekstart (buffer)))
32- @test contains (output, " inferred type: SubArray{Float64" )
30+ output = sprint (Base. show_backtrace, bt)
31+ @test contains (output, " inferred type: SubArray{Float64" ) # insert_ssa_debuginfo
3332 end
3433
3534 # use a short `u0` to trigger an error and get a stacktrace
3635 u0 = Float64[0.0 ]
3736
38- settings = DAECompiler. Settings (; mode = DAECompiler. ODENoInit, insert_stmt_debuginfo = true )
37+ settings = DAECompiler. Settings (; mode = DAECompiler. ODENoInit, insert_ssa_debuginfo = true )
3938 odef, _ = DAECompiler. factory (Val (settings), twoeq!)
4039 prob = ODEProblem (odef, u0, (0.0 , 1.0 ))
4140 test_stmt_debuginfo (() -> solve (prob, Rodas5 ()))
4241
43- settings = DAECompiler. Settings (; mode = DAECompiler. DAENoInit, insert_stmt_debuginfo = true )
42+ settings = DAECompiler. Settings (; mode = DAECompiler. DAENoInit, insert_ssa_debuginfo = true )
4443 daef, differential_vars = DAECompiler. factory (Val (settings), twoeq!)
4544 prob = DAEProblem (daef, u0, u0, (0.0 , 1.0 ))
4645 test_stmt_debuginfo (() -> solve (prob, IDA ()))
4746end ;
4847
48+ @testset " `DebugInfo`" begin
49+ settings = DAECompiler. Settings (; mode = DAECompiler. ODENoInit, insert_ssa_debuginfo = true )
50+ odef, _ = DAECompiler. factory (Val (settings), twoeq!)
51+ src = first (@code_typed debuginfo= :source odef. f (Float64[], Float64[], SciMLBase. NullParameters (), 1.0 ))
52+ output = sprint (show, src)
53+ @test contains (output, " inferred type:" )
54+
55+ settings = DAECompiler. Settings (; mode = DAECompiler. DAENoInit, insert_ssa_debuginfo = true )
56+ daef, _ = DAECompiler. factory (Val (settings), twoeq!)
57+ src = first (@code_typed debuginfo= :source daef. f (Float64[], Float64[], Float64[], SciMLBase. NullParameters (), 1.0 ))
58+ output = sprint (show, src)
59+ @test contains (output, " inferred type:" )
60+
61+ settings = DAECompiler. Settings (; mode = DAECompiler. ODENoInit, insert_stmt_debuginfo = true )
62+ odef, _ = DAECompiler. factory (Val (settings), twoeq!)
63+ src = first (@code_typed debuginfo= :source odef. f (Float64[], Float64[], SciMLBase. NullParameters (), 1.0 ))
64+ output = sprint (show, src)
65+ @test contains (output, " test/debugging.jl" ) && contains (output, " twoeq!" )
66+ @test contains (output, " ode_factory.jl" )
67+ @test contains (output, " intrinsics.jl" ) && contains (output, " continuous" )
68+
69+ settings = DAECompiler. Settings (; mode = DAECompiler. DAENoInit, insert_stmt_debuginfo = true )
70+ daef, _ = DAECompiler. factory (Val (settings), twoeq!)
71+ src = first (@code_typed debuginfo= :source daef. f (Float64[], Float64[], Float64[], SciMLBase. NullParameters (), 1.0 ))
72+ output = sprint (show, src)
73+ @test contains (output, " test/debugging.jl" ) && contains (output, " twoeq!" )
74+ @test contains (output, " dae_factory.jl" )
75+ @test contains (output, " intrinsics.jl" ) && contains (output, " continuous" )
76+ end ;
77+
4978end
0 commit comments