;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: HUNCHENTOOT; Base: 10 -*- ;;; $Header: /usr/local/cvsrep/hunchentoot/port-cmu.lisp,v 1.12 2008/04/08 14:39:18 edi Exp $ ;;; Copyright (c) 2004-2008, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions ;;; are met: ;;; * Redistributions of source code must retain the above copyright ;;; notice, this list of conditions and the following disclaimer. ;;; * Redistributions in binary form must reproduce the above ;;; copyright notice, this list of conditions and the following ;;; disclaimer in the documentation and/or other materials ;;; provided with the distribution. ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (in-package :hunchentoot) #+cmu (defun get-backtrace (error) "This is the function that is used internally by Hunchentoot to show or log backtraces. It accepts a condition object ERROR and returns a string with the corresponding backtrace." (declare (ignore error)) (with-output-to-string (s) (let ((debug:*debug-print-level* nil) (debug:*debug-print-length* nil)) (debug:backtrace most-positive-fixnum s)))) #+allegro (defun get-backtrace (error) "This is the function that is used internally by Hunchentoot to show or log backtraces. It accepts a condition object ERROR and returns a string with the corresponding backtrace." (with-output-to-string (s) (with-standard-io-syntax (let ((*print-readably* nil) (*print-miser-width* 40) (*print-pretty* t) (tpl:*zoom-print-circle* t) (tpl:*zoom-print-level* nil) (tpl:*zoom-print-length* nil)) (ignore-errors (format *terminal-io* "~ ~@~%~%" error)) (ignore-errors (let ((*terminal-io* s) (*standard-output* s)) (tpl:do-command "zoom" :from-read-eval-print-loop nil :count t :all t))))))) #+openmcl (defun get-backtrace (error) "This is the function that is used internally by Hunchentoot to show or log backtraces. It accepts a condition object ERROR and returns a string with the corresponding backtrace." (with-output-to-string (s) (let ((*debug-io* s)) (format *terminal-io* "~ ~@~%~%" error) (ccl:print-call-history :detailed-p nil)))) #+clisp (defun get-backtrace (error) "This is the function that is used internally by Hunchentoot to show or log backtraces." (declare (ignore error)) (with-output-to-string (stream) (system::print-backtrace :out stream))) #+lispworks (defun get-backtrace (error) "This is the function that is used internally by Hunchentoot to show or log backtraces. It accepts a condition object ERROR and returns a string with the corresponding backtrace." (declare (ignore error)) (with-output-to-string (s) (let ((dbg::*debugger-stack* (dbg::grab-stack nil :how-many most-positive-fixnum)) (*debug-io* s) (dbg:*debug-print-level* nil) (dbg:*debug-print-length* nil)) (dbg:bug-backtrace nil)))) ;; determine how we're going to access the backtrace in the next ;; function #+sbcl (eval-when (:compile-toplevel :load-toplevel :execute) (when (find-symbol "*DEBUG-PRINT-VARIABLE-ALIST*" :sb-debug) (pushnew :hunchentoot-sbcl-debug-print-variable-alist *features*))) #+sbcl (defun get-backtrace (error) "This is the function that is used internally by Hunchentoot to show or log backtraces. It accepts a condition object ERROR and returns a string with the corresponding backtrace." (declare (ignore error)) (with-output-to-string (s) #+:hunchentoot-sbcl-debug-print-variable-alist (let ((sb-debug:*debug-print-variable-alist* (list* '(*print-level* . nil) '(*print-length* . nil) sb-debug:*debug-print-variable-alist*))) (sb-debug:backtrace most-positive-fixnum s)) #-:hunchentoot-sbcl-debug-print-variable-alist (let ((sb-debug:*debug-print-level* nil) (sb-debug:*debug-print-length* nil)) (sb-debug:backtrace most-positive-fixnum s))))