Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IJulia infinite loop on reaching breakpoint. #52

Open
john9631 opened this issue Nov 10, 2013 · 7 comments
Open

IJulia infinite loop on reaching breakpoint. #52

john9631 opened this issue Nov 10, 2013 · 7 comments

Comments

@john9631
Copy link

I've got a little test routine:

@debug function doitfor(x,y)
    println(x, " ", y)
    x += 1
    y *= 2
    z = 5
    for i in 1:10
        z = z+5
        z = z-3
        @bp
        z = z+6
    end
    println(x, " ", y, " ", z)
end

which in Julia in terminal results in:

julia> require("testdebug.jl")
55 1

at /home/john/Julia/data/testdebug.jl:11

      10           z = z-3
 -->  11           @bp
      12           z = z+6

debug:11> q
ERROR: interrupted
 in trap at /home/john/.julia/Debug/src/UI.jl:68
 in doitfor at no file:11
 in include at boot.jl:238
at /home/john/Julia/data/testdebug.jl:20

but in IJulia an "infinite" loop locks it up:

55 1

at In[12]:9

No context available!
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")
debug:9> ParseError("end of input")

Apologies for throwing issues at you so quickly. I've been adding the basic debug commands to my reference card so I was testing a few things. It is an excellent piece of software!

John

@toivoh
Copy link
Owner

toivoh commented Nov 10, 2013

Don't apologize; it's better that I know about the issues :)
I've actually never tried Debug in IJulia, now I might. I will see if get some time to look into this.
Did you paste your example straight into a Julia prompt or put it into a script and run it? I had an experience the other day with the No context available! message when I tried a debug example straight at the prompt, but it worked fine when I put it in a script.

@john9631
Copy link
Author

It was at the prompt (well in 3 sequential cell, enable, load code, run code ... just a sec ...

doing it this time with require("testdebug.jl") as I do it from Julia repl

No. That had almost exactly the same effect:

55 1

at /home/john/Julia/data/testdebug.jl:11

      10           z = z-3
 -->  11           @bp
      12           z = z+6

debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")
debug:11> ParseError("end of input")

I run ijulia from the same directory as my test files.

The test file is here

Versioninfo() shows:

Julia Version 0.2.0-rc3+4
Commit 15d0e9d (0 days old master)
Platform Info:
System: Linux (x86_64-linux-gnu)
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
LAPACK: libopenblas
LIBM: libopenlibm

Pkg.status() shows:
Required packages:

  • Color 0.2.6
  • DataFrames 0.3.16
  • Debug 0.0.0+ master
  • Distributions 0.2.11
  • GLM 0.2.2
  • Gadfly 0.1.24
  • IJulia 0.1.0
  • Memoize 0.0.0
  • PyCall 0.1.0
  • PyPlot 1.0.12
  • RDatasets 0.0.2
  • Stats 0.2.8
  • Winston 0.5.3
    Additional packages:
  • BinDeps 0.2.12
  • Blocks 0.0.0
  • Cairo 0.2.10
  • Codecs 0.1.0
  • Compose 0.1.18
  • Datetime 0.1.2
  • Distance 0.2.4
  • GZip 0.2.5
  • IniFile 0.2.1
  • Iterators 0.1.1
  • JSON 0.2.3
  • Loess 0.0.0
  • Nettle 0.1.2
  • NumericExtensions 0.2.18
  • REPLCompletions 0.0.0
  • SortingAlgorithms 0.0.1
  • Tk 0.2.9
  • URIParser 0.0.0
  • ZMQ 0.1.7
  • zzDebug 0.0.0-

@toivoh
Copy link
Owner

toivoh commented Nov 10, 2013

I see, using a script fixed the context problem¸ but not the loop.
Debug uses readline() for user input. Have you tried to call it in IJulia to see if it works as in julia?

@john9631
Copy link
Author

In IJulia readline returns:

In [5]: readline()
Out[5]: ""

In [6]: typeof(readline())
Out[6]: ASCIIString (constructor with 1 method)

with no wait for input.

I'm not certain that debug should/must work in IJ Notebook because its cell by cell input model doesn't quite make the same sense ... perhaps stopping would be sufficient. In IJ Qtconsole the user would expect it to work though because it is essentially just an enhanced console.

ipython qtconsole --profile julia

@toivoh
Copy link
Owner

toivoh commented Nov 13, 2013

It seems that readline was just made to work in IJulia. Would you mind to try again after Pkg.update()? (Or after Pkg.checkout("IJulia") if the first one makes no difference)

@john9631
Copy link
Author

Same problem still. What I'm running:

In [2]:

versioninfo()
Julia Version 0.2.0-rc4+8
Commit b778b87 (2013-11-12 18:42 UTC)
Platform Info:
System: Linux (x86_64-linux-gnu)
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
LAPACK: libopenblas
LIBM: libopenlibm
In [3]:

Pkg.status()
Required packages:

  • Color 0.2.6
  • DataFrames 0.4.0
  • Debug 0.0.0
  • Distributions 0.2.11
  • GLM 0.2.2
  • Gadfly 0.1.24
  • IJulia 0.1.0+ master
  • Memoize 0.0.0
  • PyCall 0.2.0
  • PyPlot 1.0.12
  • RDatasets 0.0.2
  • Stats 0.2.8
  • Winston 0.5.3
    Additional packages:
  • BinDeps 0.2.12
  • Blocks 0.0.0
  • Cairo 0.2.10
  • Codecs 0.1.0
  • Compose 0.1.18
  • DataArrays 0.0.0
  • Datetime 0.1.2
  • Distance 0.2.4
  • GZip 0.2.5
  • IniFile 0.2.1
  • Iterators 0.1.1
  • JSON 0.2.3
  • Loess 0.0.0
  • Nettle 0.1.2
  • NumericExtensions 0.2.18
  • REPLCompletions 0.0.0
  • SortingAlgorithms 0.0.1
  • Tk 0.2.9
  • URIParser 0.0.0
  • ZMQ 0.1.7

Secondary problem is that this version of IJulia Notebook is unstable so I'm going to back out of it

@john9631
Copy link
Author

I'll give it another try after the instability problem is fixed if you want. Or 24 hours from now if I see nothing on that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants