SAOC LLDB D integration: 5th Weekly Update

Luís Ferreira contact at
Thu Oct 21 01:48:32 UTC 2021

Hi D community!

I'm here again, to describe what I've done during the fifth week of
Autumn of Code.

## LLVM Patches follow up

During the discussion on some patches, two other patches have been
refactoring the usage of string utilities shared among other


## Second milestone kickoff

This week I started working on the second milestone, mostly covering
issues that I discovered. The initial idea is to research a bit about
debug information is provided by each compiler and understand what can
be done,
not only on the LLDB side but also improve information generated by the

During this week I also took a look at the DWARF5 standard to
understand what
to improve. I discovered very interesting tags that can help generalize
arrays and strings interaction with the debug info.

To give a bit of context, and more deeply into the DWARF standard,
`DW_TAG_array_type` exists to represent array types. Similarly, there
is also a
tag to specifically represent string types. These tags can be used with
`DW_TAG_subrange_type` to represent a so-called "slice" and attributes
`DW_AT_count` or `DW_AT_upper_bound` can be used to represent the slice
Interestingly those attributes can refer to runtime variables and
create debug information for a "dynamic array". I checked other
compilers and
only C VLAs are using it.

I wrote a document describing some of the issues and comparing the
capabilities of the 3 most known D compilers. You can read it

Some of those issues I managed to fix in the compiler backend, others I
filed a
bug. Here is a list of patches and bug reports I created:


I have an upcoming patch to the DMD backend that I'm currently working
on to
refactor some of the DMD DWARF generator, specifically to the
code. My motivation for the refactor is the fact that I spent a lot of
looking into the backend codebase, implementing PR #13202. Later I
when looking into the DWARF standard, that DWARF abbreviations are all
encoded and the code is not respecting that. I believe some of the
produced by the compiler is due to that.

## LLVM Plugin

To have pretty-printing capabilities I will need to either implement
some of
those missing DWARF tags or/and write an LLDB language plugin. The last
report on the list above triggers a discussion in that regard. Very
soon I'm
going to write a thread on the LLVM mailing list describing the goals
of the
plugin and discuss the possibility of upstreaming it, however, I'm not
confident that will happen, because Rust among other language plugins
removed from the upstream for "lacking maintainability".

I already started working on some D integration specifically on the
LLDB side,
although I haven't pushed any of this code, since some stuff is still
experiments and not properly split up.

## What is next?

Next week, now that I have some scope about DWARF, I'm going to tackle
on the LLDB integration, since that is what the milestone is focused
on. I'm
going to clean up the idea I have of the language plugin and hopefully
some interesting practical results.

You can also read this on my blog,

Luís Ferreira @

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Digitalmars-d mailing list