Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: thorpej@wasabisystems.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Use multi-arch'd START_INFERIOR_TRAPS_EXPECTED on Alpha target
Date: Wed, 24 Apr 2002 19:30:00 -0000	[thread overview]
Message-ID: <3CC76A3F.9060502@cygnus.com> (raw)
In-Reply-To: <20020424180352.B26223@dr-evil.shagadelic.org>

> On Wed, Apr 24, 2002 at 08:06:31PM -0400, Andrew Cagney wrote:
> 
>  > #define STARTUP_WITH_SHELL 1
>  > - #define START_INFERIOR_TRAPS_EXPECTED (STARTUP_WITH_SHELL + 1)
>  > > Does STARTUP_WITH_SHELL need to be multi-arched?
>  > > I'm wondering if it would be better to make it a variable (``set 
>  > startup-with-shell <boolean>'').  Looking at its uses it appears that 
>  > fork-child.c:startup_inferior() would still work (if it did previously).

Hmm, ``HP Merge'' ~= ``there be dragons''.

> Hm.  Actually, it occurs to me that this is more like what we want, but
> not quite.  What we really want is:
> 
> 	STARTUP_WITH_SHELL_ADDS_TRAPS
> 
> So, then we get:
> 
> #define START_INFERIOR_TRAPS_EXPECTED \
>   (startup_with_shell ? (STARTUP_WITH_SHELL_ADDS_TRAPS + 1) : 1)
> 
> I.e. the issue is really how many extra traps the shell adds.

I've included a few more excerts.  I think this ``feature'' (only ever 
worked on HP/UX.  Can I suggest taking a step back and making the 
feature work :-)

	Andrew

PS:  I think the relevant bits are:

inftarg.c:
    startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
fork-child.c:

   if (STARTUP_WITH_SHELL)
     inferior_ignoring_startup_exec_events = ntraps;
   else
     inferior_ignoring_startup_exec_events = 0;
   inferior_ignoring_leading_exec_events =
     target_reported_exec_events_per_exec_call () - 1;

while pre-merge it read (unchanged since '94):

/* Accept NTRAPS traps from the inferior.  */

void
startup_inferior (ntraps)
      int ntraps;
{
   int pending_execs = ntraps;
   int terminal_initted;

   /* The process was started by the fork that created it,
      but it will have stopped one instruction after execing the shell.
      Here we must get it up to actual execution of the real program.  */

   clear_proceed_status ();

   init_wait_for_inferior ();

   terminal_initted = 0;

#ifdef STARTUP_INFERIOR
   STARTUP_INFERIOR (pending_execs);
#else
   while (1)
     {
       stop_soon_quietly = 1;    /* Make wait_for_inferior be quiet */
       wait_for_inferior ();
       if (stop_signal != TARGET_SIGNAL_TRAP)
         {
           /* Let shell child handle its own signals in its own way */
           /* FIXME, what if child has exit()ed?  Must exit loop somehow */
           resume (0, stop_signal);
         }
       else
         {
           /* We handle SIGTRAP, however; it means child did an exec.  */
           if (!terminal_initted)
             {
               /* Now that the child has exec'd we know it has already 
set its
                  process group.  On POSIX systems, tcsetpgrp will fail with
                  EPERM if we try it before the child's setpgid.  */

               /* Set up the "saved terminal modes" of the inferior
                  based on what modes we are starting it with.  */
               target_terminal_init ();

               /* Install inferior's terminal modes.  */
               target_terminal_inferior ();

               terminal_initted = 1;
             }
           if (0 == --pending_execs)
             break;
           resume (0, TARGET_SIGNAL_0);          /* Just make it go on */
         }
     }
#endif /* STARTUP_INFERIOR */
   stop_soon_quietly = 0;
}



  reply	other threads:[~2002-04-25  2:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-21 18:15 Jason R Thorpe
2002-04-24 17:06 ` Andrew Cagney
2002-04-24 17:45   ` Jason R Thorpe
2002-04-24 18:04   ` Jason R Thorpe
2002-04-24 19:30     ` Andrew Cagney [this message]
2002-04-25 13:03   ` Daniel Jacobowitz
2002-04-25 14:29     ` Michael Snyder
2002-04-25 15:00       ` Daniel Jacobowitz

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=3CC76A3F.9060502@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=thorpej@wasabisystems.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