This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with "bad offset in compilation unit header" with gdb


Hi,

I have been using gcc 2.95 for the 68332 (from David Fiddes website, long
ago) for some time now, debugging using a PE Micro bdm cable with gdb 5.0,
running under cygwin.  I've begun looking at a newer version of gcc, and
found pre-built binaries at http://www.davehylands.com/avi/index.htm .  I've
built cross-gcc before for a number of different processors (68k, msp430,
avr), but it is always easier to get pre-built binaries!

I have a short program that I can compile fine under gcc 2.95, and debugging
works great under either my old gdb 5.0, or using the newly installed gdb
5.3.  In compilation I have the "-g" flag for default debugging information,
and there are extra sections called ".stab", ".stabstr" and ".comment" which
each have a
".stab 0 (NOLOAD) : { *(.stab) } " entry in the linker file.  These sections
seem to contain all the debugging information, and these linker entries
ensure that the debugging information is available to the debugger (in the
elf file), but don't get downloaded to the target.

When I compile and link under the new gcc 3.3.1, there is, in addition to
the ".stab", ".stabstr" and ".comment" sections, a whole lot of
".debug_abbrev", ".debug_info" sections, other ".debug_" sections, and then
a bunch of ".gnu.linkonce.wi." sections (one for each header file, by the
looks of it).  If these are left in, they make my image far bigger than it
should be, which is obviously a big pain during download and cause trouble
with larger programs.  When I try to start the debugger (either version), I
get a comment such as "Error: bad offset (0x9460) in compilation unit header
(offset 0x0 + 6)" and no debugging symbols (although I can still download
and run the code, which works fine).  The address given here is the address
of the start of the ".debug_abbrev" section, acording to the map file.  If I
use the (NOLOAD) trick to remove the debugging information from the download
image, then gdb simply says "(no debugging symbols found)", and again I can
download and run the program.  However, it seems to have some symbolic
information - if I stop the program, I get a message such as "Program
received signal SIGTSTP, Stopped (user).  0x00003c2c in silentWaitKey()",
while on the link *with* the debugging sections, the message is just
"...0x00003c2c in ??".  However, on both versions a command such as "list
silentWaitKey" gives "No symbol table is loaded.  Use the "file" command.".

Has there been major changes to the way debugging information is handled
between these versions?  I have tried all sorts of variations of debugging
flags and linker commands, but I am none the wiser.  Any help or hints would
be much appreciated.

Thanks,

David Brown
Norway

"Utvikling er kunsten av å vikle seg ut av det man har viklet seg inn i"




------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]