Sign in Join

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

Mailing lists / fpc-devel / 2020-05

AVR DWARF Error

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Dimitrios Chr. Ioannidis

Hi,

  trying to debug an avr program, I got this error with fpc trunk  :

"Reading symbols from
<PATH>\Projects\unit_depth_dwarf\unit_depth_dwarf.elf... Dwarf Error: Could not find abbrev number 18 in CU at offset 0x111d [in module
G:\Programming\dimitris\Projects\unit_depth_dwarf\unit_depth_dwarf.elf] (No debugging symbols found in
<PATH>\Projects\unit_depth_dwarf\unit_depth_dwarf.elf)"

Investigating further, I found that when I declare an array type ( only ? I need to check further ... ) in a unit that is referenced from another unit which in turn is referenced from the main program, I get the error, i.e. :

depth_2.pas unit -> has a type declared as an array

depth_1.pas unit -> uses depth_2 unit and declares a variable with the type from the unit depth_2

main.pas -> uses depth_1 only

in such scenario I get the dwarf error .

FYI, readelf output show the same :

"avr-readelf.exe -w unit_depth_dwarf.elf > unit_depth_dwarf.dwf

readelf: Warning: DIE at offset 0x11de refers to abbreviation number 18 which does not exist
readelf: Warning: DIE at offset 0x11de refers to abbreviation number 18 which does not exist"

The attached example I compiled it using :

fpc.exe  -g -gw2 -a -al -Xe -Xm -Sm -Tembedded -Pavr -CpAVR5
-WpATMEGA328P -dF_CPU:=16000000 unit_depth_dwarf.pas

PS: I attached also the dwarf output from avr-readelf .

PS2: Even with an empty project and debugging enabled I get warnings from readelf :

"readelf: Warning: Invalid CIE pointer 0x009e0000 in FDE at 0x000014 readelf: Warning: Invalid CIE pointer 0x00bc0024 in FDE at 0x0013ac readelf: Warning: Invalid CIE pointer 0x00c20024 in FDE at 0x0013b8 readelf: Warning: Invalid CIE pointer 0x00d01f10 in FDE at 0x001f24 readelf: Warning: Invalid CIE pointer 0x00d41f10 in FDE at 0x001f30 readelf: Warning: Invalid CIE pointer 0x00d61f48 in FDE at 0x001f5c readelf: Warning: Encoded value extends past end of section"

regards

Dimitrios Chr. Ioannidis

Reply by email

Christo Crause
to Dimitrios Chr. Ioannidis

On Sun, May 17, 2020 at 10:46 PM Dimitrios Chr. Ioannidis via fpc-devel <

Show quoted text 28 lines
wrote: Hi, trying to debug an avr program, I got this error with fpc trunk : "Reading symbols from <PATH>\Projects\unit_depth_dwarf\unit_depth_dwarf.elf... Dwarf Error: Could not find abbrev number 18 in CU at offset 0x111d [in module G:\Programming\dimitris\Projects\unit_depth_dwarf\unit_depth_dwarf.elf] (No debugging symbols found in <PATH>\Projects\unit_depth_dwarf\unit_depth_dwarf.elf)" Investigating further, I found that when I declare an array type ( only ? I need to check further ... ) in a unit that is referenced from another unit which in turn is referenced from the main program, I get the error, i.e. : depth_2.pas unit -> has a type declared as an array depth_1.pas unit -> uses depth_2 unit and declares a variable with the type from the unit depth_2 main.pas -> uses depth_1 only in such scenario I get the dwarf error .

Looking at the compiler generated assembler (-a) the information is emitted, but doesn't end up in the final elf. This raises the suspicion that it is the linker that is dropping the whole of the 2nd unit's debug information If you add a procedure to unit2 that gets referenced anywhere else the information is retained in the elf.

Reply by email

Christo Crause
to Christo Crause
AM Christo Crause wrote 37 lines
On Sun, May 17, 2020 at 10:46 PM Dimitrios Chr. Ioannidis via fpc-devel < > wrote: > Hi, > > trying to debug an avr program, I got this error with fpc trunk : > > "Reading symbols from > <PATH>\Projects\unit_depth_dwarf\unit_depth_dwarf.elf... > Dwarf Error: Could not find abbrev number 18 in CU at offset 0x111d [in > module > G:\Programming\dimitris\Projects\unit_depth_dwarf\unit_depth_dwarf.elf] > (No debugging symbols found in > <PATH>\Projects\unit_depth_dwarf\unit_depth_dwarf.elf)" > > Investigating further, I found that when I declare an array type ( only > ? I need to check further ... ) in a unit that is referenced from > another unit which in turn is referenced from the main program, I get > the error, i.e. : > > depth_2.pas unit -> has a type declared as an array > > depth_1.pas unit -> uses depth_2 unit and declares a variable with the > type from the unit depth_2 > > main.pas -> uses depth_1 only > > in such scenario I get the dwarf error . > Looking at the compiler generated assembler (-a) the information is emitted, but doesn't end up in the final elf. This raises the suspicion that it is the linker that is dropping the whole of the 2nd unit's debug information If you add a procedure to unit2 that gets referenced anywhere else the information is retained in the elf.

A check of the dwarf info in unit_depth_dwarf_depth_2.o (avr-objdump -Wi unit_depth_dwarf_depth_2.o) shows that the dwarf info is there, it is just not linked into the final executable. Hence it is a linker problem in my opinion.

Reply by email