Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fred Fish <fnf@specifix.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Jim Blandy <jimb@red-bean.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix ptype problem printing typedefs defined differently in different compilation units
Date: Wed, 17 May 2006 19:04:00 -0000	[thread overview]
Message-ID: <200605171502.52697.fnf@specifix.com> (raw)
In-Reply-To: <20060220162320.GF16058@nevyn.them.org>

On Monday 20 February 2006 11:23, Daniel Jacobowitz wrote:
> Yuck.  In general futzing with global variables in a parser is bad
> news.  And here's another good hint that this isn't happening in the
> right place:

OK.  Lets forget the c-exp.y part of the patch.

I think it would probably be a good idea to put in the testsuite
changes, pending a better fix...

With the attached patch, I get the new PASS's:

  PASS: gdb.base/ptype.exp: ptype 'file'::symbol
  PASS: gdb.base/ptype.exp: ptype 'file'::symbol
  PASS: gdb.base/ptype.exp: p (long)1
  PASS: gdb.base/ptype.exp: ptype long value from value history
  PASS: gdb.base/ptype.exp: p (short)1
  PASS: gdb.base/ptype.exp: ptype short value from value history
  PASS: gdb.base/whatis.exp: whatis named structure in explicit scope
  PASS: gdb.base/whatis.exp: whatis unnamed structure in explicit scope
  PASS: gdb.base/whatis.exp: whatis named union in explicit scope
  PASS: gdb.base/whatis.exp: whatis unnamed union in explicit scope
  PASS: gdb.base/whatis.exp: whatis applied to variable defined by typedef in explicit scope
  PASS: gdb.base/whatis.exp: p (long)1
  PASS: gdb.base/whatis.exp: whatis long value from value history
  PASS: gdb.base/whatis.exp: p (short)1
  PASS: gdb.base/whatis.exp: whatis short value from value history

and the (expected) failures:

  FAIL: gdb.base/ptype.exp: ptype 'file'::typename
  FAIL: gdb.base/ptype.exp: ptype 'file'::typename
  FAIL: gdb.base/whatis.exp: whatis named structure using type name and explicit scope
  FAIL: gdb.base/whatis.exp: whatis named union using type name and explicit scope
  FAIL: gdb.base/whatis.exp: whatis using typedef type name and explicit scope

-Fred

============================================================================

2006-05-17  Fred Fish  <fnf@specifix.com>

	* gdb.base/ptype.c (afoo): Add variable using foo typedef.
	* gdb.base/ptype1.c (afoo): Ditto.

	* gdb.base/ptype.exp: Add tests using 'file':: prefix
	to specify scope for variables and types.  Add tests for
	printing type of last value history entry.
	* gdb.base/whatis.exp: Ditto.

Index: gdb.base/ptype.c
===================================================================
RCS file: /cvsroots/latest/src/gdb/gdb/testsuite/gdb.base/ptype.c,v
retrieving revision 1.1.1.2
diff -c -p -r1.1.1.2 ptype.c
*** gdb.base/ptype.c	8 Jan 2006 20:37:18 -0000	1.1.1.2
--- gdb.base/ptype.c	17 May 2006 18:53:28 -0000
*************** func_type v_func_type;
*** 260,265 ****
--- 260,266 ----
  /***********/
  
  typedef int foo;
