Go to the source code of this file.
◆ _GNU_SOURCE
◆ CALL_GDB
◆ INTERACTIVE
◆ STACK_TRACE
◆ si_hdl_typ
◆ debug()
Definition at line 363 of file cntrlc.cc.
364{
366 {
368 return;
369 }
370
371
372
373
374
375
376
377
378
379
380
381 int pid;
383 char * args[4] = { (
char*)
"gdb", (
char*)
"Singular",
NULL,
NULL };
384
385 #ifdef HAVE_FEREAD
387 #endif
388
390
392
394 if (pid == 0)
395 {
397 {
399 fputs (
"\n\nquit with \"p si_stop_stack_trace_x=0\"\n\n\n",
stderr);
401 break;
405 break;
406 default:
407
409 }
410 }
411 else if (pid == -1)
412 {
413 perror (
"could not fork");
414 return;
415 }
416
419}
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()
◆ init_signals()
init signal handlers and error handling for libraries: NTL, factory
Definition at line 527 of file cntrlc.cc.
528{
529
530 #ifdef SIGSEGV
532 #endif
533 #ifdef SIGBUS
535 #endif
536 #ifdef SIGFPE
538 #endif
539 #ifdef SIGILL
541 #endif
542 #ifdef SIGIOT
544 #endif
549}
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_reset_signals()
void si_reset_signals |
( |
| ) |
|
Definition at line 564 of file cntrlc.cc.
565{
566
567
569
570
571}
VAR si_hdl_typ si_sig_chld_hdl
◆ 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.
119{
120#if 0
123 {
124 fprintf(
stderr,
"Unable to init signal %d ... exiting...\n", sig);
125 }
127
128
129
130#else
133
134
138 else
140
143 if (r == -1)
144 {
145 fprintf(
stderr,
"Unable to init signal %d ... exiting...\n", sig);
147 }
148#endif
150}
#define si_siginterrupt(arg1, arg2)
◆ si_set_signals()
◆ sig_pipe_hdl()
Definition at line 64 of file cntrlc.cc.
65{
67 {
71 }
72}
void WerrorS(const char *s)
BOOLEAN slClose(si_link l)
◆ sig_term_hdl()
Definition at line 77 of file cntrlc.cc.
78{
81 {
83 }
84}
VAR volatile BOOLEAN do_shutdown
VAR volatile int defer_shutdown
◆ sigint_handler()
Definition at line 266 of file cntrlc.cc.
267{
269 #ifdef HAVE_FEREAD
271 #endif
277 {
278 int cnt=0;
279 int c;
280
282 {
283 c = 'q';
284 }
286 {
288 }
289 else
290 {
294 {
295 fputs(
"abort after this command(a), abort immediately(r), print backtrace(b), continue(c) or quit Singular(q) ?",
stderr);
298 }
299 else
300 {
301 c = 'a';
302 }
303 }
304
305 switch(c)
306 {
309 case 'r':
311 {
313 fputs(
"** Warning: Singular should be restarted as soon as possible **\n",
stderr);
319 }
320 else
321 {
322 fputs(
"** tried too often, try another possibility **\n",
stderr);
324 }
325 break;
326 case 'b':
328 break;
329 case 'a':
331 case 'c':
333 {
334
336 }
338 return;
339
340
341
342 }
343 cnt++;
345 }
346}
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()
Definition at line 234 of file cntrlc.cc.
235{
239 {
242 "please inform the authors\n",
244 }
245 #ifdef __OPTIMIZE__
247 {
252 }
253 #endif
254 #ifdef CALL_GDB
256 #endif
258}
void init_signals()
init signal handlers and error handling for libraries: NTL, factory
◆ stack_trace()
Definition at line 429 of file cntrlc.cc.
430{
431 int pid;
438 char buffer[256];
439 char c;
440
442 {
443 perror (
"could open pipe");
445 }
446
448 if (pid == 0)
449 {
453
457 }
458 else if (pid == -1)
459 {
460 perror (
"could not fork");
462 }
463
466
470
472 state = 0;
473
475 {
479
482 break;
483
485 {
487 {
488 switch (state)
489 {
490 case 0:
491 if (c == '#')
492 {
493 state = 1;
496 }
497 break;
498 case 1:
500 if ((c == '\n') || (c == '\r'))
501 {
504 state = 0;
506 }
507 break;
508 default:
509 break;
510 }
511 }
512 }
514 break;
515 }
516
522}
static int index(p_Length length, p_Ord ord)
◆ defer_shutdown
◆ do_shutdown
◆ pipeLastLink
◆ si_restart
◆ si_sig_chld_hdl
◆ si_start_jmpbuf
◆ si_stop_stack_trace_x
◆ sigint_handler_cnt
◆ singular_in_batchmode
◆ siRandomStart