From b922d5904f4a0ac69d5abfc8e24826b17012f334 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 12 Jun 2008 11:57:40 +0000 Subject: [PATCH] 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. --- binutils/ChangeLog | 14 ++++++++++++++ binutils/budbg.h | 4 ++-- binutils/doc/binutils.texi | 10 +++++----- binutils/objcopy.c | 2 +- binutils/objdump.c | 8 +++++++- binutils/rddbg.c | 9 +++++---- 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 84d7ea1b91..4ba9c0a57a 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,17 @@ +2008-06-12 Nick Clifton + + 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. + 2008-06-10 Ben Elliston * MAINTAINERS: Remove myself as m68k maintainer. diff --git a/binutils/budbg.h b/binutils/budbg.h index a8c99dddf0..cad6ac75a3 100644 --- a/binutils/budbg.h +++ b/binutils/budbg.h @@ -1,5 +1,5 @@ /* budbg.c -- Interfaces to the generic debugging information routines. - Copyright 1995, 1996, 2002, 2003, 2007 Free Software Foundation, Inc. + Copyright 1995, 1996, 2002, 2003, 2007, 2008 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -26,7 +26,7 @@ /* Routine used to read generic debugging information. */ -extern void *read_debugging_info (bfd *, asymbol **, long); +extern void *read_debugging_info (bfd *, asymbol **, long, bfd_boolean); /* Routine used to print generic debugging information. */ diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index d08c61739c..2ebf354021 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -1693,11 +1693,11 @@ for more information on demangling. @item -g @itemx --debugging -Display debugging information. This attempts to parse debugging -information stored in the file and print it out using a C like syntax. -Only certain types of debugging information have been implemented. -Some other types are supported by @command{readelf -w}. -@xref{readelf}. +Display debugging information. This attempts to parse STABS and IEEE +debugging format information stored in the file and print it out using +a C like syntax. If neither of these formats are found this option +falls back on the @option{-W} option to print any DWARF information in +the file. @item -e @itemx --debugging-tags diff --git a/binutils/objcopy.c b/binutils/objcopy.c index d44114ad71..49b022a648 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1674,7 +1674,7 @@ copy_object (bfd *ibfd, bfd *obfd) have been created, but before their contents are set. */ dhandle = NULL; if (convert_debugging) - dhandle = read_debugging_info (ibfd, isympp, symcount); + dhandle = read_debugging_info (ibfd, isympp, symcount, FALSE); if (strip_symbols == STRIP_DEBUG || strip_symbols == STRIP_ALL diff --git a/binutils/objdump.c b/binutils/objdump.c index 5a862506c8..d171d14f4f 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -2937,7 +2937,7 @@ dump_bfd (bfd *abfd) { void *dhandle; - dhandle = read_debugging_info (abfd, syms, symcount); + dhandle = read_debugging_info (abfd, syms, symcount, TRUE); if (dhandle != NULL) { if (!print_debugging_info (stdout, dhandle, abfd, syms, @@ -2949,6 +2949,12 @@ dump_bfd (bfd *abfd) exit_status = 1; } } + /* PR 6483: If there was no STABS or IEEE debug + info in the file, try DWARF instead. */ + else if (! dump_dwarf_section_info) + { + dump_dwarf (abfd); + } } if (syms) diff --git a/binutils/rddbg.c b/binutils/rddbg.c index 6d26fee47b..e21ed6fa8d 100644 --- a/binutils/rddbg.c +++ b/binutils/rddbg.c @@ -1,5 +1,5 @@ /* rddbg.c -- Read debugging information into a generic form. - Copyright 1995, 1996, 1997, 2000, 2002, 2003, 2005, 2007 + Copyright 1995, 1996, 1997, 2000, 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. Written by Ian Lance Taylor . @@ -45,7 +45,7 @@ static void free_saved_stabs (void); pointer. */ void * -read_debugging_info (bfd *abfd, asymbol **syms, long symcount) +read_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_boolean no_messages) { void *dhandle; bfd_boolean found; @@ -84,8 +84,9 @@ read_debugging_info (bfd *abfd, asymbol **syms, long symcount) if (! found) { - non_fatal (_("%s: no recognized debugging information"), - bfd_get_filename (abfd)); + if (! no_messages) + non_fatal (_("%s: no recognized debugging information"), + bfd_get_filename (abfd)); return NULL; } -- 2.34.1