From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27392 invoked by alias); 18 Jun 2014 14:31:15 -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 27286 invoked by uid 89); 18 Jun 2014 14:31:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 18 Jun 2014 14:31:12 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5IEV9aA011796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jun 2014 10:31:09 -0400 Received: from barimba (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5IEV8Vb029075 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 18 Jun 2014 10:31:09 -0400 From: Tom Tromey To: lin zuojian Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Adding bit position to ptype References: <20140618031308.GA7252@ubuntu> Date: Wed, 18 Jun 2014 14:31:00 -0000 In-Reply-To: <20140618031308.GA7252@ubuntu> (lin zuojian's message of "Wed, 18 Jun 2014 11:13:08 +0800") Message-ID: <871tumffwz.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-06/txt/msg00664.txt.bz2 >>>>> ">" == lin zuojian writes: >> Hi, I am having trouble looking up field offsets when reading >> disassembled text. So I add an extra field to ptype: Nice. You might be interested in pahole.py. >> diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c >> index 4edc9ec..9fbbc36 100644 >> --- a/gdb/c-typeprint.c >> +++ b/gdb/c-typeprint.c >> @@ -1110,6 +1110,12 @@ c_type_print_base (struct type *type, struct ui_file *stream, >> fprintf_filtered (stream, " : %d", >> TYPE_FIELD_BITSIZE (type, i)); >> } >> + else if (!field_is_static (&TYPE_FIELD (type, i))) >> + { >> + /* print the bit pos. */ >> + fprintf_filtered (stream, " bitpos: %d", >> + TYPE_FIELD_BITPOS (type, i)); >> + } >> fprintf_filtered (stream, ";\n"); To be considered for acceptance all patches require a ChangeLog entry and must pass regression testing -- which this one probably does not, as it changes gdb's output by default. Please see the contribution instructions. I think it would probably be better to add a flag to ptype to enable this behavior. Integrating all of the pahole behavior into ptype would be even better, though I understand if you don't want to go this far. thanks, Tom