executing arbitrary code at Julia breakpoint

I have the following Julia code in a file test_debug.jl

using Debugger

function main()
    x = 1 + 2
    println("Exiting function main...$(x)");

At the command line I say

@run main()

Now how can I execute arbitrary Julia code at the breakpoint, like I can do with Python’s breakpoint() function?

I would very much like to just say


At the debugger prompt. And execute other Julia code as well. Is this possible? Executing print(x) at the debugger prompt gives

Unknown command print(x). Run ? to obtain help.

Any help would be appreciated. Thanks.

>Solution :

From the README you can find either the w command to add variables to a watch list, or for arbitrary expressions you can type a backtick, `, to enter evaluation mode where you can execute code in the current debug context.

Leave a Reply