From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "R. Bernstein" Newsgroups: gmane.emacs.devel Subject: gud.el organization and adding debuggers Date: Wed, 1 Feb 2006 19:57:48 -0500 Message-ID: <17377.22796.880736.93318@panix3.panix.com> Reply-To: rocky@panix.com NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1138845398 13150 80.91.229.2 (2 Feb 2006 01:56:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 2 Feb 2006 01:56:38 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 02 02:56:37 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F4Ti4-0006aF-Gv for ged-emacs-devel@m.gmane.org; Thu, 02 Feb 2006 02:56:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F4TlA-0002Hk-0t for ged-emacs-devel@m.gmane.org; Wed, 01 Feb 2006 20:59:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F4SqN-0005wQ-V0 for emacs-devel@gnu.org; Wed, 01 Feb 2006 20:01:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F4SqL-0005vw-TK for emacs-devel@gnu.org; Wed, 01 Feb 2006 20:01:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F4SqL-0005vh-OB for emacs-devel@gnu.org; Wed, 01 Feb 2006 20:01:01 -0500 Original-Received: from [166.84.1.72] (helo=mail1.panix.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F4Sp5-0002q2-Qy for emacs-devel@gnu.org; Wed, 01 Feb 2006 19:59:44 -0500 Original-Received: from panix3.panix.com (panix3.panix.com [166.84.1.3]) by mail1.panix.com (Postfix) with ESMTP id B0C3758828 for ; Wed, 1 Feb 2006 19:57:48 -0500 (EST) Original-Received: (from rocky@localhost) by panix3.panix.com (8.11.6p3/8.8.8/PanixN1.1) id k120vnR14436; Wed, 1 Feb 2006 19:57:49 -0500 (EST) Original-To: emacs-devel@gnu.org X-Mailer: VM 7.19 under Emacs 21.3.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49895 Archived-At: Recently I've been working on debuggers for GNU make (mdb) and extending the Python debugger (pydb). And of course I would like these to be work well from inside GNU Emacs (via gud). Well, it seems I went through this once before with the bash debugger: The procedure if I recall correctly was that I cut-and-past a new section of gud.el. The cut-and-past for a debugger portion seems to be the first Emacs Lisp statement that starts: (defvar gud-xxx-history nil) - and the comments before. And then you submit a patch; perhaps it's accepted; and then wait maybe 3 years for the next release to come out. :-) Hmmm. In foundling projects like these debugger projects, releases occur a bit quicker and I think it is important that they do. To get the word out, probably one needs to submit some standalone Emacs Lisp code with the package. Not really a problem. You basically add a (require 'gud) and cut and past the code that starts (devar gud-xxx-history ... Well, almost. There's this declaration of gud-menu-map towards the top of gud.el and that lists capabilities for all of the debuggers it knows about. In order to get capabilities for the menu items that gud doesn't think your debugger will have (like "up") and disable features that gud thinks your debugger *must* have (like "stepi"??), one needs to do something additional. What I've been doing is including in the function which runs the debugger (e.g. bashdb, mdb or pydb) a define-key function like this: (define-key gud-menu-map [up] '("Up Stack" . gud-up)) I'm not a GNU-Emacs wizard, so no doubt someone may or should correct me if this is not the most linguistically pure Lisp thing to do. But it does seem to set the menu correctly for those specific debugger buffers while not interfering with other debugger buffers. Now let's come back to gud.el and how it is organized. It would focus the attention of those would-be cut-and-past debugger extenders like myself if say all those debuggers were broken out into their own file and possibly pulled in by require's (or something similar - again, I"m not a wizard). Seems to be just a little cleaner and more modular. If one needs to remove a debugger (e.g. someone forgot to submit GPL papers), you remove the "require" and the associated file. So in this scenario to add a new debugger you copy a *file* rather than a section of this file and *forget* to modify that gud-menu-map. And along with this, I guess I'm also suggesting that instead of listing all of the debugger capabilities in the easy-mmode-defmap gud-menu-map, the capabilities would be added in the individual debuggers. - - - - Some other miscellaneous remarks. I note that in gud.el CVS more gud-menu-map items have been added. Excellent! One of them is "run", but I note that most of the time it is nil. I'm assuming "run" means the gdb "run" command, which I think would better be called "restart". If gud's "run" is supposed to indicate something else, then given it's not used all that much even in gud, then I'd suggest renaming it to mean "restart" or adding a "restart" menu item. bashdb for example has such a command, so does gdb, perldb, mdb, and pydb. In other words, restarting is a pretty common thing you might want to do. The other menu items that I've added to my debuggers is * something to show a stack trace -- gud-where with key T which is what perldb, mdb, pydb and bashdb use. * something to toggle line tracing - - - "local-set-key [menu-bar debug up]" is used in the various debuggers. On my GNU Emacs 21.4.1 (GNU/Linux) with X Windows, I am not aware of any evidence of menu-bar in the display. Where is it? Thanks.