My personal website source code
Log | Files | Refs | Submodules | README | LICENSE

commit e750594a030db057acf881dbc76b65fb8e877800
parent 8c7c7a83f4a1b4f3ff7049aef37728a34e975108
Author: Luís Ferreira <>
Date:   Thu, 18 Nov 2021 20:56:49 +0000

posts: Add 'SAOC LLDB D integration: 9th Weekly Update'

Signed-off-by: Luís Ferreira <>

Mcontent/posts/ | 3++-
Acontent/posts/ | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/content/posts/ b/content/posts/ @@ -134,4 +134,5 @@ parallel and probably going to start implementing the D TypeSystem and DWARFFASTParser, required for the LLDB plugin. These are things not trivial to me, but I'm going to try to have some output. -Read about the [previous week](../d-saoc-2021-07/). +Read about the [previous week](../d-saoc-2021-07/) and the [next +week](../d-saoc-2021-09/). diff --git a/content/posts/ b/content/posts/ @@ -0,0 +1,73 @@ +--- +title: 'SAOC LLDB D integration: 9th Weekly Update' +date: '2021-11-18T18:02:00+01:00' +tags: ['saoc', 'saoc2021', 'dlang', 'llvm', 'lldb', 'debug', 'debugging', 'dwarf'] +description: "This post describes what I've done on the 9th week of the +Symmetry Autumn of Code 2021, including follow up updates on the LLVM patches +and some fixed issues." +--- + +Hi D community! + +I'm here again, to describe what I've done during the ninth week of Symmetry +Autumn of Code. + +## LLVM upstream follow up update + +I started this week updating the rest of the patches to reflect the suggestions +made in the first patch, such as use a different OutputBuffer and other nit +codestyle changes. It turns out to be very unproductive week, unfortunately, +since I got some runtime errors such as heap buffer overflows and heap usage +after free() calls leading to very weird bugs because of my dumb idea of +refactoring the existing code. + +TL;DR of the situation, I made a vim macro to substitute the existing +OutputString to an OutputBuffer and, since comma expressions are a thing, +situations like `buffer.append(ptr, size);` got silently translated to `buffer +<< ptr, size;`. Since I preallocated the buffer, the segfaults were +intermittent. Furthermore, the semantics of my previous Free() method included +resetting the buffer after a free(), leading to some heap usage after free(). + +Anyway, you can check the changes I've made +[here]( + +## Fixed issues + +### Generate artificial tag on generated main files + +DWARF now generates an artificial tag when `-main` argument is passed +indicating that the symbol is generated by the compiler. The change can be +found [here]( In the meanwhile, I +accidentally found and [fixed]( a +pre-release regression caused by the OutBuffer move when testing this. + +### Associative arrays are now named with its qualified type name + +Instead of printing `_AArray_<key>_<value>` where `<key>` and `<value>` is the +string representation of the TY, we now have the type name we are used to +`<value>[<key>]`. This also eliminates the problem where fake TY types are +internally used -- e.g. `string` types are faked to `ucent` types. You can see +the change [here]( and the [associated +issue]( + +### Attempt to fix the calling convention + +I dug into the backend codegen to understand a bit more about how the calling +convention is currently being processed. I ended up with a working test +although very weird errors are happening and I cannot have a reduced +reproducible test case to locally understand the problem and go forward with +this, although Martin Kinkelin suggested something that I can start with. You +can find the WIP PR [here]( + +### Other reported issues + +On LDC I found out that the compiler always generates the DWARF visibility +attributes, even if not necessary, leading to bigger binary sizes. I created an +[issue]( about that. + +## What is next? + +I ended up not starting the TypeSystem nor DWARFFASTParser implementation. I +will try to hopefully go forward with it next week. + +Read about the [previous week](../d-saoc-2021-08/).