delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/08/15/20:45:45

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Alexei A. Frounze" <alexfrunews AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: kbhit() not working when debugging
Date: Thu, 16 Aug 2007 00:35:53 -0000
Organization: http://groups.google.com
Lines: 30
Message-ID: <1187224553.564679.262950@g12g2000prg.googlegroups.com>
References: <46C3950F DOT 4931 DOT 47ADF6D AT gerritvn DOT gpvno DOT co DOT za>
NNTP-Posting-Host: 76.22.63.3
Mime-Version: 1.0
X-Trace: posting.google.com 1187224555 14165 127.0.0.1 (16 Aug 2007 00:35:55 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Thu, 16 Aug 2007 00:35:55 +0000 (UTC)
In-Reply-To: <46C3950F.4931.47ADF6D@gerritvn.gpvno.co.za>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: g12g2000prg.googlegroups.com; posting-host=76.22.63.3;
posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Aug 15, 3:06 pm, "Gerrit van Niekerk" <gerri DOT  DOT  DOT  AT gpvno DOT co DOT za> wrote:
> I have a DJGPP program executing a fairly long loop containing kbhit() to
> check for keyboard input. When executing normally, it works fine, but as
> soon as the program is invoked using GDB (version 6.1.1), the kbhit() never
> returns anything but 0 when using CWSDPMI under ROM-DOS. This is the
> case even if just running the program without setting any breakpoints or
> watchpoints.
>
> GDB works fine in a DOS-BOX in WinXP.
>
> I have tried both DJGPP 2.03 and 2.04 with the same result.
>
> Any help will be appreciated.

I'm not sure if it's related, but calling kbhit() in a loop may make
the OS (Windows NT/2000/XP/etc) think the program isn't doing anything
but just waiting for the keyboard input. As the consequence, the OS
may give the app significantly less time to run or give none at all
(that is, pause it) until a key is actually pressed. In one app I had
to hook up the keyboard interrupt and instead of repeatedly calling
kbhit() poll a global variable that my keyboard ISR would set (and the
poller atomically reset when done handling).

As for the debugger, I don't know for sure, but it may get in the way
with its own keyboard stuff.

Just some thoughts.

Alex

- Raw text -


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