From d176ed7c9afbcebb385f9ca8626fd3de8478429c Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 31 Aug 2022 12:01:52 -0700 Subject: [PATCH] value_primitive_field: Always mark capabilities lazy. value_primitive_field copies the subrange of a non-lazy value into the new value for a subobject. However, the value of outer objects never contain tags. Instead, always mark new values as lazy if they are a capability or are a structure containing a capability member. --- gdb/value.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/value.c b/gdb/value.c index 1c0b8d5e4dd..69c17d23a9b 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3136,7 +3136,7 @@ value_primitive_field (struct value *arg1, LONGEST offset, else boffset = arg_type->field (fieldno).loc_bitpos () / 8; - if (value_lazy (arg1)) + if (value_lazy (arg1) || type->contains_capability ()) v = allocate_value_lazy (value_enclosing_type (arg1)); else { @@ -3169,7 +3169,8 @@ value_primitive_field (struct value *arg1, LONGEST offset, if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1)) value_fetch_lazy (arg1); - if (value_lazy (arg1)) + if (value_lazy (arg1) || type->code () == TYPE_CODE_CAPABILITY + || TYPE_CAPABILITY (type)) v = allocate_value_lazy (type); else { -- 2.47.2