c[ode]clap»Forums
Kaylee
2 posts
DWARF 5 support?
Edited by Kaylee on Reason: Initial post
Does c[ode]clap support DWARF 5? And if so, does it support the thing DWARF 5 has of allowing types to have sizes specified in bits? I'm writing a compiler for a language I'm developing which has (among other things) a focus on really good support for bit fields, and a debugger with support for that would be really useful, though I'd very much understand if it's not planned since I'm not sure if anyone else actually uses that feature.
spx
148 posts / 1 project
DWARF 5 support?
I assume you are talking about DW_AT_bit_size or is there anything that was specifically introduced in DWARF 5?

Good point, at the moment codeclap does not read DW_AT_bit_size which is likely just an oversight on my end and I don't see any reason to not put this into the next update. GCC uses this and I assume clang does so as well.
Do you have anything special in mind a debugger could do regarding the use of bit fields (besides correctly handle their size and location).

I am also happy to implement anything else that might be new and of benefit in DWARF 5, as long as there is some compiler that actually uses it. The DWARF specification is quite huge which is why I focus on parts that are actually in use somewhere.

(for reference: https://issues.codeclap.cc/view.php?id=318)
Kaylee
2 posts
DWARF 5 support?
I'd been thinking specifically of the ability to apply DW_AT_bit_size to provide bit sizes for types in general, rather than just for struct members. Which now that I've checked, is apparently in DWARF 4 too, I'm not sure why I'd thought it was new. I've not personally seen it used in the purely bit sized type form in the wild (though from what I can tell some Pascal compilers use it), but ICC does at least use the combined DW_AT_byte_size and DW_AT_bit_size form for specifying long doubles (though that's not really the same thing; the combined form specifies a type whose storage size is an integer number of bytes but whose value is a subset of the bits, rather than whose storage size is measured in bits).

While I don't need it myself if DW_AT_bit_size on types is supported, on the subject of bit field support it's probably worth mentioning that gcc uses DW_AT_bit_stride for packed arrays in Ada and Fortran.

(Also I'm not sure from your response whether you are aware, but DWARF 5 introduces a few backwards-incompatible changes, notably including some header layout changes, so there's some support needed for reading DWARF 5 even if no new features are used).
spx
148 posts / 1 project
DWARF 5 support?
Edited by spx on
klkblake
(Also I'm not sure from your response whether you are aware, but DWARF 5 introduces a few backwards-incompatible changes, notably including some header layout changes, so there's some support needed for reading DWARF 5 even if no new features are used).


In fact I wasn't aware of that yet since both gcc and clang output DWARf 4 by default. I will look into having at least minimal compatibility with DWARF 5, as output by gcc and clang, with version 1.0.

Also if you happen to publish your compiler at some point, or some binary/debug files created using the compiler, I am very much happy to add support for anything it outputs within the DWARF specification and that may be missing in codeclap at that point.
Mārtiņš Možeiko
2559 posts / 2 projects
DWARF 5 support?
On arbitrary bitsize ints: http://blog.llvm.org/2020/04/the-...lang-extint-feature-provides.html