This is the mail archive of the cygwin mailing list for the Cygwin 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: cin and read(*,*) not waiting for kbd input in gdb


[snip]
>>>I'm not able to reproduce this problem.  Perhaps you can provide a similar transcript showing the steps to reproduce?
[snip]
>>Test code:
 > >    program test
  >>    implicit none
   >>   real    cycle_time_preset /0.0/ ! (seconds)
    >>  real    cycle_length /0.0/      ! (seconds)
     >> do
      >>   if (cycle_time_preset.le.0.0) then
       >>     write(*,*)'Supply the equivalent of run time in seconds.'
        >>    write(*,"('(Note: a negative run time will stop run): ',$)")
         >>   read(*,*) cycle_length
         >>else
          >>  cycle_length = cycle_time_preset
         >>end if
         >>if (cycle_length .lt. 0.0) stop 'normal termination'
      >>end do
      >>stop
      >>end

>>$ /usr/bin/gfortran   -g -ffree-form -ffree-line-length-none -Wunused -ffpe-trap=invalid,zero,overflow -o test.exe test.f
[snip]
>Following your test I do not have cin wait for kbd input whenever a breakpoint is set.
>In fact, if I run 'disa 1' to disable the breakpoint and then just 'run'
>(to restart the program from the beginning) then the program does pause for my keyboard input.
>This happens in both my Win 7 and Win 7 - RTX OS boots.
>This happens in both gdb 8.2.1-1 and 8.3.1-1.  It does not happen with Gdb version 8.1.1-1.
[snip]

I don't know if this is a gdb or a Cygwin implementation of gdb that is a problem.
Since I can go back to gdb version 8.1.1-1 this is not a problem for me now.
Here is a test case using the Fortran source above:

$ gfortran -g test1.f -o test1.exe

harryr@HARRYR-PC ~/d62sim/Excel
$ gdb test1
GNU gdb (GDB) (Cygwin 8.3.1-1) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test1...
(gdb) b test1.f:9
Breakpoint 1 at 0x100401140: file test1.f, line 9.
(gdb) r
Starting program: /cygdrive/c/Users/harryr/d62sim/Excel/test1
[New Thread 7696.0x2a9c]
[New Thread 7696.0xf0c]
[New Thread 7696.0x22f8]
 Supply the equivalent of real time test in seconds.
(Note: a negative test length will stop run):
Thread 1 "test1" hit Breakpoint 1, test1 () at test1.f:9
9                read(*,*) cycle_length
(gdb) b unix.c:271
Breakpoint 2 at 0x3df9bb3c0: file /usr/src/debug/gcc-7.4.0-1/libgfortran/io/unix.c, line 272.
(gdb) c
Continuing.

Thread 1 "test1" hit Breakpoint 2, _gfortrani_flush_if_preconnected (s=0x80004e300) at /usr/src/debug/gcc-7.4.0-1/libgfortran/io/unix.c:272
272     {
(gdb) s
275       fd = ((unix_stream *) s)->fd;
(gdb)
276       if (fd == STDIN_FILENO)
(gdb)
277         fflush (stdin);
(gdb)
__getreent () at /usr/src/debug/cygwin-3.1.2-1/winsup/cygwin/thread.cc:89
89        return &_my_tls.local_clib;
(gdb)
NtCurrentTeb () at /usr/src/debug/cygwin-3.1.2-1/winsup/cygwin/thread.cc:89
89        return &_my_tls.local_clib;
(gdb)
__readgsqword (Offset=48) at /usr/x86_64-pc-cygwin/sys-root/usr/include/w32api/psdk_inc/intrin-impl.h:714
714     /usr/x86_64-pc-cygwin/sys-root/usr/include/w32api/psdk_inc/intrin-impl.h: No such file or directory.
(gdb)
__getreent () at /usr/src/debug/cygwin-3.1.2-1/winsup/cygwin/thread.cc:89
89        return &_my_tls.local_clib;
(gdb)
90      }
(gdb)
_gfortrani_flush_if_preconnected (s=<optimized out>) at /usr/src/debug/gcc-7.4.0-1/libgfortran/io/unix.c:282
282     }
(gdb)
277         fflush (stdin);
(gdb)
/wip/cygport-git/gdb/gdb-8.3.1-1.x86_64/src/gdb-8.3.1/gdb/infrun.c:2602: internal-error: void resume_1(gdb_signal): Assertion `pc_in_thread_step_range (pc, tp)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)y

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

/wip/cygport-git/gdb/gdb-8.3.1-1.x86_64/src/gdb-8.3.1/gdb/infrun.c:2602: internal-error: void resume_1(gdb_signal): Assertion `pc_in_thread_step_range (pc, tp)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Aborted (core dumped)

Attachment: gdb.exe.stackdump
Description: gdb.exe.stackdump

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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