[PATCH] [D] Add support for printing D types.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] [D] Add support for printing D types.

Iain Buclaw
Hi,

This adds support for printing types as they would appear in D code.

Tests cover pointers, function pointers, delegates, static arrays,
dynamic arrays, associative arrays, strings (utf-8, 16 and 32),
vectors and modules.

Named types such as structs, unions, classes and enums will need some
fudging of the compiler to not write out RTTI, however I have not had
problems over the last months using them with this applied.

Iain.

dlang-typeprint.patch (49K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] [D] Add support for printing D types.

Pedro Alves-7
Hi Iain,

On 01/30/2016 04:29 PM, Iain Buclaw wrote:

> gdb/ChangeLog:
>

> * d-lang.c (d_language_defn): Change c_print_type to d_print_type.
> * d-lang.h (d_print_type): New declaration.
> * d-typeprint.c: New file.
>

These bits you can clearly self approve.


> * Makefile.in (SFILES): Add d-typeprint.c
> (COMMON_OBJS): Add d-typeprint.o
> * dwarf2read.c (read_structure_type): Set TYPE_DECLARED_CLASS also for
> classes in D language.

FAOD, these bits are OK.


> gdb/testsuite/ChangeLog:
>
> * typeprint.S: New file.
> * typeprint.exp: New file.

But these can be written in D now, right?

Thanks,
Pedro Alves

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] [D] Add support for printing D types.

Iain Buclaw
On 17 February 2016 at 17:12, Pedro Alves <[hidden email]> wrote:

> Hi Iain,
>
> On 01/30/2016 04:29 PM, Iain Buclaw wrote:
>
>> gdb/ChangeLog:
>>
>
>>       * d-lang.c (d_language_defn): Change c_print_type to d_print_type.
>>       * d-lang.h (d_print_type): New declaration.
>>       * d-typeprint.c: New file.
>>
>
> These bits you can clearly self approve.
>

OK, however, I do try to hold back on bigger changes, as there may
have been something i overlooked.

>
>>       * Makefile.in (SFILES): Add d-typeprint.c
>>       (COMMON_OBJS): Add d-typeprint.o
>>       * dwarf2read.c (read_structure_type): Set TYPE_DECLARED_CLASS also for
>>       classes in D language.
>
> FAOD, these bits are OK.
>

Thanks.

>
>> gdb/testsuite/ChangeLog:
>>
>>       * typeprint.S: New file.
>>       * typeprint.exp: New file.
>
> But these can be written in D now, right?
>

I guess so, would this be the preferred method for tests that use simple code?

I will redo this patch anyway, I noticed it's an old version with a
FIXME that I forgot to remove.

Regards,
Iain.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] [D] Add support for printing D types.

Pedro Alves-7
On 02/18/2016 09:10 PM, Iain Buclaw wrote:

>>> gdb/testsuite/ChangeLog:
>>>
>>>       * typeprint.S: New file.
>>>       * typeprint.exp: New file.
>>
>> But these can be written in D now, right?
>>
>
> I guess so, would this be the preferred method for tests that use simple code?

Right.  We prefer writing tests in their natural language, unless the
test is exercising some dwarf-specific issue where we truly need to
capture a stable dwarf snapshot.  And even then, we prefer using the
testsuite's dwarf assembler, in order to make the test arch-independent
(grep for "Dwarf" in testsuite/gdb.dwarf2).

> I will redo this patch anyway, I noticed it's an old version with a
> FIXME that I forgot to remove.

Thanks,
Pedro Alves