+ static foo afoo = 2;
  
  foo intfoo (afoo)
  {
Index: gdb.base/ptype.exp
===================================================================
RCS file: /cvsroots/latest/src/gdb/gdb/testsuite/gdb.base/ptype.exp,v
retrieving revision 1.1.1.2
diff -c -p -r1.1.1.2 ptype.exp
*** gdb.base/ptype.exp	8 Jan 2006 20:37:19 -0000	1.1.1.2
--- gdb.base/ptype.exp	17 May 2006 18:53:28 -0000
*************** gdb_test "ptype foo" "type = int" "ptype
*** 594,599 ****
--- 594,613 ----
  gdb_test "list charfoo" ""
  gdb_test "ptype foo" "type = char" "ptype foo typedef after second list of charfoo"
  
+ # Test the 'file'::exp syntax for variables and types
+ 
+ gdb_test "ptype 'ptype.c'::afoo" "type = int" "ptype 'file'::symbol"
+ gdb_test "ptype 'ptype.c'::foo" "type = int" "ptype 'file'::typename"
+ gdb_test "ptype 'ptype1.c'::afoo" "type = char" "ptype 'file'::symbol"
+ gdb_test "ptype 'ptype1.c'::foo" "type = char" "ptype 'file'::typename"
+ 
+ # Test printing value history type
+ 
+ gdb_test "p (long)1" ""
+ gdb_test "ptype" "type = long" "ptype long value from value history"
+ gdb_test "p (short)1" ""
+ gdb_test "ptype" "type = short" "ptype short value from value history"
+ 
  # Test printing type of string constants and array constants, but
  # requires a running process.  These call malloc, and can take a long
  # time to execute over a slow serial link, so increase the timeout.
Index: gdb.base/ptype1.c
===================================================================
RCS file: /cvsroots/latest/src/gdb/gdb/testsuite/gdb.base/ptype1.c,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 ptype1.c
*** gdb.base/ptype1.c	8 Jan 2006 20:37:18 -0000	1.1.1.1
--- gdb.base/ptype1.c	17 May 2006 18:53:28 -0000
***************
*** 1,4 ****
--- 1,5 ----
  typedef char foo;
+ static foo afoo = 1;
  
  foo charfoo (afoo)
  {
Index: gdb.base/whatis.exp
===================================================================
RCS file: /cvsroots/latest/src/gdb/gdb/testsuite/gdb.base/whatis.exp,v
retrieving revision 1.1.1.2
diff -c -p -r1.1.1.2 whatis.exp
*** gdb.base/whatis.exp	18 Feb 2006 21:07:16 -0000	1.1.1.2
--- gdb.base/whatis.exp	17 May 2006 18:53:28 -0000
*************** gdb_test "whatis v_struct1" \
*** 273,300 ****
--- 273,324 ----
      "type = struct t_struct" \
      "whatis named structure"
  
+ gdb_test "whatis 'whatis.c'::v_struct1" \
+     "type = struct t_struct" \
+     "whatis named structure in explicit scope"
+ 
  gdb_test "whatis struct t_struct" \
      "type = struct t_struct" \
      "whatis named structure using type name"
  
+ gdb_test "whatis 'whatis.c'::struct t_struct" \
+     "type = struct t_struct" \
+     "whatis named structure using type name and explicit scope"
+ 
  gdb_test "whatis v_struct2" \
      "type = struct \{$unstruct\}" \
      "whatis unnamed structure"
  
+ gdb_test "whatis 'whatis.c'::v_struct2" \
+     "type = struct \{$unstruct\}" \
+     "whatis unnamed structure in explicit scope"
+ 
  
  # test whatis command with union types
  gdb_test "whatis v_union" \
      "type = union t_union" \
      "whatis named union"
  
+ gdb_test "whatis 'whatis.c'::v_union" \
+     "type = union t_union" \
+     "whatis named union in explicit scope"
+ 
  gdb_test "whatis union t_union" \
      "type = union t_union" \
      "whatis named union using type name"
  
+ gdb_test "whatis 'whatis.c'::union t_union" \
+     "type = union t_union" \
+     "whatis named union using type name and explicit scope"
+ 
  gdb_test "whatis v_union2" \
      "type = union \{$ununion\}" \
      "whatis unnamed union"
  
+ gdb_test "whatis 'whatis.c'::v_union2" \
+     "type = union \{$ununion\}" \
+     "whatis unnamed union in explicit scope"
+ 
  
  # HP-UX: HP aCC compiler w/ +objdebug option detects language as
  # c++, so we need the 'void' pattern here.
*************** gdb_test "whatis char_addr" \
*** 421,426 ****
--- 445,465 ----
      "type = char \\*" \
      "whatis using typedef type name"
  
+ gdb_test "whatis 'whatis.c'::char_addr" \
+     "type = char \\*" \
+     "whatis using typedef type name and explicit scope"
+ 
  gdb_test "whatis a_char_addr" \
      "type = char_addr" \
      "whatis applied to variable defined by typedef"
+ 
+ gdb_test "whatis 'whatis.c'::a_char_addr" \
+     "type = char_addr" \
+     "whatis applied to variable defined by typedef in explicit scope"
+ 
+ # Test printing value history type
+ 
+ gdb_test "p (long)1" ""
+ gdb_test "whatis" "type = long" "whatis long value from value history"
+ gdb_test "p (short)1" ""
+ gdb_test "whatis" "type = short" "whatis short value from value history"


  reply	other threads:[~2006-05-17 19:03 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-03 20:17 Fred Fish
2006-01-03 23:15 ` Jim Blandy
2006-01-04  2:46   ` Fred Fish
2006-01-04  3:45     ` Jim Blandy
2006-01-04 11:15       ` Fred Fish
2006-01-04 21:04       ` Fred Fish
2006-01-05  0:21         ` Jim Blandy
2006-01-05  0:26         ` Jim Blandy
2006-01-05  0:54           ` Daniel Jacobowitz
2006-01-05  4:47             ` Jim Blandy
2006-01-15 18:48         ` Daniel Jacobowitz
2006-01-16  4:22           ` Jim Blandy
2006-01-23 15:27             ` Fred Fish
2006-01-23 16:12               ` Daniel Jacobowitz
2006-01-23 16:43                 ` Fred Fish
2006-01-23 19:17                   ` Jim Blandy
2006-01-23 19:35                     ` Fred Fish
2006-01-23 20:45                       ` Jim Blandy
2006-02-11  0:39                         ` Fred Fish
2006-02-11 18:35                           ` Daniel Jacobowitz
2006-02-11 19:08                             ` Eli Zaretskii
2006-02-11 20:13                               ` Daniel Jacobowitz
2006-02-11 20:01                             ` Fred Fish
2006-02-11 20:21                               ` Daniel Jacobowitz
2006-02-12 18:49                                 ` Fred Fish
2006-02-14 14:11                                   ` Daniel Jacobowitz
2006-02-14 18:47                                     ` Fred Fish
2006-02-17  0:17                                     ` Fred Fish
2006-02-17  9:15                                       ` Eli Zaretskii
2006-02-17 13:36                                         ` Fred Fish
2006-02-17 20:32                                         ` Fred Fish
2006-02-18  9:27                                           ` Eli Zaretskii
2006-02-18 22:19                                       ` Daniel Jacobowitz
2006-02-20 15:47                                       ` Fred Fish
2006-02-20 16:23                                         ` Daniel Jacobowitz
2006-05-17 19:04                                           ` Fred Fish [this message]
2006-02-11  0:39                         ` Fred Fish
2006-01-24 15:23                     ` [commit] " Fred Fish

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=200605171502.52697.fnf@specifix.com \
    --to=fnf@specifix.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jimb@red-bean.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