From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?Llu=C3=ADs?= Newsgroups: gmane.emacs.devel Subject: Re: Gdb in emacs 24 Date: Wed, 19 Oct 2011 15:10:06 +0200 Message-ID: <87k481gma9.fsf@ginnungagap.bsc.es> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1319029841 19247 80.91.229.12 (19 Oct 2011 13:10:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 19 Oct 2011 13:10:41 +0000 (UTC) Cc: David Reitter , Stefan Monnier , "emacs-devel@gnu.org devel" To: Tom Tromey Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 19 15:10:37 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RGVum-0006VW-Lz for ged-emacs-devel@m.gmane.org; Wed, 19 Oct 2011 15:10:37 +0200 Original-Received: from localhost ([::1]:50993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGVuj-0003PT-5t for ged-emacs-devel@m.gmane.org; Wed, 19 Oct 2011 09:10:33 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:59964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGVua-0003O6-Ev for emacs-devel@gnu.org; Wed, 19 Oct 2011 09:10:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGVuT-0003dR-DI for emacs-devel@gnu.org; Wed, 19 Oct 2011 09:10:24 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:53917) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RGVuT-0003cY-1I for emacs-devel@gnu.org; Wed, 19 Oct 2011 09:10:17 -0400 Original-Received: (qmail invoked by alias); 19 Oct 2011 13:10:12 -0000 Original-Received: from unknown (EHLO localhost) [84.88.53.92] by mail.gmx.net (mp008) with SMTP; 19 Oct 2011 15:10:12 +0200 X-Authenticated: #12333383 X-Provags-ID: V01U2FsdGVkX1+k9MoAo7ikkI99NYJInKTFAKzx1sCIJFYc//ebFw sIBda6I5yeudcm In-Reply-To: (Tom Tromey's message of "Tue, 18 Oct 2011 19:48:34 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 213.165.64.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:145327 Archived-At: Tom Tromey writes: >>>>>> "Stefan" == Stefan Monnier writes: >>> Wouldn't it be more user-friendly to just ask for the name of the executable >>> after M-x gdb, compose the correct arguments to GDB automatically? Stefan> That's an option. But I'd prefer if we tried to make the current Stefan> behavior work well, instead. E.g. it could warn the user when it Stefan> detects a "--fullname" or "--annotate=3". And/or gdb-mi could try and Stefan> notice when GDB doesn't seem to behave according the its expectations Stefan> and output a warning about a possibly missing "-i mi". > Another option would be to have Emacs send commands to gdb at startup to > put it in the right mode. I don't know if this is possible right now, > but we could surely make it so. I can do the gdb side if someone is > willing to work with me on the Emacs side. There seems to be no obvious command in gdb to get the current interpreter. The closest match is routine 'top_level_interpreter', but there is no command to get that. There also seems to be no obvious command to set MI as the current interpreter for all future commands. What I have found available as commands is: * set annotate Sets the annotation level on all future commands. * interpreter-exec Executes the given command with the given interpreter. Looking at its code ('interpreter_exec_cmd'), it's pretty easy to refactor a few lines of code to create a new command (e.g., "set interpreter") to set the current interpreter on all future commands (can be set up in '_initialize_interpreter'). Assuming this must work without modifying gdb, here's a possible solution: * set annotate 0 Disable annotations, so that we can forget about them even if the user did actually set them in the cmdline. * interpreter-exec mi Execute each command under the MI interpreter, even if the user did not actually set it up in the cmdline. Even if not optimal, the cost of setting the interpreter on a per-command basis (as opposed to setting the current interpreter for all future commands) should not have a noticeable impact on performance. Two questions remain open: * What to do if the user ever passed "-i=tui" in the gdb cmdline (which seems to make MI unusable even through "interpreter-exec"). This can be worked around by silently appending any other interface option in the cmdline when starting gdb. If we always appended "-i=mi", then "interpreter-exec" no longer needs to be used. * Should user-issued commands in the gdb buffer use the mi or console interpreter? If it were mi, no problems, apply same approach as above. If it were the console interpeter (append "-i=console" when starting gdb; see above), there would still be a need for the "interpreter-exec" command. Hope it helps. Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth