* objdump.c: New command line option --debugging-tags.

* doc/binutils.texi: Document new command line option.
* prdbg.c: Code to print the debug info as tags compatible with ctags.
* budbg.h: Adjust prototype.
* NEWS: Mention new switch
This commit is contained in:
Nick Clifton 2003-07-22 13:33:32 +00:00
parent aef9bcd2e7
commit 51cdc6e056
6 changed files with 1098 additions and 14 deletions

View file

@ -1,3 +1,12 @@
2003-07-22 Salvador Eduardo Tropea <set@computer.org>
* objdump.c: New command line option --debugging-tags.
* doc/binutils.texi: Document new command line option.
* prdbg.c: Code to print the debug info as tags compatible
with ctags.
* budbg.h: Adjust prototype.
* NEWS: Mention new switch
2003-07-18 Nick Clifton <nickc@redhat.com> 2003-07-18 Nick Clifton <nickc@redhat.com>
* objdump.c (main) :Accept multiple -M switch. * objdump.c (main) :Accept multiple -M switch.

View file

@ -1,5 +1,8 @@
-*- text -*- -*- text -*-
* objdump now accepts --debugging-tags to print the debug information in a
format compatible with ctags tool.
* objcopy and strip now accept --only-keep-debug to create a file containing * objcopy and strip now accept --only-keep-debug to create a file containing
those sections that would be stripped out by --strip-debug. The idea is that those sections that would be stripped out by --strip-debug. The idea is that
this can be used in conjunction with the --add-gnu-debuglink switch to create this can be used in conjunction with the --add-gnu-debuglink switch to create

View file

@ -1,5 +1,5 @@
/* budbg.c -- Interfaces to the generic debugging information routines. /* budbg.c -- Interfaces to the generic debugging information routines.
Copyright 1995, 1996, 2002 Free Software Foundation, Inc. Copyright 1995, 1996, 2002, 2003 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>. Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -26,13 +26,13 @@
/* Routine used to read generic debugging information. */ /* Routine used to read generic debugging information. */
extern PTR read_debugging_info extern PTR read_debugging_info
PARAMS ((bfd *, asymbol **, long)); PARAMS ((bfd *, asymbol **, long));
/* Routine used to print generic debugging information. */ /* Routine used to print generic debugging information. */
extern bfd_boolean print_debugging_info extern bfd_boolean print_debugging_info
PARAMS ((FILE *, PTR)); (FILE *, void *, bfd *, asymbol **, void *, bfd_boolean);
/* Routines used to read and write stabs information. */ /* Routines used to read and write stabs information. */

View file

@ -1435,6 +1435,7 @@ objdump [@option{-a}|@option{--archive-headers}]
[@option{-f}|@option{--file-headers}] [@option{-f}|@option{--file-headers}]
[@option{--file-start-context}] [@option{--file-start-context}]
[@option{-g}|@option{--debugging}] [@option{-g}|@option{--debugging}]
[@option{-e}|@option{--debugging-tags}]
[@option{-h}|@option{--section-headers}|@option{--headers}] [@option{-h}|@option{--section-headers}|@option{--headers}]
[@option{-i}|@option{--info}] [@option{-i}|@option{--info}]
[@option{-j} @var{section}|@option{--section=}@var{section}] [@option{-j} @var{section}|@option{--section=}@var{section}]
@ -1480,7 +1481,7 @@ object files.
The long and short forms of options, shown here as alternatives, are The long and short forms of options, shown here as alternatives, are
equivalent. At least one option from the list equivalent. At least one option from the list
@option{-a,-d,-D,-f,-g,-G,-h,-H,-p,-r,-R,-S,-t,-T,-V,-x} must be given. @option{-a,-d,-D,-e,-f,-g,-G,-h,-H,-p,-r,-R,-S,-t,-T,-V,-x} must be given.
@table @env @table @env
@item -a @item -a
@ -1536,6 +1537,11 @@ Only certain types of debugging information have been implemented.
Some other types are supported by @command{readelf -w}. Some other types are supported by @command{readelf -w}.
@xref{readelf}. @xref{readelf}.
@item -e
@itemx --debugging-tags
Like @option{-g}, but the information is generated in a format compatible
with ctags tool.
@item -d @item -d
@itemx --disassemble @itemx --disassemble
@cindex disassembling object code @cindex disassembling object code

View file

