mips-elf executables lack debug information

David Phillips daphillips@efficient.com
Fri Oct 19 03:04:00 GMT 2001

I've been scanning the section headers generated by the compiler for a
variety of -g* options. I find is that all the legal options are generating
.mdebug sections. My configuration allows -g, -gstab, -gcoff and -ggdb and
disallows -gxcoff, -gxcoff+, -gdwarf and -gdwarf+. The allowed debug options
generate these sections: .text, .relatext, .rel.text, .data, .bss, .reginfo,
.mdebug, and .sdata.

So it looks like all -g* options produce .mdebug debugging information.
Unfortunately, this doesn't help me because my debugger can only read stabs,
DWARF 1.x, DWARF 2.x, ECOFF, COFF, and IEEE-695 formats. Is there a
configuration option that will cause the compiler to generate one of these
other formats? 


-----Original Message-----
From: Ken Greenberg [mailto:ken@lexra.com]
Sent: Friday, November 30, 2001 1:56 PM
To: 'David Phillips'
Subject: RE: mips-elf executables lack debug information

Well, they don't lack it, it just is in a different form from what you
expected by default. The .mdebug section contains everything the gdb
debugger needs to know. The mdebug format is (was) proprietary and developed
by the mips team when they were part of SGI - possibly even before that
acquisition, now re-split. I know more about the history, but it's probably
more than you really wanted to know. While mdebug is the default, you can
(depending on how you configured and built the compiler) produce other
formats. All you have to do is ask. For example, if you wanted dwarf format
debugging info, which is even better than mdebug but possibly not supported
by gdb, you could just say -gdwarf. If you want stabs, you just say -gstabs
- you get what you ask for unless gcc was not built so as to produce it. But
that's a configuration problem. 

I use many gcc's for many targets, and I would prefer to see this all
standardized on dwarf as the most complete format. Stabs is pretty primitive
(and in my opinion ugly). But mdebug is the current standard in the mips


> -----Original Message-----
> From: crossgcc-owner@sources.redhat.com
> [mailto:crossgcc-owner@sources.redhat.com]On Behalf Of David Phillips
> Sent: Thursday, November 29, 2001 11:25 AM
> To: crossgcc@sources.redhat.com
> Subject: mips-elf executables lack debug information
> I've built a mips-elf cross-compiler that runs on a Linux 
> host for a custom
> embedded target. It uses newlib. It compiles and links good 
> code. I can see
> from the disassembly that the code is compiled correctly and 
> the symbols are
> resolved appropriately. But my problem is that the file 
> doesn't seem to
> contain debugging information.  objdump says:
> 	$ mips-elf-objdump -g x.elf
> 		x.elf:  file format elf32-bigmips
> 		mips-elf-objdump: x.elf: no recognized 
> debugging information
> objdump shows the following sections:
> 	$ mips-elf-objdump -h x.elf
> 		Idx Name
> 		  0 .text
> 		  1 .data
> 		  2 .sbss
> 		  3 .bss
> 		  4 .reginfo
> 		  5 .mdebug
> I'm not so familiar with debugging information but I might 
> have expected a
> symbol table section (.stab) and stab strings (.stabstr). I 
> think that my
> problem is with the compiler rather than the linker because the final
> executable and the intermediate executables both contain the 
> same sections
> and generate the same debugging information error message. Does anyone
> understand my problem? Any suggestions? Insightful comments 
> on where to dig
> deeper?
> Has there been a change in the debugger output since the cygnus 2.7.2
> compiler? I have access to one of these and can see that its 
> executables
> have .stab and stabstr sections. 
> Here are the command lines I used to compile and link:
> $ mips-elf-gcc -mcpu-r4000 -mips2 -mfp32 -mgp32 -G 0  
> -fvolatile -g -c -o
> x.o x.c
> $ mips-elf-ld -stat-ic -nostdlibs -N --verbose -N -o x.elf x.o -Tx.lcf
> My link control file is plain vanilla:
>  .text : ( * (.text) }
>  .data { * (.data) }
>  .bss ( * (.bss) }
> }
> It doesn't matter if I use this one or the default link control file.
> I followed Bill Gatliff's instructions to build the 
> cross-compiler, except
> that I used mips-elf as the target.
> Thanks 
> David
> ------
> Want more information?  See the CrossGCC FAQ, 
Want to unsubscribe? Send a note to

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

More information about the crossgcc mailing list