Based on a previous patch form Michal Ludvig:
[deliverable/binutils-gdb.git] / gdb / valprint.c
index 0e1359a151c7d85069361592b233764a0cc9ab5c..b3a411a1f08158f2967ff5880319b6913ffc4065 100644 (file)
@@ -326,6 +326,27 @@ val_print_type_code_int (struct type *type, const gdb_byte *valaddr,
     }
 }
 
+void
+val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
+                          struct ui_file *stream)
+{
+  LONGEST val = unpack_long (type, valaddr);
+  int bitpos, nfields = TYPE_NFIELDS (type);
+
+  fputs_filtered ("[ ", stream);
+  for (bitpos = 0; bitpos < nfields; bitpos++)
+    {
+      if (TYPE_FIELD_BITPOS (type, bitpos) != -1 && (val & (1 << bitpos)))
+       {
+         if (TYPE_FIELD_NAME (type, bitpos))
+           fprintf_filtered (stream, "%s ", TYPE_FIELD_NAME (type, bitpos));
+         else
+           fprintf_filtered (stream, "#%d ", bitpos);
+       }
+    }
+  fputs_filtered ("]", stream);
+}
+
 /* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g.
    The raison d'etre of this function is to consolidate printing of 
    LONG_LONG's into this one function. The format chars b,h,w,g are 
This page took 0.024948 seconds and 4 git commands to generate.