From: "Francisco Pastor" Newsgroups: comp.os.msdos.djgpp Subject: Problems with rmote debug in gdb Date: Tue, 17 Jun 2003 09:53:59 +0200 Organization: Universitat de Valencia Lines: 56 Message-ID: NNTP-Posting-Host: 83.red-80-24-166.pooles.rima-tde.net X-Trace: peque.uv.es 1055836448 26091 80.24.166.83 (17 Jun 2003 07:54:08 GMT) X-Complaints-To: newsmanager AT uv DOT es NNTP-Posting-Date: Tue, 17 Jun 2003 07:54:08 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I am ussing gdb 5.3 with djgpp over Win2K and this do not work in remote debuging. Looking what gdb send by the serial link it seems that gdb do not wait for a response. It send all the retries at one time. Looking the source in the module ser-go32.c, the function to read a char is: static int dos_readchar (struct serial *scb, int timeout) { struct dos_ttystate *port = &ports[scb->fd]; long then; int c; then = rawclock () + (timeout * RAWHZ); while ((c = dos_getc (port)) < 0) { if (timeout >= 0 && (rawclock () - then) >= 0) return SERIAL_TIMEOUT; } return c; } And this has the problem above. But if I change the code by: static int dos_readchar (struct serial *scb, int timeout) { struct dos_ttystate *port = &ports[scb->fd]; long then; int c; then = rawclock() + (timeout * RAWHZ); for ( ;; ) { c = dos_getc (port); if ( c >= 0 ) break; if ( timeout < 0 ) continue; if ( rawclock() > then ) return SERIAL_TIMEOUT; } return c; } With that the remote debugging work fine. Both codes seems right. My be a problem with de compiler optimization? I think that because disaseembling the code produced by the first function the loop for wait a char o the time-out seems is not correct. Please, say me if somebody have a similar problem. Thanks