Draft: Introduce DW_TAG_string_type for dwarf-4
Following the advice from https://lists.freepascal.org/pipermail/fpc-devel/2023-March/045100.html by Florian
What about using DW_TAG_string_type for this? IIRC, when I implemented dwarf, it was not available/not supported, but fpdebug can do they. I am not sure about the status of GDB about it though :)
Maybe there should be a switch added to enable it -godwarfstring
/ -godwarfpdebug
? Or maybe it is enough that it is disabled with -godwarfcpp
?
- FpDebug (Lazarus 3.99) handles it
- gdb 14.1-3.fc38 handles it ... sort of
-
x/s MyVar
prints the string fine for ansi and short. For widestring only the first char -
p MyVar
-data-evaluate-expression MyVar
it prints the chars as numbers{56, 54, 56, 54, 97}
instead of'8686a'
(for widestring it only prints half the chars) -
x MyVar
also prints the ordinal values of each char, but as0x36383638
and only the first 4 chars
-
- lldb 16.0.6 (Fedore 38) does not handle it (it recognizes the tag, but give an error
- for ansistring
Couldn't materialize: couldn't get the value of variable s: Unable to determine byte size.
- for shortstring
unhandled type tag DW_TAG_string_type (DW_TAG_string_type),
- No idea why the difference. Maybe
- for ansistring
So basically, not fully working with other debuggers.
The implementation is for DWARF-4 only.
Non-widestrings would work for DWARF-3 too. If widestrings would work depends on https://lists.dwarfstd.org/pipermail/dwarf-discuss/2024-May/002444.html
If the length is in byte, then the use of DW_OP_stack_value
can be dropped, and it works in DWARF-3 as well.
Marking this as a draft
- awaiting comment on
-godwarfstring
/-godwarfpdebug
? - outcome of https://lists.dwarfstd.org/pipermail/dwarf-discuss/2024-May/002444.html