aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorK. Richard Pixley <rich@cygnus>1992-10-06 22:54:57 +0000
committerK. Richard Pixley <rich@cygnus>1992-10-06 22:54:57 +0000
commit3950a34e45858c6f5a33e94b71832febc282eae3 (patch)
treebe2835be1f04a11cb880f503bff9505bbcbedcb2 /gdb/infrun.c
parent8d6ae8fcc581670891568655fbe9d9a3b7f09982 (diff)
downloadgdb-3950a34e45858c6f5a33e94b71832febc282eae3.zip
gdb-3950a34e45858c6f5a33e94b71832febc282eae3.tar.gz
gdb-3950a34e45858c6f5a33e94b71832febc282eae3.tar.bz2
NOTICE_SIGNAL_HANDLING_CHANGE macro added to the target vector as
to_notice_signals. * inferior.h (proc_signal_handling_change): prototype removed. * infrun.c (NOTICE_SIGNAL_HANDLING_CHANGE): default removed. (handle_command): now calls target_notice_signals. * procfs.c (proc_signal_handling_change): renamed to procfs_notice_signals. Now static. Add prototype. All callers changed. * target.h (struct target_ops): new field, to_notice_signals. (target_notice_signals): new macro to cover new field. * target.c (cleanup_target): default to_notice_signals to ignore. * corelow.c (core_ops), exec.c (exec_ops), inftarg.c (child_ops), procfs.c (procfs_ops), remote-adapt.c (adapt-ops), remote-eb.c (eb_ops), remote-es1800.c (es1800_ops, es1800_child_ops), remote-hms.c (hms_ops), remote-mm.c (mm_ops), remote-nindy.c (nindy_ops), remote-st2000.c (st2000_ops), remote-udi.c (udi_ops), remote-vx.c (vx_ops, vx_run_ops), remote.c (remote_ops), target.c (dummy_target), xcoffexec.c (exec_ops): added static initializer for to_notice_signals. * xm-irix4.h, xm-sysv4.h (NOTICE_SIGNAL_HANDLING_CHANGE): removed.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 8a01acf..de2ad56 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -109,7 +109,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "breakpoint.h"
#include "wait.h"
#include "gdbcore.h"
-#include "command.h"
+#include "gdbcmd.h"
#include "target.h"
#include <signal.h>
@@ -144,6 +144,9 @@ insert_step_breakpoint PARAMS ((void));
static void
resume_cleanups PARAMS ((int));
+static int
+hook_stop_stub PARAMS ((char *));
+
/* Sigtramp is a routine that the kernel calls (which then calls the
signal handler). On most machines it is a library routine that
is linked into the executable.
@@ -182,12 +185,6 @@ resume_cleanups PARAMS ((int));
#define IN_SOLIB_TRAMPOLINE(pc,name) 0
#endif
-/* Notify other parts of gdb that might care that signal handling may
- have changed for one or more signals. */
-#ifndef NOTICE_SIGNAL_HANDLING_CHANGE
-#define NOTICE_SIGNAL_HANDLING_CHANGE /* No actions */
-#endif
-
#ifdef TDESC
#include "tdesc.h"
int safe_to_init_tdesc_context = 0;
@@ -216,10 +213,14 @@ static unsigned char *signal_program;
(flags)[signum] = 0; \
} while (0)
+
+/* Command list pointer for the "stop" placeholder. */
+
+static struct cmd_list_element *stop_command;
+
/* Nonzero if breakpoints are now inserted in the inferior. */
-/* Nonstatic for initialization during xxx_create_inferior. FIXME. */
-/*static*/ int breakpoints_inserted;
+static int breakpoints_inserted;
/* Function inferior was in as of last step command. */
@@ -1196,6 +1197,9 @@ save_pc:
void
normal_stop ()
{
+ char *tem;
+ struct cmd_list_element *c;
+
/* Make sure that the current_frame's pc is correct. This
is a correction for setting up the frame info before doing
DECR_PC_AFTER_BREAK */
@@ -1240,6 +1244,14 @@ Further execution is probably impossible.\n");
target_terminal_ours ();
+ /* Look up the hook_stop and run it if it exists. */
+
+ if (stop_command->hook)
+ {
+ catch_errors (hook_stop_stub, (char *)stop_command->hook,
+ "Error while running hook_stop:\n");
+ }
+
if (!target_has_stack)
return;
@@ -1282,6 +1294,14 @@ Further execution is probably impossible.\n");
select_frame (get_current_frame (), 0);
}
}
+
+static int
+hook_stop_stub (cmd)
+ char *cmd;
+{
+ execute_user_command ((struct cmd_list_element *)cmd, 0);
+}
+
static void
insert_step_breakpoint ()
@@ -1492,7 +1512,7 @@ handle_command (args, from_tty)
argv++;
}
- NOTICE_SIGNAL_HANDLING_CHANGE;
+ target_notice_signals();
if (from_tty)
{
@@ -1674,6 +1694,11 @@ Pass means let program see this signal; otherwise program doesn't know.\n\
Ignore is a synonym for nopass and noignore is a synonym for pass.\n\
Pass and Stop may be combined.");
+ stop_command = add_cmd ("stop", class_pseudo, NO_FUNCTION,
+ "There is no `stop' command, but you can set a hook on `stop'.\n\
+This allows you to set a list of commands to be run each time execution\n\
+of the inferior program stops.", &cmdlist);
+
numsigs = signo_max () + 1;
signal_stop = (unsigned char *)
xmalloc (sizeof (signal_stop[0]) * numsigs);