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

Rebugger fails to register the keybind when compiled with PackageCompiler #62

Closed
tkf opened this issue Apr 2, 2019 · 1 comment · Fixed by #64
Closed

Rebugger fails to register the keybind when compiled with PackageCompiler #62

tkf opened this issue Apr 2, 2019 · 1 comment · Fixed by #64

Comments

@tkf
Copy link
Contributor

tkf commented Apr 2, 2019

To reproduce, run this Makefile like this

git clone https://github.com/tkf/julia-sysimage-recipes
cd julia-sysimage-recipes/rebugger
make
# make JULIA=$(which custom-julia)  # for using another julia executable
make repl

This launches a Julia REPL with Rebugger AOT-compiled into the system image. You can see that rebugrepl_init is not called properly:

$ make repl
$(cat build/1.1.0/julia_executable) --sysimage build/1.1.0/sys.so --startup-file=no
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.0 (2019-01-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Rebugger

julia> Rebugger.rebug_prompt_ref
Base.RefValue{Union{Nothing, Prompt}}(nothing)

julia> Rebugger.rebugrepl_init()

julia> Rebugger.rebug_prompt_ref
Base.RefValue{Union{Nothing, Prompt}}("Prompt(\"rebug> \",...)")

To see the actual error, you can edit Rebugger.__init__ like this

diff --git a/src/Rebugger.jl b/src/Rebugger.jl
index 99ed2d0..8150197 100644
--- a/src/Rebugger.jl
+++ b/src/Rebugger.jl
@@ -54,7 +54,14 @@ function rebugrepl_init(main_repl, repl_inited)
 end

 function __init__()
-    schedule(Task(rebugrepl_init))
+    task = Task() do
+        try
+            rebugrepl_init()
+        catch exception
+            @error "Initializing Rebugger's keybinding failed" exception=(exception, catch_backtrace())
+        end
+    end
+    schedule(task)
 end

which yields (after compiling it with PackageCompiler):

┌ Error: Initializing Rebugger's keybinding failed
│   exception =
│    Conflicting definitions for keyseq \es within one keymap
│    Stacktrace:
│     [1] error(::String) at ./error.jl:33
│     [2] #add_nested_key!#22(::Any, ::Any, ::Dict, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:1277
│     [3] (::getfield(REPL.LineEdit, Symbol("#kw##add_nested_key!")))(::Any, ::typeof(REPL.LineEdit.add_nested_key!), ::Dict, ::Any, ::Any) at ./none:0
│     [4] #add_keybindings#28(::Bool, ::Base.Iterators.Pairs{Symbol,String,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:stacktrace, :interpret, :stepin),Tuple{String,String,String}}}, ::Function, ::REPL.LineEditREPL) at /home/takafumi/.julia/dev/Rebugger/src/ui.jl:511
│     [5] (::getfield(Rebugger, Symbol("#kw##add_keybindings")))(::NamedTuple{(:override, :stacktrace, :interpret, :stepin),Tuple{Bool,String,String,String}}, ::typeof(Rebugger.add_keybindings), ::REPL.LineEditREPL) at ./none:0
│     [6] rebugrepl_init(::REPL.LineEditREPL, ::Bool) at /home/takafumi/.julia/dev/Rebugger/src/Rebugger.jl:57
│     [7] rebugrepl_init() at /home/takafumi/.julia/dev/Rebugger/src/Rebugger.jl:44
│     [8] (::getfield(Rebugger, Symbol("##35#36")))() at /home/takafumi/.julia/dev/Rebugger/src/Rebugger.jl:64
└ @ Rebugger ~/.julia/dev/Rebugger/src/Rebugger.jl:66
@tkf
Copy link
Contributor Author

tkf commented Apr 4, 2019

0.3.1 fixes the issue for my setup. Thanks a lot!

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

Successfully merging a pull request may close this issue.

1 participant