From: Luis Machado Date: Thu, 10 Sep 2020 20:33:06 +0000 (-0300) Subject: [General] Accept capabilities as a type of pointer X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9dbfbf0614a6a5ebb6b644fb575ba465b4317c01;p=thirdparty%2Fbinutils-gdb.git [General] Accept capabilities as a type of pointer This makes GDB happy when trying to convert to/from capabilities from long types. gdb/ChangeLog: 2020-10-20 Luis Machado * findvar.c (extract_typed_address): Handle capabilities. (store_typed_address): Likewise. * value.c (unpack_long): Likewise. (pack_long): Likewise. --- diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index d7c2199585d..72d3261532d 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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. diff --git a/gdb/value.c b/gdb/value.c index 97fab292b30..ab55aaa0c98 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -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;