OpenRadioss
2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
traceback_handler.c
Go to the documentation of this file.
1
//Copyright> OpenRadioss
2
//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3
//Copyright>
4
//Copyright> This program is free software: you can redistribute it and/or modify
5
//Copyright> it under the terms of the GNU Affero General Public License as published by
6
//Copyright> the Free Software Foundation, either version 3 of the License, or
7
//Copyright> (at your option) any later version.
8
//Copyright>
9
//Copyright> This program is distributed in the hope that it will be useful,
10
//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11
//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
//Copyright> GNU Affero General Public License for more details.
13
//Copyright>
14
//Copyright> You should have received a copy of the GNU Affero General Public License
15
//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16
//Copyright>
17
//Copyright>
18
//Copyright> Commercial Alternative: Altair Radioss Software
19
//Copyright>
20
//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21
//Copyright> software under a commercial license. Contact Altair to discuss further if the
22
//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23
/*=================================================================*/
24
/* TRACE BACK */
25
/*=================================================================*/
26
#include <stdio.h>
27
#include <string.h>
28
#include <stdlib.h>
29
#include <signal.h>
30
31
#define _FCALL
32
33
#ifdef _WIN64
34
#define trace_cf TRACE_CF
35
#else
36
#define trace_cf trace_cf_
37
#endif
38
39
40
41
/* protos */
42
void
setignorecore
(
int
*on);
43
void
ignoreCore
(
int
s);
44
void
trace_cf
(
int
*s,
int
*iw);
45
void
ARRET
(
int
*
n
);
46
void
arret_
(
int
*
n
);
47
void
arret_c
(
int
n
) ;
48
49
#ifdef _WIN64
50
void
ignoreCore
(
int
s)
51
{
52
int
iw = 1, is;
53
if
(s == SIGFPE ) is=2;
54
else
if
(s == SIGSEGV) is=3;
55
56
trace_cf
(&is,&iw);
57
}
58
59
#elif 1
60
61
void
ignoreCore
(
int
s)
62
{
63
int
iw = 1, is;
64
if
(s == SIGBUS ) is=1;
65
else
if
(s == SIGFPE ) is=2;
66
else
if
(s == SIGSEGV) is=3;
67
68
trace_cf
(&is,&iw);
69
}
70
#endif
71
72
void
user_abrt
(
int
sig)
73
{
74
int
val=3;
75
printf(
"\n\nUser or system abort detected (CTRL-C) !\n\n"
);
76
arret_c
(val);
77
}
78
79
80
/************************/
81
/* get signals for core */
82
void
_FCALL
SETIGNORECORE
(
int
*on)
83
{
setignorecore
(on);}
84
void
setignorecore__
(
int
*on)
85
{
setignorecore
(on);}
86
void
setignorecore_
(
int
*on)
87
{
setignorecore
(on);}
88
89
void
setignorecore
(
int
*on)
90
{
91
if
(*on ) {
92
#ifdef SIGBUS
93
signal (SIGBUS,
ignoreCore
);
/* 7 bus error*/
94
#endif
95
#ifdef SIGFPE
96
signal (SIGFPE,
ignoreCore
);
/* 8 i/0 */
97
#endif
98
#ifdef SIGSEGV
99
signal (SIGSEGV,
ignoreCore
);
/* 11 segmentation violation*/
100
#endif
101
#ifdef SIGILL
102
signal (SIGILL,
ignoreCore
);
/* 4 illegal instruction*/
103
#endif
104
}
105
else
{
/* acknowledging core */
106
#ifdef SIGBUS
107
signal (SIGBUS, SIG_DFL);
/* 7 bus error*/
108
#endif
109
#ifdef SIGFPE
110
signal (SIGFPE, SIG_DFL);
/* 8 i/0 */
111
#endif
112
#ifdef SIGSEGV
113
signal (SIGSEGV, SIG_DFL);
/* 11 segmentation violation*/
114
#endif
115
#ifdef SIGILL
116
signal (SIGILL, SIG_DFL);
/* 4 illegal instruction*/
117
#endif
118
}
119
120
#ifdef SIGINT
121
signal (SIGINT,
user_abrt
);
122
#endif
123
124
#ifdef SIGABRT
125
signal (SIGABRT,
user_abrt
);
126
#endif
127
128
#ifdef SIGBREAK
129
signal (SIGBREAK,
user_abrt
);
130
#endif
131
132
#ifdef SIGTERM
133
signal (SIGTERM,
user_abrt
);
/* 15 Termination signal*/
134
#endif
135
}
arret_c
void arret_c(int n)
Definition
write_routtines.c:132
setignorecore
void setignorecore(int *on)
Definition
traceback_handler.c:90
ignoreCore
void ignoreCore(int s)
Definition
traceback_handler.c:60
setignorecore_
void setignorecore_(int *on)
Definition
traceback_handler.c:87
trace_cf
#define trace_cf
Definition
traceback_handler.c:39
user_abrt
void user_abrt(int sig)
Definition
traceback_handler.c:73
ARRET
void ARRET(int *n)
arret_
void arret_(int *n)
SETIGNORECORE
void _FCALL SETIGNORECORE(int *on)
Definition
traceback_handler.c:83
setignorecore__
void setignorecore__(int *on)
Definition
traceback_handler.c:85
_FCALL
#define _FCALL
Definition
memory_use_c.c:25
n
n
Definition
schur_example.m:9
ignoreCore
void ignoreCore(int s)
Definition
traceback_handler.c:61
user_abrt
void user_abrt(int sig)
Definition
traceback_handler.c:72
starter
source
system
traceback_handler.c
Generated by
1.15.0