Bug 6483

Summary: objdump -g does not understand the debug info
Product: binutils Reporter: Chris Johns <chrisj>
Component: binutilsAssignee: unassigned
Status: RESOLVED INVALID    
Severity: normal CC: bug-binutils, ralf.corsepius
Priority: P2    
Version: 2.18   
Target Milestone: ---   
Host: x86_64-redhat-linux-gnu Target: m68k-unknown-rtems4.9
Build: x86_64-redhat-linux-gnu Last reconfirmed:
Attachments: Test case with command line instructions.
Allow -g to fall back on -W.

Description Chris Johns 2008-05-07 06:06:57 UTC
Using the M68K RTEMS 4.9 tool set from the RTEMS repo installed with yum the
following occurs for the m68k target:

$ m68k-rtems4.9-gcc -g -c -o hello.o hello.c
$ m68k-rtems4.9-objdump -g hello.o

hello.o:     file format elf32-m68k

m68k-rtems4.9-objdump: hello.o: no recognized debugging information

The object file can be linked into an RTEMS application that can be debugged
with gdb and objdump can disassemble the object with source. The objdump -W
displays the DWARF info.

The RTEMS tools can be located here:
 http://www.rtems.org/wiki/index.php/APT/Yum_Repository
Comment 1 Chris Johns 2008-05-07 06:08:08 UTC
Created attachment 2724 [details]
Test case with command line instructions.
Comment 2 Nick Clifton 2008-05-21 10:03:46 UTC
Created attachment 2747 [details]
Allow -g to fall back on -W.
Comment 3 Nick Clifton 2008-05-21 10:05:03 UTC
Hi Chris,

  I assume that your objection is that you feel that the -g command line option
should fall back on displaying DWARF debug information if no STABS debug
information is found ?  If so then please could you try out the uploaded patch
and let me know what you think ?

Cheers
  Nick
Comment 4 Nick Clifton 2008-06-12 11:58:07 UTC
I have now checked this patch in, along with this changelog entry.

binutils/ChangeLog
	PR binutils/6483
	* objdump.c (dump_bfd): If the -g option found no STABS or IEEE
	debug information to display, try dumping DWARF information
	instead.
	* rddbg.c (read_debugging_info): Add a parameter to suppress the
	display of a warning message when no debug information is found.
	* budbg.h (read_debugging_info): Update prototype.
	* objcopy.c (copy_object): Continue to allow read_debugging_info
	to produce warning messages.
	* doc/binutils.texi (--debugging): Document new behaviour of the
	-g/--debugging option.
Comment 5 Chris Johns 2008-06-26 02:14:02 UTC
Hi Nick,

Please excuse the delay in getting back to this bug. We looked into this bug
more and found the i386 tools worked fine while the m68k do not. Further it
seems -g works and -e does not.

If I build RTEMS with --target=i386-rtems4.9 using the RTEMS tools obtained by
yum on a Fedora Core 8 64bit box, install RTEMS I can extract the debug symbols
with :

$ i386-rtems4.9-objdump -e librtemsbsp.a
In archive librtemsbsp.a:
!_TAG_FILE_FORMAT       2       /extended format/
!_TAG_FILE_SORTED       0       /0=unsorted, 1=sorted/
!_TAG_PROGRAM_AUTHOR    Ian Lance Taylor, Salvador E. Tropea and others //
!_TAG_PROGRAM_NAME      objdump /From GNU binutils/
New compilation unit:
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
int    
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:int32
char   
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:int8
long int       
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:int32
unsigned int   
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:uint32
long unsigned int      
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:uint32
long long int  
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:int64
long long unsigned int 
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:uint64
short int      
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:int16
short unsigned int     
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:uint16
signed char    
/opt/work/sw/rtems/src/head/c/src/lib/libbsp/i386/pc386/../../shared/bootcard.c
0;"     kind:t  type:int8

Same command run with m68k tools on a --target=m68k-rtems4.9 build of RTEMS I get:

$ m68k-rtems4.9-objdump -e librtemsbsp.a
In archive librtemsbsp.a:
m68k-rtems4.9-objdump: bootcard.o: no recognized debugging information
m68k-rtems4.9-objdump: bspclean.o: no recognized debugging information
m68k-rtems4.9-objdump: bsplibc.o: no recognized debugging information
m68k-rtems4.9-objdump: bsppost.o: no recognized debugging information
m68k-rtems4.9-objdump: bsppredriverhook.o: no recognized debugging information
m68k-rtems4.9-objdump: bspstart.o: no recognized debugging information
 [snipped]

Regards
Chris
Comment 6 Andreas Schwab 2008-06-26 09:02:12 UTC
Please try the latest sources from CVS.
Comment 7 H.J. Lu 2015-04-24 15:21:59 UTC
No feedback after 7 years.