This is the mail archive of the
mailing list for the GDB project.
Re: [patch] Fix internal error on optimized-out values (regression by me)
>>>>> "Pedro" == Pedro Alves <email@example.com> writes:
Pedro> It just happens that today, we only support either wholy
Pedro> optimized-out values, or wholly not optimized-out values. A
Pedro> compiler can flatten out structures and optimize out just some
Pedro> unused fields (of local vars, most usefully). When
Pedro> we get to support that, it'll follow naturally that a single
Pedro> optimized out flag per value isn't sufficient, and that
Pedro> ((struct) <optimized out>).field will need to be able to
Pedro> be <optimized out>.
Actually I think GCC can already do all of this, and GDB can
(supposedly) handle it. There are a couple of lval_computed methods
used to handle this -- check_validity and check_any_valid.
I don't remember how value_primitive_field was supposed to work with
this exactly, but I think the key is that set_value_component_location
on the new value correctly inherits the 'computed' vtable; so the
optimized-out status bits are preserved by this operation.
Given this I tend to think that the patch that went in is incorrect, in
that it may break operations on an SRA'd structure where some bits are
optimized away. I thought I added tests for this, not sure though.