# Strange behavior of Debugger, Atom, Julia code?

**URL:** <https://discourse.julialang.org/t/strange-behavior-of-debugger-atom-julia-code/30207>\
**Category:** General Usage\
**Created:** [October 23, 2019, 7:54am UTC](https://discourse.julialang.org/t/strange-behavior-of-debugger-atom-julia-code/30207 "2019-10-23T07:54:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [October 23, 2019, 7:54am UTC](https://discourse.julialang.org/t/strange-behavior-of-debugger-atom-julia-code/30207/1 "2019-10-23T07:54:40Z")

</div>

I was wondering, does anyone experience something strange like what I encountered currently.  
Code:

```julia
using OpenStreetMapX
using Debugger

@enter OpenStreetMapX.get_map_data("/home/Desktop/s.osm")
println("haha")

```

Then, REPL

```julia
86 function get_map_data(filepath::String,filename::Union{String,Nothing}=nothing; road_levels::Set{Int} = Set(1:length(OpenStreetMapX.ROAD_CLASSES)),use_cache::Bool = true,only_intersections=true)::MapData
 87 #preprocessing map file
>88 datapath = (filename==nothing) ? dirname(filepath) : filepath;
 89 if filename == nothing
 90 filename = basename(filepath)
 91 end
 92 cachefile = joinpath(datapath,filename*".cache")

About to run: (Core.Box)()
julia> n

1|debug> n
In #get_map_data#6(road_levels, use_cache, only_intersections, , filepath, filename) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:88
 86 function get_map_data(filepath::String,filename::Union{String,Nothing}=nothing; road_levels::Set{Int} = Set(1:length(OpenStreetMapX.ROAD_CLASSES)),use_cache::Bool = true,only_intersections=true)::MapData
 87 #preprocessing map file
 88 datapath = (filename==nothing) ? dirname(filepath) : filepath;
>89 if filename == nothing
 90 filename = basename(filepath)
 91 end
 92 cachefile = joinpath(datapath,filename*".cache")
 93 if use_cache && isfile(cachefile)

About to run: (==)(nothing, nothing)
1|debug> n
In #get_map_data#6(road_levels, use_cache, only_intersections, , filepath, filename) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:88
 86 function get_map_data(filepath::String,filename::Union{String,Nothing}=nothing; road_levels::Set{Int} = Set(1:length(OpenStreetMapX.ROAD_CLASSES)),use_cache::Bool = true,only_intersections=true)::MapData
 87 #preprocessing map file
 88 datapath = (filename==nothing) ? dirname(filepath) : filepath;
 89 if filename == nothing
>90 filename = basename(filepath)
 91 end
 92 cachefile = joinpath(datapath,filename*".cache")
 93 if use_cache && isfile(cachefile)
 94 f=open(cachefile,"r");

About to run: (basename)("/home/Desktop/s.osm")
1|debug> n
In #get_map_data#6(road_levels, use_cache, only_intersections, , filepath, filename) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:88
 88 datapath = (filename==nothing) ? dirname(filepath) : filepath;
 89 if filename == nothing
 90 filename = basename(filepath)
 91 end
>92 cachefile = joinpath(datapath,filename*".cache")
 93 if use_cache && isfile(cachefile)
 94 f=open(cachefile,"r");
 95 res=Serialization.deserialize(f);
 96 close(f);

About to run: (*)("s.osm", ".cache")
1|debug> n
In #get_map_data#6(road_levels, use_cache, only_intersections, , filepath, filename) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:88
 89 if filename == nothing
 90 filename = basename(filepath)
 91 end
 92 cachefile = joinpath(datapath,filename*".cache")
>93 if use_cache && isfile(cachefile)
 94 f=open(cachefile,"r");
 95 res=Serialization.deserialize(f);
 96 close(f);
 97 @info "Read map data from cache $cachefile"

About to run: (isfile)("/home/Desktop/s.osm.cache")
1|debug> n
In #get_map_data#6(road_levels, use_cache, only_intersections, , filepath, filename) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:88
  95 res=Serialization.deserialize(f);
  96 close(f);
  97 @info "Read map data from cache $cachefile"
  98 else
> 99 mapdata = OpenStreetMapX.parseOSM(joinpath(datapath,filename))
 100 OpenStreetMapX.crop!(mapdata,crop_relations = false)
 101 #preparing data
 102 bounds = mapdata.bounds
 103 nodes = OpenStreetMapX.ENU(mapdata.nodes,OpenStreetMapX.center(bounds))

About to run: (joinpath)("/home/Desktop", "s.osm")

```

Then my relatively quick work space computer got stuck like forever. One confusing point is: the Debugger tells me that it is about to run the joinpath function, which should be really quick to run. But when I press ctrol + c to interrupt the julia processing, it told me a bunch of info about the parseMap function call, which should be next step, right? Any comments are greatly appreciated.

EDIT: After press ctrol +c to interupt the processing, the following is the output:

```julia
ERROR: "InterruptException(), , 0, 0, 0"
Stacktrace:
 [1] #parsefile#21(::Int64, ::OpenStreetMapX.DataHandle, ::typeof(LibExpat.parsefile), ::String, ::LibExpat.XPCallbacks) at /home/devel/.julia/packages/LibExpat/6jLDP/src/streaming.jl:237
 [2] (::getfield(LibExpat, Symbol("#kw##parsefile")))(::NamedTuple{(:data,),Tuple{OpenStreetMapX.DataHandle}}, ::typeof(LibExpat.parsefile), ::String, ::LibExpat.XPCallbacks) at none:0
 [3] #parseOSM#5(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(OpenStreetMapX.parseOSM), ::String) at /home/devel/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:65
 [4] parseOSM(::String) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:61
 [5] #get_map_data#6(::Set{Int64}, ::Bool, ::Bool, ::typeof(get_map_data), ::String, ::Nothing) at /home/devel/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:99
 [6] get_map_data(::String, ::Nothing) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:88
 [7] get_map_data(::String) at /home/.julia/packages/OpenStreetMapX/vHhHu/src/parseMap.jl:88
haha

```

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [October 23, 2019, 9:22am UTC](https://discourse.julialang.org/t/strange-behavior-of-debugger-atom-julia-code/30207/2 "2019-10-23T09:22:27Z")

</div>

Interpreting code can be _very_ slow, and `parseOSM` seems like it would potentially do lots of operations. Try turning on `Compiled mode` (uless you want to check what’s happening in that function).

> [@bsnyh](#):
>
> One confusing point is: the Debugger tells me that it is about to run the joinpath function, which should be really quick to run. But when I press ctrol + c to interrupt the julia processing, it told me a bunch of info about the parseMap function call, which should be next step, right? Any comments are greatly appreciated.

`n` steps to the next _line_, whereas `se` steps to the _next expression_.
