public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-python: make pahole print a hole after the last field
@ 2012-12-19 20:50 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2012-12-19 20:50 UTC (permalink / raw)
  To: archer-commits

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 <tromey@redhat.com>
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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-19 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 20:50 [SCM] archer-tromey-python: make pahole print a hole after the last field tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).