From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27669 invoked by alias); 18 Jun 2010 15:47:18 -0000 Received: (qmail 27657 invoked by uid 22791); 18 Jun 2010 15:47:17 -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 15:47:11 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5IFl6ht031111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jun 2010 11:47:07 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5IFl5C5008809; Fri, 18 Jun 2010 11:47:05 -0400 Message-ID: <4C1B94F9.4010403@redhat.com> Date: Fri, 18 Jun 2010 15:47: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: Doug Evans CC: tromey@redhat.com, gdb-patches ml Subject: Re: [python][patch] Inferior and Thread information support. References: <4BFA6E82.3070704@redhat.com> <4C1B16BF.3040000@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/msg00409.txt.bz2 On 06/18/2010 03:21 PM, Doug Evans wrote: > I think search_memory should take just the same type of parameter for > the search pattern that write_memory takes: a byte array (etc.). Keep > the API simple and let the caller do the conversion to a byte array > (or buffer protocol). > We could provide utilities to convert to/from byte arrays (then > write_memory can use them too!) but Python probably has them already. > Then you can punt on the `size' parameter completely. I'm not sure that conversion from a Python type to a buffer object are that transparent. For instance there seems to be no straightforward way to represent 3.141 as a sequence of bytes backed by a buffer in Python (or accessible via the buffer interface rather). Maybe there is, I'm certainly not a Python language expert. I hope someone can prove me wrong! Right now with the existing code, we take 3.141 as a gdb.value and convert that to bytes via value_contents. Your suggestions would certainly make the existing code simpler (and my porting task a little easier ;), but I can't help thinking that it would be just making the user jump through extra hoops just for API pureness. I strive for that, it's a good thing; it just strikes me a little too much in this case. OTOH we could just make add_value_pattern available via the API and have the user manually do the conversion "the GDB way". > > You also want to document what the result is. Sure, will do. Cheers, Phil