Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH RFA] New constvars.exp tests
@ 2002-10-10 13:33 Kevin Buettner
  2002-10-10 13:39 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kevin Buettner @ 2002-10-10 13:33 UTC (permalink / raw)
  To: fnasser, gdb-patches

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RFA] New constvars.exp tests
  2002-10-10 13:33 [PATCH RFA] New constvars.exp tests Kevin Buettner
@ 2002-10-10 13:39 ` Daniel Jacobowitz
  2002-10-17 13:08 ` Fernando Nasser
  2002-10-17 13:25 ` Kevin Buettner
  2 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-10-10 13:39 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: fnasser, gdb-patches

On Thu, Oct 10, 2002 at 01:32:59PM -0700, Kevin Buettner wrote:
> 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).

Not necessarily.  Recent versions of GCC will emit const qualifiers in
stabs, leading to a horde of XPASS's in our testsuite... but that's a
problem for another patch.

Nice to see someone working on the type printer.  I'm planning to
submit a "hit it over the head with a board" patch in a couple of days,
to let us simulate the output of the various demangling styles.

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

FWIW, these test cases look correct to me.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RFA] New constvars.exp tests
  2002-10-10 13:33 [PATCH RFA] New constvars.exp tests Kevin Buettner
  2002-10-10 13:39 ` Daniel Jacobowitz
@ 2002-10-17 13:08 ` Fernando Nasser
  2002-10-17 13:31   ` Kevin Buettner
  2002-10-17 13:25 ` Kevin Buettner
  2 siblings, 1 reply; 6+ messages in thread
From: Fernando Nasser @ 2002-10-17 13:08 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

This looks good.  If I am not mistaken, your patch that fixes the 
printing has been already committed so these tests will either PASS or 
XFAIL.

Pleas check it in.

Thanks for the extra tests,

Regards,
Fernando

Kevin Buettner wrote:
> 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
> 


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RFA] New constvars.exp tests
  2002-10-10 13:33 [PATCH RFA] New constvars.exp tests Kevin Buettner
  2002-10-10 13:39 ` Daniel Jacobowitz
  2002-10-17 13:08 ` Fernando Nasser
@ 2002-10-17 13:25 ` Kevin Buettner
  2 siblings, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2002-10-17 13:25 UTC (permalink / raw)
  To: gdb-patches

On Oct 10,  1:32pm, Kevin Buettner wrote:

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

Committed.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RFA] New constvars.exp tests
  2002-10-17 13:08 ` Fernando Nasser
@ 2002-10-17 13:31   ` Kevin Buettner
  2002-10-17 17:11     ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Buettner @ 2002-10-17 13:31 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: gdb-patches

On Oct 17,  4:06pm, Fernando Nasser wrote:

> This looks good.  If I am not mistaken, your patch that fixes the 
> printing has been already committed so these tests will either PASS or 
> XFAIL.

You're right; the patch is in, but I recall seeing XPASSes for my new
tests (along with a lot of other tests) when I used Dwarf 2.  I
suspect that something's going wrong with the following code:

proc local_compiler_xfail_check { } {
    global gcc_compiled;

    if {$gcc_compiled} then {
	if { ![test_debug_format "HP"] \
		&& ![test_debug_format "DWARF 2"] } then {
	    setup_xfail "*-*-*" 
	}
    }
}

I'm double checking and looking into it now...

Kevin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RFA] New constvars.exp tests
  2002-10-17 13:31   ` Kevin Buettner
@ 2002-10-17 17:11     ` Kevin Buettner
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2002-10-17 17:11 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: gdb-patches

On Oct 17,  1:31pm, Kevin Buettner wrote:

> On Oct 17,  4:06pm, Fernando Nasser wrote:
> 
> > This looks good.  If I am not mistaken, your patch that fixes the 
> > printing has been already committed so these tests will either PASS or 
> > XFAIL.
> 
> You're right; the patch is in, but I recall seeing XPASSes for my new
> tests (along with a lot of other tests) when I used Dwarf 2.  I
> suspect that something's going wrong with the following code:
> 
> proc local_compiler_xfail_check { } {
>     global gcc_compiled;
> 
>     if {$gcc_compiled} then {
> 	if { ![test_debug_format "HP"] \
> 		&& ![test_debug_format "DWARF 2"] } then {
> 	    setup_xfail "*-*-*" 
> 	}
>     }
> }
> 
> I'm double checking and looking into it now...

It turns out that the above check is okay.  It's gdb's ``info source''
command which is having problems.  When I configure & build gdb using
absolute paths, I'm NOT seeing the problem, but when I'm using relative
paths, I am.  Still haven't completely figured it out yet.

Anyway, I don't think it's a testsuite problem, but a gdb problem
instead.

Kevin


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-18  0:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-10 13:33 [PATCH RFA] New constvars.exp tests Kevin Buettner
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox