From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27120 invoked by alias); 2 Oct 2013 19:32:30 -0000 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 Received: (qmail 27111 invoked by uid 89); 2 Oct 2013 19:32:30 -0000 Received: from mail-qc0-f201.google.com (HELO mail-qc0-f201.google.com) (209.85.216.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 02 Oct 2013 19:32:30 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-qc0-f201.google.com Received: by mail-qc0-f201.google.com with SMTP id u18so156649qcx.0 for ; Wed, 02 Oct 2013 12:32:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=rAlBsuyf4NfBlEqyftDNe9vgFLeWLxCaZ5g61p4TGcA=; b=H7yyzyUQigeTqUbTb3j5/rPmFUPodKAHjFgx8jVtTzZeqc1lyMvYaXvVEmLILonoqO qFZ/rveZb8DXH89es1AqgLGvdvbnN4tzTL/vLgjD+XpqB6szLmTPUguI1IT4b+Y1ok0g eljZ4dyIT3gOMQjV4RwDVinY/aSUU4gHljdyRK3UyoX1XcK6JK09GqHcSpbPvxmmGZLO +twb+HFS5wgmS2n7gOnHsI36fIizyC4TD3ERCqQoUGagqMzrff9Y/3fz4rvDSMiCmFoz JBuRpRqsgAgARF/AaOqg07YokTAWW0xbEMTmojlqdsbPl7sPFriOUt28IGninSrfogp8 UBcA== X-Gm-Message-State: ALoCoQk8k8YTyev7N2bjpUu0756RUhliBAwvSHEzW+3kdBo2dh1Ox8knsdKaZ8itAidTesO7AwvW4YLupP1wHUxH+jwyDWAggZn9VqEpPHSZRlMgHCkG+/3UYYkehYzwbOThH430/HM7VG407J6iyXw75bSoOqF4MH5DuKyWc/DVLKW4bZbTfd74+63j3Av2PRhQAv9IFhtxl8n5nxNP3qPACaPZi24PNA== X-Received: by 10.236.13.36 with SMTP id a24mr3397916yha.50.1380742347164; Wed, 02 Oct 2013 12:32:27 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id k45si166301yhn.4.1969.12.31.16.00.00 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 02 Oct 2013 12:32:27 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 710005A4121; Wed, 2 Oct 2013 12:32:26 -0700 (PDT) From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21068.29897.907653.959807@ruffy.mtv.corp.google.com> Date: Wed, 02 Oct 2013 19:32:00 -0000 To: Joel Brobecker Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 4/7] Move struct varobj to varobj.h. In-Reply-To: <20131002094636.GC2971@adacore.com> References: <1379512482-31773-1-git-send-email-yao@codesourcery.com> <1379512482-31773-5-git-send-email-yao@codesourcery.com> <20131002094636.GC2971@adacore.com> X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00104.txt.bz2 Joel Brobecker writes: > > This patch moves most of the fields of struct varobj to varobj.h, and > > continue to name it 'struct varobj.h' there. New struct > > varobj_dynamic 'extends' struct varobj in varobj.c. > > > > Move part of struct varobj to varobj.h > > > > gdb: > > > > 2013-09-18 Yao Qi > > > > * varobj.c (struct varobj): Move most of the fields to > > varobj.h. > > (struct varobj_dynamic): New struct. > > (varobj_get_display_hint) [HAVE_PYTHON]: Cast 'var' to type > > 'struct varobj_dynamic'. > > (varobj_has_more): Likewise. > > (dynamic_varobj_has_child_method): Change type of parameter > > 'var' to 'struct varobj_dynamic *'. > > (update_dynamic_varobj_children): Likewise. > > (install_visualizer): Likewise. > > (install_default_visualizer, construct_visualizer): Likewise. > > (varobj_get_num_children): Likewise. > > (dynamic_varobj_has_child_method): Adjust. > > (varobj_list_children, varobj_get_attributes): Likewise. > > (varobj_set_value, install_new_value): Likewise. > > (varobj_update, new_variable): Likewise. > > (my_value_of_variable, value_get_print_value): Likewise. > > * varobj.h (struct varobj): Moved from varobj.c. > > Overall, I like the direction that the whole series is taking. Me too. > But this is a patch that makes me a little uncomfortable, because > I am not sure really want to introduce this kind of polymorphism > where we cast struct varobj into struct varobj_dynamic. Me too. :-) > I would > need to think about it some more - it seems to me that at the root > of things, we are always manipulating a varobj_dynamic so it is > always safe to cast it. But this then begs the question why not > declare them as struct varobj_dynamic in the first place. The answer > is probably that we don't want to expose too much of struct varobj, > and in particular the part dealing with dynamicity and pretty-printers. We don't have "private" but, heh, Python doesn't either except by convention. So ... we *could* have a similar convention. Just a thought for discussion's sake ... :-) [If C++ is around the corner one might punt, though it couldn't hurt to document (in some way) what's private and what's not today.] > Perhaps, and this is thinking out loud, another approach would be > to make this data part of the public struct varobj, but inside > an opaque structure? "works for me" There's only one constructor (I think), it could handle the details. > I'd really like feedback from other maintainers who have experience > in this area... IWBN to have something that didn't use casting alright.