[PATCH][gdb/exp] Fix internal error when printing C++ pointer-to-member
Tom de Vries
tdevries@suse.de
Tue Jul 5 20:42:06 GMT 2022
On 7/5/22 20:47, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Tom> (gdb) print ptm^M
> Tom> $1 = gdb/gdbtypes.h:695: internal-error: loc_bitpos: \
> Tom> Assertion `m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.^M
> Tom> ...
> Tom> while printing a c++ pointer-to-member.
>
> Is this crashing due to the static field?
>
Yes.
> Tom> Fix this by skipping fields with m_loc_kind != FIELD_LOC_KIND_BITPOS in
> Tom> cp_find_class_member, such that we have:
> Tom> ...
> Tom> (gdb) print ptm^M
> Tom> $1 = &A::i^M
> Tom> ...
>
> If so then I think it's better to skip when the field is static, not
> based on the loc_kind.
Ack, committed using field_is_static instead.
Thanks,
- Tom
More information about the Gdb-patches
mailing list