(defun abc (n)
(- 1 n)
(/ 1 n)
)
启动sbcl之后,切换到这个文件的buffer
C-c C-k
然后,到repl,运行(abc 0)
出错,然后,在sldb里面移动到(abc 0),按v键,可以看到光标在出错的行上面。
但是,同样的操作,allegro只把光标显示在了(defun abc上面。
这样,如果是个比较长的程序,用sbcl的话,可以马上知道哪行出错了。allegro怎么办到呢?
2012/2/23 Jeova Sanctus Unus <jeova.san...@gmail.com>:
> --
> Lisp-cn(Lisp中文用户组)
> CLUG http://lisp.org.cn
--
黄 澗石 (Jianshi Huang)
http://huangjs.net/
Restarts:
0: [ABORT] Return to sldb level 1.
1: [RETRY] Retry SLIME REPL evaluation request.
2: [*ABORT] Return to SLIME's top level.
3: [ABORT] Abort entirely from this (lisp) process.
Backtrace:
0: (ERROR TYPE-ERROR :DATUM (82) :EXPECTED-TYPE NUMBER ...)
1: ((:INTERNAL SWANK-BACKEND::BUFFER-OR-FILE-LOCATION 0) "/tmp/a.lisp")
--more--
对这个`(82)' is not of the expected type `NUMBER' 不明白。。
在 2012年2月24日 上午12:19,Xiaofeng Yang <n.akr....@gmail.com> 写道:
貌似这么用,在repl里:
(sb-ext:restrict-compiler-policy 'debug 3)
这样好像是强制debug的最小值为三
(proclaim '(optimize ...))
在所有 CL 里都可以
2012/2/24 bruce li <leil...@gmail.com>:
> 弱弱的问一句,如何让sbcl默认以debug 3的方式启动?貌似要能够直接定位到代码,要在 .lisp文件头部加入(declaim
> ...)才可以,在repl里面直接出入这句话不起作用。。 但感觉每个文件头部加个这个还是很麻烦呢。。
>
> 在 2012年2月24日 上午10:34,刘滔 <mat.l...@gmail.com>写道:
>
>> 受教了,才知道原来按v键可以调用这种功能啊,调试居然这么方便......
--
With (positive) prefix argument the form is compiled with
maximal debug settings (C-u C-c C-c). With negative prefix argument it
is compiled for speed (M-- C-c C-c).
The code for the region is executed after compilation. In
principle, the command writes the region to a file, compiles that
file, and loads the resulting code.
看中间那行,可以使用prefix argument改变默认的编译策略。同理也可以应用在C-c M-k上。
On Feb 24, 11:40 am, bruce li <leilmy...@gmail.com> wrote:
> 弱弱的问一句,如何让sbcl默认以debug 3的方式启动?貌似要能够直接定位到代码,要在 .lisp文件头部加入(declaim
> ...)才可以,在repl里面直接出入这句话不起作用。。 但感觉每个文件头部加个这个还是很麻烦呢。。
>
> 在 2012年2月24日 上午10:34,刘滔 <mat.liu...@gmail.com>写道:
>
>
>
>
>
>
>
> > 受教了,才知道原来按v键可以调用这种功能啊,调试居然这么方便......
>
> > 在 2012年2月24日 上午12:25,Xiaofeng Yang <n.akr.aki...@gmail.com>写道:
>
> > 写错了,是(/ 1 n)
>
> >> Best regards,
> >> Xiaofeng Yang
>
> >> 在 2012年2月24日 上午12:19,Xiaofeng Yang <n.akr.aki...@gmail.com>写道:
>
> >> 我试了,在ACL IDE里面。
> >>> 8.1 -> 只能到(defun abc ...
> >>> 8.2 -> 能到出错的那一句(/ n 0)
>
> >>> 8.2在调试方面做了增强,看起来还是有变化的。
>
> >>> Best regards,
> >>> Xiaofeng Yang
>
> >>> 在 2012年2月23日 下午9:10,Jeova Sanctus Unus <jeova.sanctus.u...@gmail.com>写道:
>
> >>> 代码如下
> >>>> (declaim (optimize (debug 3)))
> >>>> (in-package :cl-user)
>
> >>>> (defun abc (n)
> >>>> (- 1 n)
> >>>> (/ 1 n)
> >>>> )
>
> >>>> 启动sbcl之后,切换到这个文件的buffer
> >>>> C-c C-k
> >>>> 然后,到repl,运行(abc 0)
> >>>> 出错,然后,在sldb里面移动到(abc 0),按v键,可以看到光标在出错的行上面。
> >>>> 但是,同样的操作,allegro只把光标显示在了(defun abc上面。
> >>>> 这样,如果是个比较长的程序,用sbcl的话,可以马上知道哪行出错了。allegro怎么办到呢?
>
> >>>> --
> >>>> Lisp-cn(Lisp中文用户组)
> >>>> CLUGhttp://lisp.org.cn
>
> >> --
> >> Lisp-cn(Lisp中文用户组)
> >> CLUGhttp://lisp.org.cn
>
> > --
> > Liutos Love Linux LaTeX Lisp Ling
>
> > 我的博客,纪念我死去的GAE <http://blog.sina.com.cn/u/2031941547>
>
> > --
> > Lisp-cn(Lisp中文用户组)
> > CLUGhttp://lisp.org.cn