From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21874 invoked by alias); 17 Apr 2012 12:45:03 -0000 Received: (qmail 21789 invoked by uid 22791); 17 Apr 2012 12:45:00 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00,KAM_STOCKTIP,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Apr 2012 12:44:15 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3HCiFAw007944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Apr 2012 08:44:15 -0400 Received: from host2.jankratochvil.net (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3HCiAxl018867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 17 Apr 2012 08:44:13 -0400 Date: Tue, 17 Apr 2012 12:52:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Siddhesh Poyarekar Subject: [commit] Do not rely on FIELD_LOC_KIND_BITPOS being zero Message-ID: <20120417124410.GA15356@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00461.txt.bz2 Hi, FIELD_LOC_KIND_BITPOS is 0 and some code relied on it, using only TYPE_FIELD_BITPOS (type, n) = foo; instead of SET_FIELD_BITPOS (TYPE_FIELD (type, n), foo); This caused in consequence with TYPE_FIELD_ENUM from: [PATCH] Allow 64-bit enum values and a sanity check -#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) -#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) +#define TYPE_FIELD_BITPOSL(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) +#define TYPE_FIELD_BITPOS(thistype, n) ({ gdb_assert (TYPE_CODE (thistype) != TYPE_CODE_ENUM); TYPE_FIELD_BITPOSL(thistype, n); }) +#define TYPE_FIELD_ENUMVALL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) +#define TYPE_FIELD_ENUMVAL(thistype, n) ({ gdb_assert (TYPE_CODE (thistype) == TYPE_CODE_ENUM); TYPE_FIELD_ENUMVALL(thistype, n); }) regression with -gstabs+: file^M No executable file now.^M Discard symbol table from `/unsafegdb/testsuite.unix.-m64/gdb.python/py-value'? (y or n) y^M -Error in re-setting breakpoint 1: No symbol table is loaded. Use the "file" command.^M -Error in re-setting breakpoint 2: No symbol table is loaded. Use the "file" command.^M -No symbol file now.^M -(gdb) PASS: gdb.python/py-value.exp: Discard the symbols -python castval = arg0.cast(ptrtype.pointer())^M +gdbtypes.c:3403: internal-error: copy_type_recursive: Assertion `TYPE_CODE (type) != TYPE_CODE_ENUM' failed.^M +A problem internal to GDB has been detected,^M +further debugging may prove unreliable.^M +Quit this debugging session? (y or n) FAIL: gdb.python/py-value.exp: Discard the symbols (GDB internal error) No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu and with -gstabs+. Checked in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2012-04/msg00108.html --- src/gdb/ChangeLog 2012/04/16 11:24:43 1.14107 +++ src/gdb/ChangeLog 2012/04/17 12:43:16 1.14108 @@ -1,3 +1,12 @@ +2012-04-17 Jan Kratochvil + + Do not rely on FIELD_LOC_KIND_BITPOS being zero. + * ada-lang.c (ada_template_to_fixed_record_type_1): Replace + TYPE_FIELD_BITPOS used as lvalue by SET_FIELD_BITPOS. + * gdbtypes.c (append_flags_type_flag): Likewise, twice. + * jv-lang.c (java_link_class_type): Likewise, once. + * stabsread.c (read_enum_type): Likewise. + 2012-04-16 Yao Qi * common/agent.c (agent_run_command): Add one more parameter `len'. --- src/gdb/ada-lang.c 2012/03/29 23:30:55 1.363 +++ src/gdb/ada-lang.c 2012/04/17 12:43:19 1.364 @@ -7445,7 +7445,7 @@ { off = align_value (off, field_alignment (type, f)) + TYPE_FIELD_BITPOS (type, f); - TYPE_FIELD_BITPOS (rtype, f) = off; + SET_FIELD_BITPOS (TYPE_FIELD (rtype, f), off); TYPE_FIELD_BITSIZE (rtype, f) = 0; if (ada_is_variant_part (type, f)) --- src/gdb/gdbtypes.c 2012/02/07 04:48:20 1.226 +++ src/gdb/gdbtypes.c 2012/04/17 12:43:20 1.227 @@ -3606,12 +3606,12 @@ if (name) { TYPE_FIELD_NAME (type, bitpos) = xstrdup (name); - TYPE_FIELD_BITPOS (type, bitpos) = bitpos; + SET_FIELD_BITPOS (TYPE_FIELD (type, bitpos), bitpos); } else { /* Don't show this field to the user. */ - TYPE_FIELD_BITPOS (type, bitpos) = -1; + SET_FIELD_BITPOS (TYPE_FIELD (type, bitpos), -1); } } --- src/gdb/jv-lang.c 2012/03/02 19:29:00 1.101 +++ src/gdb/jv-lang.c 2012/04/17 12:43:20 1.102 @@ -480,7 +480,7 @@ if (accflags & 0x0008) /* ACC_STATIC */ SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset); else - TYPE_FIELD_BITPOS (type, i) = 8 * boffset; + SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset); if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ { TYPE_FIELD_TYPE (type, i) = get_java_object_type (); /* FIXME */ --- src/gdb/stabsread.c 2012/03/13 16:29:16 1.144 +++ src/gdb/stabsread.c 2012/04/17 12:43:20 1.145 @@ -3730,7 +3730,7 @@ SYMBOL_TYPE (xsym) = type; TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym); - TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym); + SET_FIELD_BITPOS (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym)); TYPE_FIELD_BITSIZE (type, n) = 0; } if (syms == osyms)