From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1450 invoked by alias); 12 Aug 2010 02:40:38 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 1435 invoked by uid 22791); 12 Aug 2010 02:40:37 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_FD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Date: Thu, 12 Aug 2010 02:40:00 -0000 From: Oleg Nesterov To: archer@sourceware.org, utrace-devel@redhat.com Subject: Re: gdbstub initial code, v3 Message-ID: <20100812023750.GA17011@redhat.com> References: <20100811235810.GA9783@redhat.com> <20100812011113.GA13212@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100812011113.GA13212@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-SW-Source: 2010-q3/txt/msg00097.txt.bz2 On 08/12, Oleg Nesterov wrote: > > > I will investigate tomorrow, but I am almost sure gdb is > > wrong. > > Yes, this seems to be true... Tomorrow. Can't sleep because of this problem ;) So, the patch below fixes the problem, and gdb + /proc/ugdb seems to work. Indeed, gdb sees that this fd is not pipe/tcp and uses the "hardwire" serial_ops, but hardwire_readchar() doesn't play well with select(). Please teach gdb to use poll/select ? Oleg. --- gdb-7.1/gdb/ser-unix.c +++ gdb-7.1/gdb/ser-unix.c @@ -452,7 +452,7 @@ hardwire_raw (struct serial *scb) static int wait_for (struct serial *scb, int timeout) { -#ifdef HAVE_SGTTY +#if 1 while (1) { struct timeval tv; @@ -474,13 +474,14 @@ wait_for (struct serial *scb, int timeou else numfds = gdb_select (scb->fd + 1, &readfds, 0, 0, 0); - if (numfds <= 0) + if (numfds <= 0) { if (numfds == 0) return SERIAL_TIMEOUT; else if (errno == EINTR) continue; else return SERIAL_ERROR; /* Got an error from select or poll */ + } return 0; }