From 01aec80370360b2fc1c0572f8765adfc6d4048d2 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Fri, 15 Sep 2006 22:50:12 +0000 Subject: * async-nat-inferior.h (struct gdb_inferior_status): Remove unused members. (inf_ptrace_him): Don't set above deleted members. (inf_ptrace_attach): Don't call gdb_inferior_destroy as it is called by gdb_create_inferior later. Merge async conditionals. (inf_ptrace_detach): Delete signal thread. --- gdb/inf-ptrace.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index cbee144cc77..a41e40540cd 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -155,14 +155,8 @@ inf_ptrace_him (int pid) if (target_can_async_p ()) { gdb_create_inferior (gdb_status, pid); - gdb_signal_thread_create (&gdb_status->signal_status, pid); - gdb_status->attached_in_ptrace = 1; - gdb_status->stopped_in_ptrace = 0; - gdb_status->stopped_in_softexc = 0; - - gdb_status->suspend_count = 0; } /* START_INFERIOR_TRAPS_EXPECTED is defined in inferior.h, and will @@ -245,9 +239,6 @@ inf_ptrace_attach (char *args, int from_tty) if (pid == getpid ()) /* Trying to masturbate? */ error (_("I refuse to debug myself!")); - if (target_can_async_p ()) - gdb_inferior_destroy (gdb_status); - if (from_tty) { exec_file = get_exec_file (0); @@ -262,10 +253,6 @@ inf_ptrace_attach (char *args, int from_tty) gdb_flush (gdb_stdout); } - if (target_can_async_p ()) - gdb_create_inferior (gdb_status, pid); - - #ifdef PT_ATTACH errno = 0; ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0); @@ -276,20 +263,14 @@ inf_ptrace_attach (char *args, int from_tty) error (_("This system does not support attaching to a process")); #endif - if (target_can_async_p ()) - { - gdb_status->attached_in_ptrace = 1; - gdb_status->stopped_in_ptrace = 0; - gdb_status->stopped_in_softexc = 0; - - gdb_status->suspend_count = 0; - } - inferior_ptid = pid_to_ptid (pid); push_target (ptrace_ops_hack); - if (target_can_async_p () && gdb_status->attached_in_ptrace) + if (target_can_async_p ()) { + gdb_create_inferior (gdb_status, pid); + gdb_status->attached_in_ptrace = 1; + gdb_status->stopped_in_ptrace = 0; gdb_signal_thread_create (&gdb_status->signal_status, pid); stop_soon = STOP_QUIETLY; wait_for_inferior (); @@ -348,6 +329,9 @@ inf_ptrace_detach (char *args, int from_tty) error (_("This system does not support detaching from a process")); #endif + if (target_can_async_p ()) + gdb_inferior_destroy (gdb_status); + inferior_ptid = null_ptid; unpush_target (ptrace_ops_hack); } -- cgit v1.2.1