Add support for casting capabilities to scalar types. We basically truncate
the capability to the size of the target type.
gdb/ChangeLog:
2020-10-20 Luis Machado <luis.machado@arm.com>
* valops.c (value_cast): Cast from capability to scalar types.
|| code2 == TYPE_CODE_RANGE
|| is_fixed_point_type (type2));
+ /* Handle casting capabilities to other scalar types. For now we truncate
+ the capability value to the size of the target type. */
+ if (scalar && code2 == TYPE_CODE_CAPABILITY)
+ {
+ if (type->is_unsigned ())
+ value_from_ulongest (to_type, value_as_long (arg2));
+ else
+ value_from_longest (to_type, value_as_long (arg2));
+ }
+
if ((code1 == TYPE_CODE_STRUCT || code1 == TYPE_CODE_UNION)
&& (code2 == TYPE_CODE_STRUCT || code2 == TYPE_CODE_UNION)
&& type->name () != 0)