This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch, rfc] Re: target_find_description question
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Cc: pedro at codesourcery dot com (Pedro Alves), drow at false dot org, brobecker at adacore dot com
- Date: Thu, 11 Sep 2008 18:11:58 +0200 (CEST)
- Subject: Re: [patch, rfc] Re: target_find_description question
> * fork-child.c (startup_inferior): Use target_wait and target_resume
> directly instead of calling wait_for_inferior / resume.
>
> * infcmd.c (kill_if_already_running): Do not call no_shared_libraries
> or init_wait_for_inferior.
> (run_command_1): Call init_wait_for_inferior.
I've checked this in now. Updated patch is appended below.
Bye,
Ulrich
Index: gdb/fork-child.c
===================================================================
RCS file: /cvs/src/src/gdb/fork-child.c,v
retrieving revision 1.43
diff -c -p -r1.43 fork-child.c
*** gdb/fork-child.c 8 Sep 2008 21:51:18 -0000 1.43
--- gdb/fork-child.c 11 Sep 2008 14:49:49 -0000
*************** startup_inferior (int ntraps)
*** 428,451 ****
if (exec_wrapper)
pending_execs++;
- clear_proceed_status ();
-
- init_wait_for_inferior ();
-
while (1)
{
! struct thread_info *tp;
! /* Make wait_for_inferior be quiet. */
! stop_soon = STOP_QUIETLY;
! wait_for_inferior (1);
! tp = inferior_thread ();
! if (tp->stop_signal != TARGET_SIGNAL_TRAP)
{
! /* Let shell child handle its own signals in its own way.
! FIXME: what if child has exited? Must exit loop
! somehow. */
! resume (0, tp->stop_signal);
}
else
{
--- 428,494 ----
if (exec_wrapper)
pending_execs++;
while (1)
{
! int resume_signal = TARGET_SIGNAL_0;
! ptid_t resume_ptid;
!
! struct target_waitstatus ws;
! memset (&ws, 0, sizeof (ws));
! resume_ptid = target_wait (pid_to_ptid (-1), &ws);
!
! /* Mark all threads non-executing. */
! set_executing (pid_to_ptid (-1), 0);
!
! /* In all-stop mode, resume all threads. */
! if (!non_stop)
! resume_ptid = pid_to_ptid (-1);
!
! switch (ws.kind)
! {
! case TARGET_WAITKIND_IGNORE:
! case TARGET_WAITKIND_SPURIOUS:
! case TARGET_WAITKIND_LOADED:
! case TARGET_WAITKIND_FORKED:
! case TARGET_WAITKIND_VFORKED:
! case TARGET_WAITKIND_SYSCALL_ENTRY:
! case TARGET_WAITKIND_SYSCALL_RETURN:
! /* Ignore gracefully during startup of the inferior. */
! break;
!
! case TARGET_WAITKIND_SIGNALLED:
! target_terminal_ours ();
! target_mourn_inferior ();
! error (_("During startup program terminated with signal %s, %s."),
! target_signal_to_name (ws.value.sig),
! target_signal_to_string (ws.value.sig));
! return;
!
! case TARGET_WAITKIND_EXITED:
! target_terminal_ours ();
! target_mourn_inferior ();
! if (ws.value.integer)
! error (_("During startup program exited with code %d."),
! ws.value.integer);
! else
! error (_("During startup program exited normally."));
! return;
!
! case TARGET_WAITKIND_EXECD:
! /* Handle EXEC signals as if they were SIGTRAP signals. */
! xfree (ws.value.execd_pathname);
! resume_signal = TARGET_SIGNAL_TRAP;
! break;
!
! case TARGET_WAITKIND_STOPPED:
! resume_signal = ws.value.sig;
! break;
! }
! if (resume_signal != TARGET_SIGNAL_TRAP)
{
! /* Let shell child handle its own signals in its own way. */
! target_resume (resume_ptid, 0, resume_signal);
}
else
{
*************** startup_inferior (int ntraps)
*** 470,479 ****
if (--pending_execs == 0)
break;
! resume (0, TARGET_SIGNAL_0); /* Just make it go on. */
}
}
- stop_soon = NO_STOP_QUIETLY;
}
/* Implement the "unset exec-wrapper" command. */
--- 513,522 ----
if (--pending_execs == 0)
break;
! /* Just make it go on. */
! target_resume (resume_ptid, 0, TARGET_SIGNAL_0);
}
}
}
/* Implement the "unset exec-wrapper" command. */
Index: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.210
diff -c -p -r1.210 infcmd.c
*** gdb/infcmd.c 8 Sep 2008 22:10:20 -0000 1.210
--- gdb/infcmd.c 11 Sep 2008 14:49:49 -0000
*************** kill_if_already_running (int from_tty)
*** 431,438 ****
Start it from the beginning? "))
error (_("Program not restarted."));
target_kill ();
- no_shared_libraries (NULL, from_tty);
- init_wait_for_inferior ();
}
}
--- 431,436 ----
*************** run_command_1 (char *args, int from_tty,
*** 448,453 ****
--- 446,453 ----
dont_repeat ();
kill_if_already_running (from_tty);
+
+ init_wait_for_inferior ();
clear_breakpoint_hit_counts ();
/* Clean up any leftovers from other runs. Some other things from
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com