Go to the source code of this file.
◆ _GNU_SOURCE
◆ CALL_GDB
◆ INTERACTIVE
◆ STACK_TRACE
◆ si_hdl_typ
typedef void(* si_hdl_typ) (int) |
◆ debug()
static void debug |
( |
int |
method | ) |
|
|
static |
Definition at line 363 of file cntrlc.cc.
383 char * args[4] = { (
char*)
"gdb", (
char*)
"Singular",
NULL,
NULL };
389 sprintf (
buf,
"%d", getpid ());
399 fputs (
"\n\nquit with \"p si_stop_stack_trace_x=0\"\n\n\n",stderr);
403 fputs (
"stack_trace\n",stderr);
413 perror (
"could not fork");
static void stack_trace(char *const *args)
VAR volatile int si_stop_stack_trace_x
static void debug_stop(char *const *args)
static void * feOptValue(feOptIndex opt)
VAR BOOLEAN fe_is_raw_tty
int dReportError(const char *fmt,...)
int status int void * buf
◆ debug_stop()
static void debug_stop |
( |
char *const * |
args | ) |
|
|
static |
Definition at line 421 of file cntrlc.cc.
423 execvp (args[0], args);
424 perror (
"exec failed");
◆ init_signals()
init signal handlers and error handling for libraries: NTL, factory
Definition at line 527 of file cntrlc.cc.
si_hdl_typ si_set_signal(int sig, si_hdl_typ signal_handler)
meta function for binding a signal to an handler
void sigsegv_handler(int sig)
void sig_chld_hdl(int)
additional default signal handler
◆ si_set_signal()
meta function for binding a signal to an handler
- Parameters
-
[in] | sig | Signal number |
[in] | signal_handler | Pointer to signal handler |
- Returns
- value of signal()
Definition at line 118 of file cntrlc.cc.
122 if (retval == SIG_ERR)
124 fprintf(stderr,
"Unable to init signal %d ... exiting...\n", sig);
131 struct sigaction new_action,old_action;
132 memset(&new_action, 0,
sizeof(
struct sigaction));
135 new_action.sa_handler = signal_handler;
137 sigemptyset (&new_action.sa_mask);
139 new_action.sa_flags = SA_RESTART;
141 int r=si_sigaction (sig, &new_action, &old_action);
145 fprintf(stderr,
"Unable to init signal %d ... exiting...\n", sig);
#define si_siginterrupt(arg1, arg2)
◆ sig_pipe_hdl()
void sig_pipe_hdl |
( |
int |
| ) |
|
Definition at line 64 of file cntrlc.cc.
void WerrorS(const char *s)
BOOLEAN slClose(si_link l)
◆ sig_term_hdl()
void sig_term_hdl |
( |
int |
| ) |
|
Definition at line 77 of file cntrlc.cc.
VAR volatile BOOLEAN do_shutdown
VAR volatile int defer_shutdown
◆ sigint_handler()
void sigint_handler |
( |
int |
| ) |
|
Definition at line 266 of file cntrlc.cc.
272 char default_opt=
' ';
274 && ((
char*)(
feOptSpec[FE_OPT_CNTRLC].value))[0])
275 { default_opt=((
char*)(
feOptSpec[FE_OPT_CNTRLC].value))[0]; }
285 else if (default_opt!=
' ')
291 fprintf(stderr,
"// ** Interrupt at cmd:`%s` in line:'%s'\n",
295 fputs(
"abort after this command(a), abort immediately(r), print backtrace(b), continue(c) or quit Singular(q) ?",stderr);
296 fflush(stderr);fflush(stdin);
313 fputs(
"** Warning: Singular should be restarted as soon as possible **\n",stderr);
322 fputs(
"** tried too often, try another possibility **\n",stderr);
335 while (c != EOF && c !=
'\n') c = fgetc(stdin);
VAR jmp_buf si_start_jmpbuf
VAR BOOLEAN singular_in_batchmode
VAR int sigint_handler_cnt
EXTERN_VAR struct fe_option feOptSpec[]
VAR char my_yylinebuf[80]
Voice * feInitStdin(Voice *pp)
const char * Tok2Cmdname(int tok)
◆ sigsegv_handler()
void sigsegv_handler |
( |
int |
sig | ) |
|
Definition at line 234 of file cntrlc.cc.
236 fprintf(stderr,
"Singular : signal %d (v: %d):\n",
241 fprintf(stderr,
"Segment fault/Bus error occurred (r:%d)\n"
242 "please inform the authors\n",
249 fputs(
"trying to restart...\n",stderr);
void init_signals()
init signal handlers and error handling for libraries: NTL, factory
◆ stack_trace()
static void stack_trace |
( |
char *const * |
args | ) |
|
|
static |
Definition at line 429 of file cntrlc.cc.
437 int sel,
index, state;
441 if ((pipe (in_fd) == -1) || (pipe (out_fd) == -1))
443 perror (
"could open pipe");
450 si_close (0); si_dup2 (in_fd[0],0);
451 si_close (1); si_dup2 (out_fd[1],1);
452 si_close (2); si_dup2 (out_fd[1],2);
454 execvp (args[0], args);
455 perror (
"exec failed");
460 perror (
"could not fork");
465 FD_SET (out_fd[0], &fdset);
467 si_write (in_fd[1],
"backtrace\n", 10);
468 si_write (in_fd[1],
"p si_stop_stack_trace_x = 0\n", 28);
469 si_write (in_fd[1],
"quit\n", 5);
480 sel = si_select (FD_SETSIZE, &readset,
NULL,
NULL, &tv);
484 if ((sel > 0) && (FD_ISSET (out_fd[0], &readset)))
486 if (si_read (out_fd[0], &c, 1))
500 if ((c ==
'\n') || (c ==
'\r'))
503 fputs (buffer,stderr);
519 si_close (out_fd[0]);
520 si_close (out_fd[1]);
static int index(p_Length length, p_Ord ord)
◆ defer_shutdown
VAR volatile int defer_shutdown = 0 |
◆ do_shutdown
◆ pipeLastLink
◆ si_restart
◆ si_start_jmpbuf
VAR jmp_buf si_start_jmpbuf |
◆ si_stop_stack_trace_x
VAR volatile int si_stop_stack_trace_x |
◆ sigint_handler_cnt
VAR int sigint_handler_cnt =0 |
◆ singular_in_batchmode
◆ siRandomStart