From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19374 invoked by alias); 11 Oct 2002 16:26:25 -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 19367 invoked from network); 11 Oct 2002 16:26:24 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 11 Oct 2002 16:26:24 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g9BG6JX08809 for ; Fri, 11 Oct 2002 12:06:19 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9BGQNf05227 for ; Fri, 11 Oct 2002 12:26:23 -0400 Received: from valrhona.uglyboxes.com (IDENT:+1gGVNxQ9Ixq+5rTS0UlVooPtFFK5dHa@vpn50-49.rdu.redhat.com [172.16.50.49]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9BGQMa08888 for ; Fri, 11 Oct 2002 12:26:23 -0400 Date: Fri, 11 Oct 2002 09:26:00 -0000 From: Keith Seitz X-X-Sender: keiths@valrhona.uglyboxes.com To: gdb@sources.redhat.com Subject: [RFC] MI varobj testsuite support Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-10/txt/msg00108.txt.bz2 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"