How do I know where error is occured?
How do I know where error is occured?
Error messages don't always list the function where an error occured. How do I find this information?
Re: How do I know where error is occured?
What type of messages are you getting? If you're in a debugger, have you looked at the backtraces? Errors often occur long before the problem becomes evident... For example, something sets a value to nil, then another function tries using it as a number.
Re: How do I know where error is occured?
Yes, usually you are told of the inner most function, so you often get things like "Error: (+ X 5); X is not a number." You need a backtrace to find out the information I think you're after, and how you get it depends on the implementation you are using. In Slime, and error will come with a backtrace right in the debugger interaction buffer, just look at the enclosing frames. If you are at the command line, which I kind of assume you are, in SBCL, for instance, you would type BACKTRACE at the debugger prompt "0]"; in CLISP, you would type :bt (or one of the other backtrace commands) at the debugger prompt "Break 1 [n]>".
Re: How do I know where error is occured?
finding the error section is my hardest problem currently too
in LispWorks you can use the debugger and click at the stack calls ("Subfunction 17")
i also use a mix of (format T "i am here"), (break "description of break") and backtrace
in LispWorks you can use the debugger and click at the stack calls ("Subfunction 17")
i also use a mix of (format T "i am here"), (break "description of break") and backtrace
Re: How do I know where error is occured?
In Emacs with Slime in debugger you can press "v" with the cursor on the specific frame in the backtrace and the form will get highlighted. Well, some form will get highlighted, getting precise location require compiling with high debug setting. There is a shortcut in Slime to recompile a form with maximum debug, by default C-u C-c C-c . All this works at least in SBCL.hewih wrote:finding the error section is my hardest problem currently too
-
- Posts: 26
- Joined: Thu Feb 04, 2010 5:56 pm
Re: How do I know where error is occured?
So far I've found the output from Slime-CLisp's debugger (with default settings) pretty much useless. I've gathered a few links that I can read on the topic, but so far I guess I just haven't had my fill of punishment; I've found all my bugs by building test-cases and putting them in the REPL (or coming here if I get really stumped). And yes, the implication that I don't actually program in the REPL is correct; I haven't read enough on that either.
Linkies:
http://clisp.cons.org/impnotes/debugger.html
http://lispforum.com/viewtopic.php?f=2&t=564
http://common-lisp.net/project/slime/do ... ugger.html
Linkies:
http://clisp.cons.org/impnotes/debugger.html
http://lispforum.com/viewtopic.php?f=2&t=564
http://common-lisp.net/project/slime/do ... ugger.html
I'm off my grokker.
- Chris
- Chris