Hi, there, I'm pretty new to ECL. I'm currently considering embedding ECL in a game engine. When I interactively interrupt the program and drop into the repl, I load up swank with quicklisp and create swank server with (swank:create-server :port 4005). I can connect to it from SLIME. But any error in the statement, either by deliberately typing sth wrong, will cause swank server to close instead of dropping into the debugging environment. I have no idea why this happens. It turns out that if I start swank on a different thread with mp:process-run-function, it goes well. But since the game engine is based on OpenGL, multithreading rendering isn't an option. I wonder if there is any way to get around the swank server and enable its debugger when it encounters error.
Thanks, Bruce
bruce li leilmyxwz@gmail.com writes:
Hi, there, I'm pretty new to ECL. I'm currently considering embedding ECL in a game engine. When I interactively interrupt the program and drop into the repl, I load up swank with quicklisp and create swank server with (swank:create-server :port 4005). I can connect to it from SLIME. But any error in the statement, either by deliberately typing sth wrong, will cause swank server to close instead of dropping into the debugging environment. I have no idea why this happens. It turns out that if I start swank on a different thread with mp:process-run-function, it goes well. But since the game engine is based on OpenGL, multithreading rendering isn't an option. I wonder if there is any way to get around the swank server and enable its debugger when it encounters error.
Is the call to swank:create-server coming from -eval or -load? ECL has an unwind-protect with exit around processing of -eval and -load. A work around is to use (load ...) from the repl.
Hello,
if you call lisp forms from C code (after cl_boot), then you have no set handler, so if your code signals a condition, then it goes uncought. If that's a case, you could do something, what toplevel does (setting handlers etc), or set si::*break-level* to 1 and call tpl:
(let ((si::*break-level* 1)) (si::tpl))
this should spawn toplevel console and won't exit. If you want to set proper handler consult src/lsp/tpl.lsp file in ECL sourcecode.
Regards, Daniel
bruce li writes:
Hi, there, I'm pretty new to ECL. I'm currently considering embedding ECL in a game engine. When I interactively interrupt the program and drop into the repl, I load up swank with quicklisp and create swank server with (swank:create-server :port 4005). I can connect to it from SLIME. But any error in the statement, either by deliberately typing sth wrong, will cause swank server to close instead of dropping into the debugging environment. I have no idea why this happens. It turns out that if I start swank on a different thread with mp:process-run-function, it goes well. But since the game engine is based on OpenGL, multithreading rendering isn't an option. I wonder if there is any way to get around the swank server and enable its debugger when it encounters error.
Thanks, Bruce
Thanks for the reply. But I don't quite understand what it means. I was doing something similar to https://chriskohlhepp.wordpress.com/embedding-lisp-in-cplusplus-a-recipe/ . When I hit C-c in the console, I drop into the top-level REPL. I typed:
(swank:create-server :port 4005)
;; Swank started at port: 4005.
Then I connect to swank server with SLIME, inside which I put something wrong there:
CL-USER> asdf Debugger received error of type: UNBOUND-VARIABLE The variable ASDF; Evaluation aborted on #<a UNBOUND-VARIABLE>.
After that, swank server stops. And I'm dropped back to top level. I wonder why this happens.
Thanks, Bruce
2015-09-01 9:34 GMT-04:00 Daniel Kochmański <daniel@turtleware.eu>:
Hello,
if you call lisp forms from C code (after cl_boot), then you have no set handler, so if your code signals a condition, then it goes uncought. If that's a case, you could do something, what toplevel does (setting handlers etc), or set si::*break-level* to 1 and call tpl:
(let ((si::*break-level* 1)) (si::tpl))
this should spawn toplevel console and won't exit. If you want to set proper handler consult src/lsp/tpl.lsp file in ECL sourcecode.
Regards, Daniel
bruce li writes:
Hi, there, I'm pretty new to ECL. I'm currently considering embedding ECL in a game engine. When I interactively interrupt the program and drop into the repl, I load up swank with quicklisp and create swank server with (swank:create-server :port 4005). I can connect to it from SLIME. But any error in the statement, either by deliberately typing sth wrong, will cause swank server to close instead of dropping into the debugging environment. I have no idea why this happens. It turns out that if I start swank on a different thread with mp:process-run-function, it goes well. But since the game engine is based on OpenGL, multithreading rendering isn't an option. I wonder if there is any way to get around the swank server and enable its debugger when it encounters error.
Thanks, Bruce
-- Daniel Kochmański | Poznań, Poland ;; aka jackdaniel
"Be the change that you wish to see in the world." - Mahatma Gandhi
Are you running ECL from the sh/bash shell in Emacs? I've run into problems with that in ECL, it seems to point to some bug in slime but I haven't had a chance to investigate. It could equally be something I'm doing wrong. But try the following:
- Double check your .eclrc resource file and make sure that the only thing your loading is quicklisp. (to remove as many troubleshooting variables as possible.)
- Run ECL from an ordinary terminal window and start swank.
- Connect to swank in Emacs using slime like you normally would.
If that ends up working, then one thing you could try is running two separate instance of Emacs, one for Swank and the other for connecting with Slime. Oddly that resolved the problem for me.
On 09/01/2015 08:22 AM, bruce li wrote:
Thanks for the reply. But I don't quite understand what it means. I was doing something similar to https://chriskohlhepp.wordpress.com/embedding-lisp-in-cplusplus-a-recipe/ . When I hit C-c in the console, I drop into the top-level REPL. I typed:
(swank:create-server :port 4005)
;; Swank started at port: 4005.
Then I connect to swank server with SLIME, inside which I put something wrong there:
CL-USER> asdf Debugger received error of type: UNBOUND-VARIABLE The variable ASDF; Evaluation aborted on #<a UNBOUND-VARIABLE>.
After that, swank server stops. And I'm dropped back to top level. I wonder why this happens.
Thanks, Bruce
2015-09-01 9:34 GMT-04:00 Daniel Kochmański <daniel-28Bxc6qBrvkO3tVf+UDk3w@public.gmane.org>:
Hello,
if you call lisp forms from C code (after cl_boot), then you have no set handler, so if your code signals a condition, then it goes uncought. If that's a case, you could do something, what toplevel does (setting handlers etc), or set si::*break-level* to 1 and call tpl:
(let ((si::*break-level* 1)) (si::tpl))
this should spawn toplevel console and won't exit. If you want to set proper handler consult src/lsp/tpl.lsp file in ECL sourcecode.
Regards, Daniel
bruce li writes:
Hi, there, I'm pretty new to ECL. I'm currently considering embedding ECL in a game engine. When I interactively interrupt the program and drop into the repl, I load up swank with quicklisp and create swank server with (swank:create-server :port 4005). I can connect to it from SLIME. But any error in the statement, either by deliberately typing sth wrong, will cause swank server to close instead of dropping into the debugging environment. I have no idea why this happens. It turns out that if I start swank on a different thread with mp:process-run-function, it goes well. But since the game engine is based on OpenGL, multithreading rendering isn't an option. I wonder if there is any way to get around the swank server and enable its debugger when it encounters error.
Thanks, Bruce
-- Daniel Kochmański | Poznań, Poland ;; aka jackdaniel
"Be the change that you wish to see in the world." - Mahatma Gandhi
Hi, As I checked with the top-level repl, si::*break-level* is already 1. If I eval (let ((si::*break-level* 1)) (si::tpl)) in the slime buffer, it won't abort connection anymore. But I lose the capability of using SLIME's debugging buffer. The errors will be directly dumped to the top-level.
Another question, possibly unrelated: I'm trying to hook up C++ callbacks with lambda func. But when I issue cl_funcall in the C++ side, any error in the execution of the lambda func will abort the execution of the program. Is there any workaround? Or should I use an alternate routine instead of cl_funcall to make it "safe"?
Thanks, Bruce
2015-09-01 21:34 GMT+08:00 Daniel Kochmański daniel@turtleware.eu:
Hello,
if you call lisp forms from C code (after cl_boot), then you have no set handler, so if your code signals a condition, then it goes uncought. If that's a case, you could do something, what toplevel does (setting handlers etc), or set si::*break-level* to 1 and call tpl:
(let ((si::*break-level* 1)) (si::tpl))
this should spawn toplevel console and won't exit. If you want to set proper handler consult src/lsp/tpl.lsp file in ECL sourcecode.
Regards, Daniel
bruce li writes:
Hi, there, I'm pretty new to ECL. I'm currently considering embedding ECL in a game engine. When I interactively interrupt the program and drop into the repl, I load up swank with quicklisp and create swank server with (swank:create-server :port 4005). I can connect to it from SLIME. But any error in the statement, either by deliberately typing sth wrong, will cause swank server to close instead of dropping into the debugging environment. I have no idea why this happens. It turns out that if I start swank on a different thread with mp:process-run-function, it goes well. But since the game engine is based on OpenGL, multithreading rendering isn't an option. I wonder if there is any way to get around the swank server and enable its debugger when it encounters error.
Thanks, Bruce
-- Daniel Kochmański | Poznań, Poland ;; aka jackdaniel
"Be the change that you wish to see in the world." - Mahatma Gandhi