[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Invoking the debugger in a meaningful frame



How do I signal an error and end up in a meaningful frame
of the debugger, skipping internal condition stuff like :internal
functions and cli::compatible-restart-trampoline?
For example, (check-number -3)

(defun check-number (number)
  (if (minusp number)
      (conditions:restart-case
	(conditions:error "The number is negative")
	(this
	  ()
	  :report "Leave it")
	(that
	  ()
	  :report "Change sign"
	  (setf number (- number)))
	(abort
	  ()
	  :report "Abort"
	  (return-from check-number nil))))
  number)

gives (detailed backtrace):

Error: The number is negative
While in the function (:INTERNAL (:INTERNAL (:INTERNAL (:INTERNAL USER::CHECK-NUMBER 0) 0) 0) 0)  CLI::COMPATIBLE-RESTART-TRAMPOLINE  (:INTERNAL (:INTERNAL (:INTERNAL USER::CHECK-NUMBER 0) 0) 0)

The condition signalled was CONDITIONS:SIMPLE-ERROR

(:INTERNAL (:INTERNAL (:INTERNAL (:INTERNAL USER::CHECK-NUMBER 0) 0) 0) 0)  (P.C. = 34)  (from SPACE50:>Healy>pglt>core>junk)
   Arg 0 (COMPILER:.LEXICAL-ENVIRONMENT-POINTER.): #<LOCATIVE 135275450>
   Local 1: #<LOCATIVE 135275307>
   Local 2: #:TEMP4059
   Local 3: #<CONDITIONS:SIMPLE-ERROR 62004766>
   Lexical 0 (#:.INTERNAL-CATCH-FOR-BLOCK-3792.): #:TEMP4059
   Special CLI::*CONDITION-RESTARTS*: (#<CONDITIONS:SIMPLE-ERROR 62004766> (#<CONDITIONS:RESTART 62004744> #<CONDITIONS:RESTART 62004752> #<CONDITIONS:RESTART 62004760>))

CLI::COMPATIBLE-RESTART-TRAMPOLINE  (P.C. = 71)
   Arg 0 (FUNCTION): #<STACK-LEXICAL-CLOSURE (:INTERNAL # 0) 135275451>
   Arg 1 (CLI::RESTART): #<CONDITIONS:RESTART 62004744>

(:INTERNAL (:INTERNAL (:INTERNAL USER::CHECK-NUMBER 0) 0) 0)  (P.C. = 23)  (from SPACE50:>Healy>pglt>core>junk)
   Arg 0 (COMPILER:.LEXICAL-ENVIRONMENT-POINTER.): #<LOCATIVE 135275406>

CLI::COMPATIBLE-RESTART-TRAMPOLINE  (P.C. = 71)
   Arg 0 (FUNCTION): #<STACK-LEXICAL-CLOSURE (:INTERNAL # 0) 135275407>
   Arg 1 (CLI::RESTART): #<CONDITIONS:RESTART 62004752>

(:INTERNAL (:INTERNAL USER::CHECK-NUMBER 0) 0)  (P.C. = 22)  (from SPACE50:>Healy>pglt>core>junk)
   Arg 0 (COMPILER:.LEXICAL-ENVIRONMENT-POINTER.): #<LOCATIVE 135275344>

CLI::COMPATIBLE-RESTART-TRAMPOLINE  (P.C. = 71)
   Arg 0 (FUNCTION): #<STACK-LEXICAL-CLOSURE (:INTERNAL # 0) 135275345>
   Arg 1 (CLI::RESTART): #<CONDITIONS:RESTART 62004760>

(:INTERNAL USER::CHECK-NUMBER 0)  (P.C. = 21)  (from SPACE50:>Healy>pglt>core>junk)
   Arg 0 (COMPILER:.LEXICAL-ENVIRONMENT-POINTER.): #<LOCATIVE 135275276>

CLI::RESTART-BIND-TRAMPOLINE  (P.C. = 11)
   Arg 0 (FUNCTION): #<STACK-LEXICAL-CLOSURE (:INTERNAL USER::CHECK-NUMBER 0) 135275277>
   Rest arg (CLI::RESTARTS): (#<CONDITIONS:RESTART 62004744> #<CONDITIONS:RESTART 62004752> #<CONDITIONS:RESTART 62004760>)

USER::CHECK-NUMBER  (P.C. = 70)  (from SPACE50:>Healy>pglt>core>junk)
   Arg 0 (NUMBER): -3

etc.


whereas I want the debugger to put me just in the last frame, user::check-number
(or maybe even the next one).  Is there an easy way to do this?

Thanks.

Liam Healy