1 /* Start (run) and stop the inferior process, for GDB.
2 Copyright (C) 1986, 1987, 1988, 1989, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /* Notes on the algorithm used in wait_for_inferior to determine if we
21 just did a subroutine call when stepping. We have the following
22 information at that point:
24 Current and previous (just before this step) pc.
25 Current and previous sp.
26 Current and previous start of current function.
28 If the start's of the functions don't match, then
30 a) We did a subroutine call.
32 In this case, the pc will be at the beginning of a function.
34 b) We did a subroutine return.
40 If we did a longjump, we were doing "nexti", since a next would
41 have attempted to skip over the assembly language routine in which
42 the longjmp is coded and would have simply been the equivalent of a
43 continue. I consider this ok behaivior. We'd like one of two
44 things to happen if we are doing a nexti through the longjmp()
45 routine: 1) It behaves as a stepi, or 2) It acts like a continue as
46 above. Given that this is a special case, and that anybody who
47 thinks that the concept of sub calls is meaningful in the context
48 of a longjmp, I'll take either one. Let's see what happens.
50 Acts like a subroutine return. I can handle that with no problem
53 -->So: If the current and previous beginnings of the current
54 function don't match, *and* the pc is at the start of a function,
55 we've done a subroutine call. If the pc is not at the start of a
56 function, we *didn't* do a subroutine call.
58 -->If the beginnings of the current and previous function do match,
61 a) We just did a recursive call.
63 In this case, we would be at the very beginning of a
64 function and 1) it will have a prologue (don't jump to
65 before prologue, or 2) (we assume here that it doesn't have
66 a prologue) there will have been a change in the stack
67 pointer over the last instruction. (Ie. it's got to put
68 the saved pc somewhere. The stack is the usual place. In
69 a recursive call a register is only an option if there's a
70 prologue to do something with it. This is even true on
71 register window machines; the prologue sets up the new
72 window. It might not be true on a register window machine
73 where the call instruction moved the register window
74 itself. Hmmm. One would hope that the stack pointer would
75 also change. If it doesn't, somebody send me a note, and
76 I'll work out a more general theory.
78 so) on all machines I'm aware of:
80 m68k: Call changes stack pointer. Regular jumps don't.
82 sparc: Recursive calls must have frames and therefor,
85 vax: All calls have frames and hence change the
88 b) We did a return from a recursive call. I don't see that we
89 have either the ability or the need to distinguish this
90 from an ordinary jump. The stack frame will be printed
91 when and if the frame pointer changes; if we are in a
92 function without a frame pointer, it's the users own
95 c) We did a jump within a function. We assume that this is
96 true if we didn't do a recursive call.
98 d) We are in no-man's land ("I see no symbols here"). We
99 don't worry about this; it will make calls look like simple
100 jumps (and the stack frames will be printed when the frame
101 pointer moves), which is a reasonably non-violent response.
104 We skip this; it causes more problems than it's worth.
105 #ifdef SUN4_COMPILER_FEATURE
106 We do a special ifdef for the sun 4, forcing it to single step
107 into calls which don't have prologues. This means that we can't
108 nexti over leaf nodes, we can probably next over them (since they
109 won't have debugging symbols, usually), and we can next out of
110 functions returning structures (with a "call .stret4" at the end).
125 #include "inferior.h"
126 #include "breakpoint.h"
131 #include "terminal.h" /* For #ifdef TIOCGPGRP and new_tty */
136 /* unistd.h is needed to #define X_OK */
140 #include <sys/file.h>
143 #ifdef SET_STACK_LIMIT_HUGE
144 #include <sys/time.h>
145 #include <sys/resource.h>
147 extern int original_stack_limit;
148 #endif /* SET_STACK_LIMIT_HUGE */
150 extern char *getenv ();
151 extern char **environ;
153 extern struct target_ops child_ops; /* In inftarg.c */
156 /* Sigtramp is a routine that the kernel calls (which then calls the
157 signal handler). On most machines it is a library routine that
158 is linked into the executable.
160 This macro, given a program counter value and the name of the
161 function in which that PC resides (which can be null if the
162 name is not known), returns nonzero if the PC and name show
163 that we are in sigtramp.
165 On most machines just see if the name is sigtramp (and if we have
166 no name, assume we are not in sigtramp). */
167 #if !defined (IN_SIGTRAMP)
168 #define IN_SIGTRAMP(pc, name) \
169 (name && !strcmp ("_sigtramp", name))
174 int safe_to_init_tdesc_context = 0;
175 extern dc_dcontext_t current_context;
178 /* Tables of how to react to signals; the user sets them. */
180 static char signal_stop[NSIG];
181 static char signal_print[NSIG];
182 static char signal_program[NSIG];
184 /* Nonzero if breakpoints are now inserted in the inferior. */
185 /* Nonstatic for initialization during xxx_create_inferior. FIXME. */
187 /*static*/ int breakpoints_inserted;
189 /* Function inferior was in as of last step command. */
191 static struct symbol *step_start_function;
193 /* Nonzero => address for special breakpoint for resuming stepping. */
195 static CORE_ADDR step_resume_break_address;
197 /* Pointer to orig contents of the byte where the special breakpoint is. */
199 static char step_resume_break_shadow[BREAKPOINT_MAX];
201 /* Nonzero means the special breakpoint is a duplicate
202 so it has not itself been inserted. */
204 static int step_resume_break_duplicate;
206 /* Nonzero if we are expecting a trace trap and should proceed from it. */
208 static int trap_expected;
210 /* Nonzero if the next time we try to continue the inferior, it will
211 step one instruction and generate a spurious trace trap.
212 This is used to compensate for a bug in HP-UX. */
214 static int trap_expected_after_continue;
216 /* Nonzero means expecting a trace trap
217 and should stop the inferior and return silently when it happens. */
221 /* Nonzero means expecting a trap and caller will handle it themselves.
222 It is used after attach, due to attaching to a process;
223 when running in the shell before the child program has been exec'd;
224 and when running some kinds of remote stuff (FIXME?). */
226 int stop_soon_quietly;
228 /* Nonzero if pc has been changed by the debugger
229 since the inferior stopped. */
233 /* Nonzero if proceed is being used for a "finish" command or a similar
234 situation when stop_registers should be saved. */
236 int proceed_to_finish;
238 /* Save register contents here when about to pop a stack dummy frame,
239 if-and-only-if proceed_to_finish is set.
240 Thus this contains the return value from the called function (assuming
241 values are returned in a register). */
243 char stop_registers[REGISTER_BYTES];
245 /* Nonzero if program stopped due to error trying to insert breakpoints. */
247 static int breakpoints_failed;
249 /* Nonzero after stop if current stack frame should be printed. */
251 static int stop_print_frame;
253 #ifdef NO_SINGLE_STEP
254 extern int one_stepped; /* From machine dependent code */
255 extern void single_step (); /* Same. */
256 #endif /* NO_SINGLE_STEP */
258 static void insert_step_breakpoint ();
259 static void remove_step_breakpoint ();
260 /*static*/ void wait_for_inferior ();
261 void init_wait_for_inferior ();
265 /* Things to clean up if we QUIT out of resume (). */
268 resume_cleanups (arg)
274 /* Resume the inferior, but allow a QUIT. This is useful if the user
275 wants to interrupt some lengthy single-stepping operation
276 (for child processes, the SIGINT goes to the inferior, and so
277 we get a SIGINT random_signal, but for remote debugging and perhaps
278 other targets, that's not true).
280 STEP nonzero if we should step (zero to continue instead).
281 SIG is the signal to give the inferior (zero for none). */
287 struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
290 #ifdef NO_SINGLE_STEP
292 single_step(); /* Do it the hard way, w/temp breakpoints */
293 step = 0; /* ...and don't ask hardware to do it. */
297 /* Handle any optimized stores to the inferior NOW... */
298 #ifdef DO_DEFERRED_STORES
302 target_resume (step, sig);
303 discard_cleanups (old_cleanups);
307 /* Clear out all variables saying what to do when inferior is continued.
308 First do this, then set the ones you want, then call `proceed'. */
311 clear_proceed_status ()
314 step_range_start = 0;
316 step_frame_address = 0;
317 step_over_calls = -1;
318 step_resume_break_address = 0;
320 stop_soon_quietly = 0;
321 proceed_to_finish = 0;
322 breakpoint_proceeded = 1; /* We're about to proceed... */
324 /* Discard any remaining commands or status from previous stop. */
325 bpstat_clear (&stop_bpstat);
328 /* Basic routine for continuing the program in various fashions.
330 ADDR is the address to resume at, or -1 for resume where stopped.
331 SIGGNAL is the signal to give it, or 0 for none,
332 or -1 for act according to how it stopped.
333 STEP is nonzero if should trap after one instruction.
334 -1 means return after that and print nothing.
335 You should probably set various step_... variables
336 before calling here, if you are stepping.
338 You should call clear_proceed_status before calling proceed. */
341 proceed (addr, siggnal, step)
349 step_start_function = find_pc_function (read_pc ());
353 if (addr == (CORE_ADDR)-1)
355 /* If there is a breakpoint at the address we will resume at,
356 step one instruction before inserting breakpoints
357 so that we do not stop right away. */
359 if (!pc_changed && breakpoint_here_p (read_pc ()))
364 write_register (PC_REGNUM, addr);
366 write_register (NPC_REGNUM, addr + 4);
368 write_register (NNPC_REGNUM, addr + 8);
373 if (trap_expected_after_continue)
375 /* If (step == 0), a trap will be automatically generated after
376 the first instruction is executed. Force step one
377 instruction to clear this condition. This should not occur
378 if step is nonzero, but it is harmless in that case. */
380 trap_expected_after_continue = 0;
384 /* We will get a trace trap after one instruction.
385 Continue it automatically and insert breakpoints then. */
389 int temp = insert_breakpoints ();
392 print_sys_errmsg ("ptrace", temp);
393 error ("Cannot insert breakpoints.\n\
394 The same program may be running in another process.");
396 breakpoints_inserted = 1;
399 /* Install inferior's terminal modes. */
400 target_terminal_inferior ();
403 stop_signal = siggnal;
404 /* If this signal should not be seen by program,
405 give it zero. Used for debugging signals. */
406 else if (stop_signal < NSIG && !signal_program[stop_signal])
409 /* Resume inferior. */
410 resume (oneproc || step || bpstat_should_step (), stop_signal);
412 /* Wait for it to stop (if not standalone)
413 and in any case decode why it stopped, and act accordingly. */
415 wait_for_inferior ();
420 /* This might be useful (not sure), but isn't currently used. See also
422 /* Writing the inferior pc as a register calls this function
423 to inform infrun that the pc has been set in the debugger. */
434 /* Record the pc and sp of the program the last time it stopped.
435 These are just used internally by wait_for_inferior, but need
436 to be preserved over calls to it and cleared when the inferior
438 static CORE_ADDR prev_pc;
439 static CORE_ADDR prev_sp;
440 static CORE_ADDR prev_func_start;
441 static char *prev_func_name;
444 /* Start an inferior Unix child process and sets inferior_pid to its pid.
445 EXEC_FILE is the file to run.
446 ALLARGS is a string containing the arguments to the program.
447 ENV is the environment vector to pass. Errors reported with error(). */
450 #define SHELL_FILE "/bin/sh"
454 child_create_inferior (exec_file, allargs, env)
462 extern char *sys_errlist[];
464 static char default_shell_file[] = SHELL_FILE;
467 /* Set debug_fork then attach to the child while it sleeps, to debug. */
468 static int debug_fork = 0;
469 /* This is set to the result of setpgrp, which if vforked, will be visible
470 to you in the parent process. It's only used by humans for debugging. */
471 static int debug_setpgrp = 657473;
474 /* The user might want tilde-expansion, and in general probably wants
475 the program to behave the same way as if run from
476 his/her favorite shell. So we let the shell run it for us.
477 FIXME, this should probably search the local environment (as
478 modified by the setenv command), not the env gdb inherited. */
479 shell_file = getenv ("SHELL");
480 if (shell_file == NULL)
481 shell_file = default_shell_file;
483 len = 5 + strlen (exec_file) + 1 + strlen (allargs) + 1 + /*slop*/ 10;
484 /* If desired, concat something onto the front of ALLARGS.
485 SHELL_COMMAND is the result. */
486 #ifdef SHELL_COMMAND_CONCAT
487 shell_command = (char *) alloca (strlen (SHELL_COMMAND_CONCAT) + len);
488 strcpy (shell_command, SHELL_COMMAND_CONCAT);
490 shell_command = (char *) alloca (len);
491 shell_command[0] = '\0';
493 strcat (shell_command, "exec ");
494 strcat (shell_command, exec_file);
495 strcat (shell_command, " ");
496 strcat (shell_command, allargs);
498 /* exec is said to fail if the executable is open. */
501 /* Retain a copy of our environment variables, since the child will
502 replace the value of environ and if we're vforked, we have to
504 save_our_env = environ;
506 /* Tell the terminal handling subsystem what tty we plan to run on;
507 it will just record the information for later. */
509 new_tty_prefork (inferior_io_terminal);
511 #if defined(USG) && !defined(HAVE_VFORK)
521 perror_with_name ("vfork");
529 /* Run inferior in a separate process group. */
530 debug_setpgrp = setpgrp (getpid (), getpid ());
531 if (debug_setpgrp == -1)
532 perror("setpgrp failed in child");
533 #endif /* TIOCGPGRP */
535 #ifdef SET_STACK_LIMIT_HUGE
536 /* Reset the stack limit back to what it was. */
540 getrlimit (RLIMIT_STACK, &rlim);
541 rlim.rlim_cur = original_stack_limit;
542 setrlimit (RLIMIT_STACK, &rlim);
544 #endif /* SET_STACK_LIMIT_HUGE */
546 /* Ask the tty subsystem to switch to the one we specified earlier
547 (or to share the current terminal, if none was specified). */
551 /* Changing the signal handlers for the inferior after
552 a vfork can also change them for the superior, so we don't mess
553 with signals here. See comments in
554 initialize_signals for how we get the right signal handlers
557 call_ptrace (0, 0, 0, 0); /* "Trace me, Dr. Memory!" */
559 /* There is no execlpe call, so we have to set the environment
560 for our child in the global variable. If we've vforked, this
561 clobbers the parent, but environ is restored a few lines down
562 in the parent. By the way, yes we do need to look down the
563 path to find $SHELL. Rich Pixley says so, and I agree. */
565 execlp (shell_file, shell_file, "-c", shell_command, (char *)0);
567 fprintf (stderr, "Cannot exec %s: %s.\n", shell_file,
568 errno < sys_nerr ? sys_errlist[errno] : "unknown error");
573 /* Restore our environment in case a vforked child clob'd it. */
574 environ = save_our_env;
576 /* Now that we have a child process, make it our target. */
577 push_target (&child_ops);
579 #ifdef CREATE_INFERIOR_HOOK
580 CREATE_INFERIOR_HOOK (pid);
583 /* The process was started by the fork that created it,
584 but it will have stopped one instruction after execing the shell.
585 Here we must get it up to actual execution of the real program. */
587 inferior_pid = pid; /* Needed for wait_for_inferior stuff below */
589 clear_proceed_status ();
591 #if defined (START_INFERIOR_HOOK)
592 START_INFERIOR_HOOK ();
595 /* We will get a trace trap after one instruction.
596 Continue it automatically. Eventually (after shell does an exec)
597 it will get another trace trap. Then insert breakpoints and continue. */
599 #ifdef START_INFERIOR_TRAPS_EXPECTED
600 pending_execs = START_INFERIOR_TRAPS_EXPECTED;
605 init_wait_for_inferior ();
607 /* Set up the "saved terminal modes" of the inferior
608 based on what modes we are starting it with. */
609 target_terminal_init ();
611 /* Install inferior's terminal modes. */
612 target_terminal_inferior ();
616 stop_soon_quietly = 1; /* Make wait_for_inferior be quiet */
617 wait_for_inferior ();
618 if (stop_signal != SIGTRAP)
620 /* Let shell child handle its own signals in its own way */
621 /* FIXME, what if child has exit()ed? Must exit loop somehow */
622 resume (0, stop_signal);
626 /* We handle SIGTRAP, however; it means child did an exec. */
627 if (0 == --pending_execs)
629 resume (0, 0); /* Just make it go on */
632 stop_soon_quietly = 0;
634 /* We are now in the child process of interest, having exec'd the
635 correct program, and are poised at the first instruction of the
637 #ifdef SOLIB_CREATE_INFERIOR_HOOK
638 SOLIB_CREATE_INFERIOR_HOOK ();
641 /* Should this perhaps just be a "proceed" call? FIXME */
642 insert_step_breakpoint ();
643 breakpoints_failed = insert_breakpoints ();
644 if (!breakpoints_failed)
646 breakpoints_inserted = 1;
647 target_terminal_inferior();
648 /* Start the child program going on its first instruction, single-
649 stepping if we need to. */
650 resume (bpstat_should_step (), 0);
651 wait_for_inferior ();
656 /* Start remote-debugging of a machine over a serial link. */
661 init_wait_for_inferior ();
662 clear_proceed_status ();
663 stop_soon_quietly = 1;
665 wait_for_inferior ();
669 /* Initialize static vars when a new inferior begins. */
672 init_wait_for_inferior ()
674 /* These are meaningless until the first time through wait_for_inferior. */
678 prev_func_name = NULL;
680 trap_expected_after_continue = 0;
681 breakpoints_inserted = 0;
682 mark_breakpoints_out ();
683 stop_signal = 0; /* Don't confuse first call to proceed(). */
687 /* Attach to process PID, then initialize for debugging it
688 and wait for the trace-trap that results from attaching. */
691 child_attach (args, from_tty)
701 error_no_arg ("process-id to attach");
703 #ifndef ATTACH_DETACH
704 error ("Can't attach to a process on this machine.");
708 if (target_has_execution)
710 if (query ("A program is being debugged already. Kill it? "))
711 target_kill ((char *)0, from_tty);
713 error ("Inferior not killed.");
716 exec_file = (char *) get_exec_file (1);
720 printf ("Attaching program: %s pid %d\n",
727 push_target (&child_ops);
729 mark_breakpoints_out ();
730 target_terminal_init ();
731 clear_proceed_status ();
732 stop_soon_quietly = 1;
733 /*proceed (-1, 0, -2);*/
734 target_terminal_inferior ();
735 wait_for_inferior ();
737 SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0);
740 #endif /* ATTACH_DETACH */
743 /* Wait for control to return from inferior to debugger.
744 If inferior gets a signal, we may decide to start it up again
745 instead of returning. That is why there is a loop in this function.
746 When this function actually returns it means the inferior
747 should be left stopped and GDB should read more commands. */
756 CORE_ADDR stop_func_start;
757 char *stop_func_name;
758 CORE_ADDR prologue_pc;
759 int stop_step_resume_break;
760 struct symtab_and_line sal;
761 int remove_breakpoints_on_following_step = 0;
763 extern dc_handle_t tdesc_handle;
767 /* This no longer works now that read_register is lazy;
768 it might try to ptrace when the process is not stopped. */
769 prev_pc = read_pc ();
770 (void) find_pc_partial_function (prev_pc, &prev_func_name,
772 prev_func_start += FUNCTION_START_OFFSET;
773 prev_sp = read_register (SP_REGNUM);
778 /* Clean up saved state that will become invalid. */
780 flush_cached_frames ();
781 registers_changed ();
785 /* See if the process still exists; clean up if it doesn't. */
788 target_terminal_ours (); /* Must do this before mourn anyway */
790 safe_to_init_tdesc_context = 0;
793 printf ("\nProgram exited with code 0%o.\n",
794 (unsigned int)WEXITSTATUS (w));
797 printf ("\nProgram exited normally.\n");
799 target_mourn_inferior ();
800 #ifdef NO_SINGLE_STEP
803 stop_print_frame = 0;
806 else if (!WIFSTOPPED (w))
808 stop_print_frame = 0;
809 stop_signal = WTERMSIG (w);
810 target_terminal_ours (); /* Must do this before mourn anyway */
811 target_kill ((char *)0, 0); /* kill mourns as well */
813 safe_to_init_tdesc_context = 0;
815 #ifdef PRINT_RANDOM_SIGNAL
816 printf ("\nProgram terminated: ");
817 PRINT_RANDOM_SIGNAL (stop_signal);
819 printf ("\nProgram terminated with signal %d, %s\n",
822 ? sys_siglist[stop_signal]
825 printf ("The inferior process no longer exists.\n");
827 #ifdef NO_SINGLE_STEP
833 #ifdef NO_SINGLE_STEP
835 single_step (0); /* This actually cleans up the ss */
836 #endif /* NO_SINGLE_STEP */
838 stop_pc = read_pc ();
840 if (safe_to_init_tdesc_context)
842 current_context = init_dcontext();
843 set_current_frame ( create_new_frame (get_frame_base (read_pc()),read_pc()));
847 set_current_frame ( create_new_frame (read_register (FP_REGNUM),
850 stop_frame_address = FRAME_FP (get_current_frame ());
851 stop_sp = read_register (SP_REGNUM);
854 /* Don't care about return value; stop_func_start and stop_func_name
855 will both be 0 if it doesn't work. */
856 (void) find_pc_partial_function (stop_pc, &stop_func_name,
858 stop_func_start += FUNCTION_START_OFFSET;
860 bpstat_clear (&stop_bpstat);
862 stop_stack_dummy = 0;
863 stop_print_frame = 1;
864 stop_step_resume_break = 0;
866 stopped_by_random_signal = 0;
867 breakpoints_failed = 0;
869 /* Look at the cause of the stop, and decide what to do.
870 The alternatives are:
871 1) break; to really stop and return to the debugger,
872 2) drop through to start up again
873 (set another_trap to 1 to single step once)
874 3) set random_signal to 1, and the decision between 1 and 2
875 will be made according to the signal handling tables. */
877 stop_signal = WSTOPSIG (w);
879 /* First, distinguish signals caused by the debugger from signals
880 that have to do with the program's own actions.
881 Note that breakpoint insns may cause SIGTRAP or SIGILL
882 or SIGEMT, depending on the operating system version.
883 Here we detect when a SIGILL or SIGEMT is really a breakpoint
884 and change it to SIGTRAP. */
886 if (stop_signal == SIGTRAP
887 || (breakpoints_inserted &&
888 (stop_signal == SIGILL
889 || stop_signal == SIGEMT))
890 || stop_soon_quietly)
892 if (stop_signal == SIGTRAP && stop_after_trap)
894 stop_print_frame = 0;
897 if (stop_soon_quietly)
900 /* Don't even think about breakpoints
901 if just proceeded over a breakpoint.
903 However, if we are trying to proceed over a breakpoint
904 and end up in sigtramp, then step_resume_break_address
905 will be set and we should check whether we've hit the
907 if (stop_signal == SIGTRAP && trap_expected
908 && step_resume_break_address == NULL)
909 bpstat_clear (&stop_bpstat);
912 /* See if there is a breakpoint at the current PC. */
913 #if DECR_PC_AFTER_BREAK
914 /* Notice the case of stepping through a jump
915 that leads just after a breakpoint.
916 Don't confuse that with hitting the breakpoint.
917 What we check for is that 1) stepping is going on
918 and 2) the pc before the last insn does not match
919 the address of the breakpoint before the current pc. */
920 if (!(prev_pc != stop_pc - DECR_PC_AFTER_BREAK
921 && step_range_end && !step_resume_break_address))
922 #endif /* DECR_PC_AFTER_BREAK not zero */
924 /* See if we stopped at the special breakpoint for
925 stepping over a subroutine call. If both are zero,
926 this wasn't the reason for the stop. */
927 if (stop_pc - DECR_PC_AFTER_BREAK
928 == step_resume_break_address
929 && step_resume_break_address)
931 stop_step_resume_break = 1;
932 if (DECR_PC_AFTER_BREAK)
934 stop_pc -= DECR_PC_AFTER_BREAK;
935 write_register (PC_REGNUM, stop_pc);
942 bpstat_stop_status (&stop_pc, stop_frame_address);
943 /* Following in case break condition called a
945 stop_print_frame = 1;
950 if (stop_signal == SIGTRAP)
952 = !(bpstat_explains_signal (stop_bpstat)
954 || stop_step_resume_break
955 || PC_IN_CALL_DUMMY (stop_pc, stop_sp, stop_frame_address)
956 || (step_range_end && !step_resume_break_address));
960 = !(bpstat_explains_signal (stop_bpstat)
961 || stop_step_resume_break
962 /* End of a stack dummy. Some systems (e.g. Sony
963 news) give another signal besides SIGTRAP,
964 so check here as well as above. */
965 || (stop_sp INNER_THAN stop_pc
966 && stop_pc INNER_THAN stop_frame_address)
969 stop_signal = SIGTRAP;
975 /* For the program's own signals, act according to
976 the signal handling tables. */
980 /* Signal not for debugging purposes. */
983 stopped_by_random_signal = 1;
985 if (stop_signal >= NSIG
986 || signal_print[stop_signal])
989 target_terminal_ours_for_output ();
990 #ifdef PRINT_RANDOM_SIGNAL
991 PRINT_RANDOM_SIGNAL (stop_signal);
993 printf ("\nProgram received signal %d, %s\n",
996 ? sys_siglist[stop_signal]
998 #endif /* PRINT_RANDOM_SIGNAL */
1001 if (stop_signal >= NSIG
1002 || signal_stop[stop_signal])
1004 /* If not going to stop, give terminal back
1005 if we took it away. */
1007 target_terminal_inferior ();
1009 /* Note that virtually all the code below does `if !random_signal'.
1010 Perhaps this code should end with a goto or continue. At least
1011 one (now fixed) bug was caused by this -- a !random_signal was
1012 missing in one of the tests below. */
1015 /* Handle cases caused by hitting a breakpoint. */
1018 && (bpstat_explains_signal (stop_bpstat) || stop_step_resume_break))
1020 /* Does a breakpoint want us to stop? */
1021 if (bpstat_stop (stop_bpstat))
1023 stop_print_frame = bpstat_should_print (stop_bpstat);
1026 /* But if we have hit the step-resumption breakpoint,
1027 remove it. It has done its job getting us here.
1028 The sp test is to make sure that we don't get hung
1029 up in recursive calls in functions without frame
1030 pointers. If the stack pointer isn't outside of
1031 where the breakpoint was set (within a routine to be
1032 stepped over), we're in the middle of a recursive
1033 call. Not true for reg window machines (sparc)
1034 because the must change frames to call things and
1035 the stack pointer doesn't have to change if it
1036 the bp was set in a routine without a frame (pc can
1037 be stored in some other window).
1039 The removal of the sp test is to allow calls to
1040 alloca. Nasty things were happening. Oh, well,
1041 gdb can only handle one level deep of lack of
1043 if (stop_step_resume_break
1044 && (step_frame_address == 0
1045 || (stop_frame_address == step_frame_address)))
1047 remove_step_breakpoint ();
1048 step_resume_break_address = 0;
1050 /* If were waiting for a trap, hitting the step_resume_break
1051 doesn't count as getting it. */
1055 /* Otherwise, must remove breakpoints and single-step
1056 to get us past the one we hit. */
1059 remove_breakpoints ();
1060 remove_step_breakpoint ();
1061 breakpoints_inserted = 0;
1065 /* We come here if we hit a breakpoint but should not
1066 stop for it. Possibly we also were stepping
1067 and should stop for that. So fall through and
1068 test for stepping. But, if not stepping,
1072 /* If this is the breakpoint at the end of a stack dummy,
1073 just stop silently. */
1075 && PC_IN_CALL_DUMMY (stop_pc, stop_sp, stop_frame_address))
1077 stop_print_frame = 0;
1078 stop_stack_dummy = 1;
1080 trap_expected_after_continue = 1;
1085 if (step_resume_break_address)
1086 /* Having a step-resume breakpoint overrides anything
1087 else having to do with stepping commands until
1088 that breakpoint is reached. */
1090 /* If stepping through a line, keep going if still within it. */
1091 else if (!random_signal
1093 && stop_pc >= step_range_start
1094 && stop_pc < step_range_end
1095 /* The step range might include the start of the
1096 function, so if we are at the start of the
1097 step range and either the stack or frame pointers
1098 just changed, we've stepped outside */
1099 && !(stop_pc == step_range_start
1100 && stop_frame_address
1101 && (stop_sp INNER_THAN prev_sp
1102 || stop_frame_address != step_frame_address)))
1105 /* When "next"ing through a function,
1106 This causes an extra stop at the end.
1107 Is there any reason for this?
1108 It's confusing to the user. */
1109 /* Don't step through the return from a function
1110 unless that is the first instruction stepped through. */
1111 if (ABOUT_TO_RETURN (stop_pc))
1119 /* We stepped out of the stepping range. See if that was due
1120 to a subroutine call that we should proceed to the end of. */
1121 else if (!random_signal && step_range_end)
1123 if (stop_func_start)
1125 prologue_pc = stop_func_start;
1126 SKIP_PROLOGUE (prologue_pc);
1129 /* Did we just take a signal? */
1130 if (IN_SIGTRAMP (stop_pc, stop_func_name)
1131 && !IN_SIGTRAMP (prev_pc, prev_func_name))
1133 /* This code is needed at least in the following case:
1134 The user types "next" and then a signal arrives (before
1135 the "next" is done). */
1136 /* We've just taken a signal; go until we are back to
1137 the point where we took it and one more. */
1138 step_resume_break_address = prev_pc;
1139 step_resume_break_duplicate =
1140 breakpoint_here_p (step_resume_break_address);
1141 if (breakpoints_inserted)
1142 insert_step_breakpoint ();
1143 /* Make sure that the stepping range gets us past
1144 that instruction. */
1145 if (step_range_end == 1)
1146 step_range_end = (step_range_start = prev_pc) + 1;
1147 remove_breakpoints_on_following_step = 1;
1150 /* ==> See comments at top of file on this algorithm. <==*/
1152 else if (stop_pc == stop_func_start
1153 && (stop_func_start != prev_func_start
1154 || prologue_pc != stop_func_start
1155 || stop_sp != prev_sp))
1157 /* It's a subroutine call */
1158 if (step_over_calls > 0
1159 || (step_over_calls && find_pc_function (stop_pc) == 0))
1161 /* A subroutine call has happened. */
1162 /* Set a special breakpoint after the return */
1163 step_resume_break_address =
1165 (SAVED_PC_AFTER_CALL (get_current_frame ()));
1166 step_resume_break_duplicate
1167 = breakpoint_here_p (step_resume_break_address);
1168 if (breakpoints_inserted)
1169 insert_step_breakpoint ();
1171 /* Subroutine call with source code we should not step over.
1172 Do step to the first line of code in it. */
1173 else if (step_over_calls)
1175 SKIP_PROLOGUE (stop_func_start);
1176 sal = find_pc_line (stop_func_start, 0);
1177 /* Use the step_resume_break to step until
1178 the end of the prologue, even if that involves jumps
1179 (as it seems to on the vax under 4.2). */
1180 /* If the prologue ends in the middle of a source line,
1181 continue to the end of that source line.
1182 Otherwise, just go to end of prologue. */
1183 #ifdef PROLOGUE_FIRSTLINE_OVERLAP
1184 /* no, don't either. It skips any code that's
1185 legitimately on the first line. */
1187 if (sal.end && sal.pc != stop_func_start)
1188 stop_func_start = sal.end;
1191 if (stop_func_start == stop_pc)
1193 /* We are already there: stop now. */
1198 /* Put the step-breakpoint there and go until there. */
1200 step_resume_break_address = stop_func_start;
1202 step_resume_break_duplicate
1203 = breakpoint_here_p (step_resume_break_address);
1204 if (breakpoints_inserted)
1205 insert_step_breakpoint ();
1206 /* Do not specify what the fp should be when we stop
1207 since on some machines the prologue
1208 is where the new fp value is established. */
1209 step_frame_address = 0;
1210 /* And make sure stepping stops right away then. */
1211 step_range_end = step_range_start;
1216 /* We get here only if step_over_calls is 0 and we
1217 just stepped into a subroutine. I presume
1218 that step_over_calls is only 0 when we're
1219 supposed to be stepping at the assembly
1225 /* No subroutince call; stop now. */
1233 else if (trap_expected
1234 && IN_SIGTRAMP (stop_pc, stop_func_name)
1235 && !IN_SIGTRAMP (prev_pc, prev_func_name))
1237 /* What has happened here is that we have just stepped the inferior
1238 with a signal (because it is a signal which shouldn't make
1239 us stop), thus stepping into sigtramp.
1241 So we need to set a step_resume_break_address breakpoint
1242 and continue until we hit it, and then step. */
1243 step_resume_break_address = prev_pc;
1244 /* Always 1, I think, but it's probably easier to have
1245 the step_resume_break as usual rather than trying to
1246 re-use the breakpoint which is already there. */
1247 step_resume_break_duplicate =
1248 breakpoint_here_p (step_resume_break_address);
1249 if (breakpoints_inserted)
1250 insert_step_breakpoint ();
1251 remove_breakpoints_on_following_step = 1;
1255 /* Save the pc before execution, to compare with pc after stop. */
1256 prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
1257 prev_func_start = stop_func_start; /* Ok, since if DECR_PC_AFTER
1258 BREAK is defined, the
1259 original pc would not have
1260 been at the start of a
1262 prev_func_name = stop_func_name;
1265 /* If we did not do break;, it means we should keep
1266 running the inferior and not return to debugger. */
1268 if (trap_expected && stop_signal != SIGTRAP)
1270 /* We took a signal (which we are supposed to pass through to
1271 the inferior, else we'd have done a break above) and we
1272 haven't yet gotten our trap. Simply continue. */
1273 resume ((step_range_end && !step_resume_break_address)
1274 || (trap_expected && !step_resume_break_address)
1275 || bpstat_should_step (),
1280 /* Either the trap was not expected, but we are continuing
1281 anyway (the user asked that this signal be passed to the
1284 The signal was SIGTRAP, e.g. it was our signal, but we
1285 decided we should resume from it.
1287 We're going to run this baby now!
1289 Insert breakpoints now, unless we are trying
1290 to one-proceed past a breakpoint. */
1291 /* If we've just finished a special step resume and we don't
1292 want to hit a breakpoint, pull em out. */
1297 safe_to_init_tdesc_context = 1;
1301 if (!step_resume_break_address &&
1302 remove_breakpoints_on_following_step)
1304 remove_breakpoints_on_following_step = 0;
1305 remove_breakpoints ();
1306 breakpoints_inserted = 0;
1308 else if (!breakpoints_inserted &&
1309 (step_resume_break_address != NULL || !another_trap))
1311 insert_step_breakpoint ();
1312 breakpoints_failed = insert_breakpoints ();
1313 if (breakpoints_failed)
1315 breakpoints_inserted = 1;
1318 trap_expected = another_trap;
1320 if (stop_signal == SIGTRAP)
1323 #ifdef SHIFT_INST_REGS
1324 /* I'm not sure when this following segment applies. I do know, now,
1325 that we shouldn't rewrite the regs when we were stopped by a
1326 random signal from the inferior process. */
1328 if (!bpstat_explains_signal (stop_bpstat)
1329 && (stop_signal != SIGCLD)
1330 && !stopped_by_random_signal)
1332 CORE_ADDR pc_contents = read_register (PC_REGNUM);
1333 CORE_ADDR npc_contents = read_register (NPC_REGNUM);
1334 if (pc_contents != npc_contents)
1336 write_register (NNPC_REGNUM, npc_contents);
1337 write_register (NPC_REGNUM, pc_contents);
1340 #endif /* SHIFT_INST_REGS */
1342 resume ((step_range_end && !step_resume_break_address)
1343 || (trap_expected && !step_resume_break_address)
1344 || bpstat_should_step (),
1348 if (target_has_execution)
1350 /* Assuming the inferior still exists, set these up for next
1351 time, just like we did above if we didn't break out of the
1353 prev_pc = read_pc ();
1354 prev_func_start = stop_func_start;
1355 prev_func_name = stop_func_name;
1360 /* Here to return control to GDB when the inferior stops for real.
1361 Print appropriate messages, remove breakpoints, give terminal our modes.
1363 STOP_PRINT_FRAME nonzero means print the executing frame
1364 (pc, function, args, file, line number and line text).
1365 BREAKPOINTS_FAILED nonzero means stop was due to error
1366 attempting to insert breakpoints. */
1371 /* Make sure that the current_frame's pc is correct. This
1372 is a correction for setting up the frame info before doing
1373 DECR_PC_AFTER_BREAK */
1374 if (target_has_execution)
1375 (get_current_frame ())->pc = read_pc ();
1377 if (breakpoints_failed)
1379 target_terminal_ours_for_output ();
1380 print_sys_errmsg ("ptrace", breakpoints_failed);
1381 printf ("Stopped; cannot insert breakpoints.\n\
1382 The same program may be running in another process.\n");
1385 if (target_has_execution)
1386 remove_step_breakpoint ();
1388 if (target_has_execution && breakpoints_inserted)
1389 if (remove_breakpoints ())
1391 target_terminal_ours_for_output ();
1392 printf ("Cannot remove breakpoints because program is no longer writable.\n\
1393 It might be running in another process.\n\
1394 Further execution is probably impossible.\n");
1397 breakpoints_inserted = 0;
1399 /* Delete the breakpoint we stopped at, if it wants to be deleted.
1400 Delete any breakpoint that is to be deleted at the next stop. */
1402 breakpoint_auto_delete (stop_bpstat);
1404 /* If an auto-display called a function and that got a signal,
1405 delete that auto-display to avoid an infinite recursion. */
1407 if (stopped_by_random_signal)
1408 disable_current_display ();
1410 if (step_multi && stop_step)
1413 target_terminal_ours ();
1415 if (!target_has_stack)
1418 /* Select innermost stack frame except on return from a stack dummy routine,
1419 or if the program has exited. Print it without a level number if
1420 we have changed functions or hit a breakpoint. Print source line
1422 if (!stop_stack_dummy)
1424 select_frame (get_current_frame (), 0);
1426 if (stop_print_frame)
1430 source_only = bpstat_print (stop_bpstat);
1431 source_only = source_only ||
1433 && step_frame_address == stop_frame_address
1434 && step_start_function == find_pc_function (stop_pc));
1436 print_stack_frame (selected_frame, -1, source_only? -1: 1);
1438 /* Display the auto-display expressions. */
1443 /* Save the function value return registers, if we care.
1444 We might be about to restore their previous contents. */
1445 if (proceed_to_finish)
1446 read_register_bytes (0, stop_registers, REGISTER_BYTES);
1448 if (stop_stack_dummy)
1450 /* Pop the empty frame that contains the stack dummy.
1451 POP_FRAME ends with a setting of the current frame, so we
1452 can use that next. */
1454 select_frame (get_current_frame (), 0);
1459 insert_step_breakpoint ()
1461 if (step_resume_break_address && !step_resume_break_duplicate)
1462 target_insert_breakpoint (step_resume_break_address,
1463 step_resume_break_shadow);
1467 remove_step_breakpoint ()
1469 if (step_resume_break_address && !step_resume_break_duplicate)
1470 target_remove_breakpoint (step_resume_break_address,
1471 step_resume_break_shadow);
1477 printf_filtered ("Signal\t\tStop\tPrint\tPass to program\tDescription\n");
1481 sig_print_info (number)
1484 char *abbrev = sig_abbrev(number);
1486 printf_filtered ("%d\t\t", number);
1488 printf_filtered ("SIG%s (%d)\t", abbrev, number);
1489 printf_filtered ("%s\t", signal_stop[number] ? "Yes" : "No");
1490 printf_filtered ("%s\t", signal_print[number] ? "Yes" : "No");
1491 printf_filtered ("%s\t\t", signal_program[number] ? "Yes" : "No");
1492 printf_filtered ("%s\n", sys_siglist[number]);
1495 /* Specify how various signals in the inferior should be handled. */
1498 handle_command (args, from_tty)
1502 register char *p = args;
1504 register int digits, wordlen;
1508 error_no_arg ("signal to handle");
1512 /* Find the end of the next word in the args. */
1514 p[wordlen] && p[wordlen] != ' ' && p[wordlen] != '\t';
1516 /* Set nextarg to the start of the word after the one we just
1517 found, and null-terminate this one. */
1518 if (p[wordlen] == '\0')
1519 nextarg = p + wordlen;
1523 nextarg = p + wordlen + 1;
1527 for (digits = 0; p[digits] >= '0' && p[digits] <= '9'; digits++);
1531 /* It is the first argument--must be the signal to operate on. */
1532 if (digits == wordlen)
1536 if (signum <= 0 || signum >= NSIG)
1539 error ("Invalid signal %s given as argument to \"handle\".", p);
1545 signum = sig_number (p);
1547 error ("No such signal \"%s\"", p);
1550 if (signum == SIGTRAP || signum == SIGINT)
1552 if (!query ("SIG%s is used by the debugger.\nAre you sure you want to change it? ", sig_abbrev (signum)))
1553 error ("Not confirmed.");
1556 /* Else, if already got a signal number, look for flag words
1557 saying what to do for it. */
1558 else if (!strncmp (p, "stop", wordlen))
1560 signal_stop[signum] = 1;
1561 signal_print[signum] = 1;
1563 else if (wordlen >= 2 && !strncmp (p, "print", wordlen))
1564 signal_print[signum] = 1;
1565 else if (wordlen >= 2 && !strncmp (p, "pass", wordlen))
1566 signal_program[signum] = 1;
1567 else if (!strncmp (p, "ignore", wordlen))
1568 signal_program[signum] = 0;
1569 else if (wordlen >= 3 && !strncmp (p, "nostop", wordlen))
1570 signal_stop[signum] = 0;
1571 else if (wordlen >= 4 && !strncmp (p, "noprint", wordlen))
1573 signal_print[signum] = 0;
1574 signal_stop[signum] = 0;
1576 else if (wordlen >= 4 && !strncmp (p, "nopass", wordlen))
1577 signal_program[signum] = 0;
1578 else if (wordlen >= 3 && !strncmp (p, "noignore", wordlen))
1579 signal_program[signum] = 1;
1580 /* Not a number and not a recognized flag word => complain. */
1583 error ("Unrecognized flag word: \"%s\".", p);
1586 /* Find start of next word. */
1588 while (*p == ' ' || *p == '\t') p++;
1593 /* Show the results. */
1594 sig_print_header ();
1595 sig_print_info (signum);
1599 /* Print current contents of the tables set by the handle command. */
1602 signals_info (signum_exp)
1606 sig_print_header ();
1610 /* First see if this is a symbol name. */
1611 i = sig_number (signum_exp);
1614 /* Nope, maybe it's an address which evaluates to a signal
1616 i = parse_and_eval_address (signum_exp);
1617 if (i >= NSIG || i < 0)
1618 error ("Signal number out of bounds.");
1624 printf_filtered ("\n");
1625 for (i = 0; i < NSIG; i++)
1632 printf_filtered ("\nUse the \"handle\" command to change these tables.\n");
1635 /* Save all of the information associated with the inferior<==>gdb
1636 connection. INF_STATUS is a pointer to a "struct inferior_status"
1637 (defined in inferior.h). */
1640 save_inferior_status (inf_status, restore_stack_info)
1641 struct inferior_status *inf_status;
1642 int restore_stack_info;
1644 inf_status->pc_changed = pc_changed;
1645 inf_status->stop_signal = stop_signal;
1646 inf_status->stop_pc = stop_pc;
1647 inf_status->stop_frame_address = stop_frame_address;
1648 inf_status->stop_step = stop_step;
1649 inf_status->stop_stack_dummy = stop_stack_dummy;
1650 inf_status->stopped_by_random_signal = stopped_by_random_signal;
1651 inf_status->trap_expected = trap_expected;
1652 inf_status->step_range_start = step_range_start;
1653 inf_status->step_range_end = step_range_end;
1654 inf_status->step_frame_address = step_frame_address;
1655 inf_status->step_over_calls = step_over_calls;
1656 inf_status->step_resume_break_address = step_resume_break_address;
1657 inf_status->stop_after_trap = stop_after_trap;
1658 inf_status->stop_soon_quietly = stop_soon_quietly;
1659 /* Save original bpstat chain here; replace it with copy of chain.
1660 If caller's caller is walking the chain, they'll be happier if we
1661 hand them back the original chain when restore_i_s is called. */
1662 inf_status->stop_bpstat = stop_bpstat;
1663 stop_bpstat = bpstat_copy (stop_bpstat);
1664 inf_status->breakpoint_proceeded = breakpoint_proceeded;
1665 inf_status->restore_stack_info = restore_stack_info;
1666 inf_status->proceed_to_finish = proceed_to_finish;
1668 bcopy (stop_registers, inf_status->stop_registers, REGISTER_BYTES);
1670 record_selected_frame (&(inf_status->selected_frame_address),
1671 &(inf_status->selected_level));
1676 restore_inferior_status (inf_status)
1677 struct inferior_status *inf_status;
1680 int level = inf_status->selected_level;
1682 pc_changed = inf_status->pc_changed;
1683 stop_signal = inf_status->stop_signal;
1684 stop_pc = inf_status->stop_pc;
1685 stop_frame_address = inf_status->stop_frame_address;
1686 stop_step = inf_status->stop_step;
1687 stop_stack_dummy = inf_status->stop_stack_dummy;
1688 stopped_by_random_signal = inf_status->stopped_by_random_signal;
1689 trap_expected = inf_status->trap_expected;
1690 step_range_start = inf_status->step_range_start;
1691 step_range_end = inf_status->step_range_end;
1692 step_frame_address = inf_status->step_frame_address;
1693 step_over_calls = inf_status->step_over_calls;
1694 step_resume_break_address = inf_status->step_resume_break_address;
1695 stop_after_trap = inf_status->stop_after_trap;
1696 stop_soon_quietly = inf_status->stop_soon_quietly;
1697 bpstat_clear (&stop_bpstat);
1698 stop_bpstat = inf_status->stop_bpstat;
1699 breakpoint_proceeded = inf_status->breakpoint_proceeded;
1700 proceed_to_finish = inf_status->proceed_to_finish;
1702 bcopy (inf_status->stop_registers, stop_registers, REGISTER_BYTES);
1704 /* The inferior can be gone if the user types "print exit(0)"
1705 (and perhaps other times). */
1706 if (target_has_stack && inf_status->restore_stack_info)
1708 fid = find_relative_frame (get_current_frame (),
1711 /* If inf_status->selected_frame_address is NULL, there was no
1712 previously selected frame. */
1714 FRAME_FP (fid) != inf_status->selected_frame_address ||
1718 /* I'm not sure this error message is a good idea. I have
1719 only seen it occur after "Can't continue previously
1720 requested operation" (we get called from do_cleanups), in
1721 which case it just adds insult to injury (one confusing
1722 error message after another. Besides which, does the
1723 user really care if we can't restore the previously
1725 fprintf (stderr, "Unable to restore previously selected frame.\n");
1727 select_frame (get_current_frame (), 0);
1731 select_frame (fid, inf_status->selected_level);
1737 _initialize_infrun ()
1741 add_info ("signals", signals_info,
1742 "What debugger does when program gets various signals.\n\
1743 Specify a signal number as argument to print info on that signal only.");
1745 add_com ("handle", class_run, handle_command,
1746 "Specify how to handle a signal.\n\
1747 Args are signal number followed by flags.\n\
1748 Flags allowed are \"stop\", \"print\", \"pass\",\n\
1749 \"nostop\", \"noprint\" or \"nopass\".\n\
1750 Print means print a message if this signal happens.\n\
1751 Stop means reenter debugger if this signal happens (implies print).\n\
1752 Pass means let program see this signal; otherwise program doesn't know.\n\
1753 Pass and Stop may be combined.");
1755 for (i = 0; i < NSIG; i++)
1758 signal_print[i] = 1;
1759 signal_program[i] = 1;
1762 /* Signals caused by debugger's own actions
1763 should not be given to the program afterwards. */
1764 signal_program[SIGTRAP] = 0;
1765 signal_program[SIGINT] = 0;
1767 /* Signals that are not errors should not normally enter the debugger. */
1769 signal_stop[SIGALRM] = 0;
1770 signal_print[SIGALRM] = 0;
1771 #endif /* SIGALRM */
1773 signal_stop[SIGVTALRM] = 0;
1774 signal_print[SIGVTALRM] = 0;
1775 #endif /* SIGVTALRM */
1777 signal_stop[SIGPROF] = 0;
1778 signal_print[SIGPROF] = 0;
1779 #endif /* SIGPROF */
1781 signal_stop[SIGCHLD] = 0;
1782 signal_print[SIGCHLD] = 0;
1783 #endif /* SIGCHLD */
1785 signal_stop[SIGCLD] = 0;
1786 signal_print[SIGCLD] = 0;
1789 signal_stop[SIGIO] = 0;
1790 signal_print[SIGIO] = 0;
1793 signal_stop[SIGURG] = 0;
1794 signal_print[SIGURG] = 0;