From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4367 invoked by alias); 17 Aug 2008 20:16:22 -0000 Received: (qmail 4358 invoked by uid 22791); 17 Aug 2008 20:16:22 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 17 Aug 2008 20:15:47 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m7HKFjeY009757 for ; Sun, 17 Aug 2008 16:15:45 -0400 Received: from opsy.redhat.com (vpn-10-34.bos.redhat.com [10.16.10.34]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m7HKFhad030293; Sun, 17 Aug 2008 16:15:44 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 027833782B7; Sun, 17 Aug 2008 14:15:48 -0600 (MDT) To: Thiago Jung Bauermann Cc: gdb-patches@sources.redhat.com Subject: Re: [python] acessing struct elements References: <20080429155212.444237503@br.ibm.com> <20080429155304.466637516@br.ibm.com> <20080528212451.GB2969@caradoc.them.org> <1215410598.1795.58.camel@localhost.localdomain> From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom Date: Sun, 17 Aug 2008 20:16:00 -0000 In-Reply-To: (Thiago Jung Bauermann's message of "Wed\, 13 Aug 2008 01\:46\:53 -0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.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: 2008-08/txt/msg00465.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Thiago> There's one unexpected consequence of this: to enable the Thiago> syntax above, all gdb.Value objects need to implement the map Thiago> methods, and Python considers empty maps to be False in Thiago> contexts which expect a boolean. Because of this, the Thiago> following will not generally work: Thiago> val = frame.read_var_value (sym) Thiago> if val: Thiago> print "Variable value is: " + str (val) I think read_var_value should throw an exception if the symbol is not found. My reason is that this is an error condition -- the caller has asked for a symbol that does not exist. (Actually, I was assuming this is what we'd do, but I realize now that this was just an assumption :) This would bypass this particular problem here. I have a feeling there might be other similar problems lurking, but I'm not sure what. Tom