Opened 8 years ago

Closed 8 years ago

#841 closed enhancement (invalid)

Better error stack traces

Reported by: mcandre Owned by:
Priority: normal Milestone:
Component: Compiler Version: trunk
Keywords: error stack trace Cc:

Description

Somewhere in my code is a bug, but it's hard to track down.

? (gen-game)
> Error: value . is not of the expected type LIST.
> While executing: (:INTERNAL (PRINT-OBJECT (CL-ROGUE:LEVEL T))), in process listener(1).

Only by trial and error can I find out which function call is to blame.

Please list the calling functions in an error trace, not just "process listener".

Change History (3)

comment:1 Changed 8 years ago by gb

  • Resolution set to invalid
  • Status changed from new to closed

Typing :B at a break loop prompt prints a backtrace.

Typing :? at a break loop prompt lists that and other options, as the text in the break message says.

? (defun foo (x) (1+ x))
FOO
? (foo 'a)
> Error: value A is not of the expected type NUMBER.
> While executing: +-2, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > :?
The following toplevel commands are available:
 <n>    the same as (:C <n>)
 (:FUNCTION FRAME-NUMBER)  Returns the function invoked in backtrace frame <frame-number>.  This may be useful for, e.g., disassembly
 (:FORM FRAME-NUMBER)  Return a form which looks like the call which established the stack frame identified by <frame-number>.  This is only well-defined in certain cases: when the function is globally named and not a lexical closure and when it was compiled with *SAVE-LOCAL-SYMBOLS* in effect.
 (:SET-LOCAL NAME FRAME-NUMBER NEW)  Set value of argument denoted <name> (see :LOCAL) in frame <frame-number> to value <new>.
 (:LOCAL NAME FRAME-NUMBER)  Return value of local denoted by <name> in frame <frame-number> <name> can either be a symbol - in which case the most recent
binding of that symbol is used - or an integer index into the frame's set of local bindings.
 (:SET-ARG NAME FRAME-NUMBER NEW)  Set value of argument named <name> in frame <frame-number> to value <new>.
 (:ARG NAME FRAME-NUMBER)  Return value of argument named <name> in frame <frame-number>
 (:V N FRAME-NUMBER)  Return value <n> in frame <frame-number>
 (:RAW N)  Show raw contents of backtrace frame <n>
 (:APPLY-IN-FRAME I FUNCTION &REST ARGS)  Applies FUNCTION to ARGS in the execution context of the Ith stack frame
 (:RETURN-FROM-FRAME I &REST VALUES)  Return VALUES from the I'th stack frame
 (:F N)  Show backtrace frame <n>
 (:C &OPTIONAL N)  Choose restart <n>. If no <n>, continue
 (:B &KEY START COUNT SHOW-FRAME-CONTENTS)  backtrace
 :NFRAMES   print the number of stack frames accessible from this break loop
 :R     list restarts
 :Q     return to toplevel
 :GO    continue
 :A     exit current break loop
 :POP   exit current break loop
 :?     help
 :PWD   Print the pathame of the current directory
 (:CD DIR)  Change to directory DIR
 (:PROC &OPTIONAL P)  Show information about specified process <p>/all processes
 (:KILL P)  Kill process whose name or ID matches <p>
 (:Y &OPTIONAL P)  Yield control of terminal-input to process
whose name or ID matches <p>, or to any process if <p> is null
Any other form is evaluated and its results are printed out.
1 > :b
 (619D54) : 0 (+-2 1 A) 663
 (619D6C) : 1 (FOO A) 55
 (619D78) : 2 (CALL-CHECK-REGS FOO A) 247
 (619D94) : 3 (TOPLEVEL-EVAL (FOO 'A) NIL) 743
 (619DD8) : 4 (READ-LOOP :INPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #xC28D306> :OUTPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #xC28D22E> :BREAK-LEVEL 0 :PROMPT-FUNCTION #<Compiled-function (:INTERNAL READ-LOOP) (Non-Global)  #x4746F66>) 2055
 (619EFC) : 5 (TOPLEVEL-LOOP) 71
 (619F04) : 6 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION (LISP-DEVELOPMENT-SYSTEM T)))>) 95
 (619F14) : 7 (FUNCALL #'#<(:INTERNAL MAKE-MCL-LISTENER-PROCESS)>) 671
 (619F60) : 8 (RUN-PROCESS-INITIAL-FORM #<TTY-LISTENER listener(1) [Active] #xC28C84E> (#<COMPILED-LEXICAL-CLOSURE # #xC28C58E>)) 671
 (619FA4) : 9 (FUNCALL #'#<(:INTERNAL (%PROCESS-PRESET-INTERNAL (PROCESS)))> #<TTY-LISTENER listener(1) [Active] #xC28C84E> (#<COMPILED-LEXICAL-CLOSURE # #xC28C58E>)) 335
 (619FCC) : 10 (FUNCALL #'#<(:INTERNAL THREAD-MAKE-STARTUP-FUNCTION)>) 279

comment:2 Changed 8 years ago by mcandre

  • Resolution invalid deleted
  • Status changed from closed to reopened

It would be helpful to list :b as an option along with :pop and :r.

comment:3 Changed 8 years ago by gb

  • Resolution set to invalid
  • Status changed from reopened to closed
 (:B &KEY START COUNT SHOW-FRAME-CONTENTS)  backtrace
Note: See TracTickets for help on using tickets.