1 ;;;; code for handling Win32 exceptions
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!UNIX")
15 ;;; An awful lot of this stuff is stubbed out for now. We basically
16 ;;; only handle inbound exceptions (the local equivalent to unblockable
17 ;;; signals), and we're only picking off the sigsegv and sigfpe traps.
19 ;;; This file is based on target-signal.lisp, but most of that went
20 ;;; away. Some of it might want to be put back or emulated.
23 ;;; SIGINT is handled like BREAK, except that ANSI BREAK ignores
24 ;;; *DEBUGGER-HOOK*, but we want SIGINT's BREAK to respect it, so that
25 ;;; SIGINT in --disable-debugger mode will cleanly terminate the system
26 ;;; (by respecting the *DEBUGGER-HOOK* established in that mode).
28 ;;; We'd like to have this work, but that would require some method of
29 ;;; delivering a "blockable signal". Windows doesn't really have the
30 ;;; concept, so we need to play with the threading functions to emulate
31 ;;; it (especially since the local equivalent of SIGINT comes in on a
32 ;;; separate thread). This is on the list for fixing later on, and will
33 ;;; be required before we implement threads (because of stop-for-gc).
35 ;;; This specific bit of functionality may well be implemented entirely
38 (defun sigint-%break (format-string &rest format-arguments)
40 (apply #'%break 'sigint format-string format-arguments)))
41 (sb!thread:interrupt-thread (sb!thread::foreground-thread) #'break-it)))
44 ;;; Actual exception handler. We hit something the runtime doesn't
45 ;;; want to or know how to deal with (that is, not a sigtrap or gc
46 ;;; wp violation), so it calls us here.
48 (defun sb!kernel:handle-win32-exception (context exception-record)
49 (error "An exception occured! Context ~A, exception-record ~A."
50 context exception-record))
55 ;;; Magically converted by the compiler into a break instruction.
56 ;;; SBCL/Win32 comment:
57 ;;; I don't know if we still need this or not. Better safe for now.
58 (defun receive-pending-interrupt ()
59 (receive-pending-interrupt))