From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19515 invoked by alias); 3 Apr 2012 05:54:55 -0000 Received: (qmail 19504 invoked by uid 22791); 3 Apr 2012 05:54:52 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KAM_STOCKGEN,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-qa0-f48.google.com (HELO mail-qa0-f48.google.com) (209.85.216.48) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Apr 2012 05:54:35 +0000 Received: by qam2 with SMTP id 2so2491084qam.0 for ; Mon, 02 Apr 2012 22:54:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=G3AA6IMfpld8D9ZXHDAXfRn3S00AINOLzCWUdplIzAQ=; b=a6pL9JSnZzySorFGLfbEwha/VHI6gRSGx0yPD3aFuAmuuuF0eL4u32k/ogKv4I+vjH fWlvMUCSwZYRnKYg3GTTyAlfUyrl0QD7DUYfVh7EQONEWZlflDkXc00X0OEgTTv28VM2 bDLq3YDp21L64mfE1/BZbdZdPETzScwrfTEfh9aAeW0Mt4TN+qhSOeZuNN/B6zRUNdVW RB4O/GXRpXcMkM9uqh3x0PUrPfuAwTMb6YxOso+1iVI7J3TOQiPTbyBGpy5K0hrUEWh1 cU9jvigXOISSXjSUxEmS5QDtiS31ZAHsxup8jwJAyYF3iZOkE1H/ZZZvwbxZ8RcCPV4+ UuEw== Received: by 10.224.190.67 with SMTP id dh3mr914039qab.12.1333432474206; Mon, 02 Apr 2012 22:54:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.190.67 with SMTP id dh3mr914034qab.12.1333432474136; Mon, 02 Apr 2012 22:54:34 -0700 (PDT) Received: by 10.224.188.140 with HTTP; Mon, 2 Apr 2012 22:54:34 -0700 (PDT) In-Reply-To: References: Date: Tue, 03 Apr 2012 05:54:00 -0000 Message-ID: Subject: Re: [RFC - Python Scripting] New method Objfile.symtabs () - docs included From: Siva Chandra To: Doug Evans Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQkXQ7OUS1OpMmm3URFk4t4r9W6PvPoZtiAGUti1rzSBVKRmKIgZ1Lf78lIxs8A7eEdIR+MdY9Ptbsgdh1uGfjw32UhpsfGetVduLRYg/F8B8XOfBvZ+tnqS2PCanB0+dM1iVODrPzhDepeizpyjAlaujaLrjw== X-IsSubscribed: yes 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: 2012-04/txt/msg00027.txt.bz2 On Tue, Apr 3, 2012 at 5:34 AM, Doug Evans wrote: > > You're touching on one of the more troublesome areas of gdb (symbol > handling), I salute your courage. :-) I seem courageous as I do not know what awaits me. :-) > Assuming we want to provide the ability to iterate over all the symbol > tables, we want to be able to do that without first expanding them. > So I think the first question is what will the user want to do with > this feature? Thanks for taking a look and starting a discussion on this. An example usage of this feature can be to implement something like run time code path tracer. This can probably be done in many other ways, but I am using this as an example. In this code path tracer, a user might want to trace the function calls when between state A and state B of program. A way to do this from Python would be to get all the function names and set internal breakpoints at these functions. But the user should first have a way to get the list of functions. This is where I thought the Objfile.symtabs becomes useful - The exploration of symbols to look for functions can happen in this order: gdb.objfiles () => Objfile.symtabs () => Symtab.blocks () => Block.symbol => Symbol.name. This patch adding Objfile.symtabs () was first of my patches towards completing this path. Looking at it more generically, I thought that having the exploratory path that I mention above available in the Python API completes a 'view' of GDB from a user's point. For the memory problem you point out, do you think something like Objfile.symtabs (regex, [symbol_type]) would be good? REGEX is a file name matcher to specify that only those symtabs whose source file names match the REGEX should be loaded, and SYMBOL_TYPE is to specify that only symbols of this kind should be loaded. This can still be abused to match everything and load everything, but it is at the user's own peril. Thanks, Siva Chandra