]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[General] Accept capabilities as a type of pointer
authorLuis Machado <luis.machado@arm.com>
Thu, 10 Sep 2020 20:33:06 +0000 (17:33 -0300)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:53:22 +0000 (15:53 -0700)
This makes GDB happy when trying to convert to/from capabilities from
long types.

gdb/ChangeLog:

2020-10-20  Luis Machado  <luis.machado@arm.com>

* findvar.c (extract_typed_address): Handle capabilities.
(store_typed_address): Likewise.
* value.c (unpack_long): Likewise.
(pack_long): Likewise.

gdb/gdbtypes.h
gdb/value.c

index d7c2199585dadf3762ecf90cc83d8099408cf000..72d3261532d1bb266b766fba1d0ea82bc4a819e2 100644 (file)
@@ -1460,7 +1460,8 @@ struct type
   /* Return true if this is a pointer or reference type.  */
   bool is_pointer_or_reference () const
   {
-    return this->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (this);
+    return this->code () == TYPE_CODE_PTR
+      || this->code () == TYPE_CODE_CAPABILITY || TYPE_IS_REFERENCE (this);
   }
 
   /* * Type that is a pointer to this type.
index 97fab292b30b59a4581b332e3675ea44e3d048bd..ab55aaa0c982542dbab9ae0e8b1f11e1eb3c5c68 100644 (file)
@@ -2909,6 +2909,7 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
     case TYPE_CODE_RVALUE_REF:
+    case TYPE_CODE_CAPABILITY:
       /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
         whether we want this to be true eventually.  */
       return extract_typed_address (valaddr, type);
@@ -3465,6 +3466,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
     case TYPE_CODE_REF:
     case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_PTR:
+    case TYPE_CODE_CAPABILITY:
       store_typed_address (buf, type, (CORE_ADDR) num);
       break;