From patchwork Wed Jun 18 03:13:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lin zuojian X-Patchwork-Id: 1543 Received: (qmail 22578 invoked by alias); 18 Jun 2014 03:13:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 22524 invoked by uid 89); 18 Jun 2014 03:13:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pd0-f170.google.com Received: from mail-pd0-f170.google.com (HELO mail-pd0-f170.google.com) (209.85.192.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 18 Jun 2014 03:13:18 +0000 Received: by mail-pd0-f170.google.com with SMTP id z10so208636pdj.15 for ; Tue, 17 Jun 2014 20:13:16 -0700 (PDT) X-Received: by 10.68.181.67 with SMTP id du3mr37508052pbc.96.1403061196436; Tue, 17 Jun 2014 20:13:16 -0700 (PDT) Received: from ubuntu ([8.37.228.188]) by mx.google.com with ESMTPSA id vs10sm684122pbc.38.2014.06.17.20.13.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 17 Jun 2014 20:13:15 -0700 (PDT) Date: Wed, 18 Jun 2014 11:13:08 +0800 From: lin zuojian To: gdb-patches@sourceware.org Subject: [PATCH] Adding bit position to ptype Message-ID: <20140618031308.GA7252@ubuntu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, I am having trouble looking up field offsets when reading disassembled text. So I add an extra field to ptype: (gdb) ptype WebCore::FrameLoader type = class WebCore::FrameLoader { private: WebCore::Frame *m_frame bitpos: 0; WebCore::FrameLoaderClient *m_client bitpos: 32; WebCore::PolicyChecker m_policyChecker bitpos: 64; WebCore::HistoryController m_history bitpos: 3264; WebCore::ResourceLoadNotifier m_notifer bitpos: 3552; WebCore::SubframeLoader m_subframeLoader bitpos: 3584; WebCore::FrameLoaderStateMachine m_stateMachine bitpos: 3680; WebCore::IconController m_icon bitpos: 3712; ... That helps me a lot to understand what "ldr r0, [r4, #408]" means. --- gdb/c-typeprint.c | 6 ++++++ 1 file changed, 6 insertions(+) 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"); }