This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 11/10] Split tdesc_type into multiple classes
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 05 Dec 2017 16:46:02 +0000
- Subject: Re: [PATCH 11/10] Split tdesc_type into multiple classes
- Authentication-results: sourceware.org; auth=none
- References: <409e1beb-1f18-f5d5-9973-b060925c8536@ericsson.com> <20171203160430.20933-1-simon.marchi@polymtl.ca>
Simon Marchi <simon.marchi@polymtl.ca> writes:
> Hi Yao,
>
> I revisited this patch, and implemented as best as I could what you
> suggested. This patch applies on top of the current series.
>
> This patch makes tdesc_type an abstract base class and creates three
> subclasses:
>
> - tdesc_type_builtin, for builtin types
> - tdesc_type_vector, for vector types
> - tdesc_type_with_fields, for struct, union, flag and enum types
>
> This allows getting rid of the union in tdesc_type and to not allow the
> std::vector separately. I tried to go further and create separate
> classes for struct, union, flag and enum, but it proved too difficult.
> One problem is that from the point of the of the target description
> code, the types tdesc_type_* are opaque (only forward-declared).
> Therefore, it doesn't know about inheritance relationship between those
> classes. This makes it impossible to make functions that accept a
> pointer to a base class and pass a pointer to a derived class, for
> example. I think this patch here is a good compromise, and if somebody
> wants to improve things further, the door is open.
>
> A make_gdb_type virtual pure method is added to tdesc_type, which
> replaces the current tdesc_gdb_type function. Calling this method on a
> tdesc_type returns the corresponding built gdb type.
Hi Simon,
Thanks for doing this, patch looks good to me.
--
Yao (齐尧)