delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/06/17/05:16:43

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "AndreA <andrea.galbusera"<Ihatespammers AT delorie DOT com>@teamware.it
Subject: DJGPP linux cross-compiler + GDB problem
Newsgroups: comp.os.msdos.djgpp
Lines: 64
Organization: TW
User-Agent: KNode/0.7.2
MIME-Version: 1.0
Message-ID: <A5dAc.342543$hc5.14767707@news3.tin.it>
Date: Thu, 17 Jun 2004 09:01:20 GMT
NNTP-Posting-Host: 80.183.241.188
X-Complaints-To: newsmaster AT tin DOT it
X-Trace: news3.tin.it 1087462880 80.183.241.188 (Thu, 17 Jun 2004 11:01:20 MET DST)
NNTP-Posting-Date: Thu, 17 Jun 2004 11:01:20 MET DST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all,

I have a problem debugging a DJGPP project with GDB. This seems to be
related to differences between native and Linux cross toolchain. If I
cross-build I get this error when loading the executable in GDB, while
everything runs fine if I use the native toolchain. The code is about 1Mb

> (gdb) file snmpd.exe
> Reading symbols from snmpd.exe...Dwarf Error: bad offset (0x69cb0 in
compilation unit header (offset 0x0 + 6)

It seems that gdb expect .debug_* sections VMA and LMA addresses to be both
0 to load the executable. ld on Windows seems to set them to 0 while ld on
linux sets them to different values making GDB complain.

I tryed to solve with a .ld script like the following:

> SECTIONS
> {
> /* DWARF 1 */
> .debug 0 : { *(.debug) }
> .line 0 : { *(.line) }
> /* GNU DWARF 1 extensions */
> .debug_srcinfo 0 : { *(.debug_srcinfo) }
> .debug_sfnames 0 : { *(.debug_sfnames) }
> /* DWARF 1.1 and DWARF 2 */
> .debug_aranges 0 : { *(.debug_aranges) }
> .debug_pubnames 0 : { *(.debug_pubnames) }
> /* DWARF 2 */
> .debug_info 0 : { *(.debug_info) }
> .debug_abbrev 0 : { *(.debug_abbrev) }
> .debug_line 0 : { *(.debug_line) }
> .debug_frame 0 : { *(.debug_frame) }
> .debug_str 0 : { *(.debug_str) }
> .debug_loc 0 : { *(.debug_loc) }
> .debug_macinfo 0 : { *(.debug_macinfo) }
> /* SGI/MIPS DWARF 2 extensions */
> .debug_weaknames 0 : { *(.debug_weaknames) }
> .debug_funcnames 0 : { *(.debug_funcnames) }
> .debug_typenames 0 : { *(.debug_typenames) }
> .debug_varnames 0 : { *(.debug_varnames) }
> }

It appear to work, but I donĀ“t know why there is such a difference between
the environments and if I have to worry about it with respect to debug
features.

Follow details on toolchains versions used.

- On the cross-devel platform I use:
gcc 3.4
binutils 2.15

- On the Windows XP environment (MSDOS Prompt)
gcc 3.3.4
binutils 2.15
gdb 5.3

Has anybody out there an answer to this? I did not find docs on this topic
online.

T.I.A
Andrea

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019