Op 13-10-2019 om 00:22 schreef Martin:
I have a few wishes with regards to:
https://bugs.freepascal.org/view.php?id=36144
1)
FpDebug detects fpc as dwarf provider, and checks the fpc version. Based
on this it can interpret the misplaced tags, and work around the issue.
I have now configured 3.3.0 as the cut-off for the workaround (since fpc
now puts the tags in the correct location).
Should this patch get merged to 3.2 then please alert me of this. So I
can adjust the check in FpDebug.
About the patch: I made the original change within the period that I
tried to get multiple-dimensional arrays to be displayed correctly in
gdb. Especially arrays of ansistrings. In the end this worked, does this
still work?
We need some kind of debug-tests. I know you have some, and that there
are huge differences between gdb versions, but still...
2)
"I shot myself in the foot"
Having reported this issue, and it no being fixed, I realized that I
(ab)used the presence of this issue.
- ShortString are encoded exactly as
record len: int; st: array of char; end;
- And in dwarf 3, ansistring are encoded as array.
With the only difference that they always had the stride in the array,
and not in the range.
FpDebug used the knowledge of this implementation detail (in the hope
that it would not change) to detect the diff between a user defined
record (with the exact same fieldnames), and an actual shortstring.
That no longer works....
Well. If someone creates a record called 'ShortString', (s)he should not
be surprised that the debugger thinks that it is actually a shortstring?
I do not see the issue here. The compiler generates debug-information
that makes it possible for any debugger to show the data correctly. For
shortstrings it repors a structure with a length and the actual
characters. This is what a shortstring is.
That some debuggers, specially made for fpc (like fpdebug, but in some
regard this holds for gdb too) show a more convenient format, is nice.
But I think this is not relevant for the compiler.
So I need a new difference, please.
Adding an artificial difference (some sort of implementation-detail) on
which some debuggers depend, does not seem to be a good idea, imho.
Ideally using DW_TAG_string_type (available since dwarf 2).
I have currently no idea what gdb will do with that.
For FpDebug I will have to implement it, but that is no problem.
DW_TAG_string_type is deliberately not used, as it describes a
string-type that fpc does not use.
If that is not an option, can we go for a simpler (implementation detail
(yes again)) workaround (that then goes into trunk, and/or if the
original fix is merged, can be merged too):
- The stride is optional. If absent it is equal to the element size
(shortstring = char = byte)
- Arrays always have a stride
- Drop it from the strings array
And I can then detect that.
If the stride is optional, the compiler should always omit it when not
necessary, to decrease the executable (debuginfo) size. What you ask is
to add a bug deliberately, which you can use to detect whether something
is a string or not.
Regards,
Joost.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel