From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30578 invoked by alias); 28 May 2010 00:18:43 -0000 Received: (qmail 30566 invoked by uid 22791); 28 May 2010 00:18:42 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 May 2010 00:18:35 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 612D72BB467; Thu, 27 May 2010 20:18:33 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rX0Ify+UgB-K; Thu, 27 May 2010 20:18:33 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3078B2BB462; Thu, 27 May 2010 20:18:33 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 913B1F58FA; Thu, 27 May 2010 17:18:20 -0700 (PDT) Date: Fri, 28 May 2010 01:34:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA/python:2/2] First script in GDB python library - command/pahole.py Message-ID: <20100528001820.GL3019@adacore.com> References: <1274918921-23200-1-git-send-email-brobecker@adacore.com> <1274918921-23200-3-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00673.txt.bz2 > 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". That's what I did to test the code, and I thought that this was OK. In my mind, I was not suggesting the addition of a new command, but rather of a new script. The distinction is really subtle but it makes the "python import ..." command the natural way to use that script. But the ulterior motive is not about the pahole command, but rather about getting things started in terms of the gdb python library. I think it would be nice to indeed have a better way of activating these commands. But in the meantime, I thought that this would already be enough of an improvement to be worthwhile on its own. We could work on the activation as a separate patch? > 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. I tend to agree that it's not ideal to just import every gdb.command.* module at startup. It seems like a nice idea In terms of documentation, I agree we need to write something up. I can take care of that: - Document the location where the GDB scripts are; - Add a section where we document new commands implemented in python. -- Joel