From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28392 invoked by alias); 12 Mar 2012 19:41:54 -0000 Received: (qmail 28382 invoked by uid 22791); 12 Mar 2012 19:41:53 -0000 X-SWARE-Spam-Status: No, hits=-6.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; Mon, 12 Mar 2012 19:41:40 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2CJfc0S024386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Mar 2012 15:41:38 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2CJfbII021505 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 12 Mar 2012 15:41:38 -0400 From: Tom Tromey To: Siva Chandra Cc: gdb-patches@sourceware.org Subject: Re: [RFC - Python Scripting] Extend Value.dereference to dereference C++ reference values References: Date: Mon, 12 Mar 2012 19:41:00 -0000 In-Reply-To: (Siva Chandra's message of "Mon, 12 Mar 2012 11:02:59 +0530") Message-ID: <8762e9ppxq.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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-03/txt/msg00411.txt.bz2 >>>>> "Siva" == Siva Chandra writes: Siva> Unless I am missing something, I couldn't find anything which can do Siva> this in the Python API. Attached is a patch which extends the Python Siva> API method Value.dereference to 'dereference' C++ reference values as Siva> well. I am probably overloading the term 'dereference' as used in the Siva> normal (pointer dereferencing) sense. I think that is fine. The patch generally looks good to me. It needs a doc review. Siva> +For example, if @code{int_ref} is a reference to value of type Siva> + @code{int}, declared in your C++ program as I think that leading space on the second line could go away. Siva> + self_val = ((value_object *) self)->value; Siva> + switch (TYPE_CODE (value_type (self_val))) Here I think you need TYPE_CODE (check_typedef (...)) Siva> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ Siva> + {debug c++}] != "" } { Siva> + untested "Couldn't compile ${srcfile}" Siva> + return -1 Siva> +} Siva> + Siva> +# Start with a fresh gdb. Siva> + Siva> +gdb_exit Siva> +gdb_start Siva> +gdb_reinitialize_dir $srcdir/$subdir Siva> +# Skip all tests if Python scripting is not enabled. Siva> +if { [skip_python_tests] } { continue } Siva> + Siva> +gdb_load ${binfile} I think all of this can be replaced with prepare_for_testing. The code bits are ok with those changes. thanks, Tom