dwarves_fprintf: Print the bit_offset for inline enum bitfield class members

Before:

  $ pahole examples/myrb_dcdb.o
  struct myrb_dcdb {
	  unsigned int               target:4;             /*     0:28  4 */
	  unsigned int               channel:4;            /*     0:24  4 */

	  /* Bitfield combined with next fields */

	  enum {
		  MYRB_DCDB_XFER_NONE = 0,
		  MYRB_DCDB_XFER_DEVICE_TO_SYSTEM = 1,
		  MYRB_DCDB_XFER_SYSTEM_TO_DEVICE = 2,
		  MYRB_DCDB_XFER_ILLEGAL = 3,
	  } data_xfer:2;                                     /*     1     1 */
  <SNIP>

After:

  $ pahole examples/myrb_dcdb.o
  struct myrb_dcdb {
	unsigned int               target:4;             /*     0:28  4 */
	unsigned int               channel:4;            /*     0:24  4 */

	/* Bitfield combined with next fields */

	enum {
		MYRB_DCDB_XFER_NONE = 0,
		MYRB_DCDB_XFER_DEVICE_TO_SYSTEM = 1,
		MYRB_DCDB_XFER_SYSTEM_TO_DEVICE = 2,
		MYRB_DCDB_XFER_ILLEGAL = 3,
	} data_xfer:2;                                   /*     1: 6  1 */

  <SNIP>

Look at data_xfer:2, it now shows the bit_offset (6) in addition to the
byte offset (1) and the bit_size (2).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c
index 8eac67e..5e005c0 100644
--- a/dwarves_fprintf.c
+++ b/dwarves_fprintf.c
@@ -784,12 +784,26 @@
 		if (!sconf.suppress_offset_comment) {
 			/* Check if this is a anonymous union */
 			const int slen = cm_name ? (int)strlen(cm_name) : -1;
+			int size_spacing = 5;
+
 			printed += fprintf(fp, sconf.hex_fmt ?
-							"%*s/* %#5x %#5x */" :
-							"%*s/* %5u %5u */",
+							"%*s/* %#5x" :
+							"%*s/* %5u",
 					   (sconf.type_spacing +
 					    sconf.name_spacing - slen - 3),
-					   " ", offset, size);
+					   " ", offset);
+
+			if (member->bitfield_size != 0) {
+				unsigned int bitfield_offset = member->bitfield_offset;
+
+				if (member->bitfield_offset < 0)
+					bitfield_offset = member->byte_size * 8 + member->bitfield_offset;
+
+				printed += fprintf(fp, sconf.hex_fmt ?  ":%#2x" : ":%2u", bitfield_offset);
+				size_spacing -= 3;
+			}
+
+			printed += fprintf(fp, sconf.hex_fmt ?  " %#*x */" : " %*u */", size_spacing, size);
 		}
 	} else {
 		int spacing = sconf.type_spacing + sconf.name_spacing - printed;