Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: fnasser@redhat.com, gdb-patches@sources.redhat.com
Subject: [PATCH RFA] New constvars.exp tests
Date: Thu, 10 Oct 2002 13:33:00 -0000	[thread overview]
Message-ID: <1021010203259.ZM16308@localhost.localdomain> (raw)

I am about to submit a patch which causes ptype to print a struct with
qualifiers correctly.  E.g, for the "crass" test, gdb currently
exhibits the following behavior:

    (gdb) ptype crass
    type = struct crass {
	char * constptr;
    }

This is incorrect because gdb failed to print a space in between
"const" and "ptr".

Unfortunately, if you don't use Dwarf 2, you'll simply end up seeing

    type = struct crass {
	char *ptr;
    }

...which is also wrong, but not unexpected (hence the xfail).

For the "crisp" test, gdb currently does the following:

    (gdb) ptype crisp
    type = struct crisp {
	char * const*ptr;
    }

Here is what I regard to be the correct behavior for these commands:

    (gdb) ptype crass
    type = struct crass {
	char * const ptr;
    }
    (gdb) ptype crisp
    type = struct crisp {
	char * const *ptr;
    }

Okay?
 
	* gdb.base/constvars.c (struct crass, struct crisp): New structs.
	* gdb.base/constvars.exp (ptype crass, ptype crisp): New tests.

Index: testsuite/gdb.base/constvars.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/constvars.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 constvars.c
--- testsuite/gdb.base/constvars.c	16 Apr 1999 01:34:30 -0000	1.1.1.1
+++ testsuite/gdb.base/constvars.c	10 Oct 2002 20:12:12 -0000
@@ -166,6 +166,11 @@ main (void)
 
   const volatile char              * const volatile vagary = &victor;
   const volatile unsigned char     * const volatile vendor = &vicar;
+  
+  /* various structs with const members */
+
+  struct crass { char * const ptr; } crass;
+  struct crisp { char * const *ptr; } crisp;
 
   /* misc. references */
   /*
Index: testsuite/gdb.base/constvars.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/constvars.exp,v
retrieving revision 1.7
diff -u -p -r1.7 constvars.exp
--- testsuite/gdb.base/constvars.exp	19 Dec 2001 21:08:45 -0000	1.7
+++ testsuite/gdb.base/constvars.exp	10 Oct 2002 20:12:12 -0000
@@ -278,6 +278,11 @@ proc do_constvar_tests {} {
     gdb_test "print *locust" " = 70"
     local_compiler_xfail_check
     gdb_test "ptype locust" "type = double \\* const"
+
+    local_compiler_xfail_check
+    gdb_test "ptype crass" "type = struct crass \{\[\r\n\]+\[\ \t\]+char \\* const ptr;\[\r\n\]+\}"
+    local_compiler_xfail_check
+    gdb_test "ptype crisp" "type = struct crisp \{\[\r\n\]+\[\ \t\]+char \\* const \\*ptr;\[\r\n\]+\}"
 }
 
 do_constvar_tests


             reply	other threads:[~2002-10-10 20:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-10 13:33 Kevin Buettner [this message]
2002-10-10 13:39 ` Daniel Jacobowitz
2002-10-17 13:08 ` Fernando Nasser
2002-10-17 13:31   ` Kevin Buettner
2002-10-17 17:11     ` Kevin Buettner
2002-10-17 13:25 ` Kevin Buettner

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=1021010203259.ZM16308@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=fnasser@redhat.com \
    --cc=gdb-patches@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