From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32266 invoked by alias); 5 Apr 2012 20:26:26 -0000 Received: (qmail 32161 invoked by uid 22791); 5 Apr 2012 20:26:24 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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-gy0-f169.google.com (HELO mail-gy0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Apr 2012 20:26:08 +0000 Received: by ghrr18 with SMTP id r18so1197629ghr.0 for ; Thu, 05 Apr 2012 13:26:07 -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:content-transfer-encoding:x-system-of-record :x-gm-message-state; bh=O9zKpi6KU8agWlYFRaVmjatEtkYQWoNnjHXGbPq92BI=; b=awzVPANWmsJHO4wtzSMc/RM9o9zgoWcFkxbdTrE0X6/twcskYGN8+cmo8tocvqfpyi /4O64WhDYFbeuMeYHBnfxX3riPTUBckUGcrpqlCLvhLaLgwUkS/4bJZKKoaTwbrvTNpv 7a7AnNUtK9Vj9cCzQm281FN/XrQRaH2ww4eA1H6i9cgU3Z0sW0tta0DZo3Yce3cNjt1R /KBmNHbfewwBfqN9p9Rf21xjCzKcu69cC+Q0BUtoNhYbz7QfjaZaMKVbQGopIzg/5YlE tRiPxJhPOMYB+lVzBCcOOrQPo2NUD/W18H027SgRRinUkgwJ6pRWZN1lJzXHZIBslj/C QFrw== Received: by 10.236.184.73 with SMTP id r49mr4092945yhm.2.1333657567866; Thu, 05 Apr 2012 13:26:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.184.73 with SMTP id r49mr4092930yhm.2.1333657567786; Thu, 05 Apr 2012 13:26:07 -0700 (PDT) Received: by 10.220.73.14 with HTTP; Thu, 5 Apr 2012 13:26:07 -0700 (PDT) In-Reply-To: <09787EF419216C41A903FD14EE5506DD0313D5C22C@AUSX7MCPC103.AMER.DELL.COM> References: <09787EF419216C41A903FD14EE5506DD0313D5C22C@AUSX7MCPC103.AMER.DELL.COM> Date: Thu, 05 Apr 2012 20:26:00 -0000 Message-ID: Subject: Re: [RFC - Python Scripting] New method Objfile.symtabs () - docs included From: Doug Evans To: Paul_Koning@dell.com Cc: sivachandra@google.com, gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQkeKlI+MoAwmCTLgcMBmrT8PlBI+dbMGGX1HNnOUtgxCyi0e7GBcqnaREQSvCOe2r1f3Evjm7tHMHZj4KgKArIdWYFMETgJT+TCVzd0Wd1DJUmNyw54nxc5oA3Q9lnA81bW70OJlnfq3xa1sQyBDG2F2jQj7w== 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/msg00083.txt.bz2 On Thu, Apr 5, 2012 at 12:56 PM, wrote: > In this patch, you have an iterator that walks over the symtabs for an ob= jfile, but that is only used internally in the symtabs() method which is wr= itten to return a list. > > How about having symtabs() return the iterator instead? =A0An iterator is= usually just as good as a list (and more efficient); in the rare cases whe= re you actually need the list, simply doing list(objfile.symtabs()) will do= that. There is a lower fundamental problem that needs to be addressed. In a nutshell: If "list (objfile.symtabs())" can increase gdb's memory usage by gigabytes, then it's a non-starter (IMO). Before we provide anything along these lines, we need to fix the underlying problem. I can think of a simple(quick) solution: create the symtab object when the psymtab object is created (suitably modified to clean up anything obvious), but not expand it. [btw, Psymtabs at the moment aren't as much of an implementation detail as we want them to be (IMO).] It's not perfect: Depending on what you want from the symtab you may ultimately end up expanding everything anyway. But it's a step. One way to go would be to build into gdb the ability to discard the expansion say when memory gets tight. I think there's room for improvement before we get to that though.