GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
sighandlers.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <csignal>
28 #include <cstdlib>
29 
30 #include <iostream>
31 #include <new>
32 
33 #if defined (OCTAVE_USE_WINDOWS_API)
34 # define WIN32_LEAN_AND_MEAN
35 # include <windows.h>
36 #endif
37 
38 #include "cmd-edit.h"
39 #include "oct-syscalls.h"
40 #include "quit.h"
41 #include "singleton-cleanup.h"
42 #include "signal-wrappers.h"
43 
44 #include "debug.h"
45 #include "defun.h"
46 #include "error.h"
47 #include "input.h"
48 #include "interpreter.h"
49 #include "load-save.h"
50 #include "octave.h"
51 #include "oct-map.h"
52 #include "pager.h"
53 #include "pt-bp.h"
54 #include "pt-eval.h"
55 #include "sighandlers.h"
56 #include "sysdep.h"
57 #include "utils.h"
58 #include "variables.h"
59 
60 namespace octave
61 {
62  // Nonzero means we have already printed a message for this series of
63  // SIGPIPES. We assume that the writer will eventually give up.
65 
66  // TRUE means we can be interrupted.
67  bool can_interrupt = false;
68 
69  // TRUE means we should try to enter the debugger on SIGINT.
70  bool Vdebug_on_interrupt = false;
71 
72  // Allow users to avoid writing octave-workspace for SIGHUP (sent by
73  // closing gnome-terminal, for example). Note that this variable has
74  // no effect if Vcrash_dumps_octave_core is FALSE.
75  static bool Vsighup_dumps_octave_core = true;
76 
77  // Similar to Vsighup_dumps_octave_core, but for SIGTERM signal.
78  static bool Vsigterm_dumps_octave_core = true;
79 
80  // List of signals we have caught since last call to octave::signal_handler.
81  static bool *signals_caught = 0;
82 
83  // Forward declaration.
84  static void user_abort (const char *sig_name, int sig_number);
85 
86  class
88  {
89  public:
90 
92 
93  virtual ~base_interrupt_manager (void) { }
94 
95  virtual void do_jump_to_enclosing_context (void) = 0;
96 
97  virtual void do_user_abort (const char *sig_name, int sig_number) = 0;
98 
99  virtual void do_raise_sigint (void) = 0;
100 
101  private:
102 
103  // No copying!
104 
106 
107  base_interrupt_manager& operator = (const base_interrupt_manager&);
108  };
109 
110 #if defined (OCTAVE_USE_WINDOWS_API)
111 
112  class
113  w32_interrupt_manager : public base_interrupt_manager
114  {
115  public:
116 
117  w32_interrupt_manager (void)
118  : thread (0), thread_id (0)
119  {
120  thread_id = GetCurrentThreadId ();
121 
122  DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
123  GetCurrentProcess (), &thread, 0, FALSE,
124  DUPLICATE_SAME_ACCESS);
125  }
126 
127  ~w32_interrupt_manager (void) { }
128 
129  static void jump_to_enclosing_context_sync (void)
130  {
131 #if defined (_MSC_VER)
132  _fpreset ();
133 #endif
135  }
136 
137  void do_jump_to_enclosing_context (void)
138  {
139  bool is_interrupt_thread = (GetCurrentThreadId () == thread_id);
140 
141  if (is_interrupt_thread)
142  jump_to_enclosing_context_sync ();
143  else
144  {
145 
146  CONTEXT threadContext;
147 
148  SuspendThread (thread);
149  threadContext.ContextFlags = CONTEXT_CONTROL;
150  GetThreadContext (thread, &threadContext);
151 
152 #if (defined (__MINGW64__) || defined (_WIN64))
153  threadContext.Rip = (DWORD64) jump_to_enclosing_context_sync;
154 #else
155  threadContext.Eip = (DWORD) jump_to_enclosing_context_sync;
156 #endif
157 
158  SetThreadContext (thread, &threadContext);
159 
160  ResumeThread (thread);
161  }
162  }
163 
164  void do_user_abort (const char *sig_name, int sig_number)
165  {
166  bool is_interrupt_thread = (GetCurrentThreadId () == thread_id);
167 
168  if (is_interrupt_thread)
169  octave::user_abort (sig_name, sig_number);
170  else
171  {
172  SuspendThread (thread);
173  octave::user_abort (sig_name, sig_number);
174  ResumeThread (thread);
175  }
176  }
177 
178  void do_raise_sigint (void)
179  {
180  bool is_interrupt_thread = (GetCurrentThreadId () == thread_id);
181 
182  if (is_interrupt_thread)
183  octave_raise_wrapper (SIGINT);
184  else
185  {
186  SuspendThread (thread);
187  octave_raise_wrapper (SIGINT);
188  ResumeThread (thread);
189  }
190  }
191 
192  private:
193 
194  // A handle to the thread that is running the octave interpreter.
195  HANDLE thread;
196 
197  // The ID of the thread that is running the octave interpreter.
198  DWORD thread_id;
199 
200  private:
201 
202  // No copying!
203 
204  w32_interrupt_manager (const w32_interrupt_manager&);
205 
206  w32_interrupt_manager& operator = (const w32_interrupt_manager&);
207  };
208 
209 #endif
210 
211  class
213  {
214  public:
215 
218  { }
219 
221 
223  {
225  }
226 
227  void do_user_abort (const char *sig_name, int sig_number)
228  {
229  octave::user_abort (sig_name, sig_number);
230  }
231 
232  void do_raise_sigint (void)
233  {
234  octave_raise_wrapper (SIGINT);
235  }
236 
237  private:
238 
239  // No copying!
240 
242 
244  };
245 
246  class
248  {
249  public:
250 
252 
253  static bool init (void) { return instance_ok (); }
254 
255  static void jump_to_enclosing_context (void)
256  {
257  if (instance_ok ())
258  instance->do_jump_to_enclosing_context ();
259  }
260 
261  static void user_abort (const char *sig_name, int sig_number)
262  {
263  if (instance_ok ())
264  instance->do_user_abort (sig_name, sig_number);
265  }
266 
267  static void raise_sigint (void)
268  {
269  if (instance_ok ())
270  instance->do_raise_sigint ();
271  }
272 
273  private:
274 
275  interrupt_manager (void) { }
276 
277  // No copying!
278 
280 
281  interrupt_manager& operator = (const interrupt_manager&);
282 
283  static bool instance_ok (void)
284  {
285  bool retval = true;
286 
287  if (! instance)
288  {
289  instance = create_instance ();
290 
291  if (instance)
292  singleton_cleanup_list::add (cleanup_instance);
293  }
294 
295  if (! instance)
296  error ("unable to create interrupt_manager");
297 
298  return retval;
299  }
300 
302  {
303 #if defined (OCTAVE_USE_WINDOWS_API)
304  return new w32_interrupt_manager ();
305 #else
306  return new posix_interrupt_manager ();
307 #endif
308  }
309 
310  static void cleanup_instance (void) { delete instance; instance = 0; }
311 
313  };
314 
316 
317  // Called from octave_quit () to actually do something about the signals
318  // we have caught.
319 
320  void
322  {
323  // The list of signals is relatively short, so we will just go
324  // linearly through the list.
325 
326  static int sigchld;
327  static int sigfpe;
328  static int sigpipe;
329 
330  static const bool have_sigchld = octave_get_sig_number ("SIGCHLD", &sigchld);
331  static const bool have_sigfpe = octave_get_sig_number ("SIGFPE", &sigfpe);
332  static const bool have_sigpipe = octave_get_sig_number ("SIGPIPE", &sigpipe);
333 
334  for (int i = 0; i < octave_num_signals (); i++)
335  {
336  if (signals_caught[i])
337  {
338  signals_caught[i] = false;
339 
340  if (have_sigchld && i == sigchld)
341  {
342  volatile interrupt_handler saved_interrupt_handler
343  = ignore_interrupts ();
344 
345  void *context = octave_block_child ();
346 
347  child_list::wait ();
348 
349  set_interrupt_handler (saved_interrupt_handler);
350 
351  octave_unblock_child (context);
352 
353  child_list::reap ();
354  }
355  else if (have_sigfpe && i == sigfpe)
356  std::cerr << "warning: floating point exception" << std::endl;
357  else if (have_sigpipe && i == sigpipe)
358  std::cerr << "warning: broken pipe" << std::endl;
359  }
360  }
361  }
362 
363  static void
364  my_friendly_exit (const char *sig_name, int sig_number,
365  bool save_vars = true)
366  {
367  static bool been_there_done_that = false;
368 
369  if (been_there_done_that)
370  {
371  set_signal_handler ("SIGABRT", SIG_DFL);
372 
373  std::cerr << "panic: attempted clean up failed -- aborting..."
374  << std::endl;
375 
376  sysdep_cleanup ();
377 
378  abort ();
379  }
380  else
381  {
382  been_there_done_that = true;
383 
384  std::cerr << "panic: " << sig_name << " -- stopping myself..."
385  << std::endl;
386 
387  if (save_vars)
388  dump_octave_core ();
389 
390  if (sig_number < 0)
391  {
392  sysdep_cleanup ();
393 
394  exit (1);
395  }
396  else
397  {
398  set_signal_handler (sig_number, SIG_DFL);
399 
400  octave_raise_wrapper (sig_number);
401  }
402  }
403  }
404 
405  sig_handler *
406  set_signal_handler (int sig, sig_handler *handler, bool restart_syscalls)
407  {
408  return octave_set_signal_handler_internal (sig, handler, restart_syscalls);
409  }
410 
411  sig_handler *
412  set_signal_handler (const char *signame, sig_handler *handler,
413  bool restart_syscalls)
414  {
415  return octave_set_signal_handler_by_name (signame, handler,
416  restart_syscalls);
417  }
418 
419  static void
421  {
423  }
424 
425  // Handle SIGCHLD.
426 
427  static void
428  sigchld_handler (int sig)
429  {
431 
432  signals_caught[sig] = true;
433  }
434 
435 #if defined (__alpha__)
436  static void
437  sigfpe_handler (int sig)
438  {
439  if (can_interrupt && octave_interrupt_state >= 0)
440  {
442 
443  signals_caught[sig] = true;
444 
446  }
447  }
448 #endif
449 
450  static void
451  sig_hup_handler (int /* sig */)
452  {
453  if (Vsighup_dumps_octave_core)
454  dump_octave_core ();
455 
456  clean_up_and_exit (0);
457  }
458 
459  static void
460  sig_term_handler (int /* sig */)
461  {
462  if (Vsigterm_dumps_octave_core)
463  dump_octave_core ();
464 
465  clean_up_and_exit (0);
466  }
467 
468 #if 0
469  static void
470  sigwinch_handler (int /* sig */)
471  {
473  }
474 #endif
475 
476  // Handle SIGINT by restarting the parser (see octave.cc).
477  //
478  // This also has to work for SIGBREAK (on systems that have it), so we
479  // use the value of sig, instead of just assuming that it is called
480  // for SIGINT only.
481 
482  static void
483  user_abort (const char *sig_name, int sig_number)
484  {
485  if (! octave_initialized)
486  exit (1);
487 
488  if (can_interrupt)
489  {
490  if (Vdebug_on_interrupt)
491  {
493  {
496 
497  return;
498  }
499  else
500  {
501  // Clear the flag and do normal interrupt stuff.
502 
506  }
507  }
508 
510  {
511  if (octave_interrupt_state == 0)
513 
515  }
516  else
517  {
518  // If we are already cleaning up from a previous interrupt,
519  // take note of the fact that another interrupt signal has
520  // arrived.
521 
522  if (octave_interrupt_state < 0)
524 
527 
528  if (octave::application::interactive ()
529  && ! octave::application::forced_interactive ()
530  && octave_interrupt_state == 2)
531  std::cerr << "Press Control-C again to abort." << std::endl;
532 
533  if (octave_interrupt_state >= 3)
534  my_friendly_exit (sig_name, sig_number, true);
535  }
536  }
537  }
538 
539  static void
540  sigint_handler (int sig)
541  {
543  }
544 
545  static void
546  sigpipe_handler (int sig)
547  {
549 
550  signals_caught[sig] = true;
551 
552  // Don't loop forever on account of this.
553 
554  if (pipe_handler_error_count++ > 100 && octave_interrupt_state >= 0)
556  }
557 
558  interrupt_handler
560  {
562 
564 
565  retval.int_handler = set_signal_handler ("SIGINT", sigint_handler);
566  retval.brk_handler = set_signal_handler ("SIGBREAK", sigint_handler);
567 
568  return retval;
569  }
570 
571  interrupt_handler
573  {
575 
577 
578  retval.int_handler = set_signal_handler ("SIGINT", SIG_IGN);
579  retval.brk_handler = set_signal_handler ("SIGBREAK", SIG_IGN);
580 
581  return retval;
582  }
583 
584  interrupt_handler
586  bool restart_syscalls)
587  {
589 
591 
592  retval.int_handler = set_signal_handler ("SIGINT", h.int_handler,
593  restart_syscalls);
594 
595  retval.brk_handler = set_signal_handler ("SIGBREAK", h.brk_handler,
596  restart_syscalls);
597 
598  return retval;
599  }
600 
601  // Install all the handlers for the signals we might care about.
602 
603  void
605  {
606  if (! signals_caught)
607  signals_caught = new bool [octave_num_signals ()];
608 
609  for (int i = 0; i < octave_num_signals (); i++)
610  signals_caught[i] = false;
611 
612  catch_interrupts ();
613 
617  set_signal_handler ("SIGCHLD", sigchld_handler);
618 
619  // SIGCLD
620  // SIGCONT
621 
623 
624 #if defined (__alpha__)
625  set_signal_handler ("SIGFPE", sigfpe_handler);
626 #else
628 #endif
629 
632 
633  // SIGINFO
634  // SIGINT
635 
638  set_signal_handler ("SIGPIPE", sigpipe_handler);
639  set_signal_handler ("SIGPOLL", SIG_IGN);
640 
641  // SIGPROF
642  // SIGPWR
643 
646 
647  // SIGSTOP
648 
652 
653  // SIGTSTP
654  // SIGTTIN
655  // SIGTTOU
656  // SIGURG
657 
661  set_signal_handler ("SIGIO", SIG_IGN);
662 
663 #if 0
664  set_signal_handler ("SIGWINCH", sigwinch_handler);
665 #endif
666 
669  }
670 
671  static void
672  set_sig_struct_field (octave_scalar_map& m, const char *signame)
673  {
674  int signum;
675 
676  // The names in the struct do not include the leading "SIG" prefix.
677 
678  if (octave_get_sig_number (signame, &signum))
679  m.assign (&signame[3], signum);
680  }
681 
682  static octave_scalar_map
684  {
686 
687  set_sig_struct_field (m, "SIGABRT");
688  set_sig_struct_field (m, "SIGALRM");
689  set_sig_struct_field (m, "SIGBUS");
690  set_sig_struct_field (m, "SIGCHLD");
691  set_sig_struct_field (m, "SIGCLD");
692  set_sig_struct_field (m, "SIGCONT");
693  set_sig_struct_field (m, "SIGEMT");
694  set_sig_struct_field (m, "SIGFPE");
695  set_sig_struct_field (m, "SIGHUP");
696  set_sig_struct_field (m, "SIGILL");
697  set_sig_struct_field (m, "SIGINFO");
698  set_sig_struct_field (m, "SIGINT");
699  set_sig_struct_field (m, "SIGIO");
700  set_sig_struct_field (m, "SIGIOT");
701  set_sig_struct_field (m, "SIGKILL");
702  set_sig_struct_field (m, "SIGLOST");
703  set_sig_struct_field (m, "SIGPIPE");
704  set_sig_struct_field (m, "SIGPOLL");
705  set_sig_struct_field (m, "SIGPROF");
706  set_sig_struct_field (m, "SIGPWR");
707  set_sig_struct_field (m, "SIGQUIT");
708  set_sig_struct_field (m, "SIGSEGV");
709  set_sig_struct_field (m, "SIGSTKFLT");
710  set_sig_struct_field (m, "SIGSTOP");
711  set_sig_struct_field (m, "SIGSYS");
712  set_sig_struct_field (m, "SIGTERM");
713  set_sig_struct_field (m, "SIGTRAP");
714  set_sig_struct_field (m, "SIGTSTP");
715  set_sig_struct_field (m, "SIGTTIN");
716  set_sig_struct_field (m, "SIGTTOU");
717  set_sig_struct_field (m, "SIGUNUSED");
718  set_sig_struct_field (m, "SIGURG");
719  set_sig_struct_field (m, "SIGUSR1");
720  set_sig_struct_field (m, "SIGUSR2");
721  set_sig_struct_field (m, "SIGVTALRM");
722  set_sig_struct_field (m, "SIGWINCH");
723  set_sig_struct_field (m, "SIGXCPU");
724  set_sig_struct_field (m, "SIGXFSZ");
725 
726  return m;
727  }
728 }
729 
730 DEFUN (SIG, args, ,
731  doc: /* -*- texinfo -*-
732 @deftypefn {} {} SIG ()
733 Return a structure containing Unix signal names and their defined values.
734 @end deftypefn */)
735 {
736  if (args.length () != 0)
737  print_usage ();
738 
740 
741  return ovl (m);
742 }
743 
744 /*
745 %!assert (isstruct (SIG ()))
746 %!assert (! isempty (SIG ()))
747 
748 %!error SIG (1)
749 */
750 
751 DEFUN (debug_on_interrupt, args, nargout,
752  doc: /* -*- texinfo -*-
753 @deftypefn {} {@var{val} =} debug_on_interrupt ()
754 @deftypefnx {} {@var{old_val} =} debug_on_interrupt (@var{new_val})
755 @deftypefnx {} {} debug_on_interrupt (@var{new_val}, "local")
756 Query or set the internal variable that controls whether Octave will try
757 to enter debugging mode when it receives an interrupt signal (typically
758 generated with @kbd{C-c}).
759 
760 If a second interrupt signal is received before reaching the debugging mode,
761 a normal interrupt will occur.
762 
763 When called from inside a function with the @qcode{"local"} option, the
764 variable is changed locally for the function and any subroutines it calls.
765 The original variable value is restored when exiting the function.
766 @seealso{debug_on_error, debug_on_warning}
767 @end deftypefn */)
768 {
770  "debug_on_interrupt");
771 }
772 
773 /*
774 %!test
775 %! orig_val = debug_on_interrupt ();
776 %! old_val = debug_on_interrupt (! orig_val);
777 %! assert (orig_val, old_val);
778 %! assert (debug_on_interrupt (), ! orig_val);
779 %! debug_on_interrupt (orig_val);
780 %! assert (debug_on_interrupt (), orig_val);
781 
782 %!error (debug_on_interrupt (1, 2))
783 */
784 
785 DEFUN (sighup_dumps_octave_core, args, nargout,
786  doc: /* -*- texinfo -*-
787 @deftypefn {} {@var{val} =} sighup_dumps_octave_core ()
788 @deftypefnx {} {@var{old_val} =} sighup_dumps_octave_core (@var{new_val})
789 @deftypefnx {} {} sighup_dumps_octave_core (@var{new_val}, "local")
790 Query or set the internal variable that controls whether Octave tries
791 to save all current variables to the file @file{octave-workspace} if it
792 receives a hangup signal.
793 
794 When called from inside a function with the @qcode{"local"} option, the
795 variable is changed locally for the function and any subroutines it calls.
796 The original variable value is restored when exiting the function.
797 @end deftypefn */)
798 {
800  args, nargout,
801  "sighup_dumps_octave_core");
802 }
803 
804 /*
805 %!test
806 %! orig_val = sighup_dumps_octave_core ();
807 %! old_val = sighup_dumps_octave_core (! orig_val);
808 %! assert (orig_val, old_val);
809 %! assert (sighup_dumps_octave_core (), ! orig_val);
810 %! sighup_dumps_octave_core (orig_val);
811 %! assert (sighup_dumps_octave_core (), orig_val);
812 
813 %!error (sighup_dumps_octave_core (1, 2))
814 */
815 
816 DEFUN (sigterm_dumps_octave_core, args, nargout,
817  doc: /* -*- texinfo -*-
818 @deftypefn {} {@var{val} =} sigterm_dumps_octave_core ()
819 @deftypefnx {} {@var{old_val} =} sigterm_dumps_octave_core (@var{new_val})
820 @deftypefnx {} {} sigterm_dumps_octave_core (@var{new_val}, "local")
821 Query or set the internal variable that controls whether Octave tries
822 to save all current variables to the file @file{octave-workspace} if it
823 receives a terminate signal.
824 
825 When called from inside a function with the @qcode{"local"} option, the
826 variable is changed locally for the function and any subroutines it calls.
827 The original variable value is restored when exiting the function.
828 @end deftypefn */)
829 {
831  args, nargout,
832  "sigterm_dumps_octave_core");
833 }
834 
835 /*
836 %!test
837 %! orig_val = sigterm_dumps_octave_core ();
838 %! old_val = sigterm_dumps_octave_core (! orig_val);
839 %! assert (orig_val, old_val);
840 %! assert (sigterm_dumps_octave_core (), ! orig_val);
841 %! sigterm_dumps_octave_core (orig_val);
842 %! assert (sigterm_dumps_octave_core (), orig_val);
843 
844 %!error (sigterm_dumps_octave_core (1, 2))
845 */
volatile sig_atomic_t octave_signal_caught
Definition: cquit.c:66
bool octave_initialized
Definition: interpreter.cc:82
Octave interface to the compression and uncompression libraries.
Definition: aepbalance.cc:47
static void user_abort(const char *sig_name, int sig_number)
Definition: sighandlers.cc:483
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
Definition: defun.cc:52
static bool have_breakpoints(void)
Definition: debug.h:119
static void my_friendly_exit(const char *sig_name, int sig_number, bool save_vars=true)
Definition: sighandlers.cc:364
interrupt_handler catch_interrupts(void)
Definition: sighandlers.cc:559
octave_sig_handler * octave_set_signal_handler_internal(int sig, octave_sig_handler *handler, bool restart_syscalls)
static void sigpipe_handler(int sig)
Definition: sighandlers.cc:546
#define DEFUN(name, args_name, nargout_name, doc)
Definition: defun.h:46
void error(const char *fmt,...)
Definition: error.cc:570
void sig_handler(int)
Definition: sighandlers.h:43
void * octave_block_child(void)
static void jump_to_enclosing_context(void)
Definition: sighandlers.cc:255
virtual ~base_interrupt_manager(void)
Definition: sighandlers.cc:93
static void sig_term_handler(int)
Definition: sighandlers.cc:460
void do_user_abort(const char *sig_name, int sig_number)
Definition: sighandlers.cc:227
static base_interrupt_manager * instance
Definition: sighandlers.cc:312
void sysdep_cleanup(void)
Definition: sysdep.cc:346
void octave_jump_to_enclosing_context(void)
Definition: cquit.c:47
static octave_scalar_map make_sig_struct(void)
Definition: sighandlers.cc:683
bool can_interrupt
Definition: sighandlers.cc:67
JNIEnv void * args
Definition: ov-java.cc:67
sig_handler * set_signal_handler(int sig, sig_handler *handler, bool restart_syscalls)
Definition: sighandlers.cc:406
double h
Definition: graphics.cc:11205
void octave_unblock_child(void *context_arg)
bool Vdebug_on_interrupt
Definition: sighandlers.cc:70
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
int pipe_handler_error_count
Definition: sighandlers.cc:64
static base_interrupt_manager * create_instance(void)
Definition: sighandlers.cc:301
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
static void resize_terminal(void)
Definition: cmd-edit.cc:1244
static void add(fptr f)
static bool init(void)
Definition: sighandlers.cc:253
static void sig_hup_handler(int)
Definition: sighandlers.cc:451
double signum(double x)
Definition: lo-mappers.h:259
static bool wait(void)
Definition: child-list.cc:72
OCTAVE_API void clean_up_and_exit(int exit_status, bool safe_to_return)
Definition: quit.cc:52
sig_handler * brk_handler
Definition: sighandlers.h:49
void signal_handler(void)
Definition: sighandlers.cc:321
OCTINTERP_API octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)
static void set_sig_struct_field(octave_scalar_map &m, const char *signame)
Definition: sighandlers.cc:672
octave_value retval
Definition: data.cc:6294
static void user_abort(const char *sig_name, int sig_number)
Definition: sighandlers.cc:261
static void sigchld_handler(int sig)
Definition: sighandlers.cc:428
sig_atomic_t octave_interrupt_state
Definition: cquit.c:58
sig_handler * int_handler
Definition: sighandlers.h:48
int octave_num_signals(void)
interrupt_handler ignore_interrupts(void)
Definition: sighandlers.cc:572
static bool debug_mode
Definition: pt-eval.h:160
sig_atomic_t octave_interrupt_immediately
Definition: cquit.c:56
static void sigint_handler(int sig)
Definition: sighandlers.cc:540
static void raise_sigint(void)
Definition: sighandlers.cc:267
int octave_raise_wrapper(int signum)
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
static bool Vsigterm_dumps_octave_core
Definition: sighandlers.cc:78
void assign(const std::string &k, const octave_value &val)
Definition: oct-map.h:223
static bool Vsighup_dumps_octave_core
Definition: sighandlers.cc:75
interrupt_handler set_interrupt_handler(const volatile interrupt_handler &h, bool restart_syscalls)
Definition: sighandlers.cc:585
bool octave_debug_on_interrupt_state
Definition: pt-bp.cc:33
static bool * signals_caught
Definition: sighandlers.cc:81
bool octave_get_sig_number(const char *signame, int *signum)
octave_sig_handler * octave_set_signal_handler_by_name(const char *signame, octave_sig_handler *handler, bool restart_syscalls)
static void cleanup_instance(void)
Definition: sighandlers.cc:310
bool Vdebugging
Definition: input.cc:109
static bool instance_ok(void)
Definition: sighandlers.cc:283
static void generic_sig_handler(int sig)
Definition: sighandlers.cc:420
static void reap(void)
Definition: child-list.cc:65
void install_signal_handlers(void)
Definition: sighandlers.cc:604
static size_t save_vars(std::ostream &os, const std::string &pattern, load_save_format fmt, bool save_as_floats)
Definition: load-save.cc:1001
static void dump_octave_core(std::ostream &os, const char *fname, load_save_format fmt, bool save_as_floats)
Definition: load-save.cc:1314
char * octave_strsignal_wrapper(int signum)