This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/19893] Synthetic pointers created from C++ references are broken


https://sourceware.org/bugzilla/show_bug.cgi?id=19893

--- Comment #3 from Martin Galvan <martin.galvan at tallertechnologies dot com> ---
Hi everyone,

I've fixed cases 2 and 3 by implementing pieced_value_funcs.coerce_ref as a
wrapper for indirect_pieced_value that works only for synthetic references. I
changed the check in indirect_pieced_value so that it works with both
TYPE_CODE_PTR and TYPE_CODE_REF, since gdb always assumes they're both
pointers.

While that seems to work, there's an issue: right now
pieced_value_funcs.coerce_ref takes a const value which represents the
reference, while indirect_pieced_value's argument isn't const. Dwelling deeper
I saw that this is correct: indirect_pieced_value needs to fetch the value's
contents (i.e. the pointer's value), which ends up calling value_fetch_lazy.
However, this breaks my approach unless I de-const the value all the way up
from pieced_value_funcs.coerce_ref (which is ugly, especially when done on
printing functions).

How could I go about doing this differently? Is there something I'm missing
here?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]