[PATCH 10/11] Add Python support for dynamic types

Tom Tromey tom@tromey.com
Fri Apr 24 19:42:09 GMT 2020


>>>>> "Christian" == Christian Biesinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Christian> Thanks for the detailed explanation! I would suggest two things:
Christian> - For your note in the documentation that "the position of a field may
Christian> not be constant", maybe add that the field may not exist in a specific
Christian> value, and
Christian> - mention somewhere that value.type will be different from
Christian> gdb.lookup_type(value.type.name), and lets you access the concrete
Christian> fields

I'll write a new doc patch for this.

Christian> The "dynamic type" name is unfortunate, since it is unrelated to
Christian> Value.dynamic_type AFAICT. I thought discriminated/tagged union was a
Christian> more common name for this :(

Yeah, though this code doesn't really only apply to variant parts /
discriminated unions.  It applies to any type that might have some kind
of dynamically-resolved attribute.  For example, this can be used by
structures that contain dynamically-sized arrays.

Tom


More information about the Gdb-patches mailing list