Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Cc: pedro@codesourcery.com (Pedro Alves),
	drow@false.org,         brobecker@adacore.com
Subject: Re: [patch, rfc] Re: target_find_description question
Date: Thu, 11 Sep 2008 16:13:00 -0000	[thread overview]
Message-ID: <200809111611.m8BGBwiF004648@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <200809042359.m84NxTYO018519@d12av02.megacenter.de.ibm.com> from "Ulrich Weigand" at Sep 05, 2008 01:59:29 AM


> 	* 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


      parent reply	other threads:[~2008-09-11 16:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-02 23:49 Ulrich Weigand
2008-09-04 12:12 ` Daniel Jacobowitz
2008-09-04 19:17   ` Ulrich Weigand
2008-09-04 21:52     ` Daniel Jacobowitz
2008-09-04 22:12       ` Pedro Alves
2008-09-04 22:27         ` Pedro Alves
2008-09-05  0:00           ` [patch, rfc] " Ulrich Weigand
2008-09-05  2:40             ` Daniel Jacobowitz
2008-09-05 13:11             ` Pedro Alves
2008-09-06  1:55             ` Joel Brobecker
2008-09-11 16:13             ` Ulrich Weigand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200809111611.m8BGBwiF004648@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=brobecker@adacore.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox