My Journey with LLVM (GSoC'20 Phase 2)

During the second coding period, we’ve implemented the .debug_str_offsets, .debug_rnglists and .debug_loclists section. We’re able to handcraft these 3 sections via the following syntax.


Note: The .debug_loclists section is implemented, but it hasn’t been landed yet.

We’ve also taught yaml2obj to infer the compilation unit’s length for us. Now, we’re able to handcraft the .debug_info section without caring about the length field.


You’ve probably noticed that we still have to calculate the AbbrOffset field manually and it makes handcrafting the .debug_info section a nightmare. In the next coding period, we’re going to address this issue and make yaml2obj able to interlink some DWARF sections. If time permits, we’d also like to add DWARF support to obj2yaml.

Areas in Need of Improvements#

In the second coding period, I’m not good at splitting a huge change into several pieces of small patches which brings inconvenience to reviewers. I will try to avoid it in the future. Just as what James has pointed out, I should communicate more with others. When I was implementing these DWARF sections, I should learn about people’s requirements and ask others opinions rather than do it myself and implement what I have in my own mind. I haven’t realized it until I work on the .debug_loclists section. Pavel Labath gives me some good advice and comments that I haven’t thought of before!

Accepted Patches#

D84496 [DWARFYAML] Replace 'Format', 'Version', etc with 'FormParams'. NFC.

D84383 [DWARFYAML] Pull out common helper functions for rnglist and loclist tables. NFC.

D84008 [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

D84239 [DWARFYAML] Refactor range list table to hold more data structure.

D83624 [DWARFYAML] Implement the .debug_rnglists section.

D83853 [DWARFYAML] Implement the .debug_str_offsets section.

D83749 [DWARFYAML] Add support for emitting value forms of strx, addrx, etc.

D83452 [DWARFYAML] Use override instead of virtual for better safety.

D83220 [DWARFYAML][unittest] Refactor parseDWARFYAML().

Ongoing Patches#

D84386 [DWARFYAML] Add support for emitting custom operands for range list entry.

D84234 [DWARFYAML] Implement the .debug_loclists section.

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.