Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2013-01

dwarf for "array [ 0..191] of "

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

Since I don't know the fpc cdoebase, I can not check this myself.

I suspect it is a gdb issue. But if it is not to much work, maybe someone who does know fpc dwarf generation can check that it is not fpc?

I got the following source:
     type  TFoo = array [0..191] of integer;

and in gdb
ptype TFoo

Using dwarf, up to gdb 7.2 (inclusive) the result is ok.

but 7.3 up reports
array [0..-65] of LONGINT

SO definitely something changed in GDB.
But I do not know if the old or new gdb is right.

---------
So my guess is fpc declares the index as byte sized type.

If someone can confirm this, and that fpc declares it as unsigned in the dwarf info, then it is a gdb issue.

Thanks

Reply by email

Sven Barth
to Martin
Martin wrote 24 lines
Since I don't know the fpc cdoebase, I can not check this myself. I suspect it is a gdb issue. But if it is not to much work, maybe someone who does know fpc dwarf generation can check that it is not fpc? I got the following source: type TFoo = array [0..191] of integer; and in gdb ptype TFoo Using dwarf, up to gdb 7.2 (inclusive) the result is ok. but 7.3 up reports array [0..-65] of LONGINT SO definitely something changed in GDB. But I do not know if the old or new gdb is right. --------- So my guess is fpc declares the index as byte sized type. If someone can confirm this, and that fpc declares it as unsigned in the dwarf info, then it is a gdb issue.

I don't know the dwarf format good enough, but the generation of debug information is (mostly?) located in the compiler/dbg*.pas files. Namely for dwarf you should and there at the class
TDebugInfoDwarf of which probably the method appenddef_array is of interest for you.

Regards,
Sven

Reply by email

Martin
to Sven Barth
Sven Barth wrote 16 lines
On 19.01.2013 15:17, Martin wrote: > I got the following source: > type TFoo = array [0..191] of integer; > > and in gdb > ptype TFoo > > Using dwarf, up to gdb 7.2 (inclusive) the result is ok. > > but 7.3 up reports > array [0..-65] of LONGINT I don't know the dwarf format good enough, but the generation of debug information is (mostly?) located in the compiler/dbg*.pas files. Namely for dwarf you should and there at the class TDebugInfoDwarf of which probably the method appenddef_array is of interest for you.

Well unfortunately neither do I know the dwarf format internals. So even if I found which node it writes, I would not necessarily know it's meaning. Well I could look at the naming/comments in fpc, but since they are part of what I want to be verified, it would be no use to rely on them...

Reply by email

Jonas Maebe
to Martin: Since I don't know the fpc cdoebase, I can not check this myself. I suspect it is a gdb…
Martin wrote 17 lines
Since I don't know the fpc cdoebase, I can not check this myself. I suspect it is a gdb issue. But if it is not to much work, maybe someone who does know fpc dwarf generation can check that it is not fpc? I got the following source: type TFoo = array [0..191] of integer; and in gdb ptype TFoo Using dwarf, up to gdb 7.2 (inclusive) the result is ok. but 7.3 up reports array [0..-65] of LONGINT SO definitely something changed in GDB. But I do not know if the old or new gdb is right.

It looks like a gdb issue (from dwarfdump; readelf -g can show similar information):

0x00000076: TAG_array_type [4] *
AT_name( "TFOO" )
AT_byte_size( 0x00000180 )
AT_type( {0x00000091} ( SMALLINT ) )

0x00000082: TAG_subrange_type [5]
AT_lower_bound( 0x0000000000000000 )
AT_upper_bound( 0x00000000000000bf )
AT_byte_stride( 0x00000002 )
AT_type( {0x000000b0} ( BYTE ) )

0x0000008b: NULL

...
AT_name( "BYTE" )
AT_type( {0x000000ba} ( BYTE ) )

0x000000ba: TAG_base_type [7]
AT_name( "BYTE" )
AT_encoding( DW_ATE_unsigned )
AT_byte_size( 0x01 )

I.e., FPC declares the range of the array as BYTE, and BYTE is declared as an unsigned base type of 1 byte large.

Jonas

Reply by email