[fpc-devel] [Dwarf AVR] DIE refers to abbreviation number which does not exist

Dimitrios Chr. Ioannidis d.ioannidis at nephelae.eu
Thu Feb 4 00:28:59 CET 2021


Hi,

  in Windows which cross tools / toolchain for avr should I use ? FPC's 
avr-embedded-xxxx ( from 
https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32 ) or 
Microchip's AVR Toolchain for Windows ( 
https://www.microchip.com/en-us/development-tools-tools-and-software/gcc-compilers-avr-and-arm 
) ?

AFAIK, the fpc's supplied avr cross ld, objdump, objcopy, etc version is 
"GNU ld (GNU Binutils) 2.30" and Microchip's version is 
"(AVR_8_bit_GNU_Toolchain_3.6.2_1778) 2.26.20160125" .


  I'm asking because with FPC's avr-embedded-xxxx cross tools, I get the 
following warning ( error ? ) but with Microchip's cross tools, the 
warning ( error ? ) is gone.

( test program at the end )

"avr-embedded-objdump.exe: Warning: DIE at offset 0x119f refers to 
abbreviation number 17 which does not exist"

and the output of avr-embedded-objdump.exe --dwarf 
dwarf_DIE_ABBREV_Bug.elf is :

-------------------------------------------------------------

< a lot more before >

  <1><1025>: Abbrev Number: 7 (DW_TAG_base_type)
     <1026>   DW_AT_name        : WORD
     <102b>   DW_AT_encoding    : 7    (unsigned)
     <102c>   DW_AT_byte_size   : 2
  <1><102d>: Abbrev Number: 8 (DW_TAG_reference_type)
     <102e>   DW_AT_type        : <0x101b>
  <1><1032>: Abbrev Number: 0
   Compilation Unit @ offset 0x1033:
    Length:        0x1e4 (32-bit)
    Version:       2
    Abbrev Offset: 0x0
    Pointer Size:  4
  <0><103e>: Abbrev Number: 1 (DW_TAG_compile_unit)
     <103f>   DW_AT_name        : dwarf_DIE_ABBREV_Bug_used_unit.pas
     <1062>   DW_AT_producer    : Free Pascal 3.3.1 2021/02/03
     <107f>   DW_AT_comp_dir    : 
G:/Programming/dimitris/Projects/fpc_avr_dwarf_bug/
     <10b3>   DW_AT_language    : 9    (ANSI Pascal)
     <10b4>   DW_AT_identifier_case: 3  (case_insensitive)
     <10b5>   DW_AT_stmt_list   : 0x0
     <10b9>   DW_AT_low_pc      : 0x0
     <10bd>   DW_AT_high_pc     : 0x0
  <1><10c1>: Abbrev Number: 2 (DW_TAG_variable)
     <10c2>   DW_AT_name        : TMPARRAY
     <10cb>   DW_AT_location    : 207 byte block: 10 0 0 3 54 4d 50 41 
52 52 41 59 0 4 2 e4 11 0 0 4 0 1 fb 11 0 0 0 5 c1 10 0 0 2 72 74 74 69 
64 65 66 24 52 54 54 49 5f 24 44 57 41 52 46 5f 44 49 45 5f 41 42 42 52 
45 56 5f 42 55 47 5f 55 53 45 44 5f 55 4e 49 54 5f 24 24 5f 54 4d 50 41 
52 52 41 59 0 2a 11 0 0 6 24 52 54 54 49 44 45 46 24 52 54 54 49 5f 24 
44 57 41 52 46 5f 44 49 45 5f 41 42 42 52 45 56 5f 42 55 47 5f 55 53 45 
44 5f 55 4e 49 54 5f 24 24 5f 54 4d 50 41 52 52 41 59 0 15 0 5 ec 10 0 0 
2 72 74 74 69 5f 6e 6f 72 6d 61 6c 5f 61 72 72 61 79 24 31 0 85 11 0 0 6 
24 52 54 54 49 5f 4e 4f 52 4d 41 4c 5f 41 52 52 41 59 24 31 0    
  (DW_OP_constu: 0; (Unknown location op 0x0))
     <119b>   DW_AT_type        : <0x6c05000b>
  <1><119f>: Abbrev Number: 17
Contents of the .debug_abbrev section:

   Number TAG (0x0)
    1      DW_TAG_compile_unit    [has children]
     DW_AT_name         DW_FORM_string
     DW_AT_producer     DW_FORM_string

< a lot more after >

-------------------------------------------------------------


==========CODE=========

program dwarf_DIE_ABBREV_Bug;

uses
   dwarf_DIE_ABBREV_Bug_used_unit;

var
   aArray: tmpArray;

begin
end.

==========CODE=========

==========CODE=========

unit dwarf_DIE_ABBREV_Bug_used_unit;

interface

type
   tmpArray = array[0..1] of word;

implementation

end.

==========CODE=========


Compiled with : ppcrossavr.exe -MObjFPC -Tembedded -Pavr -CpAVR5 
-WpATMEGA328p -Xm -gw2 -O1 dwarf_DIE_ABBREV_Bug.pas

I'm using fpc trunk on Windows 10 :

"Free Pascal Compiler version 3.3.1

Compiler date      : 2021/02/03
Compiler CPU target: avr"


regards,

-- 

Dimitrios Chr. Ioannidis



More information about the fpc-devel mailing list