Go to the source code of this file.
◆ _GNU_SOURCE
◆ CALL_GDB
◆ INTERACTIVE
◆ STACK_TRACE
◆ debug()
Definition at line 366 of file cntrlc.cc.
367{
369 {
371 return;
372 }
373
374
375
376
377
378
379
380
381
382
383
384 int pid;
386 char * args[4] = { (
char*)
"gdb", (
char*)
"Singular",
NULL,
NULL };
387
388 #ifdef HAVE_FEREAD
390 #endif
391
393
395
397 if (pid == 0)
398 {
400 {
402 fputs (
"\n\nquit with \"p si_stop_stack_trace_x=0\"\n\n\n",
stderr);
404 break;
408 break;
409 default:
410
412 }
413 }
414 else if (pid == -1)
415 {
416 perror (
"could not fork");
417 return;
418 }
419
422}
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 530 of file cntrlc.cc.
531{
532
533 #ifdef SIGSEGV
535 #endif
536 #ifdef SIGBUS
538 #endif
539 #ifdef SIGFPE
541 #endif
542 #ifdef SIGILL
544 #endif
545 #ifdef SIGIOT
547 #endif
552}
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 568 of file cntrlc.cc.
569{
570
571
573
575}
VAR si_hdl_typ si_sig_term_hdl
VAR si_hdl_typ old_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 121 of file cntrlc.cc.
122{
123#if 0
126 {
127 fprintf(
stderr,
"Unable to init signal %d ... exiting...\n", sig);
128 }
130
131
132
133#else
136
137
141 else
143
146 if (r == -1)
147 {
148 fprintf(
stderr,
"Unable to init signal %d ... exiting...\n", sig);
150 }
151#endif
153}
#define si_siginterrupt(arg1, arg2)
◆ si_set_signals()
Definition at line 560 of file cntrlc.cc.
561{
562
564
566}
VAR si_hdl_typ si_sig_chld_hdl
◆ 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
◆ sig_term_hdl_child()
◆ sigint_handler()
Definition at line 269 of file cntrlc.cc.
270{
272 #ifdef HAVE_FEREAD
274 #endif
280 {
281 int cnt=0;
282 int c;
283
285 {
286 c = 'q';
287 }
289 {
291 }
292 else
293 {
297 {
298 fputs(
"abort after this command(a), abort immediately(r), print backtrace(b), continue(c) or quit Singular(q) ?",
stderr);
301 }
302 else
303 {
304 c = 'a';
305 }
306 }
307
308 switch(c)
309 {
312 case 'r':
314 {
316 fputs(
"** Warning: Singular should be restarted as soon as possible **\n",
stderr);
322 }
323 else
324 {
325 fputs(
"** tried too often, try another possibility **\n",
stderr);
327 }
328 break;
329 case 'b':
331 break;
332 case 'a':
334 case 'c':
336 {
337
339 }
341 return;
342
343
344
345 }
346 cnt++;
348 }
349}
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 237 of file cntrlc.cc.
238{
242 {
245 "please inform the authors\n",
247 }
248 #ifdef __OPTIMIZE__
250 {
255 }
256 #endif
257 #ifdef CALL_GDB
259 #endif
261}
void init_signals()
init signal handlers and error handling for libraries: NTL, factory
◆ stack_trace()
Definition at line 432 of file cntrlc.cc.
433{
434 int pid;
441 char buffer[256];
442 char c;
443
445 {
446 perror (
"could open pipe");
448 }
449
451 if (pid == 0)
452 {
456
460 }
461 else if (pid == -1)
462 {
463 perror (
"could not fork");
465 }
466
469
473
475 state = 0;
476
478 {
482
485 break;
486
488 {
490 {
491 switch (state)
492 {
493 case 0:
494 if (c == '#')
495 {
496 state = 1;
499 }
500 break;
501 case 1:
503 if ((c == '\n') || (c == '\r'))
504 {
507 state = 0;
509 }
510 break;
511 default:
512 break;
513 }
514 }
515 }
517 break;
518 }
519
525}
static int index(p_Length length, p_Ord ord)
◆ defer_shutdown
◆ do_shutdown
◆ old_sig_chld_hdl
◆ pipeLastLink
◆ si_restart
◆ si_sig_chld_hdl
◆ si_sig_term_hdl
◆ si_start_jmpbuf
◆ si_stop_stack_trace_x
◆ sigint_handler_cnt
◆ singular_in_batchmode
◆ siRandomStart