[Bug cli/23311] New: ptype/o gives strange results with bitfields

tromey at sourceware dot org sourceware-bugzilla@sourceware.org
Mon Jun 18 20:52:00 GMT 2018


https://sourceware.org/bugzilla/show_bug.cgi?id=23311

            Bug ID: 23311
           Summary: ptype/o gives strange results with bitfields
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: tromey at sourceware dot org
  Target Milestone: ---

Consider this test:

struct x{
  char r;
  int s : 3;
  int t : 7;
};

x y;


gdb says:

(gdb) ptype/o x
/* offset    |  size */  type = struct x {
/*    0      |     1 */    char r;
/*    0:21   |     4 */    int s : 3;
/*    0:14   |     4 */    int t : 7;
/* XXX  6-bit padding  */
/* XXX  1-byte padding */

                           /* total size (bytes):    4 */
                         }


Seeing "0:" for the bitfields seems strange.
I think it would generally be clearer to refer to the starting byte.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list