delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/01/17/10:41:58

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:cc:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=uEU6gm4AykKt6wty
aIpw80PMGk4ITonx6O6il9zr6cEMZQ5f7EJ3awXdeola80gA9XqyAyillDbtowI4
lIj3HHp51fqOPELaX0xzpOKqoEQSmtzPOgigxiRPrGENABI9aLKlGIH+GvuuGVG4
8l1Fs98ZM3ppyqj8JUy9b4Ha3tQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:cc:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=BQSHFhoAupTza5Kv7yaCJH
9Xg+c=; b=lvNTCGEDO291TMU0rUbXVxWDOoJ7t7LqfsXX1exXqBUNrAxAbrd4GH
e/dVXr6aa0K8K/HOyuqtmmBqm2+pskRKZP0YOUHkrdvkv+19QLOmv+QgVp5vTAvu
pP/YXcYGindTKPZKL6Bmu9KyGcBwFjNLtpP6zqdKuZfiUOr3TDpqA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,FORGED_SPF_HELO,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=no version=3.3.1 spammy=cygwinannounce, gplhtml, gpl.html, UD:gpl.html
X-HELO: sa-prd-fep-043.btinternet.com
Authentication-Results: btinternet.com; auth=pass (PLAIN) smtp.auth=jonturney AT btinternet DOT com
X-OWM-Source-IP: 31.51.207.12 (GB)
X-OWM-Env-Sender: jonturney AT btinternet DOT com
X-VadeSecure-score: verdict=clean score=0/300, class=clean
Subject: Re: cin and read(*,*) not waiting for kbd input in gdb
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
References: <552d8b06cb6e431fb00f581c7853b795 AT vsrv060ex01 DOT ssd DOT fsi DOT com>
From: Jon Turney <jon DOT turney AT dronecode DOT org DOT uk>
Cc: "Rockefeller, Harry" <Harry DOT Rockefeller AT flightsafety DOT com>
Message-ID: <ba72d46a-1f44-e313-5ce9-e496e1adbf6c@dronecode.org.uk>
Date: Fri, 17 Jan 2020 15:40:14 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1
MIME-Version: 1.0
In-Reply-To: <552d8b06cb6e431fb00f581c7853b795@vsrv060ex01.ssd.fsi.com>

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...

[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.
> 
> I've tried simplifying cpp problem with simple code.
> e.g.
> #include <iostream> // to enable terminal printout
> #include <cmath>    // pow function
> int main() {
>    float request_time_to_run(void);
>    float a=0.0f;
>    a = request_time_to_run();
>    printf ("a is %f\n", a);
> }
> float request_time_to_run() {
>    float tm = 0.0;        // Time duration (sec)
>    std::string ans = "";  // interactive answer for time duration
>    std::cout << "Supply the equivalent of runtime in seconds. \n";
>    std::cout << "Note: time=0 will stop main. \n";
>    std::cin >> ans;
>    if ( (int)(ans[0]) < 48 || (int)(ans[0] > 57) ) {
>      tm = 1.0;
>    } else {
>      int i;
>      int j = 0;
>      tm = 0.0;
>      for (i=ans.length() - 1; i>=0; i--) {
>        tm += ((int)(ans[i]) - 48) * pow( 10, j++);
>      }
>    }
>    return tm;
> }
> 

I'm not able to reproduce this problem.  Perhaps you can provide a 
similar transcript showing the steps to reproduce?

> $ 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.


--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019