4 |
|
* Derived from Bruno Haible's work on his SIGSEGV library for clisp |
5 |
|
* <http://clisp.sourceforge.net/> |
6 |
|
* |
7 |
< |
* Basilisk II (C) 1997-2001 Christian Bauer |
7 |
> |
* Basilisk II (C) 1997-2005 Christian Bauer |
8 |
|
* |
9 |
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
* it under the terms of the GNU General Public License as published by |
27 |
|
// Address type |
28 |
|
typedef char * sigsegv_address_t; |
29 |
|
|
30 |
+ |
// SIGSEGV handler return state |
31 |
+ |
enum sigsegv_return_t { |
32 |
+ |
SIGSEGV_RETURN_SUCCESS, |
33 |
+ |
SIGSEGV_RETURN_FAILURE, |
34 |
+ |
SIGSEGV_RETURN_SKIP_INSTRUCTION, |
35 |
+ |
}; |
36 |
+ |
|
37 |
|
// Type of a SIGSEGV handler. Returns boolean expressing successful operation |
38 |
< |
typedef bool (*sigsegv_handler_t)(sigsegv_address_t fault_address, sigsegv_address_t instruction_address); |
38 |
> |
typedef sigsegv_return_t (*sigsegv_fault_handler_t)(sigsegv_address_t fault_address, sigsegv_address_t instruction_address); |
39 |
> |
|
40 |
> |
// Type of a SIGSEGV state dump function |
41 |
> |
typedef void (*sigsegv_state_dumper_t)(sigsegv_address_t fault_address, sigsegv_address_t instruction_address); |
42 |
|
|
43 |
|
// Install a SIGSEGV handler. Returns boolean expressing success |
44 |
< |
extern bool sigsegv_install_handler(sigsegv_handler_t handler); |
44 |
> |
extern bool sigsegv_install_handler(sigsegv_fault_handler_t handler); |
45 |
|
|
46 |
|
// Remove the user SIGSEGV handler, revert to default behavior |
47 |
|
extern void sigsegv_uninstall_handler(void); |
48 |
|
|
49 |
+ |
// Set callback function when we cannot handle the fault |
50 |
+ |
extern void sigsegv_set_dump_state(sigsegv_state_dumper_t handler); |
51 |
+ |
|
52 |
|
// Define an address that is bound to be invalid for a program counter |
53 |
|
const sigsegv_address_t SIGSEGV_INVALID_PC = (sigsegv_address_t)(-1); |
54 |
|
|