This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: cin and read(*,*) not waiting for kbd input in gdb
- From: "Rockefeller, Harry" <Harry dot Rockefeller at flightsafety dot com>
- To: Jon Turney <jon dot turney at dronecode dot org dot uk>, The Cygwin Mailing List <cygwin at cygwin dot com>
- Date: Fri, 17 Jan 2020 17:34:37 +0000
- Subject: RE: cin and read(*,*) not waiting for kbd input in gdb
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 66.109.88.133) smtp.rcpttodomain=cygwin.com smtp.mailfrom=flightsafety.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=flightsafety.com; dkim=none (message not signed); arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ak7EdTNn2da/Y55K2o11U0cU6dcSB35DK1fnvc3yK6U=; b=abS9iK3uaEBNIbsBMcW7JJOhbNColBS8PC0gPt+0U3mum6kjbImNLWaMTntRJ3H+4Qr2YK753u6Z1VP3fkUCRgRMmJZOrBnf4Zvj7KbINA5PgYZ/qXBKxAQA53Hpk92kN3TtOWcl6hI2svYl9B+KDMcgTedhJcSw5dBg77KxRy+VtVlk6OkiLF5Rhqu+KHOkPRbwxwVGk4pIx1R3GfyXcz45XZLw+zSn5kpKHGkzfRDMa6ZuH84166YhSGI0Y1nXKnm/J+xJecq70ALdQrGNhNqQk4IoI9687njxsRCtORHZT1WgxkE9ONl1Biyk5pnjqqCG3a3vWtGU4nDRL7/9+w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xn/3+cgVZLEPacdia4qE7UjnAV5qc1YtNBhJ6e06uSyMtHIC7bfceKP4kHt1qJ/K1JHmyQ7ewBu0y4BqGcDHg3J4SUYIm/X06YQwl/REEeDPxcgpDEmVZF34OBOF1lRHFzQ7f2UV4HZH1QrBc6NYVkw+aWZXqngIxXZItn4iTrK3wnyj5Nv8BHmHW2JowrDxc22V3iYFnXpl+Qyq28DUOtiyHaOi7bvGHmAsjf19pz1Sk1i76Br9/vCjYz3xz2XhGsdVbrgXyMHhRVl5dZPnowHMsMfQKQDhIfPBUG+ezm7sEBPI1bInMwuDm97Y/7iU3kTqKmUs8eu/RIb7ZUbE+g==
- References: <552d8b06cb6e431fb00f581c7853b795@vsrv060ex01.ssd.fsi.com> <ba72d46a-1f44-e313-5ce9-e496e1adbf6c@dronecode.org.uk>
>>-----Original Message-----
>>From: Jon Turney <jon.turney@dronecode.org.uk>
>Sent: Friday, January 17, 2020 9:40 AM
>To: The Cygwin Mailing List <cygwin@cygwin.com>
>Cc: Rockefeller, Harry <Harry.Rockefeller@flightsafety.com>
>Subject: Re: cin and read(*,*) not waiting for kbd input in gdb
>EXTERNAL EMAIL: STOP and verify sender address, links, and attachments before taking action.
>On 16/01/2020 21:02, Rockefeller, Harry wrote:
>> Both the Fortran and cpp used to work correctly when run in gdb.
>
>Thanks for reporting this problem.
>
>I assume this means that this worked with gdb-8.1.1-1, but not with
>gdb-8.2.1-1 (Made available for testing 2019-03-21 [1], promoted to current 2020-01-07 [2])
>
>Firstly, can I suggest that if a working gdb is important to you, you try test versions when they are available. Wider testing helps me make good releases of gdb.
>Secondly, can you try the recently made test release of gdb-8.3.1-1 [3], to see if this behaves differently? If that doesn't help, you can downgrade to 8.1.1-1 for the moment...
I certainly plan to do that as soon as problem(s) are identified.
>[1] https://cygwin.com/ml/cygwin-announce/2019-03/msg00032.html
>[2] https://cygwin.com/ml/cygwin/2020-01/msg00064.html
>[3] https://cygwin.com/ml/cygwin-announce/2019-12/msg00033.html
>
>> FWIW, Both Fortran and cpp work correctly, stopping for keyboard input, when run outside of gdb.
>>
>> But now, code simply doesn't stop to take keyboard input inside gdb.
>>
>> [C++ test code omitted for brevity]
>I'm not able to reproduce this problem. Perhaps you can provide a similar transcript showing the steps to reproduce?
I see that when I ran it I also had a few lines like these:
[New Thread 6188.0x1e54].
Since I develop mostly for "hard" real time, my default boot is a Win7 with RTX.
I rebooted my pc with the Win7 alone (no RTX) and the stdin does work as you show below.
I am working with my software support staff to find out if anything changed recently in my PC boot stuff.
>> $ gdb rockefeller.exe
>> GNU gdb (GDB) (Cygwin 8.2.1-1) 8.2.1
>> Copyright (C) 2018 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 rockefeller.exe...done.
>> (gdb) b request_time_to_run()
>> Breakpoint 1 at 0x1004010e8: file rockefeller.cpp, line 10.
>> (gdb) r
>> Starting program: /wip/rockefeller.exe
>>
>> Thread 1 "rockefeller" hit Breakpoint 1, request_time_to_run () at rockefeller.cpp:10
>> 10 float tm = 0.0; // Time duration (sec)
>> (gdb) n
>> 11 std::string ans = ""; // interactive answer for time duration
>> (gdb) n
>> 12 std::cout << "Supply the equivalent of runtime in seconds. \n";
>> (gdb) n
>> Supply the equivalent of runtime in seconds.
>> 13 std::cout << "Note: time=0 will stop main. \n";
>> (gdb) n
>> Note: time=0 will stop main.
>> 14 std::cin >> ans;
>> (gdb) n
>> 1
>> 15 if ( (int)(ans[0]) < 48 || (int)(ans[0] > 57) ) {
>> (gdb) n
>> 19 int j = 0;
>> (gdb) c
>> Continuing.
>> a is 1.000000
>> [Inferior 1 (process 12660) exited normally]
>> But, simple stuff does run correctly in gdb stopping for terminal input at
>> std::cin >> ans;
>> FWIW, for simple cpp above neither the cout nor the cin works directly (not running in gdb).
>Although not related to gdb, that would be a serious cygwin bug.
I am still in the Win7 only boot on my PC ... no RTX
More on this last problem. This time using Fortran.
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
harryr@HARRYR-PC ~/
$ test.exe
$
Neither standard output nor input works.
FWIW, running in gdb both standard input and output work.