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/?a=commitdiff_plain;h=51e95f5515a7c0f0002ebc406b3c0b368413de45;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/ChangeLog b/gdb/ChangeLog index fe10cf4e4d5..5ba49ff62f6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-10-20 Luis Machado + + * findvar.c (extract_typed_address): Handle capabilities. + (store_typed_address): Likewise. + * value.c (unpack_long): Likewise. + (pack_long): Likewise. + 2020-10-20 Luis Machado * valops.c (value_cast): Cast from capability to scalar types. diff --git a/gdb/findvar.c b/gdb/findvar.c index 78d727b07bb..5c3a8848a5b 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -153,7 +153,8 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len, CORE_ADDR extract_typed_address (const gdb_byte *buf, struct type *type) { - if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) + if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type) + && type->code () != TYPE_CODE_CAPABILITY) internal_error (__FILE__, __LINE__, _("extract_typed_address: " "type is not a pointer or reference")); @@ -206,7 +207,8 @@ template void store_integer (gdb_byte *addr, int len, void store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr) { - if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) + if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type) + && type->code () != TYPE_CODE_CAPABILITY) internal_error (__FILE__, __LINE__, _("store_typed_address: " "type is not a pointer or reference")); diff --git a/gdb/value.c b/gdb/value.c index 7c36c31dccd..ef2ebf09ef5 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2809,6 +2809,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); @@ -3369,6 +3370,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;