From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22999 invoked by alias); 15 Mar 2006 04:16:23 -0000 Received: (qmail 22989 invoked by uid 22791); 15 Mar 2006 04:16:23 -0000 X-Spam-Check-By: sourceware.org Received: from mta07.pge.com (HELO mta07.pge.com) (131.90.0.77) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Mar 2006 04:16:21 +0000 Received: from mta16.comp.pge.com (mta16.comp.pge.com [10.244.4.51]) by mta07.pge.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k2F4GJYV001144 for ; Tue, 14 Mar 2006 20:16:19 -0800 (PST) Received: from mdssdev05.comp.pge.com (mdssdev05.comp.pge.com [10.244.96.61]) by mta16.comp.pge.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k2F4GIYF017998; Tue, 14 Mar 2006 20:16:18 -0800 (PST) Received: (from esp5@localhost) by mdssdev05.comp.pge.com (8.11.7p1+Sun/8.11.7) id k2F4GIH12535; Tue, 14 Mar 2006 20:16:18 -0800 (PST) Date: Wed, 15 Mar 2006 05:09:00 -0000 From: Ed Peschko To: gdb@sourceware.org Cc: esp5@pge.com Subject: Re: tracing, attaching to gdb processes Message-ID: <20060315041618.GB12493@mdssdev05> References: <20060306052832.GA12829@mdssdev05> <20060314022809.GA1335@nevyn.them.org> <20060315030437.GE10146@mdssdev05> <20060315034420.GA1616@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060315034420.GA1616@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/msg00071.txt.bz2 > > I don't understand.. > > > > Are you suggesting that I make an expect script to control gdb, and then have > > that control script pass characters to the underlying process? Or something > > more exotic? > > The GDB CLI scripting language has "while". See the manual. > > It won't work very well though. The C-c will stop the sleep, but not > the while. exactly... > > And why can't this be built into gdb in the form of a 'set' variable? Either that, > > or a built-in high-resolution 'sleep' call that doesn't require spawning a shell? > > You asked if GDB could do what you wanted; this is how it can. I > don't know whether it should have a built in command to do this or not. > > > Or best yet, a builtin non-blocking read call that waits for a person's input? > > I fail to see how this relates to what you wanted. while 1; > set end_on_input > step; > gdb_sleep .1 'set stop_on_input' would make it so that the user could interrupt the script with the press of a key via a non-blocking read.. ie: exactly what I would want. gdb_sleep would be a high res sleep call that slept fractional amounts of a second. 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. > > It would be very cool, for example, if you could somehow trigger gdb to run with > > an instantiated call, say: > > > > /* my code here */ > > spawn_gdb() > > /* my code here */ > > > > and then a gdb would be spawned automatically and attached to the process at the > > point right following the spawn_gdb call. > > GDK/GTK already have code to do this. So do lots of other libraries. > It's not something that needs to be distributed with GDB; it's just > if (fork () == 0) > execlp ("gdb", argv[0], getppid (), NULL); well, 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? Anyways, if this isn't the place to request gdb features, what *is* the correct place? Ed