From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32125 invoked by alias); 19 Dec 2012 20:50:39 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 32096 invoked by uid 306); 19 Dec 2012 20:50:37 -0000 Date: Wed, 19 Dec 2012 20:50:00 -0000 Message-ID: <20121219205037.32081.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: make pahole print a hole after the last field X-Git-Refname: refs/heads/archer-tromey-python X-Git-Reftype: branch X-Git-Oldrev: da55ddadfd53c0c125444ddc697977adfef7a464 X-Git-Newrev: 3e4a982a09b88f3f416b86abdffa1a7fca7050c4 X-SW-Source: 2012-q4/txt/msg00036.txt.bz2 List-Id: The branch, archer-tromey-python has been updated via 3e4a982a09b88f3f416b86abdffa1a7fca7050c4 (commit) from da55ddadfd53c0c125444ddc697977adfef7a464 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 3e4a982a09b88f3f416b86abdffa1a7fca7050c4 Author: Tom Tromey Date: Wed Dec 19 13:49:44 2012 -0700 make pahole print a hole after the last field This changes the pahole command to notice holes between the last field and the end of the object. ----------------------------------------------------------------------- Summary of changes: gdb/python/lib/gdb/command/pahole.py | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) First 500 lines of diff: diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py index 21a0bf0..636f99d 100644 --- a/gdb/python/lib/gdb/command/pahole.py +++ b/gdb/python/lib/gdb/command/pahole.py @@ -1,6 +1,6 @@ # pahole command for gdb -# Copyright (C) 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,6 +26,11 @@ It prints the type and displays comments showing where holes are.""" super (Pahole, self).__init__ ("pahole", gdb.COMMAND_NONE, gdb.COMPLETE_SYMBOL) + def maybe_print_hole(self, bitpos, field_bitpos): + if bitpos != field_bitpos: + hole = field_bitpos - bitpos + print ' /* XXX %d bit hole, try to pack */' % hole + def pahole (self, type, level, name): if name is None: name = '' @@ -41,10 +46,8 @@ It prints the type and displays comments showing where holes are.""" ftype = field.type.strip_typedefs() - if bitpos != field.bitpos: - hole = field.bitpos - bitpos - print ' /* XXX %d bit hole, try to pack */' % hole - bitpos = field.bitpos + self.maybe_print_hole(bitpos, field.bitpos) + bitpos = field.bitpos if field.bitsize > 0: fieldsize = field.bitsize else: @@ -61,6 +64,9 @@ It prints the type and displays comments showing where holes are.""" print ' ' * (2 + 2 * level), print '%s %s' % (str (ftype), field.name) + if level == 0: + self.maybe_print_hole(bitpos, 8 * type.sizeof) + print ' ' * (14 + 2 * level), print '} %s' % name hooks/post-receive -- Repository for Project Archer.