aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--gdb/ChangeLog33
-rw-r--r--gdb/corelow.c1
-rw-r--r--gdb/infrun.c45
-rw-r--r--gdb/procfs.c16
-rw-r--r--gdb/remote-adapt.c1
-rw-r--r--gdb/remote-eb.c1
-rw-r--r--gdb/remote-es1800.c2
-rw-r--r--gdb/remote-hms.c1
-rw-r--r--gdb/remote-mm.c1
-rw-r--r--gdb/remote-nindy.c1
-rw-r--r--gdb/remote-st2000.c1
-rw-r--r--gdb/remote-udi.c1
-rw-r--r--gdb/remote-vx.c2
-rw-r--r--gdb/xcoffexec.c1
-rw-r--r--gdb/xm-irix4.h11
-rw-r--r--gdb/xm-sysv4.h12
16 files changed, 91 insertions, 39 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 78659af..e6c0ab4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,36 @@
+Tue Oct 6 14:47:11 1992 K. Richard Pixley (rich@sendai.cygnus.com)
+
+ 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.
+
Tue Oct 6 12:13:08 1992 John Gilmore (gnu@cygnus.com)
* main.c (define_command): Add forgotten initializer.
diff --git a/gdb/corelow.c b/gdb/corelow.c
index d9d5152..75f64d5 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -257,6 +257,7 @@ struct target_ops core_ops = {
0, 0, 0, /* kill, load, lookup sym */
find_default_create_inferior, 0, /* mourn_inferior */
0, /* can_run */
+ 0, /* notice_signals */
core_stratum, 0, /* next */
0, 1, 1, 1, 0, /* all mem, mem, stack, regs, exec */
0, 0, /* section pointers */
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);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 6254c9c..1a694e0 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -416,6 +416,9 @@ do_detach PARAMS ((int siggnal));
static void
procfs_create_inferior PARAMS ((char *, char *, char **));
+static void
+procfs_notice_signals PARAMS ((void));
+
/* External function prototypes that can't be easily included in any
header file because the args are typedefs in system include files. */
@@ -1267,7 +1270,7 @@ procfs_init_inferior (pid)
{
memset ((char *) &pi.prrun, 0, sizeof (pi.prrun));
prfillset (&pi.prrun.pr_trace);
- proc_signal_handling_change ();
+ procfs_notice_signals ();
prfillset (&pi.prrun.pr_fault);
prdelset (&pi.prrun.pr_fault, FLTPAGE);
if (ioctl (pi.fd, PIOCWSTOP, &pi.prstatus) < 0)
@@ -1285,11 +1288,11 @@ procfs_init_inferior (pid)
GLOBAL FUNCTION
- proc_signal_handling_change
+ procfs_notice_signals
SYNOPSIS
- void proc_signal_handling_change (void);
+ static void procfs_notice_signals (void);
DESCRIPTION
@@ -1306,8 +1309,8 @@ DESCRIPTION
involved.
*/
-void
-proc_signal_handling_change ()
+static void
+procfs_notice_signals ()
{
int signo;
@@ -1775,7 +1778,7 @@ do_attach (pid)
memset (&pi.prrun, 0, sizeof (pi.prrun));
prfillset (&pi.prrun.pr_trace);
- proc_signal_handling_change ();
+ procfs_notice_signals ();
prfillset (&pi.prrun.pr_fault);
prdelset (&pi.prrun.pr_fault, FLTPAGE);
if (ioctl (pi.fd, PIOCSFAULT, &pi.prrun.pr_fault))
@@ -3118,6 +3121,7 @@ struct target_ops procfs_ops = {
procfs_create_inferior, /* to_create_inferior */
procfs_mourn_inferior, /* to_mourn_inferior */
procfs_can_run, /* to_can_run */
+ procfs_notice_signals, /* to_notice_signals */
process_stratum, /* to_stratum */
0, /* to_next */
1, /* to_has_all_memory */
diff --git a/gdb/remote-adapt.c b/gdb/remote-adapt.c
index 374c9de..98182e2 100644
--- a/gdb/remote-adapt.c
+++ b/gdb/remote-adapt.c
@@ -1359,6 +1359,7 @@ struct target_ops adapt_ops = {
adapt_create_inferior, /* create_inferior */
adapt_mourn, /* mourn_inferior FIXME */
0, /* can_run */
+ 0, /* notice_signals */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0,0, /* Section pointers */
diff --git a/gdb/remote-eb.c b/gdb/remote-eb.c
index 666de4f..bba59cf 100644
--- a/gdb/remote-eb.c
+++ b/gdb/remote-eb.c
@@ -988,6 +988,7 @@ executable as it exists on the remote computer. For example,\n\
eb_create_inferior,
eb_mourn_inferior,
0, /* can_run */
+ 0, /* notice_signals */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0, 0, /* Section pointers */
diff --git a/gdb/remote-es1800.c b/gdb/remote-es1800.c
index ca806b2..5329869 100644
--- a/gdb/remote-es1800.c
+++ b/gdb/remote-es1800.c
@@ -2188,6 +2188,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
es1800_create_inferior, /* to_create_inferior */
NULL, /* to_mourn_inferior */
0, /* to_can_run */
+ 0, /* notice_signals */
core_stratum, /* to_stratum */
0, /* to_next */
0, /* to_has_all_memory */
@@ -2234,6 +2235,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
es1800_create_inferior, /* to_create_inferior */
es1800_mourn_inferior, /* to_mourn_inferior */
0, /* to_can_run */
+ 0, /* notice_signals */
process_stratum, /* to_stratum */
0, /* to_next */
1, /* to_has_all_memory */
diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c
index 23afa48..e5f1f02 100644
--- a/gdb/remote-hms.c
+++ b/gdb/remote-hms.c
@@ -1329,6 +1329,7 @@ by a serial line.",
hms_create_inferior, /* create_inferior */
hms_mourn, /* mourn_inferior FIXME */
0, /* can_run */
+ 0, /* notice_signals */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0,0, /* Section pointers */
diff --git a/gdb/remote-mm.c b/gdb/remote-mm.c
index f62b64d..dc751c2 100644
--- a/gdb/remote-mm.c
+++ b/gdb/remote-mm.c
@@ -1607,6 +1607,7 @@ struct target_ops mm_ops = {
mm_create_inferior, /* create_inferior */
mm_mourn, /* mourn_inferior FIXME */
0, /* can_run */
+ 0, /* notice_signals */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0,0, /* sections, sections_end */
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 69849fc..2fc965f 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -942,6 +942,7 @@ specified when you started GDB.",
nindy_create_inferior,
nindy_mourn_inferior,
0, /* can_run */
+ 0, /* notice_signals */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0, 0, /* Section pointers */
diff --git a/gdb/remote-st2000.c b/gdb/remote-st2000.c
index d7de930..02a5a63 100644
--- a/gdb/remote-st2000.c
+++ b/gdb/remote-st2000.c
@@ -796,6 +796,7 @@ the speed to connect at in bits per second.",
st2000_create_inferior,
st2000_mourn_inferior,
0, /* can_run */
+ 0, /* notice_signals */
process_stratum,
0, /* next */
1,
diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c
index a6a015c..e2aee26 100644
--- a/gdb/remote-udi.c
+++ b/gdb/remote-udi.c
@@ -1341,6 +1341,7 @@ static struct target_ops udi_ops = {
udi_create_inferior,
udi_mourn, /* mourn_inferior FIXME */
0, /* can_run */
+ 0, /* notice_signals */
process_stratum,
0, /* next */
1, /* has_all_memory */
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index ddb6955..74a2e9f 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -1320,6 +1320,7 @@ Specify the name of the machine to connect to.",
vx_lookup_symbol,
vx_create_inferior, 0, /* mourn_inferior */
0, /* can_run */
+ 0, /* notice_signals */
core_stratum, 0, /* next */
1, 1, 0, 0, 0, /* all mem, mem, stack, regs, exec */
0, 0, /* Section pointers */
@@ -1343,6 +1344,7 @@ struct target_ops vx_run_ops = {
vx_lookup_symbol,
0, vx_mourn_inferior,
0, /* can_run */
+ 0, /* notice_signals */
process_stratum, 0, /* next */
0, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
/* all_mem is off to avoid spurious msg in "i files" */
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c
index 302b539..6187a59 100644
--- a/gdb/xcoffexec.c
+++ b/gdb/xcoffexec.c
@@ -999,6 +999,7 @@ Specify the filename of the executable file.",
find_default_create_inferior,
0, /* mourn_inferior */
0, /* can_run */
+ 0, /* notice_signals */
file_stratum, 0, /* next */
0, 1, 0, 0, 0, /* all mem, mem, stack, regs, exec */
0, 0, /* section pointers */
diff --git a/gdb/xm-irix4.h b/gdb/xm-irix4.h
index 1ecbd5c..21ee98f 100644
--- a/gdb/xm-irix4.h
+++ b/gdb/xm-irix4.h
@@ -48,15 +48,4 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
#define PSIGNAL_IN_SIGNAL_H
-/* If gdb's signal handling changes (due to a "handle" command), then
- this macro expands to an action to perform to notify other parts of
- gdb that might care, that signal handling has changed. For hosts using
- the /proc interface, gdb has more control over which signals cause the
- inferior to stop and which do not. In some cases, it is desirable to
- have signals delivered directly to the inferior without involving the
- debugger at all. */
-#ifdef USE_PROC_FS
-#define NOTICE_SIGNAL_HANDLING_CHANGE proc_signal_handling_change()
-#endif
-
#define BROKEN_SIGINFO_H /* <sys/siginfo.h> si_pid & si_uid are bogus */
diff --git a/gdb/xm-sysv4.h b/gdb/xm-sysv4.h
index 07cd547..f2697a9 100644
--- a/gdb/xm-sysv4.h
+++ b/gdb/xm-sysv4.h
@@ -59,18 +59,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define NEED_POSIX_SETPGID
-/* If gdb's signal handling changes (due to a "handle" command), then
- this macro expands to an action to perform to notify other parts of
- gdb that might care, that signal handling has changed. For hosts using
- the /proc interface, gdb has more control over which signals cause the
- inferior to stop and which do not. In some cases, it is desirable to
- have signals delivered directly to the inferior without involving the
- debugger at all. */
-
-#ifdef USE_PROC_FS
-#define NOTICE_SIGNAL_HANDLING_CHANGE proc_signal_handling_change()
-#endif
-
/* We have to include these files now, so that GDB will not make
competing definitions in defs.h. */
#include <limits.h>