gdb/
[deliverable/binutils-gdb.git] / gdb / python / py-type.c
index d47d4c8be8624c563e5e8b8d4005d34d36177093..23808af488684c61338e0f73f4209c29fec900c6 100644 (file)
@@ -167,11 +167,23 @@ convert_field (struct type *type, int field)
 
   if (!field_is_static (&TYPE_FIELD (type, field)))
     {
-      arg = PyLong_FromLong (TYPE_FIELD_BITPOS (type, field));
+      const char *attrstring;
+
+      if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+       {
+         arg = gdb_py_long_from_longest (TYPE_FIELD_ENUMVAL (type, field));
+         attrstring = "enumval";
+       }
+      else
+       {
+         arg = PyLong_FromLong (TYPE_FIELD_BITPOS (type, field));
+         attrstring = "bitpos";
+       }
+
       if (!arg)
        goto fail;
 
-      if (PyObject_SetAttrString (result, "bitpos", arg) < 0)
+      if (PyObject_SetAttrString (result, attrstring, arg) < 0)
        goto failarg;
     }
 
@@ -1018,6 +1030,10 @@ check_types_equal (struct type *type1, struct type *type2,
              if (FIELD_BITPOS (*field1) != FIELD_BITPOS (*field2))
                return Py_NE;
              break;
+           case FIELD_LOC_KIND_ENUMVAL:
+             if (FIELD_ENUMVAL (*field1) != FIELD_ENUMVAL (*field2))
+               return Py_NE;
+             break;
            case FIELD_LOC_KIND_PHYSADDR:
              if (FIELD_STATIC_PHYSADDR (*field1)
                  != FIELD_STATIC_PHYSADDR (*field2))
This page took 0.024963 seconds and 4 git commands to generate.