@ -74,6 +74,7 @@ static int wide_output; /* -w */
static bfd_vma start_address = (bfd_vma) -1; /* --start-address */ static bfd_vma start_address = (bfd_vma) -1; /* --start-address */
static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */ static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */
static int dump_debugging; /* --debugging */ static int dump_debugging; /* --debugging */
static int dump_debugging_tags; /* --debugging-tags */
static bfd_vma adjust_section_vma = 0; /* --adjust-vma */ static bfd_vma adjust_section_vma = 0; /* --adjust-vma */
static int file_start_context = 0; /* --file-start-context */ static int file_start_context = 0; /* --file-start-context */
@ -208,6 +209,7 @@ usage (stream, status)
-S, --source Intermix source code with disassembly\n\ -S, --source Intermix source code with disassembly\n\
-s, --full-contents Display the full contents of all sections requested\n\ -s, --full-contents Display the full contents of all sections requested\n\
-g, --debugging Display debug information in object file\n\ -g, --debugging Display debug information in object file\n\
-e, --debugging-tags Display debug information using ctags style\n\
-G, --stabs Display (in raw form) any STABS info in the file\n\ -G, --stabs Display (in raw form) any STABS info in the file\n\
-t, --syms Display the contents of the symbol table(s)\n\ -t, --syms Display the contents of the symbol table(s)\n\
-T, --dynamic-syms Display the contents of the dynamic symbol table\n\ -T, --dynamic-syms Display the contents of the dynamic symbol table\n\
@ -266,6 +268,7 @@ static struct option long_options[]=
{"architecture", required_argument, NULL, 'm'}, {"architecture", required_argument, NULL, 'm'},
{"archive-headers", no_argument, NULL, 'a'}, {"archive-headers", no_argument, NULL, 'a'},
{"debugging", no_argument, NULL, 'g'}, {"debugging", no_argument, NULL, 'g'},
{"debugging-tags", no_argument, NULL, 'e'},
{"demangle", optional_argument, NULL, 'C'}, {"demangle", optional_argument, NULL, 'C'},
{"disassemble", no_argument, NULL, 'd'}, {"disassemble", no_argument, NULL, 'd'},
{"disassemble-all", no_argument, NULL, 'D'}, {"disassemble-all", no_argument, NULL, 'D'},
@ -2068,15 +2071,17 @@ dump_bfd (abfd)
} }
} }
printf (_("\n%s: file format %s\n"), bfd_get_filename (abfd), if (! dump_debugging_tags)
abfd->xvec->name); printf (_("\n%s: file format %s\n"), bfd_get_filename (abfd),
abfd->xvec->name);
if (dump_ar_hdrs) if (dump_ar_hdrs)
print_arelt_descr (stdout, abfd, TRUE); print_arelt_descr (stdout, abfd, TRUE);
if (dump_file_header) if (dump_file_header)
dump_bfd_header (abfd); dump_bfd_header (abfd);
if (dump_private_headers) if (dump_private_headers)
dump_bfd_private_header (abfd); dump_bfd_private_header (abfd);
putchar ('\n'); if (! dump_debugging_tags)
putchar ('\n');
if (dump_section_headers) if (dump_section_headers)
dump_headers (abfd); dump_headers (abfd);
@ -2106,7 +2111,8 @@ dump_bfd (abfd)
dhandle = read_debugging_info (abfd, syms, symcount); dhandle = read_debugging_info (abfd, syms, symcount);
if (dhandle != NULL) if (dhandle != NULL)
{ {
if (! print_debugging_info (stdout, dhandle)) if (! print_debugging_info (stdout, dhandle, abfd, syms, demangle,
dump_debugging_tags ? TRUE : FALSE))
{ {
non_fatal (_("%s: printing debugging information failed"), non_fatal (_("%s: printing debugging information failed"),
bfd_get_filename (abfd)); bfd_get_filename (abfd));
@ -2648,7 +2654,7 @@ main (argc, argv)
bfd_init (); bfd_init ();
set_default_bfd_target (); set_default_bfd_target ();
while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSj:wE:zgG", while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSj:wE:zgeG",
long_options, (int *) 0)) long_options, (int *) 0))
!= EOF) != EOF)
{ {
@ -2785,6 +2791,12 @@ main (argc, argv)
dump_debugging = 1; dump_debugging = 1;
seenflag = TRUE; seenflag = TRUE;
break; break;
case 'e':
dump_debugging = 1;
dump_debugging_tags = 1;
do_demangle = TRUE;
seenflag = TRUE;
break;
case 'G': case 'G':
dump_stab_section_info = TRUE; dump_stab_section_info = TRUE;
seenflag = TRUE; seenflag = TRUE;

File diff suppressed because it is too large Load diff