Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: gdb@sources.redhat.com
Subject: [RFC] MI varobj testsuite support
Date: Fri, 11 Oct 2002 09:26:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0210110858470.1975-100000@valrhona.uglyboxes.com> (raw)

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"




             reply	other threads:[~2002-10-11 16:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-11  9:26 Keith Seitz [this message]
2002-10-17 13:22 ` Fernando Nasser
2002-10-17 13:38   ` Keith Seitz
2002-10-18  9:49     ` Fernando Nasser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0210110858470.1975-100000@valrhona.uglyboxes.com \
    --to=keiths@redhat.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox