2 * Copyright (c) 2004,2005 Voltaire Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 #endif /* HAVE_CONFIG_H */
47 #include <sys/types.h>
50 #include <sys/ioctl.h>
62 static int loop_on_panic;
67 if (!__builtin_frame_address(1))
69 syslog(LOG_ALERT, "#1 %p\n", __builtin_return_address(1));
71 if (!__builtin_frame_address(2))
73 syslog(LOG_ALERT, "#2 %p\n", __builtin_return_address(2));
75 if (!__builtin_frame_address(3))
77 syslog(LOG_ALERT, "#3 %p\n", __builtin_return_address(3));
79 if (!__builtin_frame_address(4))
81 syslog(LOG_ALERT, "#4 %p\n", __builtin_return_address(4));
83 if (!__builtin_frame_address(5))
85 syslog(LOG_ALERT, "#5 %p\n", __builtin_return_address(5));
87 if (!__builtin_frame_address(6))
89 syslog(LOG_ALERT, "#6 %p\n", __builtin_return_address(6));
91 if (!__builtin_frame_address(7))
93 syslog(LOG_ALERT, "#7 %p\n", __builtin_return_address(7));
95 if (!__builtin_frame_address(8))
97 syslog(LOG_ALERT, "#8 %p\n", __builtin_return_address(8));
99 if (!__builtin_frame_address(9))
101 syslog(LOG_ALERT, "#9 %p\n", __builtin_return_address(9));
103 if (!__builtin_frame_address(10))
105 syslog(LOG_ALERT, "#10 %p\n", __builtin_return_address(10));
107 if (!__builtin_frame_address(11))
109 syslog(LOG_ALERT, "#11 %p\n", __builtin_return_address(11));
111 if (!__builtin_frame_address(12))
113 syslog(LOG_ALERT, "#12 %p\n", __builtin_return_address(12));
115 if (!__builtin_frame_address(13))
117 syslog(LOG_ALERT, "#13 %p\n", __builtin_return_address(13));
119 if (!__builtin_frame_address(14))
121 syslog(LOG_ALERT, "#14 %p\n", __builtin_return_address(14));
123 if (!__builtin_frame_address(15))
125 syslog(LOG_ALERT, "#15 %p\n", __builtin_return_address(15));
127 if (!__builtin_frame_address(16))
129 syslog(LOG_ALERT, "#16 %p\n", __builtin_return_address(16));
131 if (!__builtin_frame_address(17))
133 syslog(LOG_ALERT, "#17 %p\n", __builtin_return_address(17));
135 if (!__builtin_frame_address(18))
137 syslog(LOG_ALERT, "#18 %p\n", __builtin_return_address(18));
149 syslog(LOG_ALERT, "*** exception handler: died with signal %d", x);
155 fprintf(stderr, "%s *** exception handler: died with signal %d pid %d\n",
156 ctime(&tm), x, getpid());
162 fprintf(stderr, "exception handler: entering tight loop ... pid %d\n",getpid());
171 enable_stack_dump(int loop)
173 loop_on_panic = loop;
174 signal(SIGILL, handler);
175 signal(SIGBUS, handler);
176 signal(SIGSEGV, handler);
177 signal(SIGABRT, handler);