From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30027 invoked by alias); 17 Oct 2002 20:22:37 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 30020 invoked from network); 17 Oct 2002 20:22:36 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 17 Oct 2002 20:22:36 -0000 Received: from redhat.com (tooth.toronto.redhat.com [172.16.14.29]) by touchme.toronto.redhat.com (Postfix) with ESMTP id CE59E8000E3; Thu, 17 Oct 2002 16:22:35 -0400 (EDT) Message-ID: <3DAF1B94.1050907@redhat.com> Date: Thu, 17 Oct 2002 13:22:00 -0000 From: Fernando Nasser Organization: Red Hat Canada User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Keith Seitz Cc: gdb@sources.redhat.com Subject: Re: [RFC] MI varobj testsuite support References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-10/txt/msg00129.txt.bz2 Keith, What about the other commands like -var-info-num-children, -var-update, etc.? Would we still use the old way? I have the impression that the command part is not really useful. We could live with the pattern part only. Fernando Keith Seitz wrote: > Hi, > > I believe that Andrew (and others, myself included) have been less than > satisfied with how time-consuming it is to write varobj tests for MI. By > their very nature, the output is rather verbose and quite complicated. > > I've whipped up a little something to facilitate writing tests, and I > would appreciate comments about it. (Even if it's just as simple as: "I > like it -- submit the patch!") > > This is stolen from the comments in the file, explaining how to use the > basic create/children procedures (only thing I've implemented so far). > > Keith > > # This module defines support routines that can be used by the MI > # testsuite to facilitate the testing of the varobj interface. > # > # The public commands of this module take at least two arguments: a > # KEY to direct the type of output and a variable specification (VARSPEC) > # which describes the (root) variable. > > # The most basic varspec is simply a Tcl list of the variable's type, its > # "name" and a list of its children. For example, consider the following > # variable declaration in C: > # > # int foo; > # > # The varspec to fully describe this variable would be: > # > # set foo_varspec { > # int foo {} > # } > # > # To get the MI testsuite to test the creation of this varobj, one would > # use the command Varobj::create with the "command" and "pattern" keys > # with mi_gdb_test: > # > # mi_gdb_test [Varobj::create command $foo_varspec] \ > # [Varobj::create pattern $foo_varspec] \ > # "create varobj for foo" > > # Consider a more complex example: > # > # class B > # { > # public: > # int pub_b; > # protected: > # char *prot_b; > # }; > # > # class A : public B > # { > # public: > # int pub_a; > # private: > # int priv_a[3]; > # }; > # > # A varspec describing a variable "bar" of type "class A" would look like: > # > # set bar_varspec { > # A bar { > # B B { > # public { > # int pub_b {} > # } > # protected { > # {char *} prot_b { > # char *prot_b {} > # } > # } > # } > # {} public { > # int pub_a {} > # } > # {} private { > # {int [3]} priv_a { > # int 0 {} > # int 1 {} > # int 2 {} > # } > # } > # } > # } > # > # To test the creation of this varobj, simply use: > # mi_gdb_test [Varobj::create command $bar_varspec] \ > # [Varobj::create pattern $bar_varspec] \ > # "create varobj for bar" > # > # To get this children of this varobj: > # mi_gdb_test [Varobj::children command $bar_varspec] \ > # [Varobj::children pattern $bar_varspec] \ > # "get children of bar" > # > # To test getting the children of "B", simply use: > # mi_gdb_test [Varobj::children command $bar_varspec B] \ > # [Varobj::children pattern $bar_varspec B] \ > # "get children of bar.B" > # > # Finally, to get the children of one of the children of bar, specify > # the child's name as a period-delimited path through the varspec: > # mi_gdb_test [Varobj::children command $bar_varspec B.protected.prot_b] \ > # [Varobj::children pattern $bar_varspec B.protected.prot_b] \ > # "get children of bar.B.protected.prot_b" > > > -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9