aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-04-27 13:26:05 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-04-27 13:26:05 +0000
commit482f7fee1929be3dcd5770e605c23751e1d5b84e (patch)
tree4404727de110363ae9f0a0f68bf2367763d9e37c /gdb
parent1f480a5e28ef0f10bb3236b5088a14346e7b9b20 (diff)
downloadgdb-482f7fee1929be3dcd5770e605c23751e1d5b84e.zip
gdb-482f7fee1929be3dcd5770e605c23751e1d5b84e.tar.gz
gdb-482f7fee1929be3dcd5770e605c23751e1d5b84e.tar.bz2
* config/rs6000/nm-rs6000.h (CHILD_SPECIAL_WAITSTATUS): Remove.
* rs6000-nat.c (rs6000_wait): New function. (_initialize_core_rs6000): Install it as to_wait target method. * target.c (store_waitstatus): Don't check CHILD_SPECIAL_WAITSTATUS.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/config/rs6000/nm-rs6000.h13
-rw-r--r--gdb/rs6000-nat.c59
-rw-r--r--gdb/target.c7
4 files changed, 66 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2abe05d..baf4074 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2007-04-27 Ulrich Weigand <uweigand@de.ibm.com>
+ * config/rs6000/nm-rs6000.h (CHILD_SPECIAL_WAITSTATUS): Remove.
+ * rs6000-nat.c (rs6000_wait): New function.
+ (_initialize_core_rs6000): Install it as to_wait target method.
+ * target.c (store_waitstatus): Don't check CHILD_SPECIAL_WAITSTATUS.
+
+2007-04-27 Ulrich Weigand <uweigand@de.ibm.com>
+
* config/rs6000/nm-rs6000.h (TARGET_CREATE_INFERIOR_HOOK): Remove.
* fork-child.c (fork_inferior): Don't call TARGET_CREATE_INFERIOR_HOOK.
* rs6000-nat.c (super_create_inferior): New variable.
diff --git a/gdb/config/rs6000/nm-rs6000.h b/gdb/config/rs6000/nm-rs6000.h
index 2d8542b..832b906 100644
--- a/gdb/config/rs6000/nm-rs6000.h
+++ b/gdb/config/rs6000/nm-rs6000.h
@@ -51,16 +51,3 @@ extern char *xcoff_solib_address (CORE_ADDR);
/* Flag for machine-specific stuff in shared files. FIXME */
#define DEPRECATED_IBM6000_TARGET
-/* AIX has a couple of strange returns from wait(). */
-
-#define CHILD_SPECIAL_WAITSTATUS(ourstatus, hoststatus) ( \
- /* "stop after load" status. */ \
- (hoststatus) == 0x57c ? (ourstatus)->kind = TARGET_WAITKIND_LOADED, 1 : \
- \
- /* signal 0. I have no idea why wait(2) returns with this status word. */ \
- /* It looks harmless. */ \
- (hoststatus) == 0x7f ? (ourstatus)->kind = TARGET_WAITKIND_SPURIOUS, 1 : \
- \
- /* A normal waitstatus. Let the usual macros deal with it. */ \
- 0)
-
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 365463a..1281da2 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -523,6 +523,63 @@ rs6000_xfer_partial (struct target_ops *ops, enum target_object object,
}
}
+/* Wait for the child specified by PTID to do something. Return the
+ process ID of the child, or MINUS_ONE_PTID in case of error; store
+ the status in *OURSTATUS. */
+
+static ptid_t
+rs6000_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+{
+ pid_t pid;
+ int status, save_errno;
+
+ do
+ {
+ set_sigint_trap ();
+ set_sigio_trap ();
+
+ do
+ {
+ pid = waitpid (ptid_get_pid (ptid), &status, 0);
+ save_errno = errno;
+ }
+ while (pid == -1 && errno == EINTR);
+
+ clear_sigio_trap ();
+ clear_sigint_trap ();
+
+ if (pid == -1)
+ {
+ fprintf_unfiltered (gdb_stderr,
+ _("Child process unexpectedly missing: %s.\n"),
+ safe_strerror (save_errno));
+
+ /* Claim it exited with unknown signal. */
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+ return minus_one_ptid;
+ }
+
+ /* Ignore terminated detached child processes. */
+ if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
+ pid = -1;
+ }
+ while (pid == -1);
+
+ /* AIX has a couple of strange returns from wait(). */
+
+ /* stop after load" status. */
+ if (status == 0x57c)
+ ourstatus->kind = TARGET_WAITKIND_LOADED;
+ /* signal 0. I have no idea why wait(2) returns with this status word. */
+ else if (status == 0x7f)
+ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
+ /* A normal waitstatus. Let the usual macros deal with it. */
+ else
+ store_waitstatus (ourstatus, status);
+
+ return pid_to_ptid (pid);
+}
/* Execute one dummy breakpoint instruction. This way we give the kernel
a chance to do some housekeeping and update inferior's internal data,
@@ -1258,6 +1315,8 @@ _initialize_core_rs6000 (void)
super_create_inferior = t->to_create_inferior;
t->to_create_inferior = rs6000_create_inferior;
+ t->to_wait = rs6000_wait;
+
add_target (t);
/* Initialize hook in rs6000-tdep.c for determining the TOC address
diff --git a/gdb/target.c b/gdb/target.c
index b4857ca..42b0a1d 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1976,13 +1976,6 @@ generic_mourn_inferior (void)
void
store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
{
-#ifdef CHILD_SPECIAL_WAITSTATUS
- /* CHILD_SPECIAL_WAITSTATUS should return nonzero and set *OURSTATUS
- if it wants to deal with hoststatus. */
- if (CHILD_SPECIAL_WAITSTATUS (ourstatus, hoststatus))
- return;
-#endif
-
if (WIFEXITED (hoststatus))
{
ourstatus->kind = TARGET_WAITKIND_EXITED;