From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23886 invoked by alias); 18 Jun 2010 20:10:37 -0000 Received: (qmail 23873 invoked by uid 22791); 18 Jun 2010 20:10:35 -0000 X-SWARE-Spam-Status: No, hits=-5.2 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; Fri, 18 Jun 2010 20:10:31 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5IKARiH019361 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jun 2010 16:10:27 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5IKAQwB000318; Fri, 18 Jun 2010 16:10:26 -0400 Message-ID: <4C1BD2B2.80503@redhat.com> Date: Fri, 18 Jun 2010 20:10:00 -0000 From: Phil Muldoon User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4 MIME-Version: 1.0 To: tromey@redhat.com CC: Doug Evans , gdb-patches ml Subject: Re: [python][patch] Inferior and Thread information support. References: <4BFA6E82.3070704@redhat.com> <4C1B16BF.3040000@redhat.com> <4C1B94F9.4010403@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2010-06/txt/msg00420.txt.bz2 On 06/18/2010 06:58 PM, Tom Tromey wrote: >>>>>> "Phil" == Phil Muldoon writes: > > Phil> I'm not sure that conversion from a Python type to a buffer object are > Phil> that transparent. For instance there seems to be no straightforward > Phil> way to represent 3.141 as a sequence of bytes backed by a buffer in > Phil> Python (or accessible via the buffer interface rather). Maybe there > Phil> is, I'm certainly not a Python language expert. I hope someone can > Phil> prove me wrong! > > Yeah, there are some things in Python for this. See the 'struct' > module. > > I think it is somewhat better to keep our API simple and rely on the > built-in library for more complicated things. Sorry about that. Simplifying the API will be the easy part (though I disagree on it), it just means removing code. I'll submit a patch for that next week. > > Phil> Right now with the existing code, we take 3.141 as a gdb.value and > Phil> convert that to bytes via value_contents. Your suggestions would > Phil> certainly make the existing code simpler (and my porting task a little > Phil> easier ;), but I can't help thinking that it would be just making the > Phil> user jump through extra hoops just for API pureness. I strive for > Phil> that, it's a good thing; it just strikes me a little too much in this > Phil> case. OTOH we could just make add_value_pattern available via the API > Phil> and have the user manually do the conversion "the GDB way". > > Arguably, gdb.Value should support the buffer protocol. I don't know if > that is directly possible, but if not we should supply a way to convert > a Value to a buffer -- to give the user a way to view the underlying > bits. I don't disagree in principle. I'm not sure this is within the the scope of this patch though? > I think you should just remove the max_count argument. It seems weird > to me. If people want multiple searches, it is easy to iterate. Or, if > we really want to support multiple searches, then I think we should do > it by returning an iterator instead of a list. >From a pragmatic point of view, between you and Doug I'm a little lost about what we need to do to get this patch suitable for inclusion in the FSF tree, with a possible view for inclusion to 7.2? I'm not sure what the removal of the max_count has to do with the other comments? Making search_memory only support buffers is okay from the Python side, that is easy. What else needs to be done is my question ;) Cheers, Phil