如何退出Gallium调试器?

时间:2016-10-14 09:07:56

标签: debugging julia gallium

为Julia退出Gallium调试器的命令是什么?我尝试了所有内容,例如qQexit()exitCtrl-c

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0 (2016-09-19 18:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-apple-darwin13.4.0

julia> using Gallium

julia> include(Pkg.dir("Gallium/examples/testprograms/misc.jl"))
optional (generic function with 2 methods)

julia> Gallium.breakpoint(sinthesin,Tuple{Int64})

Locations (+: active, -: inactive, *: source):
 + sinthesin(x::Int64) at /Users/florian.oswald/.julia/v0.5/Gallium/examples/testprograms/misc.jl:2


julia> inaloop(2)
In /Users/florian.oswald/.julia/v0.5/Gallium/examples/testprograms/misc.jl:2
1 @noinline function sinthesin(x)
2     sin(sin(x))
3 end
4 

About to run: Main.sin
1|debug > q
In /Users/florian.oswald/.julia/v0.5/Gallium/examples/testprograms/misc.jl:2
1 @noinline function sinthesin(x)
2     sin(sin(x))
3 end
4 

About to run: Main.sin
1|debug > 

更新

github上有一个相关的issue。这方面的主要内容是使用@enter func(x,y)并直接进入函数。我觉得这很有效。

2 个答案:

答案 0 :(得分:2)

使用REPL时,可以使用finish退出当前功能。要退出调试器,您可能需要多次执行此命令。

在Atom中,相应的命令是Debug: Finish Function按钮。

您可以找到更多命令here

UPDATE:

只要程序中的某个点到达,断点就会暂停程序。在您的示例中,inaloop(2)会两次调用sinthesin,因此单个qCtrl+d不足以退出调试器。我认为这是预期的行为,请看下面的例子:

julia> bp = Gallium.breakpoint(sinthesin,Tuple{Int64})
Locations (+: active, -: inactive, *: source):
 + sinthesin(x::Int64) at /Users/gnimuc/.julia/v0.5/Gallium/examples/testprograms/misc.jl:2


julia> inaloop(2)
In /Users/gnimuc/.julia/v0.5/Gallium/examples/testprograms/misc.jl:2
1 @noinline function sinthesin(x)
2     sin(sin(x))
3 end
4 

About to run: Main.sin
1|debug > q
In /Users/gnimuc/.julia/v0.5/Gallium/examples/testprograms/misc.jl:2
1 @noinline function sinthesin(x)
2     sin(sin(x))
3 end
4 

About to run: Main.sin
1|debug > q

julia> 

julia> Gallium.disable(bp)
true

julia> @enter inaloop(2)
In /Users/gnimuc/.julia/v0.5/Gallium/examples/testprograms/misc.jl:6
5 @noinline function inaloop(y)
6     for i = 1:y
7   sinthesin(i)
8     end

About to run: (colon)(1,2)
1|debug > q

答案 1 :(得分:1)

根据Gnimuc的回答,您还应该能够使用q命令退出调试器。

来自here

const all_commands = ("q", "s", "si", "finish", "bt", "loc", "ind", "shadow",
        "up", "down", "ns", "nc", "n", "se")