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
#include <stdio.h>
24
#include <string.h>
25
#include <stdlib.h>
26
27
#include <signal.h>
28
29
#define _FCALL
30
31
void
ARRET
(
int
*
n
);
32
void
arret_
(
int
*
n
);
33
void
arret_c
(
int
n
);
34
35
36
#ifdef _WIN64
37
#define trace_cf TRACE_CF
38
#else
39
#define trace_cf trace_cf_
40
#endif
41
42
43
void
setignorecore
(
int
*on);
44
void
ignoreCore
(
int
s);
45
void
trace_cf
(
int
*s,
int
*iw);
46
47
#ifdef _WIN64
48
void
ignoreCore
(
int
s)
49
{
50
int
iw = 1, is;
51
if
(s == SIGFPE ) is=2;
52
else
if
(s == SIGSEGV) is=3;
53
54
trace_cf
(&is,&iw);
55
56
}
57
58
#else
59
60
void
ignoreCore
(
int
s)
61
{
62
int
iw = 1, is;
63
if
(s == SIGBUS ) is=1;
64
else
if
(s == SIGFPE ) is=2;
65
else
if
(s == SIGSEGV) is=3;
66
67
trace_cf
(&is,&iw);
68
/* setIgnoreCore (1);*/
69
}
70
71
#endif
72
73
void
user_abrt
(
int
sig)
74
{
75
int
val=6;
/* arret_c(6) initiates STOP with 3 as error code (system error) */
76
printf(
"\n\nUser or system abort detected (CTRL-C) !\n\n"
);
77
arret_c
(val);
78
}
79
80
81
/************************/
82
/* get signals for core */
83
void
_FCALL
SETIGNORECORE
(
int
*on)
84
{
setignorecore
(on);}
85
void
setignorecore__
(
int
*on)
86
{
setignorecore
(on);}
87
void
setignorecore_
(
int
*on)
88
{
setignorecore
(on);}
89
90
void
setignorecore
(
int
*on)
91
{
92
if
(*on) {
/*ignoring core */
93
#ifdef SIGBUS
94
signal (SIGBUS,
ignoreCore
);
/* 7 bus error*/
95
#endif
96
#ifdef SIGFPE
97
signal (SIGFPE,
ignoreCore
);
/* 8 i/0 */
98
#endif
99
#ifdef SIGSEGV
100
signal (SIGSEGV,
ignoreCore
);
/* 11 segmentation violation*/
101
#endif
102
}
103
else
{
/* acknowledging core */
104
#ifdef SIGBUS
105
signal (SIGBUS, SIG_DFL);
/* 7 bus error*/
106
#endif
107
#ifdef SIGFPE
108
signal (SIGFPE, SIG_DFL);
/* 8 i/0 */
109
#endif
110
#ifdef SIGSEGV
111
signal (SIGSEGV, SIG_DFL);
/* 11 segmentation violation*/
112
#endif
113
}
114
115
#ifdef SIGINT
116
signal (SIGINT,
user_abrt
);
/* 2 Interrupt from keyboard*/
117
#endif
118
119
#ifdef SIGABRT
120
signal (SIGABRT,
user_abrt
);
/* 6 Abnormal termination*/
121
#endif
122
123
#ifdef SIGBREAK
124
signal (SIGBREAK,
user_abrt
);
/* Ctrl-Break signal*/
125
#endif
126
127
#ifdef SIGTERM
128
signal (SIGTERM,
user_abrt
);
/* 15 Termination signal*/
129
#endif
130
}
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
engine
source
system
traceback_handler.c
Generated by
1.15.0