From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5662 invoked by alias); 30 Dec 2013 02:57:23 -0000 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 Received: (qmail 5652 invoked by uid 89); 30 Dec 2013 02:57:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 30 Dec 2013 02:57:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A6B681165DF; Sun, 29 Dec 2013 21:57:19 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LGEq5tPcmFHl; Sun, 29 Dec 2013 21:57:19 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 49E2A1164A5; Sun, 29 Dec 2013 21:57:19 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 46560E0DFE; Mon, 30 Dec 2013 06:57:15 +0400 (RET) Date: Mon, 30 Dec 2013 02:57:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFA/doco] Fix gdb.Field attributes documentation for enum types. Message-ID: <20131230025715.GA6055@adacore.com> References: <1387783386-6072-1-git-send-email-brobecker@adacore.com> <834n5z8rxl.fsf@gnu.org> <20131228033003.GD4532@adacore.com> <83vby92vo5.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83vby92vo5.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-12/txt/msg00987.txt.bz2 > > @table @code > > @item bitpos > > This attribute is not available for @code{enum} or @code{static} > > -(as in C@t{++} or Java) fields. The value is the bit position of > > -the field. > > +(as in C@t{++} or Java) fields. The value is the position, counting > > +in bits, from the start of the containing type. > > Thanks, this is clear. Thanks. I just pushed the commit. > I'm curious: why are the bit units useful? Field offsets are > generally counted in bytes, not bits. It's normally true that fields are byte-aligned. But the containing structures can also be packed, in which case the fields no longer start at byte offsets. You need bit-precision to determine their location. Some example in the GDB code bases are, I think, struct symbol, where some of the fields are packed together to fit within the same word, without regard to byte boundaries (avoiding unused "holes"). -- Joel