2012-01-24 Pedro Alves <pedro@codesourcery.com>
* 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. (handle_syscall_event): Get syscall_number from the execution control state's wait status. (wait_for_inferior): Don't clear syscall_number.
This commit is contained in:
parent
09ac7c10d4
commit
f90263c124
3 changed files with 31 additions and 84 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2012-01-24 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
(handle_syscall_event): Get syscall_number from the execution
|
||||||
|
control state's wait status.
|
||||||
|
(wait_for_inferior): Don't clear syscall_number.
|
||||||
|
|
||||||
2012-01-24 Pedro Alves <palves@redhat.com>
|
2012-01-24 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* breakpoint.c (bpstat_check_location, bpstat_stop_status,
|
* breakpoint.c (bpstat_check_location, bpstat_stop_status,
|
||||||
|
|
|
@ -6232,7 +6232,11 @@ breakpoint_hit_catch_fork (const struct bp_location *bl,
|
||||||
{
|
{
|
||||||
struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner;
|
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
|
/* Implement the "print_it" breakpoint_ops method for fork
|
||||||
|
@ -6342,7 +6346,11 @@ breakpoint_hit_catch_vfork (const struct bp_location *bl,
|
||||||
{
|
{
|
||||||
struct fork_catchpoint *c = (struct fork_catchpoint *) bl->owner;
|
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
|
/* Implement the "print_it" breakpoint_ops method for vfork
|
||||||
|
@ -6552,9 +6560,12 @@ breakpoint_hit_catch_syscall (const struct bp_location *bl,
|
||||||
const struct syscall_catchpoint *c
|
const struct syscall_catchpoint *c
|
||||||
= (const struct syscall_catchpoint *) bl->owner;
|
= (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;
|
return 0;
|
||||||
|
|
||||||
|
syscall_number = ws->value.syscall_number;
|
||||||
|
|
||||||
/* Now, checking if the syscall is the same. */
|
/* Now, checking if the syscall is the same. */
|
||||||
if (c->syscalls_to_be_caught)
|
if (c->syscalls_to_be_caught)
|
||||||
{
|
{
|
||||||
|
@ -6860,7 +6871,11 @@ breakpoint_hit_catch_exec (const struct bp_location *bl,
|
||||||
{
|
{
|
||||||
struct exec_catchpoint *c = (struct exec_catchpoint *) bl->owner;
|
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
|
static enum print_stop_action
|
||||||
|
|
81
gdb/infrun.c
81
gdb/infrun.c
|
@ -2701,10 +2701,6 @@ wait_for_inferior (void)
|
||||||
state. */
|
state. */
|
||||||
old_chain = make_cleanup (finish_thread_state_cleanup, &minus_one_ptid);
|
old_chain = make_cleanup (finish_thread_state_cleanup, &minus_one_ptid);
|
||||||
|
|
||||||
if (ecs->ws.kind == TARGET_WAITKIND_SYSCALL_ENTRY
|
|
||||||
|| ecs->ws.kind == TARGET_WAITKIND_SYSCALL_RETURN)
|
|
||||||
ecs->ws.value.syscall_number = UNKNOWN_SYSCALL;
|
|
||||||
|
|
||||||
/* Now figure out what to do with the result of the result. */
|
/* Now figure out what to do with the result of the result. */
|
||||||
handle_inferior_event (ecs);
|
handle_inferior_event (ecs);
|
||||||
|
|
||||||
|
@ -3072,11 +3068,9 @@ handle_syscall_event (struct execution_control_state *ecs)
|
||||||
|
|
||||||
regcache = get_thread_regcache (ecs->ptid);
|
regcache = get_thread_regcache (ecs->ptid);
|
||||||
gdbarch = get_regcache_arch (regcache);
|
gdbarch = get_regcache_arch (regcache);
|
||||||
syscall_number = gdbarch_get_syscall_number (gdbarch, ecs->ptid);
|
syscall_number = ecs->ws.value.syscall_number;
|
||||||
stop_pc = regcache_read_pc (regcache);
|
stop_pc = regcache_read_pc (regcache);
|
||||||
|
|
||||||
target_last_waitstatus.value.syscall_number = syscall_number;
|
|
||||||
|
|
||||||
if (catch_syscall_enabled () > 0
|
if (catch_syscall_enabled () > 0
|
||||||
&& catching_syscall_number (syscall_number) > 0)
|
&& catching_syscall_number (syscall_number) > 0)
|
||||||
{
|
{
|
||||||
|
@ -6862,79 +6856,6 @@ discard_infcall_control_state (struct infcall_control_state *inf_status)
|
||||||
xfree (inf_status);
|
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
|
int
|
||||||
ptid_match (ptid_t ptid, ptid_t filter)
|
ptid_match (ptid_t ptid, ptid_t filter)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue