From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7698 invoked by alias); 15 Mar 2006 23:18:52 -0000 Received: (qmail 7690 invoked by uid 22791); 15 Mar 2006 23:18:52 -0000 X-Spam-Check-By: sourceware.org Received: from mta03.pge.com (HELO mta03.pge.com) (131.89.129.73) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Mar 2006 23:18:51 +0000 Received: from mta11.comp.pge.com (mta11.comp.pge.com [10.245.211.126]) by mta03.pge.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k2FNInfM010696 for ; Wed, 15 Mar 2006 15:18:49 -0800 (PST) Received: from mdssdev05.comp.pge.com (mdssdev05.comp.pge.com [10.244.96.61]) by mta11.comp.pge.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k2FNIm2w024186; Wed, 15 Mar 2006 15:18:48 -0800 (PST) Received: (from esp5@localhost) by mdssdev05.comp.pge.com (8.11.7p1+Sun/8.11.7) id k2FNIkw13923; Wed, 15 Mar 2006 15:18:46 -0800 (PST) Date: Wed, 15 Mar 2006 23:37:00 -0000 From: Ed Peschko To: gdb@sourceware.org Cc: esp5@pge.com Subject: Re: tracing, attaching to gdb processes Message-ID: <20060315231846.GA13847@mdssdev05> References: <20060306052832.GA12829@mdssdev05> <20060314022809.GA1335@nevyn.them.org> <20060315030437.GE10146@mdssdev05> <20060315034420.GA1616@nevyn.them.org> <20060315041618.GB12493@mdssdev05> <20060315142230.GA12258@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060315142230.GA12258@nevyn.them.org> User-Agent: Mutt/1.4.2.1i Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00085.txt.bz2 On Wed, Mar 15, 2006 at 09:22:31AM -0500, Daniel Jacobowitz wrote: > On Tue, Mar 14, 2006 at 08:16:18PM -0800, Ed Peschko wrote: > > Also, I note that when you do do something like this, you get a 'press to > > coninue, q to quit'. It would be nice if there was a way to override this. > > "set height 0" > > Stopping on input is a bit more complicated than you think. Whenever > the program is running, it has control of the terminal - and input goes > to it, not to us. I don't see an easy way to do this. The way to do it is thorugh something similar to ReadKey - For example, the following perl script does sort of what I'd want: use Term::ReadKey; ReadMode('cbreak'); while (1) { # do stuff. if (defined($char = ReadKey(-1))) { last; } system("ls"); sleep(1); } At every point the program hits the ReadKey call, it checks to see if there is input to process, and if so, drops out. If there is nothing to read, it continues. So you basically will get a bunch of 'lses' until you hit anything, and then the program will stop. Term::ReadKey is implemented with its own handwritten c, but I can't imagine that readline wouldn't have something similar. > > cool.. then simply add that as a hook inside the library. Which would > > you rather write (continuously), the first one, or the second? And isn't it useful > > to have it just for suggesting ideas to end users of gdb? > > That says to me that it belongs in the manual. Shipping a library is a > serious pain; why should we do it for a two-line function? Right now, I look inside of the gdb folder inside of the build directory for gdb-6.3, and I see that make creates a: libgdb.a file. I'm assuming it wouldn't be that difficult to add there. Another thing that might be useful to add there is an 'automatic breakpoint' function. Perl has '$DB::single', ie: you set the value $DB::single = 1, the debugger automatically stops. Similarly, it would be nice to have a gdb_stop(); function, which you could use to pepper your code with useful breakpoints. As far as patching goes, I'd be willing to write some of this stuff, if I got a pointer to say, how you do a non-blocking read with readline. And maybe an inkling if someone would be willing to include it in the 'standard distribution' (I'm not too hot on needing to maintain a local patch) Ed