[fpc-devel] Record types with unbounded trailing data

Martin Frb lazarus at mfriebe.de
Mon Jun 24 11:31:26 CEST 2019


On 24/06/2019 11:28, Michael Van Canneyt wrote:
>
>
> On Mon, 24 Jun 2019, Martin Frb wrote:
>
>> On 24/06/2019 06:41, Michael Van Canneyt wrote:
>>>
>>> If you want to get rid of warnings, define it as
>>> LOGPALETTE = record
>>>    palVersion : WORD;
>>>    palNumEntries : WORD;
>>>    palPalEntry : array[0..(MAXINT div sizeof(PALETTEENTRY)] of 
>>> PALETTEENTRY;
>>> end;
>>
>> Which of course can prevent debugging to work.
>>
>> Older gdb will crash (out of mem).
>> Newer ones have a mem limit, and will simply give an error.
>>
>> Gdb even has issues to get individual fields of such large structures.
>
> In the other case [0..0] it will presumably refuse to show more than 1 
> entry ?
>
> As I said, it is a dummy structure, so expecting it to work without 
> tricks is IMO futile. And that apparently extends to debugging as well...

It will show one by default, but gdb does not range-check. So one can 
show each individual entry.


More information about the fpc-devel mailing list