Re: [fpc-devel] DW_AT_external and other additions to FPC generated dwarf

2023-03-28 Thread Sven Barth via fpc-devel
Martin Frb via fpc-devel  schrieb am So.,
26. März 2023, 16:50:

> It also would fall short, if ever Fpc did what Delphi did:
> {$ZEROBASEDSTRINGS }
> Though, maybe that is a "wont ever happen".
>

FPC supports that directive since at least 3.2.0 (though apparently it was
forgotten to be documented in the New Features page).

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] DW_AT_external and other additions to FPC generated dwarf

2023-03-28 Thread Martin Frb via fpc-devel

On 26/03/2023 16:50, Martin Frb via fpc-devel wrote:

On 26/03/2023 15:50, Florian Klämpfl via fpc-devel wrote:
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 :)


 It still needs to be added to fpdebug, but that will be easy.


Whether it will be used or not...
I added a basic version to FpDebug. Without DWARF-5, since I haven't 
even got test data for the basic DWARF 3/4 implementation.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] DW_AT_external and other additions to FPC generated dwarf

2023-03-26 Thread Martin Frb via fpc-devel

On 26/03/2023 15:50, Florian Klämpfl via fpc-devel wrote:

Am 23.03.23 um 09:45 schrieb Martin Frb via fpc-devel:

It's a little hard to comment all at once, but at least I start with 
one :)



4) "official" marker for string vs pchar vs array



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 :)


That would work.
But it can't distinguish between strings of char or widechar.  I.e. it 
can only be used for short and long-string(ansi). But not WideString or 
UnicodeString.
Only DWARF 5 introduces a "DW_AT_type" for DW_TAG_string_type that can 
then define the base type for each char.

Ignoring gdb, fpc could add that for lower dwarf versions too.


It also would fall short, if ever Fpc did what Delphi did: 
{$ZEROBASEDSTRINGS }

Though, maybe that is a "wont ever happen".


 It still needs to be added to fpdebug, but that will be easy.
It is present in gdb sources, but I have no idea how well it will then work.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] DW_AT_external and other additions to FPC generated dwarf

2023-03-26 Thread Florian Klämpfl via fpc-devel

Am 23.03.23 um 09:45 schrieb Martin Frb via fpc-devel:

It's a little hard to comment all at once, but at least I start with one :)


4) "official" marker for string vs pchar vs array

Not sure if that is reported already. Depending on dwarf version 
"string" (ansistring) is a pointer (either TAG pointer/reference or 
location expression) to

- char  (dwarf 2)
- array of char (dwarf 3)

Currently for dwarf 2, the debugger can't tell the difference. If the 
user says:  foo[1]
The debugger does not know, if the first or second char is meant (0 or 1 
based index)


With dwarf 3 the difference would be in the display format "('a', 'b', 
'c') vs 'abc'.
But currently the debugger (fpdebug) can tell the difference, because 
fpc has a tiny difference in how it encodes the "stride".

That is obviously an implementation detail, and not very future proof.

Therefore an "official" marker would be nice.
- it appears there is none in dwarf
- it could be a custom addition to dwarf
- documenting an "implementation detail" (such as the stride), so 
fpdebug can safely rely on it.


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 :)


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel