1 --- 2 title: 'SAOC LLDB D integration: 16th Weekly Update' 3 date: '2022-01-07T03:12:00+01:00' 4 tags: ['saoc', 'saoc2021', 'dlang', 'llvm', 'lldb', 'debug', 'debugging', 'dwarf'] 5 description: "This post describes what I've done on the 16th week of the 6 Symmetry Autumn of Code 2021, including updates on the upstream patches and 7 implementation of the value dumping for the rest of the built-in types." 8 --- 9 10 Hi D community! 11 12 I'm here again, to describe what I've done during the sixteenth week of 13 Symmetry Autumn of Code. 14 15 ## LLVM upstream updates 16 17 This week I continued my work on the demangler patches, including the next 3 18 patches related to minimal type parsing and symbol/type back referencing. I 19 removed most of the types in this next patch, due to the fact that it requires 20 other dependencies to be visually tested. 21 22 Two more patches got merged into the upstream. The LLD one got reverted due to 23 failures on PowerPC buildbots, although the error ended up being a missing 24 dependency. The second one was about the other patch I worked last week about 25 immutable type qualifier in the DWARF debug info: 26 27 - https://reviews.llvm.org/D113633 28 - https://reviews.llvm.org/D116279 29 30 ## Extending value dumping for the rest of the built-in types 31 32 After adding support for boolean type I successfully extended type value 33 dumping for the rest of the built-in types: 34 35 ``` 36 (lldb) ta v 37 Global variables for app.d in app: 38 (int) app.int42_gvar = -42 39 (ulong) app.ulong42_gvar = 42 40 (uint) app.uint_gvar = 0 41 (uint) app.uint42_gvar = 42 42 (double) app.double_42_gvar = -42 43 (real) app.real42_gvar = 42 44 (long) app.long42_gvar = -42 45 (dchar) app.d = U+0x00000064 46 (ulong) app.ulong_gvar = 0 47 (char) app.c = 0x63 48 (bool) app.true_gvar = true 49 (ushort) app.ushort_gvar = 0 50 (byte) app.byte42_gvar = d6 51 (double) app.double_gvar = 0 52 (long) app.long_gvar = 0 53 (double) app.double42_gvar = 42 54 (float) app.float42_gvar = 42 55 (wchar) app.w = U+0077 56 ... 57 ``` 58 59 I have tested almost every built-in type including `real`. Thanks to some 60 guidance on the previous weekly report, I made some basic logic to make `real` 61 work according to the exported DWARF type name, although realizing that D 62 should map directly to `long double`, I can later map the `real` bit size using 63 the same interface used in the Clang DWARF Parser (`clang::TargetInfo`). 64 65 From what I tested, at least one target that have support for 128bit `long 66 double`, RISC-V, is not correctly mapped by the LDC compiler, so I decided to 67 make a PR to fix that: 68 69 - https://github.com/ldc-developers/ldc/pull/3891 70 - https://github.com/ldc-developers/ldc/pull/3892 71 72 ## What is next? 73 74 After having support for basic built-in types functionality, I plan to 75 implement some type modifiers, including `const` and add support for other 76 derived types. I also plan to work in parallel to merge some more patches about 77 the demangler. 78 79 You can also read this on the D programming language forum, 80 [here](https://firstname.lastname@example.org#post-cfeuzatpyknarblnsoti:40forum.dlang.org), 81 and discuss there! 82 83 Read about the [previous week](../d-saoc-2021-15/) and the [next week](../d-saoc-2021-17/).