1 /* Target-struct-independent code to start (run) and stop an inferior process.
2 Copyright 1986, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 1998
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 #include "gdb_string.h"
27 #include "breakpoint.h"
32 #include "gdbthread.h"
34 #include "symfile.h" /* for overlay functions */
38 /* Prototypes for local functions */
40 static void signals_info
PARAMS ((char *, int));
42 static void handle_command
PARAMS ((char *, int));
44 static void sig_print_info
PARAMS ((enum target_signal
));
46 static void sig_print_header
PARAMS ((void));
48 static void resume_cleanups
PARAMS ((int));
50 static int hook_stop_stub
PARAMS ((char *));
52 static void delete_breakpoint_current_contents
PARAMS ((PTR
));
54 void _initialize_infrun
PARAMS ((void));
56 /* GET_LONGJMP_TARGET returns the PC at which longjmp() will resume the
57 program. It needs to examine the jmp_buf argument and extract the PC
58 from it. The return value is non-zero on success, zero otherwise. */
60 #ifndef GET_LONGJMP_TARGET
61 #define GET_LONGJMP_TARGET(PC_ADDR) 0
65 /* Some machines have trampoline code that sits between function callers
66 and the actual functions themselves. If this machine doesn't have
67 such things, disable their processing. */
69 #ifndef SKIP_TRAMPOLINE_CODE
70 #define SKIP_TRAMPOLINE_CODE(pc) 0
73 /* Dynamic function trampolines are similar to solib trampolines in that they
74 are between the caller and the callee. The difference is that when you
75 enter a dynamic trampoline, you can't determine the callee's address. Some
76 (usually complex) code needs to run in the dynamic trampoline to figure out
77 the callee's address. This macro is usually called twice. First, when we
78 enter the trampoline (looks like a normal function call at that point). It
79 should return the PC of a point within the trampoline where the callee's
80 address is known. Second, when we hit the breakpoint, this routine returns
81 the callee's address. At that point, things proceed as per a step resume
84 #ifndef DYNAMIC_TRAMPOLINE_NEXTPC
85 #define DYNAMIC_TRAMPOLINE_NEXTPC(pc) 0
88 /* On SVR4 based systems, determining the callee's address is exceedingly
89 difficult and depends on the implementation of the run time loader.
90 If we are stepping at the source level, we single step until we exit
91 the run time loader code and reach the callee's address. */
93 #ifndef IN_SOLIB_DYNSYM_RESOLVE_CODE
94 #define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) 0
97 /* For SVR4 shared libraries, each call goes through a small piece of
98 trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates
99 to nonzero if we are current stopped in one of these. */
101 #ifndef IN_SOLIB_CALL_TRAMPOLINE
102 #define IN_SOLIB_CALL_TRAMPOLINE(pc,name) 0
105 /* In some shared library schemes, the return path from a shared library
106 call may need to go through a trampoline too. */
108 #ifndef IN_SOLIB_RETURN_TRAMPOLINE
109 #define IN_SOLIB_RETURN_TRAMPOLINE(pc,name) 0
112 /* On MIPS16, a function that returns a floating point value may call
113 a library helper function to copy the return value to a floating point
114 register. The IGNORE_HELPER_CALL macro returns non-zero if we
115 should ignore (i.e. step over) this function call. */
116 #ifndef IGNORE_HELPER_CALL
117 #define IGNORE_HELPER_CALL(pc) 0
120 /* On some systems, the PC may be left pointing at an instruction that won't
121 actually be executed. This is usually indicated by a bit in the PSW. If
122 we find ourselves in such a state, then we step the target beyond the
123 nullified instruction before returning control to the user so as to avoid
126 #ifndef INSTRUCTION_NULLIFIED
127 #define INSTRUCTION_NULLIFIED 0
130 /* Tables of how to react to signals; the user sets them. */
132 static unsigned char *signal_stop
;
133 static unsigned char *signal_print
;
134 static unsigned char *signal_program
;
136 #define SET_SIGS(nsigs,sigs,flags) \
138 int signum = (nsigs); \
139 while (signum-- > 0) \
140 if ((sigs)[signum]) \
141 (flags)[signum] = 1; \
144 #define UNSET_SIGS(nsigs,sigs,flags) \
146 int signum = (nsigs); \
147 while (signum-- > 0) \
148 if ((sigs)[signum]) \
149 (flags)[signum] = 0; \
153 /* Command list pointer for the "stop" placeholder. */
155 static struct cmd_list_element
*stop_command
;
157 /* Nonzero if breakpoints are now inserted in the inferior. */
159 static int breakpoints_inserted
;
161 /* Function inferior was in as of last step command. */
163 static struct symbol
*step_start_function
;
165 /* Nonzero if we are expecting a trace trap and should proceed from it. */
167 static int trap_expected
;
170 /* Nonzero if we want to give control to the user when we're notified
171 of shared library events by the dynamic linker. */
172 static int stop_on_solib_events
;
176 /* Nonzero if the next time we try to continue the inferior, it will
177 step one instruction and generate a spurious trace trap.
178 This is used to compensate for a bug in HP-UX. */
180 static int trap_expected_after_continue
;
183 /* Nonzero means expecting a trace trap
184 and should stop the inferior and return silently when it happens. */
188 /* Nonzero means expecting a trap and caller will handle it themselves.
189 It is used after attach, due to attaching to a process;
190 when running in the shell before the child program has been exec'd;
191 and when running some kinds of remote stuff (FIXME?). */
193 int stop_soon_quietly
;
195 /* Nonzero if proceed is being used for a "finish" command or a similar
196 situation when stop_registers should be saved. */
198 int proceed_to_finish
;
200 /* Save register contents here when about to pop a stack dummy frame,
201 if-and-only-if proceed_to_finish is set.
202 Thus this contains the return value from the called function (assuming
203 values are returned in a register). */
205 char stop_registers
[REGISTER_BYTES
];
207 /* Nonzero if program stopped due to error trying to insert breakpoints. */
209 static int breakpoints_failed
;
211 /* Nonzero after stop if current stack frame should be printed. */
213 static int stop_print_frame
;
215 /* Non-zero if we just simulating a single-step. This is needed
216 because we cannot remove the breakpoints in the inferior process
217 until after the `wait' in `wait_for_inferior'. */
218 static int singlestep_breakpoints_inserted_p
= 0;
221 /* Things to clean up if we QUIT out of resume (). */
224 resume_cleanups (arg
)
230 /* Resume the inferior, but allow a QUIT. This is useful if the user
231 wants to interrupt some lengthy single-stepping operation
232 (for child processes, the SIGINT goes to the inferior, and so
233 we get a SIGINT random_signal, but for remote debugging and perhaps
234 other targets, that's not true).
236 STEP nonzero if we should step (zero to continue instead).
237 SIG is the signal to give the inferior (zero for none). */
241 enum target_signal sig
;
243 struct cleanup
*old_cleanups
= make_cleanup ((make_cleanup_func
)
247 #ifdef CANNOT_STEP_BREAKPOINT
248 /* Most targets can step a breakpoint instruction, thus executing it
249 normally. But if this one cannot, just continue and we will hit
251 if (step
&& breakpoints_inserted
&& breakpoint_here_p (read_pc ()))
255 if (SOFTWARE_SINGLE_STEP_P
&& step
)
257 /* Do it the hard way, w/temp breakpoints */
258 SOFTWARE_SINGLE_STEP (sig
, 1 /*insert-breakpoints*/);
259 /* ...and don't ask hardware to do it. */
261 /* and do not pull these breakpoints until after a `wait' in
262 `wait_for_inferior' */
263 singlestep_breakpoints_inserted_p
= 1;
266 /* Handle any optimized stores to the inferior NOW... */
267 #ifdef DO_DEFERRED_STORES
271 /* Install inferior's terminal modes. */
272 target_terminal_inferior ();
274 target_resume (-1, step
, sig
);
275 discard_cleanups (old_cleanups
);
279 /* Clear out all variables saying what to do when inferior is continued.
280 First do this, then set the ones you want, then call `proceed'. */
283 clear_proceed_status ()
286 step_range_start
= 0;
288 step_frame_address
= 0;
289 step_over_calls
= -1;
291 stop_soon_quietly
= 0;
292 proceed_to_finish
= 0;
293 breakpoint_proceeded
= 1; /* We're about to proceed... */
295 /* Discard any remaining commands or status from previous stop. */
296 bpstat_clear (&stop_bpstat
);
299 /* Basic routine for continuing the program in various fashions.
301 ADDR is the address to resume at, or -1 for resume where stopped.
302 SIGGNAL is the signal to give it, or 0 for none,
303 or -1 for act according to how it stopped.
304 STEP is nonzero if should trap after one instruction.
305 -1 means return after that and print nothing.
306 You should probably set various step_... variables
307 before calling here, if you are stepping.
309 You should call clear_proceed_status before calling proceed. */
312 proceed (addr
, siggnal
, step
)
314 enum target_signal siggnal
;
320 step_start_function
= find_pc_function (read_pc ());
324 if (addr
== (CORE_ADDR
)-1)
326 /* If there is a breakpoint at the address we will resume at,
327 step one instruction before inserting breakpoints
328 so that we do not stop right away. */
330 if (read_pc () == stop_pc
&& breakpoint_here_p (read_pc ()))
333 #ifndef STEP_SKIPS_DELAY
334 #define STEP_SKIPS_DELAY(pc) (0)
335 #define STEP_SKIPS_DELAY_P (0)
337 /* Check breakpoint_here_p first, because breakpoint_here_p is fast
338 (it just checks internal GDB data structures) and STEP_SKIPS_DELAY
339 is slow (it needs to read memory from the target). */
340 if (STEP_SKIPS_DELAY_P
341 && breakpoint_here_p (read_pc () + 4)
342 && STEP_SKIPS_DELAY (read_pc ()))
348 #ifdef PREPARE_TO_PROCEED
349 /* In a multi-threaded task we may select another thread and then continue.
351 In this case the thread that stopped at a breakpoint will immediately
352 cause another stop, if it is not stepped over first. On the other hand,
353 if (ADDR != -1) we only want to single step over the breakpoint if we did
354 switch to another thread.
356 If we are single stepping, don't do any of the above.
357 (Note that in the current implementation single stepping another
358 thread after a breakpoint and then continuing will cause the original
359 breakpoint to be hit again, but you can always continue, so it's not
362 if (! step
&& PREPARE_TO_PROCEED (1) && breakpoint_here_p (read_pc ()))
364 #endif /* PREPARE_TO_PROCEED */
367 if (trap_expected_after_continue
)
369 /* If (step == 0), a trap will be automatically generated after
370 the first instruction is executed. Force step one
371 instruction to clear this condition. This should not occur
372 if step is nonzero, but it is harmless in that case. */
374 trap_expected_after_continue
= 0;
376 #endif /* HP_OS_BUG */
379 /* We will get a trace trap after one instruction.
380 Continue it automatically and insert breakpoints then. */
384 int temp
= insert_breakpoints ();
387 print_sys_errmsg ("ptrace", temp
);
388 error ("Cannot insert breakpoints.\n\
389 The same program may be running in another process.");
391 breakpoints_inserted
= 1;
394 if (siggnal
!= TARGET_SIGNAL_DEFAULT
)
395 stop_signal
= siggnal
;
396 /* If this signal should not be seen by program,
397 give it zero. Used for debugging signals. */
398 else if (!signal_program
[stop_signal
])
399 stop_signal
= TARGET_SIGNAL_0
;
401 annotate_starting ();
403 /* Make sure that output from GDB appears before output from the
405 gdb_flush (gdb_stdout
);
407 /* Resume inferior. */
408 resume (oneproc
|| step
|| bpstat_should_step (), stop_signal
);
410 /* Wait for it to stop (if not standalone)
411 and in any case decode why it stopped, and act accordingly. */
413 wait_for_inferior ();
417 /* Record the pc and sp of the program the last time it stopped.
418 These are just used internally by wait_for_inferior, but need
419 to be preserved over calls to it and cleared when the inferior
421 static CORE_ADDR prev_pc
;
422 static CORE_ADDR prev_func_start
;
423 static char *prev_func_name
;
426 /* Start remote-debugging of a machine over a serial link. */
432 init_wait_for_inferior ();
433 clear_proceed_status ();
434 stop_soon_quietly
= 1;
436 wait_for_inferior ();
440 /* Initialize static vars when a new inferior begins. */
443 init_wait_for_inferior ()
445 /* These are meaningless until the first time through wait_for_inferior. */
448 prev_func_name
= NULL
;
451 trap_expected_after_continue
= 0;
453 breakpoints_inserted
= 0;
454 breakpoint_init_inferior ();
456 /* Don't confuse first call to proceed(). */
457 stop_signal
= TARGET_SIGNAL_0
;
461 delete_breakpoint_current_contents (arg
)
464 struct breakpoint
**breakpointp
= (struct breakpoint
**)arg
;
465 if (*breakpointp
!= NULL
)
466 delete_breakpoint (*breakpointp
);
469 /* Wait for control to return from inferior to debugger.
470 If inferior gets a signal, we may decide to start it up again
471 instead of returning. That is why there is a loop in this function.
472 When this function actually returns it means the inferior
473 should be left stopped and GDB should read more commands. */
478 struct cleanup
*old_cleanups
;
479 struct target_waitstatus w
;
481 int random_signal
= 0;
482 CORE_ADDR stop_func_start
;
483 CORE_ADDR stop_func_end
;
484 char *stop_func_name
;
486 CORE_ADDR prologue_pc
= 0;
489 struct symtab_and_line sal
;
490 int remove_breakpoints_on_following_step
= 0;
492 struct symtab
*current_symtab
;
493 int handling_longjmp
= 0; /* FIXME */
494 struct breakpoint
*step_resume_breakpoint
= NULL
;
495 struct breakpoint
*through_sigtramp_breakpoint
= NULL
;
497 int update_step_sp
= 0;
499 old_cleanups
= make_cleanup (delete_breakpoint_current_contents
,
500 &step_resume_breakpoint
);
501 make_cleanup (delete_breakpoint_current_contents
,
502 &through_sigtramp_breakpoint
);
503 sal
= find_pc_line(prev_pc
, 0);
504 current_line
= sal
.line
;
505 current_symtab
= sal
.symtab
;
507 /* Are we stepping? */
508 #define CURRENTLY_STEPPING() \
509 ((through_sigtramp_breakpoint == NULL \
510 && !handling_longjmp \
511 && ((step_range_end && step_resume_breakpoint == NULL) \
513 || bpstat_should_step ())
517 extern int overlay_cache_invalid
; /* declared in symfile.h */
519 overlay_cache_invalid
= 1;
521 /* We have to invalidate the registers BEFORE calling target_wait because
522 they can be loaded from the target while in target_wait. This makes
523 remote debugging a bit more efficient for those targets that provide
524 critical registers as part of their normal status mechanism. */
526 registers_changed ();
528 if (target_wait_hook
)
529 pid
= target_wait_hook (-1, &w
);
531 pid
= target_wait (-1, &w
);
535 We goto this label from elsewhere in wait_for_inferior when we want
536 to continue the main loop without calling "wait" and trashing the
537 waitstatus contained in W. */
540 flush_cached_frames ();
542 /* If it's a new process, add it to the thread database */
544 if (w
.kind
!= TARGET_WAITKIND_EXITED
545 && w
.kind
!= TARGET_WAITKIND_SIGNALLED
546 && pid
!= inferior_pid
547 && !in_thread_list (pid
))
550 printf_filtered ("[New %s]\n", target_pid_to_str (pid
));
552 /* We may want to consider not doing a resume here in order to give
553 the user a chance to play with the new thread. It might be good
554 to make that a user-settable option. */
556 /* At this point, all threads are stopped (happens automatically in
557 either the OS or the native code). Therefore we need to continue
558 all threads in order to make progress. */
560 target_resume (-1, 0, TARGET_SIGNAL_0
);
566 case TARGET_WAITKIND_LOADED
:
567 /* Ignore gracefully during startup of the inferior, as it
568 might be the shell which has just loaded some objects,
569 otherwise add the symbols for the newly loaded objects. */
571 if (!stop_soon_quietly
)
573 extern int auto_solib_add
;
575 /* Remove breakpoints, SOLIB_ADD might adjust
576 breakpoint addresses via breakpoint_re_set. */
577 if (breakpoints_inserted
)
578 remove_breakpoints ();
580 /* Check for any newly added shared libraries if we're
581 supposed to be adding them automatically. */
584 /* Switch terminal for any messages produced by
585 breakpoint_re_set. */
586 target_terminal_ours_for_output ();
587 SOLIB_ADD (NULL
, 0, NULL
);
588 target_terminal_inferior ();
591 /* Reinsert breakpoints and continue. */
592 if (breakpoints_inserted
)
593 insert_breakpoints ();
596 resume (0, TARGET_SIGNAL_0
);
599 case TARGET_WAITKIND_SPURIOUS
:
600 resume (0, TARGET_SIGNAL_0
);
603 case TARGET_WAITKIND_EXITED
:
604 target_terminal_ours (); /* Must do this before mourn anyway */
605 annotate_exited (w
.value
.integer
);
607 printf_filtered ("\nProgram exited with code 0%o.\n",
608 (unsigned int)w
.value
.integer
);
610 printf_filtered ("\nProgram exited normally.\n");
612 /* Record the exit code in the convenience variable $_exitcode, so
613 that the user can inspect this again later. */
614 set_internalvar (lookup_internalvar ("_exitcode"),
615 value_from_longest (builtin_type_int
,
616 (LONGEST
) w
.value
.integer
));
617 gdb_flush (gdb_stdout
);
618 target_mourn_inferior ();
619 singlestep_breakpoints_inserted_p
= 0; /*SOFTWARE_SINGLE_STEP_P*/
620 stop_print_frame
= 0;
623 case TARGET_WAITKIND_SIGNALLED
:
624 stop_print_frame
= 0;
625 stop_signal
= w
.value
.sig
;
626 target_terminal_ours (); /* Must do this before mourn anyway */
627 annotate_signalled ();
629 /* This looks pretty bogus to me. Doesn't TARGET_WAITKIND_SIGNALLED
630 mean it is already dead? This has been here since GDB 2.8, so
631 perhaps it means rms didn't understand unix waitstatuses?
632 For the moment I'm just kludging around this in remote.c
633 rather than trying to change it here --kingdon, 5 Dec 1994. */
634 target_kill (); /* kill mourns as well */
636 printf_filtered ("\nProgram terminated with signal ");
637 annotate_signal_name ();
638 printf_filtered ("%s", target_signal_to_name (stop_signal
));
639 annotate_signal_name_end ();
640 printf_filtered (", ");
641 annotate_signal_string ();
642 printf_filtered ("%s", target_signal_to_string (stop_signal
));
643 annotate_signal_string_end ();
644 printf_filtered (".\n");
646 printf_filtered ("The program no longer exists.\n");
647 gdb_flush (gdb_stdout
);
648 singlestep_breakpoints_inserted_p
= 0; /*SOFTWARE_SINGLE_STEP_P*/
651 case TARGET_WAITKIND_STOPPED
:
652 /* This is the only case in which we keep going; the above cases
653 end in a continue or goto. */
657 stop_signal
= w
.value
.sig
;
659 stop_pc
= read_pc_pid (pid
);
661 /* See if a thread hit a thread-specific breakpoint that was meant for
662 another thread. If so, then step that thread past the breakpoint,
665 if (stop_signal
== TARGET_SIGNAL_TRAP
)
667 if (SOFTWARE_SINGLE_STEP_P
&& singlestep_breakpoints_inserted_p
)
670 if (breakpoints_inserted
671 && breakpoint_here_p (stop_pc
- DECR_PC_AFTER_BREAK
))
674 if (!breakpoint_thread_match (stop_pc
- DECR_PC_AFTER_BREAK
, pid
))
676 /* Saw a breakpoint, but it was hit by the wrong thread. Just continue. */
677 write_pc_pid (stop_pc
- DECR_PC_AFTER_BREAK
, pid
);
679 remove_breakpoints ();
680 target_resume (pid
, 1, TARGET_SIGNAL_0
); /* Single step */
681 /* FIXME: What if a signal arrives instead of the single-step
684 if (target_wait_hook
)
685 target_wait_hook (pid
, &w
);
687 target_wait (pid
, &w
);
688 insert_breakpoints ();
690 /* We need to restart all the threads now. */
691 target_resume (-1, 0, TARGET_SIGNAL_0
);
699 /* See if something interesting happened to the non-current thread. If
700 so, then switch to that thread, and eventually give control back to
703 if (pid
!= inferior_pid
)
707 /* If it's a random signal for a non-current thread, notify user
708 if he's expressed an interest. */
711 && signal_print
[stop_signal
])
714 target_terminal_ours_for_output ();
715 printf_filtered ("\nProgram received signal %s, %s.\n",
716 target_signal_to_name (stop_signal
),
717 target_signal_to_string (stop_signal
));
718 gdb_flush (gdb_stdout
);
721 /* If it's not SIGTRAP and not a signal we want to stop for, then
722 continue the thread. */
724 if (stop_signal
!= TARGET_SIGNAL_TRAP
725 && !signal_stop
[stop_signal
])
728 target_terminal_inferior ();
730 /* Clear the signal if it should not be passed. */
731 if (signal_program
[stop_signal
] == 0)
732 stop_signal
= TARGET_SIGNAL_0
;
734 target_resume (pid
, 0, stop_signal
);
738 /* It's a SIGTRAP or a signal we're interested in. Switch threads,
739 and fall into the rest of wait_for_inferior(). */
741 /* Save infrun state for the old thread. */
742 save_infrun_state (inferior_pid
, prev_pc
,
743 prev_func_start
, prev_func_name
,
744 trap_expected
, step_resume_breakpoint
,
745 through_sigtramp_breakpoint
,
746 step_range_start
, step_range_end
,
747 step_frame_address
, handling_longjmp
,
752 /* Load infrun state for the new thread. */
753 load_infrun_state (inferior_pid
, &prev_pc
,
754 &prev_func_start
, &prev_func_name
,
755 &trap_expected
, &step_resume_breakpoint
,
756 &through_sigtramp_breakpoint
,
757 &step_range_start
, &step_range_end
,
758 &step_frame_address
, &handling_longjmp
,
762 context_hook (pid_to_thread_id (pid
));
764 printf_filtered ("[Switching to %s]\n", target_pid_to_str (pid
));
765 flush_cached_frames ();
768 if (SOFTWARE_SINGLE_STEP_P
&& singlestep_breakpoints_inserted_p
)
770 /* Pull the single step breakpoints out of the target. */
771 SOFTWARE_SINGLE_STEP (0, 0);
772 singlestep_breakpoints_inserted_p
= 0;
775 /* If PC is pointing at a nullified instruction, then step beyond
776 it so that the user won't be confused when GDB appears to be ready
779 if (INSTRUCTION_NULLIFIED
)
781 struct target_waitstatus tmpstatus
;
783 registers_changed ();
784 target_resume (pid
, 1, TARGET_SIGNAL_0
);
786 /* We may have received a signal that we want to pass to
787 the inferior; therefore, we must not clobber the waitstatus
788 in W. So we call wait ourselves, then continue the loop
789 at the "have_waited" label. */
790 if (target_wait_hook
)
791 target_wait_hook (pid
, &tmpstatus
);
793 target_wait (pid
, &tmpstatus
);
799 #ifdef HAVE_STEPPABLE_WATCHPOINT
800 /* It may not be necessary to disable the watchpoint to stop over
801 it. For example, the PA can (with some kernel cooperation)
802 single step over a watchpoint without disabling the watchpoint. */
803 if (STOPPED_BY_WATCHPOINT (w
))
810 #ifdef HAVE_NONSTEPPABLE_WATCHPOINT
811 /* It is far more common to need to disable a watchpoint
812 to step the inferior over it. FIXME. What else might
813 a debug register or page protection watchpoint scheme need
815 if (STOPPED_BY_WATCHPOINT (w
))
817 /* At this point, we are stopped at an instruction which has attempted to write
818 to a piece of memory under control of a watchpoint. The instruction hasn't
819 actually executed yet. If we were to evaluate the watchpoint expression
820 now, we would get the old value, and therefore no change would seem to have
823 In order to make watchpoints work `right', we really need to complete the
824 memory write, and then evaluate the watchpoint expression. The following
825 code does that by removing the watchpoint (actually, all watchpoints and
826 breakpoints), single-stepping the target, re-inserting watchpoints, and then
827 falling through to let normal single-step processing handle proceed. Since
828 this includes evaluating watchpoints, things will come to a stop in the
831 write_pc (stop_pc
- DECR_PC_AFTER_BREAK
);
833 remove_breakpoints ();
835 target_resume (pid
, 1, TARGET_SIGNAL_0
); /* Single step */
837 if (target_wait_hook
)
838 target_wait_hook (pid
, &w
);
840 target_wait (pid
, &w
);
841 insert_breakpoints ();
842 /* FIXME-maybe: is this cleaner than setting a flag? Does it
843 handle things like signals arriving and other things happening
844 in combination correctly? */
849 #ifdef HAVE_CONTINUABLE_WATCHPOINT
850 /* It may be possible to simply continue after a watchpoint. */
851 STOPPED_BY_WATCHPOINT (w
);
857 /* Don't care about return value; stop_func_start and stop_func_name
858 will both be 0 if it doesn't work. */
859 find_pc_partial_function (stop_pc
, &stop_func_name
, &stop_func_start
,
861 stop_func_start
+= FUNCTION_START_OFFSET
;
863 bpstat_clear (&stop_bpstat
);
865 stop_stack_dummy
= 0;
866 stop_print_frame
= 1;
868 stopped_by_random_signal
= 0;
869 breakpoints_failed
= 0;
871 /* Look at the cause of the stop, and decide what to do.
872 The alternatives are:
873 1) break; to really stop and return to the debugger,
874 2) drop through to start up again
875 (set another_trap to 1 to single step once)
876 3) set random_signal to 1, and the decision between 1 and 2
877 will be made according to the signal handling tables. */
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
== TARGET_SIGNAL_TRAP
887 || (breakpoints_inserted
&&
888 (stop_signal
== TARGET_SIGNAL_ILL
889 || stop_signal
== TARGET_SIGNAL_EMT
891 || stop_soon_quietly
)
893 if (stop_signal
== TARGET_SIGNAL_TRAP
&& stop_after_trap
)
895 stop_print_frame
= 0;
898 if (stop_soon_quietly
)
901 /* Don't even think about breakpoints
902 if just proceeded over a breakpoint.
904 However, if we are trying to proceed over a breakpoint
905 and end up in sigtramp, then through_sigtramp_breakpoint
906 will be set and we should check whether we've hit the
908 if (stop_signal
== TARGET_SIGNAL_TRAP
&& trap_expected
909 && through_sigtramp_breakpoint
== NULL
)
910 bpstat_clear (&stop_bpstat
);
913 /* See if there is a breakpoint at the current PC. */
914 stop_bpstat
= bpstat_stop_status
916 (DECR_PC_AFTER_BREAK
?
917 /* Notice the case of stepping through a jump
918 that lands just after a breakpoint.
919 Don't confuse that with hitting the breakpoint.
920 What we check for is that 1) stepping is going on
921 and 2) the pc before the last insn does not match
922 the address of the breakpoint before the current pc
923 and 3) we didn't hit a breakpoint in a signal handler
924 without an intervening stop in sigtramp, which is
925 detected by a new stack pointer value below
926 any usual function calling stack adjustments. */
927 (CURRENTLY_STEPPING ()
928 && prev_pc
!= stop_pc
- DECR_PC_AFTER_BREAK
930 && read_sp () INNER_THAN (step_sp
- 16))) :
933 /* Following in case break condition called a
935 stop_print_frame
= 1;
938 if (stop_signal
== TARGET_SIGNAL_TRAP
)
940 = !(bpstat_explains_signal (stop_bpstat
)
942 #ifndef CALL_DUMMY_BREAKPOINT_OFFSET
943 || PC_IN_CALL_DUMMY (stop_pc
, read_sp (),
944 FRAME_FP (get_current_frame ()))
945 #endif /* No CALL_DUMMY_BREAKPOINT_OFFSET. */
946 || (step_range_end
&& step_resume_breakpoint
== NULL
));
950 = !(bpstat_explains_signal (stop_bpstat
)
951 /* End of a stack dummy. Some systems (e.g. Sony
952 news) give another signal besides SIGTRAP,
953 so check here as well as above. */
954 #ifndef CALL_DUMMY_BREAKPOINT_OFFSET
955 || PC_IN_CALL_DUMMY (stop_pc
, read_sp (),
956 FRAME_FP (get_current_frame ()))
957 #endif /* No CALL_DUMMY_BREAKPOINT_OFFSET. */
960 stop_signal
= TARGET_SIGNAL_TRAP
;
966 /* For the program's own signals, act according to
967 the signal handling tables. */
971 /* Signal not for debugging purposes. */
974 stopped_by_random_signal
= 1;
976 if (signal_print
[stop_signal
])
979 target_terminal_ours_for_output ();
981 printf_filtered ("\nProgram received signal ");
982 annotate_signal_name ();
983 printf_filtered ("%s", target_signal_to_name (stop_signal
));
984 annotate_signal_name_end ();
985 printf_filtered (", ");
986 annotate_signal_string ();
987 printf_filtered ("%s", target_signal_to_string (stop_signal
));
988 annotate_signal_string_end ();
989 printf_filtered (".\n");
990 gdb_flush (gdb_stdout
);
992 if (signal_stop
[stop_signal
])
994 /* If not going to stop, give terminal back
995 if we took it away. */
997 target_terminal_inferior ();
999 /* Clear the signal if it should not be passed. */
1000 if (signal_program
[stop_signal
] == 0)
1001 stop_signal
= TARGET_SIGNAL_0
;
1003 /* I'm not sure whether this needs to be check_sigtramp2 or
1004 whether it could/should be keep_going. */
1005 goto check_sigtramp2
;
1008 /* Handle cases caused by hitting a breakpoint. */
1010 CORE_ADDR jmp_buf_pc
;
1011 struct bpstat_what what
;
1013 what
= bpstat_what (stop_bpstat
);
1015 if (what
.call_dummy
)
1017 stop_stack_dummy
= 1;
1019 trap_expected_after_continue
= 1;
1023 switch (what
.main_action
)
1025 case BPSTAT_WHAT_SET_LONGJMP_RESUME
:
1026 /* If we hit the breakpoint at longjmp, disable it for the
1027 duration of this command. Then, install a temporary
1028 breakpoint at the target of the jmp_buf. */
1029 disable_longjmp_breakpoint();
1030 remove_breakpoints ();
1031 breakpoints_inserted
= 0;
1032 if (!GET_LONGJMP_TARGET(&jmp_buf_pc
)) goto keep_going
;
1034 /* Need to blow away step-resume breakpoint, as it
1035 interferes with us */
1036 if (step_resume_breakpoint
!= NULL
)
1038 delete_breakpoint (step_resume_breakpoint
);
1039 step_resume_breakpoint
= NULL
;
1041 /* Not sure whether we need to blow this away too, but probably
1042 it is like the step-resume breakpoint. */
1043 if (through_sigtramp_breakpoint
!= NULL
)
1045 delete_breakpoint (through_sigtramp_breakpoint
);
1046 through_sigtramp_breakpoint
= NULL
;
1050 /* FIXME - Need to implement nested temporary breakpoints */
1051 if (step_over_calls
> 0)
1052 set_longjmp_resume_breakpoint(jmp_buf_pc
,
1053 get_current_frame());
1056 set_longjmp_resume_breakpoint(jmp_buf_pc
, NULL
);
1057 handling_longjmp
= 1; /* FIXME */
1060 case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME
:
1061 case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE
:
1062 remove_breakpoints ();
1063 breakpoints_inserted
= 0;
1065 /* FIXME - Need to implement nested temporary breakpoints */
1067 && (FRAME_FP (get_current_frame ())
1068 INNER_THAN step_frame_address
))
1074 disable_longjmp_breakpoint();
1075 handling_longjmp
= 0; /* FIXME */
1076 if (what
.main_action
== BPSTAT_WHAT_CLEAR_LONGJMP_RESUME
)
1078 /* else fallthrough */
1080 case BPSTAT_WHAT_SINGLE
:
1081 if (breakpoints_inserted
)
1082 remove_breakpoints ();
1083 breakpoints_inserted
= 0;
1085 /* Still need to check other stuff, at least the case
1086 where we are stepping and step out of the right range. */
1089 case BPSTAT_WHAT_STOP_NOISY
:
1090 stop_print_frame
= 1;
1092 /* We are about to nuke the step_resume_breakpoint and
1093 through_sigtramp_breakpoint via the cleanup chain, so
1094 no need to worry about it here. */
1098 case BPSTAT_WHAT_STOP_SILENT
:
1099 stop_print_frame
= 0;
1101 /* We are about to nuke the step_resume_breakpoint and
1102 through_sigtramp_breakpoint via the cleanup chain, so
1103 no need to worry about it here. */
1107 case BPSTAT_WHAT_STEP_RESUME
:
1108 delete_breakpoint (step_resume_breakpoint
);
1109 step_resume_breakpoint
= NULL
;
1112 case BPSTAT_WHAT_THROUGH_SIGTRAMP
:
1113 if (through_sigtramp_breakpoint
)
1114 delete_breakpoint (through_sigtramp_breakpoint
);
1115 through_sigtramp_breakpoint
= NULL
;
1117 /* If were waiting for a trap, hitting the step_resume_break
1118 doesn't count as getting it. */
1123 case BPSTAT_WHAT_CHECK_SHLIBS
:
1126 extern int auto_solib_add
;
1128 /* Remove breakpoints, we eventually want to step over the
1129 shlib event breakpoint, and SOLIB_ADD might adjust
1130 breakpoint addresses via breakpoint_re_set. */
1131 if (breakpoints_inserted
)
1132 remove_breakpoints ();
1133 breakpoints_inserted
= 0;
1135 /* Check for any newly added shared libraries if we're
1136 supposed to be adding them automatically. */
1139 /* Switch terminal for any messages produced by
1140 breakpoint_re_set. */
1141 target_terminal_ours_for_output ();
1142 SOLIB_ADD (NULL
, 0, NULL
);
1143 target_terminal_inferior ();
1146 /* Try to reenable shared library breakpoints, additional
1147 code segments in shared libraries might be mapped in now. */
1148 re_enable_breakpoints_in_shlibs ();
1150 /* If requested, stop when the dynamic linker notifies
1151 gdb of events. This allows the user to get control
1152 and place breakpoints in initializer routines for
1153 dynamically loaded objects (among other things). */
1154 if (stop_on_solib_events
)
1156 stop_print_frame
= 0;
1161 /* We want to step over this breakpoint, then keep going. */
1169 case BPSTAT_WHAT_LAST
:
1170 /* Not a real code, but listed here to shut up gcc -Wall. */
1172 case BPSTAT_WHAT_KEEP_CHECKING
:
1177 /* We come here if we hit a breakpoint but should not
1178 stop for it. Possibly we also were stepping
1179 and should stop for that. So fall through and
1180 test for stepping. But, if not stepping,
1183 #ifndef CALL_DUMMY_BREAKPOINT_OFFSET
1184 /* This is the old way of detecting the end of the stack dummy.
1185 An architecture which defines CALL_DUMMY_BREAKPOINT_OFFSET gets
1186 handled above. As soon as we can test it on all of them, all
1187 architectures should define it. */
1189 /* If this is the breakpoint at the end of a stack dummy,
1190 just stop silently, unless the user was doing an si/ni, in which
1191 case she'd better know what she's doing. */
1193 if (PC_IN_CALL_DUMMY (stop_pc
, read_sp (), FRAME_FP (get_current_frame ()))
1196 stop_print_frame
= 0;
1197 stop_stack_dummy
= 1;
1199 trap_expected_after_continue
= 1;
1203 #endif /* No CALL_DUMMY_BREAKPOINT_OFFSET. */
1205 if (step_resume_breakpoint
)
1206 /* Having a step-resume breakpoint overrides anything
1207 else having to do with stepping commands until
1208 that breakpoint is reached. */
1209 /* I'm not sure whether this needs to be check_sigtramp2 or
1210 whether it could/should be keep_going. */
1211 goto check_sigtramp2
;
1213 if (step_range_end
== 0)
1214 /* Likewise if we aren't even stepping. */
1215 /* I'm not sure whether this needs to be check_sigtramp2 or
1216 whether it could/should be keep_going. */
1217 goto check_sigtramp2
;
1219 /* If stepping through a line, keep going if still within it. */
1220 if (stop_pc
>= step_range_start
1221 && stop_pc
< step_range_end
1223 /* I haven't a clue what might trigger this clause, and it seems wrong anyway,
1224 so I've disabled it until someone complains. -Stu 10/24/95 */
1226 /* The step range might include the start of the
1227 function, so if we are at the start of the
1228 step range and either the stack or frame pointers
1229 just changed, we've stepped outside */
1230 && !(stop_pc
== step_range_start
1231 && FRAME_FP (get_current_frame ())
1232 && (read_sp () INNER_THAN step_sp
1233 || FRAME_FP (get_current_frame ()) != step_frame_address
))
1237 /* We might be doing a BPSTAT_WHAT_SINGLE and getting a signal.
1238 So definately need to check for sigtramp here. */
1239 goto check_sigtramp2
;
1242 /* We stepped out of the stepping range. */
1244 /* If we are stepping at the source level and entered the runtime
1245 loader dynamic symbol resolution code, we keep on single stepping
1246 until we exit the run time loader code and reach the callee's
1248 if (step_over_calls
< 0 && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc
))
1251 /* We can't update step_sp every time through the loop, because
1252 reading the stack pointer would slow down stepping too much.
1253 But we can update it every time we leave the step range. */
1256 /* Did we just take a signal? */
1257 if (IN_SIGTRAMP (stop_pc
, stop_func_name
)
1258 && !IN_SIGTRAMP (prev_pc
, prev_func_name
)
1259 && read_sp () INNER_THAN step_sp
)
1261 /* We've just taken a signal; go until we are back to
1262 the point where we took it and one more. */
1264 /* This code is needed at least in the following case:
1265 The user types "next" and then a signal arrives (before
1266 the "next" is done). */
1268 /* Note that if we are stopped at a breakpoint, then we need
1269 the step_resume breakpoint to override any breakpoints at
1270 the same location, so that we will still step over the
1271 breakpoint even though the signal happened. */
1274 struct symtab_and_line sr_sal
;
1276 INIT_SAL (&sr_sal
); /* initialize to zeroes */
1277 sr_sal
.pc
= prev_pc
;
1278 sr_sal
.section
= find_pc_overlay (sr_sal
.pc
);
1279 /* We could probably be setting the frame to
1280 step_frame_address; I don't think anyone thought to try it. */
1281 step_resume_breakpoint
=
1282 set_momentary_breakpoint (sr_sal
, NULL
, bp_step_resume
);
1283 if (breakpoints_inserted
)
1284 insert_breakpoints ();
1287 /* If this is stepi or nexti, make sure that the stepping range
1288 gets us past that instruction. */
1289 if (step_range_end
== 1)
1290 /* FIXME: Does this run afoul of the code below which, if
1291 we step into the middle of a line, resets the stepping
1293 step_range_end
= (step_range_start
= prev_pc
) + 1;
1295 remove_breakpoints_on_following_step
= 1;
1300 /* I disabled this test because it was too complicated and slow. The
1301 SKIP_PROLOGUE was especially slow, because it caused unnecessary
1302 prologue examination on various architectures. The code in the #else
1303 clause has been tested on the Sparc, Mips, PA, and Power
1304 architectures, so it's pretty likely to be correct. -Stu 10/24/95 */
1306 /* See if we left the step range due to a subroutine call that
1307 we should proceed to the end of. */
1309 if (stop_func_start
)
1313 /* Do this after the IN_SIGTRAMP check; it might give
1315 prologue_pc
= stop_func_start
;
1317 /* Don't skip the prologue if this is assembly source */
1318 s
= find_pc_symtab (stop_pc
);
1319 if (s
&& s
->language
!= language_asm
)
1320 SKIP_PROLOGUE (prologue_pc
);
1323 if (!(step_sp INNER_THAN
read_sp ()) /* don't mistake (sig)return as a call */
1324 && (/* Might be a non-recursive call. If the symbols are missing
1325 enough that stop_func_start == prev_func_start even though
1326 they are really two functions, we will treat some calls as
1328 stop_func_start
!= prev_func_start
1330 /* Might be a recursive call if either we have a prologue
1331 or the call instruction itself saves the PC on the stack. */
1332 || prologue_pc
!= stop_func_start
1333 || read_sp () != step_sp
)
1334 && (/* PC is completely out of bounds of any known objfiles. Treat
1335 like a subroutine call. */
1338 /* If we do a call, we will be at the start of a function... */
1339 || stop_pc
== stop_func_start
1341 /* ...except on the Alpha with -O (and also Irix 5 and
1342 perhaps others), in which we might call the address
1343 after the load of gp. Since prologues don't contain
1344 calls, we can't return to within one, and we don't
1345 jump back into them, so this check is OK. */
1347 || stop_pc
< prologue_pc
1349 /* ...and if it is a leaf function, the prologue might
1350 consist of gp loading only, so the call transfers to
1351 the first instruction after the prologue. */
1352 || (stop_pc
== prologue_pc
1354 /* Distinguish this from the case where we jump back
1355 to the first instruction after the prologue,
1356 within a function. */
1357 && stop_func_start
!= prev_func_start
)
1359 /* If we end up in certain places, it means we did a subroutine
1360 call. I'm not completely sure this is necessary now that we
1361 have the above checks with stop_func_start (and now that
1362 find_pc_partial_function is pickier). */
1363 || IN_SOLIB_CALL_TRAMPOLINE (stop_pc
, stop_func_name
)
1365 /* If none of the above apply, it is a jump within a function,
1366 or a return from a subroutine. The other case is longjmp,
1367 which can no longer happen here as long as the
1368 handling_longjmp stuff is working. */
1371 /* This test is a much more streamlined, (but hopefully correct)
1372 replacement for the code above. It's been tested on the Sparc,
1373 Mips, PA, and Power architectures with good results. */
1375 if (stop_pc
== stop_func_start
/* Quick test */
1376 || in_prologue (stop_pc
, stop_func_start
)
1377 || IN_SOLIB_CALL_TRAMPOLINE (stop_pc
, stop_func_name
)
1378 || stop_func_name
== 0)
1382 /* It's a subroutine call. */
1384 if (step_over_calls
== 0)
1386 /* I presume that step_over_calls is only 0 when we're
1387 supposed to be stepping at the assembly language level
1388 ("stepi"). Just stop. */
1393 if (step_over_calls
> 0 || IGNORE_HELPER_CALL (stop_pc
))
1394 /* We're doing a "next". */
1395 goto step_over_function
;
1397 /* If we are in a function call trampoline (a stub between
1398 the calling routine and the real function), locate the real
1399 function. That's what tells us (a) whether we want to step
1400 into it at all, and (b) what prologue we want to run to
1401 the end of, if we do step into it. */
1402 tmp
= SKIP_TRAMPOLINE_CODE (stop_pc
);
1404 stop_func_start
= tmp
;
1407 tmp
= DYNAMIC_TRAMPOLINE_NEXTPC (stop_pc
);
1410 struct symtab_and_line xxx
;
1411 /* Why isn't this s_a_l called "sr_sal", like all of the
1412 other s_a_l's where this code is duplicated? */
1413 INIT_SAL (&xxx
); /* initialize to zeroes */
1415 xxx
.section
= find_pc_overlay (xxx
.pc
);
1416 step_resume_breakpoint
=
1417 set_momentary_breakpoint (xxx
, NULL
, bp_step_resume
);
1418 insert_breakpoints ();
1423 /* If we have line number information for the function we
1424 are thinking of stepping into, step into it.
1426 If there are several symtabs at that PC (e.g. with include
1427 files), just want to know whether *any* of them have line
1428 numbers. find_pc_line handles this. */
1430 struct symtab_and_line tmp_sal
;
1432 tmp_sal
= find_pc_line (stop_func_start
, 0);
1433 if (tmp_sal
.line
!= 0)
1434 goto step_into_function
;
1438 /* A subroutine call has happened. */
1440 /* Set a special breakpoint after the return */
1441 struct symtab_and_line sr_sal
;
1443 INIT_SAL (&sr_sal
); /* initialize to zeroes */
1445 ADDR_BITS_REMOVE (SAVED_PC_AFTER_CALL (get_current_frame ()));
1446 sr_sal
.section
= find_pc_overlay (sr_sal
.pc
);
1447 step_resume_breakpoint
=
1448 set_momentary_breakpoint (sr_sal
, get_current_frame (),
1450 if (!IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal
.pc
))
1451 step_resume_breakpoint
->frame
= step_frame_address
;
1452 if (breakpoints_inserted
)
1453 insert_breakpoints ();
1458 /* Subroutine call with source code we should not step over.
1459 Do step to the first line of code in it. */
1463 s
= find_pc_symtab (stop_pc
);
1464 if (s
&& s
->language
!= language_asm
)
1465 SKIP_PROLOGUE (stop_func_start
);
1467 sal
= find_pc_line (stop_func_start
, 0);
1468 /* Use the step_resume_break to step until
1469 the end of the prologue, even if that involves jumps
1470 (as it seems to on the vax under 4.2). */
1471 /* If the prologue ends in the middle of a source line,
1472 continue to the end of that source line (if it is still
1473 within the function). Otherwise, just go to end of prologue. */
1474 #ifdef PROLOGUE_FIRSTLINE_OVERLAP
1475 /* no, don't either. It skips any code that's
1476 legitimately on the first line. */
1478 if (sal
.end
&& sal
.pc
!= stop_func_start
&& sal
.end
< stop_func_end
)
1479 stop_func_start
= sal
.end
;
1482 if (stop_func_start
== stop_pc
)
1484 /* We are already there: stop now. */
1489 /* Put the step-breakpoint there and go until there. */
1491 struct symtab_and_line sr_sal
;
1493 INIT_SAL (&sr_sal
); /* initialize to zeroes */
1494 sr_sal
.pc
= stop_func_start
;
1495 sr_sal
.section
= find_pc_overlay (stop_func_start
);
1496 /* Do not specify what the fp should be when we stop
1497 since on some machines the prologue
1498 is where the new fp value is established. */
1499 step_resume_breakpoint
=
1500 set_momentary_breakpoint (sr_sal
, NULL
, bp_step_resume
);
1501 if (breakpoints_inserted
)
1502 insert_breakpoints ();
1504 /* And make sure stepping stops right away then. */
1505 step_range_end
= step_range_start
;
1510 /* We've wandered out of the step range. */
1512 sal
= find_pc_line(stop_pc
, 0);
1514 if (step_range_end
== 1)
1516 /* It is stepi or nexti. We always want to stop stepping after
1522 /* If we're in the return path from a shared library trampoline,
1523 we want to proceed through the trampoline when stepping. */
1524 if (IN_SOLIB_RETURN_TRAMPOLINE(stop_pc
, stop_func_name
))
1528 /* Determine where this trampoline returns. */
1529 tmp
= SKIP_TRAMPOLINE_CODE (stop_pc
);
1531 /* Only proceed through if we know where it's going. */
1534 /* And put the step-breakpoint there and go until there. */
1535 struct symtab_and_line sr_sal
;
1537 INIT_SAL (&sr_sal
); /* initialize to zeroes */
1539 sr_sal
.section
= find_pc_overlay (sr_sal
.pc
);
1540 /* Do not specify what the fp should be when we stop
1541 since on some machines the prologue
1542 is where the new fp value is established. */
1543 step_resume_breakpoint
=
1544 set_momentary_breakpoint (sr_sal
, NULL
, bp_step_resume
);
1545 if (breakpoints_inserted
)
1546 insert_breakpoints ();
1548 /* Restart without fiddling with the step ranges or
1556 /* We have no line number information. That means to stop
1557 stepping (does this always happen right after one instruction,
1558 when we do "s" in a function with no line numbers,
1559 or can this happen as a result of a return or longjmp?). */
1564 if (stop_pc
== sal
.pc
1565 && (current_line
!= sal
.line
|| current_symtab
!= sal
.symtab
))
1567 /* We are at the start of a different line. So stop. Note that
1568 we don't stop if we step into the middle of a different line.
1569 That is said to make things like for (;;) statements work
1575 /* We aren't done stepping.
1577 Optimize by setting the stepping range to the line.
1578 (We might not be in the original line, but if we entered a
1579 new line in mid-statement, we continue stepping. This makes
1580 things like for(;;) statements work better.) */
1582 if (stop_func_end
&& sal
.end
>= stop_func_end
)
1584 /* If this is the last line of the function, don't keep stepping
1585 (it would probably step us out of the function).
1586 This is particularly necessary for a one-line function,
1587 in which after skipping the prologue we better stop even though
1588 we will be in mid-line. */
1592 step_range_start
= sal
.pc
;
1593 step_range_end
= sal
.end
;
1594 step_frame_address
= FRAME_FP (get_current_frame ());
1595 current_line
= sal
.line
;
1596 current_symtab
= sal
.symtab
;
1601 && IN_SIGTRAMP (stop_pc
, stop_func_name
)
1602 && !IN_SIGTRAMP (prev_pc
, prev_func_name
)
1603 && read_sp () INNER_THAN step_sp
)
1605 /* What has happened here is that we have just stepped the inferior
1606 with a signal (because it is a signal which shouldn't make
1607 us stop), thus stepping into sigtramp.
1609 So we need to set a step_resume_break_address breakpoint
1610 and continue until we hit it, and then step. FIXME: This should
1611 be more enduring than a step_resume breakpoint; we should know
1612 that we will later need to keep going rather than re-hitting
1613 the breakpoint here (see testsuite/gdb.t06/signals.exp where
1614 it says "exceedingly difficult"). */
1615 struct symtab_and_line sr_sal
;
1617 INIT_SAL (&sr_sal
); /* initialize to zeroes */
1618 sr_sal
.pc
= prev_pc
;
1619 sr_sal
.section
= find_pc_overlay (sr_sal
.pc
);
1620 /* We perhaps could set the frame if we kept track of what
1621 the frame corresponding to prev_pc was. But we don't,
1623 through_sigtramp_breakpoint
=
1624 set_momentary_breakpoint (sr_sal
, NULL
, bp_through_sigtramp
);
1625 if (breakpoints_inserted
)
1626 insert_breakpoints ();
1628 remove_breakpoints_on_following_step
= 1;
1633 /* Come to this label when you need to resume the inferior.
1634 It's really much cleaner to do a goto than a maze of if-else
1637 /* Save the pc before execution, to compare with pc after stop. */
1638 prev_pc
= read_pc (); /* Might have been DECR_AFTER_BREAK */
1639 prev_func_start
= stop_func_start
; /* Ok, since if DECR_PC_AFTER
1640 BREAK is defined, the
1641 original pc would not have
1642 been at the start of a
1644 prev_func_name
= stop_func_name
;
1647 step_sp
= read_sp ();
1650 /* If we did not do break;, it means we should keep
1651 running the inferior and not return to debugger. */
1653 if (trap_expected
&& stop_signal
!= TARGET_SIGNAL_TRAP
)
1655 /* We took a signal (which we are supposed to pass through to
1656 the inferior, else we'd have done a break above) and we
1657 haven't yet gotten our trap. Simply continue. */
1658 resume (CURRENTLY_STEPPING (), stop_signal
);
1662 /* Either the trap was not expected, but we are continuing
1663 anyway (the user asked that this signal be passed to the
1666 The signal was SIGTRAP, e.g. it was our signal, but we
1667 decided we should resume from it.
1669 We're going to run this baby now!
1671 Insert breakpoints now, unless we are trying
1672 to one-proceed past a breakpoint. */
1673 /* If we've just finished a special step resume and we don't
1674 want to hit a breakpoint, pull em out. */
1675 if (step_resume_breakpoint
== NULL
1676 && through_sigtramp_breakpoint
== NULL
1677 && remove_breakpoints_on_following_step
)
1679 remove_breakpoints_on_following_step
= 0;
1680 remove_breakpoints ();
1681 breakpoints_inserted
= 0;
1683 else if (!breakpoints_inserted
&&
1684 (through_sigtramp_breakpoint
!= NULL
|| !another_trap
))
1686 breakpoints_failed
= insert_breakpoints ();
1687 if (breakpoints_failed
)
1689 breakpoints_inserted
= 1;
1692 trap_expected
= another_trap
;
1694 if (stop_signal
== TARGET_SIGNAL_TRAP
)
1695 stop_signal
= TARGET_SIGNAL_0
;
1697 #ifdef SHIFT_INST_REGS
1698 /* I'm not sure when this following segment applies. I do know, now,
1699 that we shouldn't rewrite the regs when we were stopped by a
1700 random signal from the inferior process. */
1701 /* FIXME: Shouldn't this be based on the valid bit of the SXIP?
1702 (this is only used on the 88k). */
1704 if (!bpstat_explains_signal (stop_bpstat
)
1705 && (stop_signal
!= TARGET_SIGNAL_CHLD
)
1706 && !stopped_by_random_signal
)
1708 #endif /* SHIFT_INST_REGS */
1710 resume (CURRENTLY_STEPPING (), stop_signal
);
1715 if (target_has_execution
)
1717 /* Assuming the inferior still exists, set these up for next
1718 time, just like we did above if we didn't break out of the
1720 prev_pc
= read_pc ();
1721 prev_func_start
= stop_func_start
;
1722 prev_func_name
= stop_func_name
;
1724 do_cleanups (old_cleanups
);
1727 /* Here to return control to GDB when the inferior stops for real.
1728 Print appropriate messages, remove breakpoints, give terminal our modes.
1730 STOP_PRINT_FRAME nonzero means print the executing frame
1731 (pc, function, args, file, line number and line text).
1732 BREAKPOINTS_FAILED nonzero means stop was due to error
1733 attempting to insert breakpoints. */
1738 /* Make sure that the current_frame's pc is correct. This
1739 is a correction for setting up the frame info before doing
1740 DECR_PC_AFTER_BREAK */
1741 if (target_has_execution
&& get_current_frame())
1742 (get_current_frame ())->pc
= read_pc ();
1744 if (breakpoints_failed
)
1746 target_terminal_ours_for_output ();
1747 print_sys_errmsg ("ptrace", breakpoints_failed
);
1748 printf_filtered ("Stopped; cannot insert breakpoints.\n\
1749 The same program may be running in another process.\n");
1752 if (target_has_execution
&& breakpoints_inserted
)
1753 if (remove_breakpoints ())
1755 target_terminal_ours_for_output ();
1756 printf_filtered ("Cannot remove breakpoints because program is no longer writable.\n\
1757 It might be running in another process.\n\
1758 Further execution is probably impossible.\n");
1761 breakpoints_inserted
= 0;
1763 /* Delete the breakpoint we stopped at, if it wants to be deleted.
1764 Delete any breakpoint that is to be deleted at the next stop. */
1766 breakpoint_auto_delete (stop_bpstat
);
1768 /* If an auto-display called a function and that got a signal,
1769 delete that auto-display to avoid an infinite recursion. */
1771 if (stopped_by_random_signal
)
1772 disable_current_display ();
1774 if (step_multi
&& stop_step
)
1777 target_terminal_ours ();
1780 && stop_bpstat
->breakpoint_at
1781 && stop_bpstat
->breakpoint_at
->type
== bp_shlib_event
)
1782 printf_filtered ("Stopped due to shared library event\n");
1784 /* Look up the hook_stop and run it if it exists. */
1786 if (stop_command
->hook
)
1788 catch_errors (hook_stop_stub
, (char *)stop_command
->hook
,
1789 "Error while running hook_stop:\n", RETURN_MASK_ALL
);
1792 if (!target_has_stack
)
1795 /* Select innermost stack frame except on return from a stack dummy routine,
1796 or if the program has exited. Print it without a level number if
1797 we have changed functions or hit a breakpoint. Print source line
1799 if (!stop_stack_dummy
)
1801 select_frame (get_current_frame (), 0);
1803 if (stop_print_frame
)
1807 source_only
= bpstat_print (stop_bpstat
);
1808 source_only
= source_only
||
1810 && step_frame_address
== FRAME_FP (get_current_frame ())
1811 && step_start_function
== find_pc_function (stop_pc
));
1813 print_stack_frame (selected_frame
, -1, source_only
? -1: 1);
1815 /* Display the auto-display expressions. */
1820 /* Save the function value return registers, if we care.
1821 We might be about to restore their previous contents. */
1822 if (proceed_to_finish
)
1823 read_register_bytes (0, stop_registers
, REGISTER_BYTES
);
1825 if (stop_stack_dummy
)
1827 /* Pop the empty frame that contains the stack dummy.
1828 POP_FRAME ends with a setting of the current frame, so we
1829 can use that next. */
1831 /* Set stop_pc to what it was before we called the function. Can't rely
1832 on restore_inferior_status because that only gets called if we don't
1833 stop in the called function. */
1834 stop_pc
= read_pc();
1835 select_frame (get_current_frame (), 0);
1838 annotate_stopped ();
1842 hook_stop_stub (cmd
)
1845 execute_user_command ((struct cmd_list_element
*)cmd
, 0);
1849 int signal_stop_state (signo
)
1852 return signal_stop
[signo
];
1855 int signal_print_state (signo
)
1858 return signal_print
[signo
];
1861 int signal_pass_state (signo
)
1864 return signal_program
[signo
];
1871 Signal Stop\tPrint\tPass to program\tDescription\n");
1875 sig_print_info (oursig
)
1876 enum target_signal oursig
;
1878 char *name
= target_signal_to_name (oursig
);
1879 int name_padding
= 13 - strlen (name
);
1880 if (name_padding
<= 0)
1883 printf_filtered ("%s", name
);
1884 printf_filtered ("%*.*s ", name_padding
, name_padding
, " ");
1885 printf_filtered ("%s\t", signal_stop
[oursig
] ? "Yes" : "No");
1886 printf_filtered ("%s\t", signal_print
[oursig
] ? "Yes" : "No");
1887 printf_filtered ("%s\t\t", signal_program
[oursig
] ? "Yes" : "No");
1888 printf_filtered ("%s\n", target_signal_to_string (oursig
));
1891 /* Specify how various signals in the inferior should be handled. */
1894 handle_command (args
, from_tty
)
1899 int digits
, wordlen
;
1900 int sigfirst
, signum
, siglast
;
1901 enum target_signal oursig
;
1904 unsigned char *sigs
;
1905 struct cleanup
*old_chain
;
1909 error_no_arg ("signal to handle");
1912 /* Allocate and zero an array of flags for which signals to handle. */
1914 nsigs
= (int)TARGET_SIGNAL_LAST
;
1915 sigs
= (unsigned char *) alloca (nsigs
);
1916 memset (sigs
, 0, nsigs
);
1918 /* Break the command line up into args. */
1920 argv
= buildargv (args
);
1925 old_chain
= make_cleanup ((make_cleanup_func
) freeargv
, (char *) argv
);
1927 /* Walk through the args, looking for signal oursigs, signal names, and
1928 actions. Signal numbers and signal names may be interspersed with
1929 actions, with the actions being performed for all signals cumulatively
1930 specified. Signal ranges can be specified as <LOW>-<HIGH>. */
1932 while (*argv
!= NULL
)
1934 wordlen
= strlen (*argv
);
1935 for (digits
= 0; isdigit ((*argv
)[digits
]); digits
++) {;}
1937 sigfirst
= siglast
= -1;
1939 if (wordlen
>= 1 && !strncmp (*argv
, "all", wordlen
))
1941 /* Apply action to all signals except those used by the
1942 debugger. Silently skip those. */
1945 siglast
= nsigs
- 1;
1947 else if (wordlen
>= 1 && !strncmp (*argv
, "stop", wordlen
))
1949 SET_SIGS (nsigs
, sigs
, signal_stop
);
1950 SET_SIGS (nsigs
, sigs
, signal_print
);
1952 else if (wordlen
>= 1 && !strncmp (*argv
, "ignore", wordlen
))
1954 UNSET_SIGS (nsigs
, sigs
, signal_program
);
1956 else if (wordlen
>= 2 && !strncmp (*argv
, "print", wordlen
))
1958 SET_SIGS (nsigs
, sigs
, signal_print
);
1960 else if (wordlen
>= 2 && !strncmp (*argv
, "pass", wordlen
))
1962 SET_SIGS (nsigs
, sigs
, signal_program
);
1964 else if (wordlen
>= 3 && !strncmp (*argv
, "nostop", wordlen
))
1966 UNSET_SIGS (nsigs
, sigs
, signal_stop
);
1968 else if (wordlen
>= 3 && !strncmp (*argv
, "noignore", wordlen
))
1970 SET_SIGS (nsigs
, sigs
, signal_program
);
1972 else if (wordlen
>= 4 && !strncmp (*argv
, "noprint", wordlen
))
1974 UNSET_SIGS (nsigs
, sigs
, signal_print
);
1975 UNSET_SIGS (nsigs
, sigs
, signal_stop
);
1977 else if (wordlen
>= 4 && !strncmp (*argv
, "nopass", wordlen
))
1979 UNSET_SIGS (nsigs
, sigs
, signal_program
);
1981 else if (digits
> 0)
1983 /* It is numeric. The numeric signal refers to our own internal
1984 signal numbering from target.h, not to host/target signal number.
1985 This is a feature; users really should be using symbolic names
1986 anyway, and the common ones like SIGHUP, SIGINT, SIGALRM, etc.
1987 will work right anyway. */
1989 sigfirst
= siglast
= (int) target_signal_from_command (atoi (*argv
));
1990 if ((*argv
)[digits
] == '-')
1993 (int) target_signal_from_command (atoi ((*argv
) + digits
+ 1));
1995 if (sigfirst
> siglast
)
1997 /* Bet he didn't figure we'd think of this case... */
2005 oursig
= target_signal_from_name (*argv
);
2006 if (oursig
!= TARGET_SIGNAL_UNKNOWN
)
2008 sigfirst
= siglast
= (int)oursig
;
2012 /* Not a number and not a recognized flag word => complain. */
2013 error ("Unrecognized or ambiguous flag word: \"%s\".", *argv
);
2017 /* If any signal numbers or symbol names were found, set flags for
2018 which signals to apply actions to. */
2020 for (signum
= sigfirst
; signum
>= 0 && signum
<= siglast
; signum
++)
2022 switch ((enum target_signal
)signum
)
2024 case TARGET_SIGNAL_TRAP
:
2025 case TARGET_SIGNAL_INT
:
2026 if (!allsigs
&& !sigs
[signum
])
2028 if (query ("%s is used by the debugger.\n\
2029 Are you sure you want to change it? ",
2030 target_signal_to_name
2031 ((enum target_signal
)signum
)))
2037 printf_unfiltered ("Not confirmed, unchanged.\n");
2038 gdb_flush (gdb_stdout
);
2042 case TARGET_SIGNAL_0
:
2043 case TARGET_SIGNAL_DEFAULT
:
2044 case TARGET_SIGNAL_UNKNOWN
:
2045 /* Make sure that "all" doesn't print these. */
2056 target_notice_signals(inferior_pid
);
2060 /* Show the results. */
2061 sig_print_header ();
2062 for (signum
= 0; signum
< nsigs
; signum
++)
2066 sig_print_info (signum
);
2071 do_cleanups (old_chain
);
2074 /* Print current contents of the tables set by the handle command.
2075 It is possible we should just be printing signals actually used
2076 by the current target (but for things to work right when switching
2077 targets, all signals should be in the signal tables). */
2080 signals_info (signum_exp
, from_tty
)
2084 enum target_signal oursig
;
2085 sig_print_header ();
2089 /* First see if this is a symbol name. */
2090 oursig
= target_signal_from_name (signum_exp
);
2091 if (oursig
== TARGET_SIGNAL_UNKNOWN
)
2093 /* No, try numeric. */
2095 target_signal_from_command (parse_and_eval_address (signum_exp
));
2097 sig_print_info (oursig
);
2101 printf_filtered ("\n");
2102 /* These ugly casts brought to you by the native VAX compiler. */
2103 for (oursig
= TARGET_SIGNAL_FIRST
;
2104 (int)oursig
< (int)TARGET_SIGNAL_LAST
;
2105 oursig
= (enum target_signal
)((int)oursig
+ 1))
2109 if (oursig
!= TARGET_SIGNAL_UNKNOWN
2110 && oursig
!= TARGET_SIGNAL_DEFAULT
2111 && oursig
!= TARGET_SIGNAL_0
)
2112 sig_print_info (oursig
);
2115 printf_filtered ("\nUse the \"handle\" command to change these tables.\n");
2118 /* Save all of the information associated with the inferior<==>gdb
2119 connection. INF_STATUS is a pointer to a "struct inferior_status"
2120 (defined in inferior.h). */
2123 save_inferior_status (inf_status
, restore_stack_info
)
2124 struct inferior_status
*inf_status
;
2125 int restore_stack_info
;
2127 inf_status
->stop_signal
= stop_signal
;
2128 inf_status
->stop_pc
= stop_pc
;
2129 inf_status
->stop_step
= stop_step
;
2130 inf_status
->stop_stack_dummy
= stop_stack_dummy
;
2131 inf_status
->stopped_by_random_signal
= stopped_by_random_signal
;
2132 inf_status
->trap_expected
= trap_expected
;
2133 inf_status
->step_range_start
= step_range_start
;
2134 inf_status
->step_range_end
= step_range_end
;
2135 inf_status
->step_frame_address
= step_frame_address
;
2136 inf_status
->step_over_calls
= step_over_calls
;
2137 inf_status
->stop_after_trap
= stop_after_trap
;
2138 inf_status
->stop_soon_quietly
= stop_soon_quietly
;
2139 /* Save original bpstat chain here; replace it with copy of chain.
2140 If caller's caller is walking the chain, they'll be happier if we
2141 hand them back the original chain when restore_i_s is called. */
2142 inf_status
->stop_bpstat
= stop_bpstat
;
2143 stop_bpstat
= bpstat_copy (stop_bpstat
);
2144 inf_status
->breakpoint_proceeded
= breakpoint_proceeded
;
2145 inf_status
->restore_stack_info
= restore_stack_info
;
2146 inf_status
->proceed_to_finish
= proceed_to_finish
;
2148 memcpy (inf_status
->stop_registers
, stop_registers
, REGISTER_BYTES
);
2150 read_register_bytes (0, inf_status
->registers
, REGISTER_BYTES
);
2152 record_selected_frame (&(inf_status
->selected_frame_address
),
2153 &(inf_status
->selected_level
));
2157 struct restore_selected_frame_args
{
2158 CORE_ADDR frame_address
;
2162 static int restore_selected_frame
PARAMS ((char *));
2164 /* Restore the selected frame. args is really a struct
2165 restore_selected_frame_args * (declared as char * for catch_errors)
2166 telling us what frame to restore. Returns 1 for success, or 0 for
2167 failure. An error message will have been printed on error. */
2170 restore_selected_frame (args
)
2173 struct restore_selected_frame_args
*fr
=
2174 (struct restore_selected_frame_args
*) args
;
2175 struct frame_info
*frame
;
2176 int level
= fr
->level
;
2178 frame
= find_relative_frame (get_current_frame (), &level
);
2180 /* If inf_status->selected_frame_address is NULL, there was no
2181 previously selected frame. */
2182 if (frame
== NULL
||
2183 FRAME_FP (frame
) != fr
->frame_address
||
2186 warning ("Unable to restore previously selected frame.\n");
2189 select_frame (frame
, fr
->level
);
2194 restore_inferior_status (inf_status
)
2195 struct inferior_status
*inf_status
;
2197 stop_signal
= inf_status
->stop_signal
;
2198 stop_pc
= inf_status
->stop_pc
;
2199 stop_step
= inf_status
->stop_step
;
2200 stop_stack_dummy
= inf_status
->stop_stack_dummy
;
2201 stopped_by_random_signal
= inf_status
->stopped_by_random_signal
;
2202 trap_expected
= inf_status
->trap_expected
;
2203 step_range_start
= inf_status
->step_range_start
;
2204 step_range_end
= inf_status
->step_range_end
;
2205 step_frame_address
= inf_status
->step_frame_address
;
2206 step_over_calls
= inf_status
->step_over_calls
;
2207 stop_after_trap
= inf_status
->stop_after_trap
;
2208 stop_soon_quietly
= inf_status
->stop_soon_quietly
;
2209 bpstat_clear (&stop_bpstat
);
2210 stop_bpstat
= inf_status
->stop_bpstat
;
2211 breakpoint_proceeded
= inf_status
->breakpoint_proceeded
;
2212 proceed_to_finish
= inf_status
->proceed_to_finish
;
2214 memcpy (stop_registers
, inf_status
->stop_registers
, REGISTER_BYTES
);
2216 /* The inferior can be gone if the user types "print exit(0)"
2217 (and perhaps other times). */
2218 if (target_has_execution
)
2219 write_register_bytes (0, inf_status
->registers
, REGISTER_BYTES
);
2221 /* The inferior can be gone if the user types "print exit(0)"
2222 (and perhaps other times). */
2224 /* FIXME: If we are being called after stopping in a function which
2225 is called from gdb, we should not be trying to restore the
2226 selected frame; it just prints a spurious error message (The
2227 message is useful, however, in detecting bugs in gdb (like if gdb
2228 clobbers the stack)). In fact, should we be restoring the
2229 inferior status at all in that case? . */
2231 if (target_has_stack
&& inf_status
->restore_stack_info
)
2233 struct restore_selected_frame_args fr
;
2234 fr
.level
= inf_status
->selected_level
;
2235 fr
.frame_address
= inf_status
->selected_frame_address
;
2236 /* The point of catch_errors is that if the stack is clobbered,
2237 walking the stack might encounter a garbage pointer and error()
2238 trying to dereference it. */
2239 if (catch_errors (restore_selected_frame
, &fr
,
2240 "Unable to restore previously selected frame:\n",
2241 RETURN_MASK_ERROR
) == 0)
2242 /* Error in restoring the selected frame. Select the innermost
2244 select_frame (get_current_frame (), 0);
2250 _initialize_infrun ()
2253 register int numsigs
;
2255 add_info ("signals", signals_info
,
2256 "What debugger does when program gets various signals.\n\
2257 Specify a signal as argument to print info on that signal only.");
2258 add_info_alias ("handle", "signals", 0);
2260 add_com ("handle", class_run
, handle_command
,
2261 concat ("Specify how to handle a signal.\n\
2262 Args are signals and actions to apply to those signals.\n\
2263 Symbolic signals (e.g. SIGSEGV) are recommended but numeric signals\n\
2264 from 1-15 are allowed for compatibility with old versions of GDB.\n\
2265 Numeric ranges may be specified with the form LOW-HIGH (e.g. 1-5).\n\
2266 The special arg \"all\" is recognized to mean all signals except those\n\
2267 used by the debugger, typically SIGTRAP and SIGINT.\n",
2268 "Recognized actions include \"stop\", \"nostop\", \"print\", \"noprint\",\n\
2269 \"pass\", \"nopass\", \"ignore\", or \"noignore\".\n\
2270 Stop means reenter debugger if this signal happens (implies print).\n\
2271 Print means print a message if this signal happens.\n\
2272 Pass means let program see this signal; otherwise program doesn't know.\n\
2273 Ignore is a synonym for nopass and noignore is a synonym for pass.\n\
2274 Pass and Stop may be combined.", NULL
));
2276 stop_command
= add_cmd ("stop", class_obscure
, not_just_help_class_command
,
2277 "There is no `stop' command, but you can set a hook on `stop'.\n\
2278 This allows you to set a list of commands to be run each time execution\n\
2279 of the program stops.", &cmdlist
);
2281 numsigs
= (int)TARGET_SIGNAL_LAST
;
2282 signal_stop
= (unsigned char *)
2283 xmalloc (sizeof (signal_stop
[0]) * numsigs
);
2284 signal_print
= (unsigned char *)
2285 xmalloc (sizeof (signal_print
[0]) * numsigs
);
2286 signal_program
= (unsigned char *)
2287 xmalloc (sizeof (signal_program
[0]) * numsigs
);
2288 for (i
= 0; i
< numsigs
; i
++)
2291 signal_print
[i
] = 1;
2292 signal_program
[i
] = 1;
2295 /* Signals caused by debugger's own actions
2296 should not be given to the program afterwards. */
2297 signal_program
[TARGET_SIGNAL_TRAP
] = 0;
2298 signal_program
[TARGET_SIGNAL_INT
] = 0;
2300 /* Signals that are not errors should not normally enter the debugger. */
2301 signal_stop
[TARGET_SIGNAL_ALRM
] = 0;
2302 signal_print
[TARGET_SIGNAL_ALRM
] = 0;
2303 signal_stop
[TARGET_SIGNAL_VTALRM
] = 0;
2304 signal_print
[TARGET_SIGNAL_VTALRM
] = 0;
2305 signal_stop
[TARGET_SIGNAL_PROF
] = 0;
2306 signal_print
[TARGET_SIGNAL_PROF
] = 0;
2307 signal_stop
[TARGET_SIGNAL_CHLD
] = 0;
2308 signal_print
[TARGET_SIGNAL_CHLD
] = 0;
2309 signal_stop
[TARGET_SIGNAL_IO
] = 0;
2310 signal_print
[TARGET_SIGNAL_IO
] = 0;
2311 signal_stop
[TARGET_SIGNAL_POLL
] = 0;
2312 signal_print
[TARGET_SIGNAL_POLL
] = 0;
2313 signal_stop
[TARGET_SIGNAL_URG
] = 0;
2314 signal_print
[TARGET_SIGNAL_URG
] = 0;
2318 (add_set_cmd ("stop-on-solib-events", class_support
, var_zinteger
,
2319 (char *) &stop_on_solib_events
,
2320 "Set stopping for shared library events.\n\
2321 If nonzero, gdb will give control to the user when the dynamic linker\n\
2322 notifies gdb of shared library events. The most common event of interest\n\
2323 to the user would be loading/unloading of a new library.\n",