aboutsummaryrefslogtreecommitdiff
path: root/gdb/procfs.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-01-06 16:34:51 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-01-06 16:34:51 +0000
commit45dc9be38877cbb8218182b5c5ebd6e82e5ccd47 (patch)
tree82ad3d6e6f401a050d61bf80e7fc4e49a6c46c8d /gdb/procfs.c
parent588d1d685c66966dfdc5c57964e245424060a076 (diff)
downloadgdb-45dc9be38877cbb8218182b5c5ebd6e82e5ccd47.zip
gdb-45dc9be38877cbb8218182b5c5ebd6e82e5ccd47.tar.gz
gdb-45dc9be38877cbb8218182b5c5ebd6e82e5ccd47.tar.bz2
* procfs.c (procfs_wait): Fix argument name to match 4 Jan changes.
* Move target_signal_from_host, target_signal_to_host, and store_waitstatus from inftarg.c to target.c. procfs needs them. * target.c: Include "wait.h" and <signal.h>. * target.h, infrun.c (proceed), proceed callers: Pass new code TARGET_SIGNAL_DEFAULT instead of -1. This avoids problems with enums being treated as unsigned and is cleaner. * infrun.c (signals_info): Don't print TARGET_SIGNAL_DEFAULT or TARGET_SIGNAL_0. * infcmd.c (signal_command), infrun.c (signals_info): Don't allow user to specify numeric equivalent of TARGET_SIGNAL_DEFAULT.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r--gdb/procfs.c65
1 files changed, 25 insertions, 40 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 5ebc5e0..c9e0d8f 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -2174,48 +2174,33 @@ do_detach (signal)
attach_flag = 0;
}
-/*
-
-LOCAL FUNCTION
-
- procfs_wait -- emulate wait() as much as possible
- Wait for child to do something. Return pid of child, or -1 in case
- of error; store status through argument pointer STATUS.
-
-
-SYNOPSIS
-
- int procfs_wait (int pid, int *statloc)
-
-DESCRIPTION
-
- Try to emulate wait() as much as possible. Not sure why we can't
- just use wait(), but it seems to have problems when applied to a
- process being controlled with the /proc interface.
-
-NOTES
-
- We have a race problem here with no obvious solution. We need to let
- the inferior run until it stops on an event of interest, which means
- that we need to use the PIOCWSTOP ioctl. However, we cannot use this
- ioctl if the process is already stopped on something that is not an
- event of interest, or the call will hang indefinitely. Thus we first
- use PIOCSTATUS to see if the process is not stopped. If not, then we
- use PIOCWSTOP. But during the window between the two, if the process
- stops for any reason that is not an event of interest (such as a job
- control signal) then gdb will hang. One possible workaround is to set
- an alarm to wake up every minute of so and check to see if the process
- is still running, and if so, then reissue the PIOCWSTOP. But this is
- a real kludge, so has not been implemented. FIXME: investigate
- alternatives.
-
- FIXME: Investigate why wait() seems to have problems with programs
- being control by /proc routines.
-
- */
+/* emulate wait() as much as possible.
+ Wait for child to do something. Return pid of child, or -1 in case
+ of error; store status in *OURSTATUS.
+
+ Not sure why we can't
+ just use wait(), but it seems to have problems when applied to a
+ process being controlled with the /proc interface.
+
+ We have a race problem here with no obvious solution. We need to let
+ the inferior run until it stops on an event of interest, which means
+ that we need to use the PIOCWSTOP ioctl. However, we cannot use this
+ ioctl if the process is already stopped on something that is not an
+ event of interest, or the call will hang indefinitely. Thus we first
+ use PIOCSTATUS to see if the process is not stopped. If not, then we
+ use PIOCWSTOP. But during the window between the two, if the process
+ stops for any reason that is not an event of interest (such as a job
+ control signal) then gdb will hang. One possible workaround is to set
+ an alarm to wake up every minute of so and check to see if the process
+ is still running, and if so, then reissue the PIOCWSTOP. But this is
+ a real kludge, so has not been implemented. FIXME: investigate
+ alternatives.
+
+ FIXME: Investigate why wait() seems to have problems with programs
+ being control by /proc routines. */
static int
-procfs_wait (pid, statloc)
+procfs_wait (pid, ourstatus)
int pid;
struct target_waitstatus *ourstatus;
{