[fpc-devel] I could use some help on gdb problems with pic32 (missing debuginfo)
Michael Ring
mail at michael-ring.org
Sat Jun 22 22:02:31 CEST 2013
Hi!
I have spent a while trying to figure out what I am doing wrong but I do
not have clue. I can compile a binary for pic32 just fine
but when I load it into gdb I get an error: Dwarf Error: bad length
(0x6f590000) in compilation unit header (offset 0x7e + 0)
when I look at the file with readelf then I can see that there are
symbols in the file.
what is strange is that nm does show wrong addresses (but this seems to
be a known issue for mips, the 32bit addresses somehow get incorrectly
converted to 64 bits (i tried -msym32 for as, this did not help). I
needed to apply a patch for ihex.c in binutils-2.23.2, without this I
could not create .hex files because of this problem. I also compiled
binutils from ChipKit pic32, there the fix seems to be included, the
addresses are wrong there, too.
I also tried binutils from xc32 compiler, they show the addresses
correctly but the linker seems to be somewhat incompatible, i get the
following error:
/Applications/microchip/xc32/v1.21/bin/xc32-ld -g -EL --gc-sections -L.
-o hello.elf -T link.res
xc32-ld: Link Error: invalid attributes for section
'.text.b_DEBUGSTART_$P$HELLO'
So right now I am a little out of ideas on how to continue. Florian has
created a subversion account for me so I can check in the whole
pic32code in case somebody has some spare time to help me, I wanted to
do this the moment I can debug a program on a pic, seems I have to do
this a little earlier.....
Here's a link to the created binary, in case this helps:
http://temp.michael-ring.org/hello.elf
Michael
--- here are some outputs for your reference
ppcrossmipsel -MObjFPC -Scghi -Ch1024 -Cs1024 -Tembedded -Pmipsel -gw2
-vewnhix -l -Cpmips32r2 -WpPIC32MX220F032C -XPpic32mx-elf32
-FD/usr/local/bin -a -godwarfsets -godwarfmethodclassprefix hello.pas
***** /usr/local/bin/pic32mx-elf32-as -mabi=eabi -march=mips32r2
-mtune=mips32r2 -W -EL -msym32 -o hello.o hello.s
***** /usr/local/bin/pic32mx-elf32-ld -g -EL --gc-sections -L. -o
hello.elf -T link.res
mips-sde-elf-gdb hello.elf
Reading symbols from /Users/ring/devel/hello/hello.elf...Dwarf Error:
bad length (0x6f590000) in compilation unit header (offset 0x7e + 0) [in
module /Users/ring/devel/hello/hello.elf]
(no debugging symbols found)...done.
Section Headers:
[Nr] Name Type Addr Off Size ES Flg
Lk Inf Al
[ 0] NULL 00000000 000000 000000 00
0 0 0
[ 1] .reset PROGBITS bfc00000 030000 000118 00 AX
0 0 4
[ 2] .bev_excpt PROGBITS bfc00380 030380 000010 00 AX
0 0 4
[ 3] .text PROGBITS 9d000000 010000 000970 00 AX
0 0 4
[ 4] .data PROGBITS a0000000 020000 000064 00 WA
0 0 4
[ 5] .got PROGBITS a0000070 020070 0000b4 04 WAp
0 0 16
[ 6] .bss NOBITS a0000124 020124 00000a 00 WA
0 0 4
[ 7] .reginfo MIPS_REGINFO 00000000 030390 000018 18
0 0 4
[ 8] .debug_line MIPS_DWARF 00000000 0303a8 0119c4 00
0 0 4
[ 9] .debug_abbrev MIPS_DWARF 00000000 041d6c 0003a7 00
0 0 1
[10] .debug_info MIPS_DWARF 00000000 042114 047ee4 00
0 0 4
[11] .shstrtab STRTAB 00000000 089ff8 000072 00
0 0 1
[12] .symtab SYMTAB 00000000 08a29c 018100 10
13 5206 4
[13] .strtab STRTAB 00000000 0a239c 0268f4 00
0 0 1
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x010000 0x9d000000 0x9d000000 0x00970 0x00970 R E 0x10000
LOAD 0x020000 0xa0000000 0x9d000970 0x00064 0x00064 RW 0x10000
LOAD 0x020070 0xa0000070 0x9d0009d4 0x000b4 0x000b4 RW 0x10000
LOAD 0x020124 0xa0000124 0xa0000124 0x00000 0x0000a RW 0x10000
LOAD 0x030000 0xbfc00000 0xbfc00000 0x00390 0x00390 R E 0x10000
Section to Segment mapping:
Segment Sections...
00 .text
01 .data
02 .got
03 .bss
04 .reset .bev_excpt
There is no dynamic section in this file.
There are no relocations in this file.
There are no unwind sections in this file.
Symbol table '.symtab' contains 6160 entries:
pic32mx-elf32-nm -n hello.elf
...
ffffffffbfc00000 A _RESET_ADDR
ffffffffbfc00000 T _reset
ffffffffbfc00010 T _startup
mips-sde-elf-objdump -x hello.o
7 .text.b_DEBUGSTART_$P$HELLO 00000000 00000000 00000000 000000e8 2**0
CONTENTS, ALLOC, LOAD, CODE
8 .text.n_main 0000003c 00000000 00000000 000000e8 2**2
CONTENTS, ALLOC, LOAD, RELOC, CODE
More information about the fpc-devel
mailing list