This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: invoking GDB from FE and signals


On Thu, May 18, 2006 at 11:49:01PM +0200, Andreas Schwab wrote:
> Bob Rossi <bob_rossi@cox.net> writes:
> 
> > I find in emacs:process.c code that they send the SIGINT in different
> > ways
> >     /* If possible, send signals to the entire pgrp
> >        by sending an input character to it.  */
> >
> >     /* TERMIOS is the latest and bestest, and seems most likely to
> >        work.  If the system has it, use it.  */
> >     case SIGINT:
> >       sig_char = &t.c_cc[VINTR];
> >       break;
> >     ...
> >     send_process (proc, sig_char, 1, Qnil);
> 
> This part is only active if SIGNALS_VIA_CHARACTERS is defined.  That is
> defined mostly for BSD-derived systems, but not, for example, for Linux.
> The fallback is to send the signal to the foreground process group of the
> terminal.

Thanks Andreas, I see now. The code is below on how to get the
foreground process group. I see that it get's the process group and then
calls killpg.

Is this the prefered way of sending a single to the inferior? I am only
now realizing how many different case's that emacs supports.

Thanks,
Bob Rossi

/* Return the foreground process group for the tty/pty that
   the process P uses.  */
static int
emacs_get_tty_pgrp (p)
     struct Lisp_Process *p;
{
  int gid = -1;

#ifdef TIOCGPGRP
  if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
    {
      int fd;
      /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
         master side.  Try the slave side.  */
      fd = emacs_open (XSTRING (p->tty_name)->data, O_RDONLY, 0);

      if (fd != -1)
        {
          ioctl (fd, TIOCGPGRP, &gid);
          emacs_close (fd);
        }
    }
#endif /* defined (TIOCGPGRP ) */

  return gid;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]