From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4501 invoked by alias); 17 May 2006 19:03:18 -0000 Received: (qmail 4206 invoked by uid 22791); 17 May 2006 19:03:13 -0000 X-Spam-Check-By: sourceware.org Received: from w099.z064220152.sjc-ca.dsl.cnc.net (HELO duck.specifix.com) (64.220.152.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 17 May 2006 19:02:36 +0000 Received: from [::1] (duck.specifix.com [64.220.152.99]) by duck.specifix.com (Postfix) with ESMTP id 2B3636718; Wed, 17 May 2006 12:02:29 -0700 (PDT) From: Fred Fish Reply-To: fnf@specifix.com To: Daniel Jacobowitz Subject: Re: [PATCH] Fix ptype problem printing typedefs defined differently in different compilation units Date: Wed, 17 May 2006 19:04:00 -0000 User-Agent: KMail/1.9.1 Cc: Jim Blandy , gdb-patches@sourceware.org References: <200601031517.50309.fnf@specifix.com> <200602201046.08713.fnf@specifix.com> <20060220162320.GF16058@nevyn.them.org> In-Reply-To: <20060220162320.GF16058@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605171502.52697.fnf@specifix.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00385.txt.bz2 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 * 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"