Mail Archives: djgpp/1998/04/17/13:14:23
Eli Zaretskii wrote:
> So I suggest to get the sources of the above two modules from
> djlsr201.zip, compile them with -g, link Bash with them, and step inside
> `read' and `__libc_termios_hook' with GDB.
Ok, that's what I've done!
> It figures. IIRC Bash uses the termios functions to read console input.
> The DJGPP implementation of termios (written AFIK by Daisuke Aoyama and
> used almost exclusively by Bash) hooks calls to the `read' function and
> makes the library call `__libc_termios_read' instead. See the library
> sources on src/libc/posix/unistd/read.c and
> src/libc/posix/termios/tminit.c, for the gory details.
In fact, there is already a "tminit.c" file in bash sources. It seems to
be
slightly different from the "unistd" one (I've done a quick diff).
Nevertheless
the "fatal" function __libc_termios_read_cooked_tty (see below) is the
same in both
files. Moreover, I've tried to link bash with both "tminit" files: the
debug behaviour
is exactly the same.
> It seems that the
> problem is somewhere inside `__libc_termios_read' or its subroutines.
You're right. More precisely at first call to __dpmi_yield in function
__libc_termios_read_cooked_tty.
Here is the source code of that function:
static ssize_t
__libc_termios_read_cooked_tty (int handle, void *buffer, size_t count)
{
unsigned char *wp;
ssize_t n;
wp = buffer;
n = count;
#if 0
/* clear cooked queue */
if (__libc_termios_exist_queue ())
__libc_termios_clear_queue ();
#endif
if (__libc_tty_p->t_lflag & ICANON)
{
/* get inputs (wait for NL or EOT) */
if (! __libc_termios_exist_queue ())
__libc_termios_fill_queue ();
while (--n >= 0)
{
if (! __libc_termios_exist_queue ())
break;
*wp++ = __libc_termios_get_queue ();
}
}
else
{
/* block until getting inputs */
while (! __libc_termios_exist_queue ())
{
__dpmi_yield (); <<<<<< freezes here! (first call)
__libc_termios_fill_queue ();
}
while (--n >= 0)
{
*wp++ = __libc_termios_get_queue ();
if (! __libc_termios_exist_queue ())
{
__libc_termios_fill_queue ();
if (! __libc_termios_exist_queue ())
break;
}
}
}
return (ssize_t) (wp - (unsigned char *) buffer);
}
> I hope you will be at least
> able to see what part there hangs on you, and we could then scratch our
> heads to try to figure out why.
Ouasp!!! I'm still trying! Unfortunately, I don't know anything about
DPMI. I'm going
to study that, of course, but I'm sure you'll have an idea before me,
won't you.
Regards,
Philippe.
_______________________________________________________________________
Philippe HANRIGOU Conseil Général de la Martinique
Ingénieur informatique D.D.S.T. - service I.T.S.
Immeuble Concorde, route de la Folie
Tél: (0596) 59-84-63 97200 Fort de France
E-mail: HANRIGOU AT cgste DOT mq FRANCE
_______________________________________________________________________
- Raw text -