From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25473 invoked by alias); 18 Jun 2010 17:59:12 -0000 Received: (qmail 25461 invoked by uid 22791); 18 Jun 2010 17:59:10 -0000 X-SWARE-Spam-Status: No, hits=-5.9 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 17:59:05 +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 o5IHwxAX000412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jun 2010 13:58:59 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5IHwwHG003558; Fri, 18 Jun 2010 13:58:58 -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 o5IHwvc2014684; Fri, 18 Jun 2010 13:58:58 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 42D2437814A; Fri, 18 Jun 2010 11:58:56 -0600 (MDT) From: Tom Tromey To: Phil Muldoon 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> Reply-To: tromey@redhat.com Date: Fri, 18 Jun 2010 17:59:00 -0000 In-Reply-To: <4C1B94F9.4010403@redhat.com> (Phil Muldoon's message of "Fri, 18 Jun 2010 16:47:05 +0100") 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-06/txt/msg00414.txt.bz2 >>>>> "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. 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 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. Tom