[fpc-devel] Bug: Alignment issue with dwarf debug_info on mipsel(-embedded)?? code

Michael Ring mail at michael-ring.org
Fri Jul 5 22:23:30 CEST 2013

I have now found out why debug symbols get discarded by 
pic32mx-elf32-gdb. The problem is a bug  in the generation of 
dwarf-debuginfo. My guess is that the problem should also exist in linux 

For mips unaligned data in dward debug info needs to be defined as 
.4byte and .2byte instead of .long and .short.

This is implemented in most places but it seems not everywhere.

When I compile this program:

program hello;
   i : integer;

the symbol I has one entry with .long, the resulting binary does not 
load in gdb with the error-message: Dwarf Error: wrong version in 
compilation unit header (is 10752, should be 2, 3, or 4)

# Syms - Begin Staticsymtable
# Symbol SYSTEM
# Symbol OBJPAS
# Symbol HELLO
# Symbol main
# Symbol I
         .uleb128        2
         .ascii  "I\000"
         .byte   5
         .byte   3
         .long   U_$P$HELLO_$$_I
         .4byte  _$HELLO$_Ld1
# Syms - End Staticsymtable

when I replace the '.long' with '.4byte' and recompile then the 
resulting hello.elf loads fine into gdb. I could see before with readelf 
that the dwarf info was misaligned compared to the dwarf imfo when I 
compile the same code for arm-embedded

Can anybody help with a fix?


More information about the fpc-devel mailing list