2011-09-09 Pedro Alves gdb/ * breakpoint.c (breakpoint_hit_catch_fork) (breakpoint_hit_catch_vfork, breakpoint_hit_catch_syscall) (breakpoint_hit_catch_exec): Make use of the `ws' argument. * infrun.c (inferior_has_forked, inferior_has_vforked) (inferior_has_execd, inferior_has_called_syscall): Delete. --- gdb/breakpoint.c | 23 ++++++++++++++--- gdb/infrun.c | 72 ------------------------------------------------------- 2 files changed, 19 insertions(+), 76 deletions(-) Index: src/gdb/breakpoint.c =================================================================== --- src.orig/gdb/breakpoint.c 2011-09-09 16:33:26.509763222 +0100 +++ src/gdb/breakpoint.c 2011-09-09 16:33:44.299763226 +0100 @@ -6170,7 +6170,11 @@ breakpoint_hit_catch_fork (const struct { struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner; - return inferior_has_forked (inferior_ptid, &c->forked_inferior_pid); + if (ws->kind != TARGET_WAITKIND_FORKED) + return 0; + + c->forked_inferior_pid = ws->value.related_pid; + return 1; } /* Implement the "print_it" breakpoint_ops method for fork @@ -6267,7 +6271,11 @@ breakpoint_hit_catch_vfork (const struct { struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner; - return inferior_has_vforked (inferior_ptid, &c->forked_inferior_pid); + if (ws->kind != TARGET_WAITKIND_VFORKED) + return 0; + + c->forked_inferior_pid = ws->value.related_pid; + return 1; } /* Implement the "print_it" breakpoint_ops method for vfork @@ -6464,9 +6472,12 @@ breakpoint_hit_catch_syscall (const stru const struct syscall_catchpoint *c = (const struct syscall_catchpoint *) bl->owner; - if (!inferior_has_called_syscall (inferior_ptid, &syscall_number)) + if (ws->kind != TARGET_WAITKIND_SYSCALL_ENTRY + && ws->kind != TARGET_WAITKIND_SYSCALL_RETURN) return 0; + syscall_number = ws->value.syscall_number; + /* Now, checking if the syscall is the same. */ if (c->syscalls_to_be_caught) { @@ -6760,7 +6771,11 @@ breakpoint_hit_catch_exec (const struct { struct exec_catchpoint *c = (struct exec_catchpoint *) bl->owner; - return inferior_has_execd (inferior_ptid, &c->exec_pathname); + if (ws->kind != TARGET_WAITKIND_EXECD) + return 0; + + c->exec_pathname = xstrdup (ws->value.execd_pathname); + return 1; } static enum print_stop_action Index: src/gdb/infrun.c =================================================================== --- src.orig/gdb/infrun.c 2011-09-09 16:33:26.519763222 +0100 +++ src/gdb/infrun.c 2011-09-09 16:33:44.299763226 +0100 @@ -6744,78 +6744,6 @@ discard_infcall_control_state (struct in xfree (inf_status); } -int -inferior_has_forked (ptid_t pid, ptid_t *child_pid) -{ - struct target_waitstatus last; - ptid_t last_ptid; - - get_last_target_status (&last_ptid, &last); - - if (last.kind != TARGET_WAITKIND_FORKED) - return 0; - - if (!ptid_equal (last_ptid, pid)) - return 0; - - *child_pid = last.value.related_pid; - return 1; -} - -int -inferior_has_vforked (ptid_t pid, ptid_t *child_pid) -{ - struct target_waitstatus last; - ptid_t last_ptid; - - get_last_target_status (&last_ptid, &last); - - if (last.kind != TARGET_WAITKIND_VFORKED) - return 0; - - if (!ptid_equal (last_ptid, pid)) - return 0; - - *child_pid = last.value.related_pid; - return 1; -} - -int -inferior_has_execd (ptid_t pid, char **execd_pathname) -{ - struct target_waitstatus last; - ptid_t last_ptid; - - get_last_target_status (&last_ptid, &last); - - if (last.kind != TARGET_WAITKIND_EXECD) - return 0; - - if (!ptid_equal (last_ptid, pid)) - return 0; - - *execd_pathname = xstrdup (last.value.execd_pathname); - return 1; -} - -int -inferior_has_called_syscall (ptid_t pid, int *syscall_number) -{ - struct target_waitstatus last; - ptid_t last_ptid; - - get_last_target_status (&last_ptid, &last); - - if (last.kind != TARGET_WAITKIND_SYSCALL_ENTRY && - last.kind != TARGET_WAITKIND_SYSCALL_RETURN) - return 0; - - if (!ptid_equal (last_ptid, pid)) - return 0; - - *syscall_number = last.value.syscall_number; - return 1; -} int ptid_match (ptid_t ptid, ptid_t filter)