From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28860 invoked by alias); 27 May 2010 20:32:10 -0000 Received: (qmail 28848 invoked by uid 22791); 27 May 2010 20:32:09 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 May 2010 20:32:05 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4RKVgIo016037 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 May 2010 16:31:42 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4RKVffF024180; Thu, 27 May 2010 16:31:41 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4RKVeKU028371; Thu, 27 May 2010 16:31:41 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 9812D3780A5; Thu, 27 May 2010 14:31:40 -0600 (MDT) From: Tom Tromey To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFA/python:2/2] First script in GDB python library - command/pahole.py References: <1274918921-23200-1-git-send-email-brobecker@adacore.com> <1274918921-23200-3-git-send-email-brobecker@adacore.com> Reply-To: tromey@redhat.com Date: Thu, 27 May 2010 20:37:00 -0000 In-Reply-To: <1274918921-23200-3-git-send-email-brobecker@adacore.com> (Joel Brobecker's message of "Wed, 26 May 2010 17:08:41 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-05/txt/msg00660.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> This patch makes use of the work done in the previous patch that allows Joel> to store the GDB python library at a global location. It updates the Joel> Makefile.in, adding install-python and uninstall-python targets. And Joel> it also introduces the first script in the GDB python library: pahole.py. Today I remembered the other reasons we haven't upstreamed any of the new commands written in Python :-( There is no sensible way for a user to activate such a command. With this patch a user would have to know the name of the command's file and invoke "python import gdb.command.pahole". On the branch we have this "require" system so that users can write "require command pahole" (with completion!). But that was just a kind of experiment, I don't think it is a very good idea. One idea would be to allow some kind of auto-loading when a command is not found. That is, load pahole.py the first time the "pahole" command is used. Or even better, scan the install tree first so that command completion still works. (This is not ideal, though, since there is not actually a way to discover command names without loading the file.) FWIW I did not want to load all the commands at startup, as I was concerned about slowing down startup. Also there is the documentation issue. If we ship a command then it seems like we are giving it an official stamp, and it ought to be documented in the manual. I realize this is a lot of problems to solve. The command activation solution is one that would also be useful to users, since (ideally) it would let them install local commands alongside built-in ones. Tom