Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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
    @bp
    println("Exiting function main...$(x)");
end

At the command line I say

include("test_debug.jl")
@run main()

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I would very much like to just say

print(x)

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading