diff options
Diffstat (limited to 'binutils-2.25/binutils')
-rw-r--r-- | binutils-2.25/binutils/.gitignore | 58 | ||||
-rw-r--r-- | binutils-2.25/binutils/ChangeLog | 93 | ||||
-rw-r--r-- | binutils-2.25/binutils/Makefile.in | 2 | ||||
-rw-r--r-- | binutils-2.25/binutils/bfdtest2.c | 210 | ||||
-rwxr-xr-x | binutils-2.25/binutils/configure | 20 | ||||
-rw-r--r-- | binutils-2.25/binutils/cxxfilt.c | 1 | ||||
-rw-r--r-- | binutils-2.25/binutils/doc/Makefile.am | 2 | ||||
-rw-r--r-- | binutils-2.25/binutils/doc/Makefile.in | 4 | ||||
-rw-r--r-- | binutils-2.25/binutils/dwarf.c | 926 | ||||
-rw-r--r-- | binutils-2.25/binutils/dwarf.h | 3 | ||||
-rw-r--r-- | binutils-2.25/binutils/readelf.c | 6 |
11 files changed, 923 insertions, 402 deletions
diff --git a/binutils-2.25/binutils/.gitignore b/binutils-2.25/binutils/.gitignore new file mode 100644 index 00000000..1934ea0f --- /dev/null +++ b/binutils-2.25/binutils/.gitignore @@ -0,0 +1,58 @@ +/addr2line +/ar +/bin2c +/coffdump +/cxxfilt +/dlltool +/dllwrap +/elfedit +/nlmconv +/nm-new +/objcopy +/objdump +/ranlib +/readelf +/size +/srconv +/strings +/strip-new +/sysdump +/sysinfo +/windmc +/windres + +/arlex.c +/arparse.c +/arparse.h +/deflex.c +/defparse.c +/defparse.h +/mcparse.c +/mcparse.h +/nlmheader.c +/nlmheader.h +/rcparse.c +/rcparse.h +/sysinfo.c +/sysinfo.h +/syslex.c +/sysroff.c +/sysroff.h + +/doc/addr2line.1 +/doc/ar.1 +/doc/c++filt.1 +/doc/cxxfilt.man +/doc/dlltool.1 +/doc/elfedit.1 +/doc/nlmconv.1 +/doc/nm.1 +/doc/objcopy.1 +/doc/objdump.1 +/doc/ranlib.1 +/doc/readelf.1 +/doc/size.1 +/doc/strings.1 +/doc/strip.1 +/doc/windmc.1 +/doc/windres.1 diff --git a/binutils-2.25/binutils/ChangeLog b/binutils-2.25/binutils/ChangeLog index c2f69e9c..9f7e17c0 100644 --- a/binutils-2.25/binutils/ChangeLog +++ b/binutils-2.25/binutils/ChangeLog @@ -1,8 +1,8 @@ -2014-11-17 Nick Clifton <nickc@redhat.com> +2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> - Apply trunk patches: + * readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible". - 2014-11-14 Nick Clifton <nickc@redhat.com> +2014-11-14 Nick Clifton <nickc@redhat.com> PR binutils/17512 * dwarf.c (get_encoded_value): Add an 'end' parameter. Change the @@ -16,7 +16,7 @@ read. Update call to get_encoded_value. Warn if the read CFA expressions are too big. - 2014-11-13 Nick Clifton <nickc@redhat.com> +2014-11-13 Nick Clifton <nickc@redhat.com> PR binutils/17531 * readelf.c (process_version_sections): If the read of the version @@ -30,7 +30,7 @@ (print_gnu_note): Do not print the note if the descsz is too small. - 2014-11-12 Nick Clifton <nickc@redhat.com> +2014-11-12 Nick Clifton <nickc@redhat.com> PR binutils/17512 * dwarf.c (read_and_display_attr_value): Check that we do not read @@ -50,7 +50,7 @@ string table. Avoid walking off the end of the stabs data. * stabs.c (parse_stab_string): Add check for a NULL name. - 2014-11-11 Nick Clifton <nickc@redhat.com> +2014-11-11 Nick Clifton <nickc@redhat.com> PR binutils/17531 * binutils/readelf.c (dynamic_nent): Change type to size_t. @@ -77,17 +77,21 @@ size_t. Skip processing of sections headers if there are none. Improve out of memory error messages. - 2014-11-11 Nick Clifton <nickc@redhat.com> +2014-11-11 Nick Clifton <nickc@redhat.com> + + * po/fr.po: Updated French translation. + +2014-11-11 Nick Clifton <nickc@redhat.com> PR binutils/17531 * readelf.c (display_arm_attribute): Avoid reading off the end of the buffer when processing a Tag_nodefaults. - 2014-11-10 Nick Clifton <nickc@redhat.com> +2014-11-10 Nick Clifton <nickc@redhat.com> PR binutils/17531 - * readelf.c (ia64_process_unwind): Replace assertion with an error - message. Add range checking for group section indicies. + * (ia64_process_unwind): Replace assertion with an error message. + Add range checking for group section indicies. (hppa_process_unwind): Replace assertion with an error message. (process_syminfo): Likewise. (decode_arm_unwind_bytecode): Add range checking. @@ -98,13 +102,18 @@ (display_tic6x_attribute): Likewise. (display_msp430x_attribute): Likewise. - 2014-11-10 Nick Clifton <nickc@redhat.com> +2014-11-10 Nick Clifton <nickc@redhat.com> PR binutils/17552 - * objcopy.c (copy_archive): Clean up temporary files even if an - error occurs. + * (copy_archive): Clean up temporary files even if an error + occurs. + +2014-11-07 H.J. Lu <hongjiu.lu@intel.com> + + * readelf.c (process_dynamic_section): Cast time value to unsigned + long to print. - 2014-11-07 Nick Clifton <nickc@redhat.com> +2014-11-07 Nick Clifton <nickc@redhat.com> PR binutils/17531 * readelf.c (get_data): Avoid allocating memory when we know that @@ -124,7 +133,7 @@ (display_msp430x_attribute): Likewise. (process_mips_specific): Add range check. - 2014-11-06 Nick Clifton <nickc@redhat.com> +2014-11-06 Nick Clifton <nickc@redhat.com> PR binutils/17552, binutils/17533 * bucomm.c (is_valid_archive_path): New function. Returns false @@ -136,7 +145,7 @@ * doc/binutils.texi: Update documentation to mention the limitation on pathname of archive members. - 2014-11-05 Nick Clifton <nickc@redhat.com> +2014-11-05 Nick Clifton <nickc@redhat.com> PR binutils/17531 * readelf.c (printable_section_name): New function. @@ -158,7 +167,7 @@ small. (process_mips_specific): Check for a corrupt GOT symbol offset. - 2014-11-05 Nick Clifton <nickc@redhat.com> +2014-11-05 Nick Clifton <nickc@redhat.com> PR binutils/17533 * bucomm.c (is_valid_archive_path): New function. @@ -167,7 +176,15 @@ member filename before extracting it. * objcopy.c (copy_archive): Likewise. - 2014-11-04 Nick Clifton <nickc@redhat.com> +2014-11-05 Jan-Benedict Glaw <jbglaw@lug-owl.de> + + * readelf.c (process_mips_specific): Fix format string warning. + +2014-11-04 Matthew Fortune <matthew.fortune@imgtec.com> + + * readelf.c (process_mips_specific): Rename index to idx. + +2014-11-04 Nick Clifton <nickc@redhat.com> PR binutils/17531 * readelf.c (get_data): If the reason parameter is null, do not @@ -179,6 +196,7 @@ (get_file_header): Pass TRUE to get_section_headers. (process_dynamic_section): Change an assert to an error message. (process_symbol_table): Handle corrupt histograms. + (get_32bit_program_headers): Verify program header entry size before reading in the program headers. (get_64bit_program_headers): Likewise. @@ -190,27 +208,44 @@ the section before attempting to read the length of the next attribute. - 2014-11-03 Nick Clifton <nickc@redhat.com> +2014-11-03 Nick Clifton <nickc@redhat.com> PR binutils/17512 * objdump.c (slurp_symtab): Fail gracefully if the table could not be read. (dump_relocs_in_section): Likewise. -2014-11-11 Nick Clifton <nickc@redhat.com> - - * po/fr.po: Updated French translation. - 2014-11-03 Nick Clifton <nickc@redhat.com> * po/fi.po: Updated Finnish translation. * po/sv.po: Updated Swedish translation. +2014-11-01 Hans-Peter Nilsson <hp@axis.com> + + * readelf.c (get_32bit_elf_symbols): Cast error + parameters of bfd_size_type with the %lx format to + unsigned long. + +2014-10-31 Andrew Pinski <apinski@cavium.com> + Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> + + * readelf.c (print_mips_isa_ext): Print the value of Octeon3. + +2014-10-31 Iain Buclaw <ibuclaw@gdcproject.org> + + * cxxfilt.c (main): Add case for dlang_demangling style. + 2014-10-31 Nick Clifton <nickc@redhat.com> - Apply trunk patch: + PR binutils/17512 + * readelf.c (process_program_headers): Avoid memory exhaustion due + to corrupt values in a dynamis segment header. + (get_32bit_elf_symbols): Do not attempt to read an over-large + section. + (get_64bit_elf_symbols): Likewise. + +2014-10-31 Nick Clifton <nickc@redhat.com> - 2014-10-31 Nick Clifton <nickc@redhat.com> * strings.c: Add new command line option --data to only scan the initialized, loadable data secions of binaries. Choose the default behaviour of --all or --data based upon a configure @@ -226,9 +261,6 @@ 2014-10-30 Nick Clifton <nickc@redhat.com> - Apply trunk patch: - - 2014-10-30 Nick Clifton <nickc@redhat.com> * readelf.c (CHECK_ENTSIZE_VALUES): Rewrite error message so that there is a single string for translation. (dynamic_section_mips_val): Likewise. @@ -239,11 +271,8 @@ * po/sr.po: New Serbian translation. * po/sv.po: Updated Swedish translation. -2014-10-28 Matthew Fortune <matthew.fortune@imgtec.com> - - Apply trunk patch: +2014-10-22 Matthew Fortune <matthew.fortune@imgtec.com> - 2014-10-22 Matthew Fortune <matthew.fortune@imgtec.com> * readelf.c (print_mips_ases): Print unknown ASEs. (print_mips_isa_ext): Print the value of an unknown extension. diff --git a/binutils-2.25/binutils/Makefile.in b/binutils-2.25/binutils/Makefile.in index c6e0003d..aaf4d51c 100644 --- a/binutils-2.25/binutils/Makefile.in +++ b/binutils-2.25/binutils/Makefile.in @@ -16,7 +16,7 @@ @SET_MAKE@ # -# Copyright (C) 2012-2014 Free Software Foundation, Inc. +# Copyright (C) 2012-2015 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/binutils-2.25/binutils/bfdtest2.c b/binutils-2.25/binutils/bfdtest2.c index a791080c..8b54765c 100644 --- a/binutils-2.25/binutils/bfdtest2.c +++ b/binutils-2.25/binutils/bfdtest2.c @@ -1,106 +1,106 @@ -/* A program to test BFD.
+/* A program to test BFD. Copyright (C) 2012-2014 Free Software Foundation, Inc. -
- This file is part of the GNU Binutils.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-static void
-die (const char *s)
-{
- printf ("oops: %s\n", s);
- exit (1);
-}
-
-static void *
-iovec_open (struct bfd *nbfd ATTRIBUTE_UNUSED, void *open_closure)
-{
- return open_closure;
-}
-
-static file_ptr iovec_read (struct bfd *nbfd ATTRIBUTE_UNUSED,
- void *stream, void *buf, file_ptr nbytes,
- file_ptr offset)
-{
- FILE* file = (FILE*) stream;
-
- if (fseek(file, offset, SEEK_SET) != 0)
- die ("fseek error");
-
- return fread (buf, 1, nbytes, file);
-}
-
-static int
-iovec_stat (struct bfd *abfd ATTRIBUTE_UNUSED,
- void *stream, struct stat *sb)
-{
- return fstat (fileno ((FILE*) stream), sb);
-}
-
-static bfd_boolean
-check_format_any (struct bfd *abfd, bfd_format format)
-{
- char** targets = NULL;
-
- if (bfd_check_format_matches (abfd, format, &targets))
- return TRUE;
-
- if (targets)
- {
- bfd_find_target (targets[0], abfd);
-
- return bfd_check_format (abfd, format);
- }
-
- return FALSE;
-}
-
-int
-main (int argc, const char** argv)
-{
- FILE* file;
- bfd *abfd, *mbfd;
-
- if (argc < 2)
- die ("Usage: test archivefile");
-
- file = fopen(argv[1], "rb");
- if (!file)
- die ("file not found");
-
- abfd = bfd_openr_iovec (argv[1], 0, iovec_open, file,
- iovec_read, NULL, iovec_stat);
- if (!abfd)
- die ("error opening file");
-
- if (!check_format_any (abfd, bfd_archive))
- die ("not an archive");
-
- mbfd = bfd_openr_next_archived_file (abfd, 0);
- if (!mbfd)
- die ("error opening archive member");
-
- if (!bfd_close (mbfd))
- die ("error closing archive member");
-
- if (!bfd_close (abfd))
- die ("error closing archive");
-
- return 0;
-}
+ + This file is part of the GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" + +static void +die (const char *s) +{ + printf ("oops: %s\n", s); + exit (1); +} + +static void * +iovec_open (struct bfd *nbfd ATTRIBUTE_UNUSED, void *open_closure) +{ + return open_closure; +} + +static file_ptr iovec_read (struct bfd *nbfd ATTRIBUTE_UNUSED, + void *stream, void *buf, file_ptr nbytes, + file_ptr offset) +{ + FILE* file = (FILE*) stream; + + if (fseek(file, offset, SEEK_SET) != 0) + die ("fseek error"); + + return fread (buf, 1, nbytes, file); +} + +static int +iovec_stat (struct bfd *abfd ATTRIBUTE_UNUSED, + void *stream, struct stat *sb) +{ + return fstat (fileno ((FILE*) stream), sb); +} + +static bfd_boolean +check_format_any (struct bfd *abfd, bfd_format format) +{ + char** targets = NULL; + + if (bfd_check_format_matches (abfd, format, &targets)) + return TRUE; + + if (targets) + { + bfd_find_target (targets[0], abfd); + + return bfd_check_format (abfd, format); + } + + return FALSE; +} + +int +main (int argc, const char** argv) +{ + FILE* file; + bfd *abfd, *mbfd; + + if (argc < 2) + die ("Usage: test archivefile"); + + file = fopen(argv[1], "rb"); + if (!file) + die ("file not found"); + + abfd = bfd_openr_iovec (argv[1], 0, iovec_open, file, + iovec_read, NULL, iovec_stat); + if (!abfd) + die ("error opening file"); + + if (!check_format_any (abfd, bfd_archive)) + die ("not an archive"); + + mbfd = bfd_openr_next_archived_file (abfd, 0); + if (!mbfd) + die ("error opening archive member"); + + if (!bfd_close (mbfd)) + die ("error closing archive member"); + + if (!bfd_close (abfd)) + die ("error closing archive"); + + return 0; +} diff --git a/binutils-2.25/binutils/configure b/binutils-2.25/binutils/configure index 07551c30..70387ea2 100755 --- a/binutils-2.25/binutils/configure +++ b/binutils-2.25/binutils/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for binutils 2.24.90. +# Generated by GNU Autoconf 2.64 for binutils 2.25.51. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='binutils' PACKAGE_TARNAME='binutils' -PACKAGE_VERSION='2.24.90' -PACKAGE_STRING='binutils 2.24.90' +PACKAGE_VERSION='2.25.51' +PACKAGE_STRING='binutils 2.25.51' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1333,7 +1333,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures binutils 2.24.90 to adapt to many kinds of systems. +\`configure' configures binutils 2.25.51 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1404,7 +1404,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of binutils 2.24.90:";; + short | recursive ) echo "Configuration of binutils 2.25.51:";; esac cat <<\_ACEOF @@ -1525,7 +1525,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -binutils configure 2.24.90 +binutils configure 2.25.51 generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. @@ -1935,7 +1935,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by binutils $as_me 2.24.90, which was +It was created by binutils $as_me 2.25.51, which was generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -3743,7 +3743,7 @@ fi # Define the identity of the package. PACKAGE='binutils' - VERSION='2.24.90' + VERSION='2.25.51' cat >>confdefs.h <<_ACEOF @@ -14850,7 +14850,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by binutils $as_me 2.24.90, which was +This file was extended by binutils $as_me 2.25.51, which was generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14914,7 +14914,7 @@ Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -binutils config.status 2.24.90 +binutils config.status 2.25.51 configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/binutils-2.25/binutils/cxxfilt.c b/binutils-2.25/binutils/cxxfilt.c index 157ebe02..03c4d0cc 100644 --- a/binutils-2.25/binutils/cxxfilt.c +++ b/binutils-2.25/binutils/cxxfilt.c @@ -239,6 +239,7 @@ main (int argc, char **argv) case edg_demangling: case gnat_demangling: case gnu_v3_demangling: + case dlang_demangling: case auto_demangling: valid_symbols = standard_symbol_characters (); break; diff --git a/binutils-2.25/binutils/doc/Makefile.am b/binutils-2.25/binutils/doc/Makefile.am index e7a38c29..1c9b989e 100644 --- a/binutils-2.25/binutils/doc/Makefile.am +++ b/binutils-2.25/binutils/doc/Makefile.am @@ -28,7 +28,7 @@ MANCONF = -Dman TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ - --release="binutils-$(VERSION)" --section=1 + --release="binutils-$(VERSION)" --section=1 --date=" " # List of man pages generated from binutils.texi man_MANS = \ diff --git a/binutils-2.25/binutils/doc/Makefile.in b/binutils-2.25/binutils/doc/Makefile.in index 2b172e11..21079c56 100644 --- a/binutils-2.25/binutils/doc/Makefile.in +++ b/binutils-2.25/binutils/doc/Makefile.in @@ -16,7 +16,7 @@ @SET_MAKE@ # -# Copyright (C) 2012-2014 Free Software Foundation, Inc. +# Copyright (C) 2012-2015 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -289,7 +289,7 @@ CONFIG = all MANCONF = -Dman TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ - --release="binutils-$(VERSION)" --section=1 + --release="binutils-$(VERSION)" --section=1 --date=" " # List of man pages generated from binutils.texi diff --git a/binutils-2.25/binutils/dwarf.c b/binutils-2.25/binutils/dwarf.c index 84e628a2..4777baba 100644 --- a/binutils-2.25/binutils/dwarf.c +++ b/binutils-2.25/binutils/dwarf.c @@ -365,6 +365,9 @@ typedef struct State_Machine_Registers unsigned int file; unsigned int line; unsigned int column; + unsigned int discriminator; + unsigned int context; + unsigned int subprogram; int is_stmt; int basic_block; unsigned char op_index; @@ -384,19 +387,65 @@ reset_state_machine (int is_stmt) state_machine_regs.file = 1; state_machine_regs.line = 1; state_machine_regs.column = 0; + state_machine_regs.discriminator = 0; + state_machine_regs.context = 0; + state_machine_regs.subprogram = 0; state_machine_regs.is_stmt = is_stmt; state_machine_regs.basic_block = 0; state_machine_regs.end_sequence = 0; state_machine_regs.last_file_entry = 0; } +/* Build a logicals table for reference when reading the actuals table. */ + +static SMR *logicals_table = NULL; +static unsigned int logicals_allocated = 0; +static unsigned int logicals_count = 0; + +static void +free_logicals (void) +{ + free (logicals_table); + logicals_allocated = 0; + logicals_count = 0; + logicals_table = NULL; +} + +static void +append_logical (void) +{ + if (logicals_allocated == 0) + { + logicals_allocated = 4; + logicals_table = (SMR *) xmalloc (logicals_allocated * sizeof (SMR)); + } + if (logicals_count >= logicals_allocated) + { + logicals_allocated *= 2; + logicals_table = (SMR *) + xrealloc (logicals_table, logicals_allocated * sizeof (SMR)); + } + logicals_table[logicals_count++] = state_machine_regs; + printf (_("\t\tLogical %u: 0x%s[%u] file %u line %u discrim %u context %u subprog %u is_stmt %d\n"), + logicals_count, + dwarf_vmatoa ("x", state_machine_regs.address), + state_machine_regs.op_index, + state_machine_regs.file, + state_machine_regs.line, + state_machine_regs.discriminator, + state_machine_regs.context, + state_machine_regs.subprogram, + state_machine_regs.is_stmt); +} + /* Handled an extend line op. Returns the number of bytes read. */ static int process_extended_line_op (unsigned char * data, int is_stmt, - unsigned char * end) + unsigned char * end, + int is_logical) { unsigned char op_code; unsigned int bytes_read; @@ -423,6 +472,8 @@ process_extended_line_op (unsigned char * data, { case DW_LNE_end_sequence: printf (_("End of Sequence\n\n")); + if (is_logical) + append_logical (); reset_state_machine (is_stmt); break; @@ -453,8 +504,14 @@ process_extended_line_op (unsigned char * data, break; case DW_LNE_set_discriminator: - printf (_("set Discriminator to %s\n"), - dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); + { + unsigned int discrim; + + discrim = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + printf (_("set Discriminator to %u\n"), discrim); + state_machine_regs.discriminator = discrim; + } break; /* HP extensions. */ @@ -567,7 +624,7 @@ fetch_indirect_string (dwarf_vma offset) if (section->start == NULL) return (const unsigned char *) _("<no .debug_str section>"); - if (offset > section->size) + if (offset >= section->size) { warn (_("DW_FORM_strp offset too big: %s\n"), dwarf_vmatoa ("x", offset)); @@ -577,6 +634,24 @@ fetch_indirect_string (dwarf_vma offset) return (const unsigned char *) section->start + offset; } +static const unsigned char * +fetch_indirect_line_string (dwarf_vma offset) +{ + struct dwarf_section *section = &debug_displays [line_str].section; + + if (section->start == NULL) + return (const unsigned char *) _("<no .debug_line_str section>"); + + if (offset >= section->size) + { + warn (_("DW_FORM_line_strp offset too big: %s\n"), + dwarf_vmatoa ("x", offset)); + return (const unsigned char *) _("<offset is too big>"); + } + + return (const unsigned char *) section->start + offset; +} + static const char * fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set, dwarf_vma offset_size, int dwo) @@ -594,7 +669,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set, if (this_set != NULL) index_offset += this_set->section_offsets [DW_SECT_STR_OFFSETS]; - if (index_offset > index_section->size) + if (index_offset + offset_size > index_section->size) { warn (_("DW_FORM_GNU_str_index offset too big: %s\n"), dwarf_vmatoa ("x", index_offset)); @@ -607,7 +682,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set, str_offset = byte_get (index_section->start + index_offset, offset_size); str_offset -= str_section->address; - if (str_offset > str_section->size) + if (str_offset >= str_section->size) { warn (_("DW_FORM_GNU_str_index indirect offset too big: %s\n"), dwarf_vmatoa ("x", str_offset)); @@ -2616,6 +2691,10 @@ load_debug_info (void * file) return 0; } +/* Experimental DWARF 5 extensions. + See http://wiki.dwarfstd.org/index.php?title=TwoLevelLineTables. */ +#define DWARF2_LINE_EXPERIMENTAL_VERSION 0xf006 + /* Read a DWARF .debug_line section header starting at DATA. Upon success returns an updated DATA pointer and the LINFO structure and the END_OF_SEQUENCE pointer will be filled in. @@ -2626,7 +2705,9 @@ read_debug_line_header (struct dwarf_section * section, unsigned char * data, unsigned char * end, DWARF2_Internal_LineInfo * linfo, - unsigned char ** end_of_sequence) + unsigned char ** end_of_sequence, + unsigned int * pinitial_length_size, + unsigned int * poffset_size) { unsigned char *hdrptr; unsigned int offset_size; @@ -2651,6 +2732,8 @@ read_debug_line_header (struct dwarf_section * section, offset_size = 4; initial_length_size = 4; } + *pinitial_length_size = initial_length_size; + *poffset_size = offset_size; if (linfo->li_length + initial_length_size > section->size) { @@ -2673,15 +2756,30 @@ read_debug_line_header (struct dwarf_section * section, /* Get and check the version number. */ SAFE_BYTE_GET_AND_INC (linfo->li_version, hdrptr, 2, end); + /* Version 0xf006 is for experimental two-level line tables. */ if (linfo->li_version != 2 && linfo->li_version != 3 - && linfo->li_version != 4) + && linfo->li_version != 4 + && linfo->li_version != 5 + && linfo->li_version != DWARF2_LINE_EXPERIMENTAL_VERSION) { - warn (_("Only DWARF version 2, 3 and 4 line info is currently supported.\n")); + warn (_("Only DWARF versions 2-5 line info are currently supported.\n")); return NULL; } + if (linfo->li_version < 5) + { + linfo->li_address_size = 0; + linfo->li_segment_size = 0; + } + else if (linfo->li_version != DWARF2_LINE_EXPERIMENTAL_VERSION) + { + SAFE_BYTE_GET_AND_INC (linfo->li_address_size, hdrptr, 1, end); + SAFE_BYTE_GET_AND_INC (linfo->li_segment_size, hdrptr, 1, end); + } + SAFE_BYTE_GET_AND_INC (linfo->li_prologue_length, hdrptr, offset_size, end); + SAFE_BYTE_GET_AND_INC (linfo->li_min_insn_length, hdrptr, 1, end); if (linfo->li_version >= 4) @@ -2706,12 +2804,473 @@ read_debug_line_header (struct dwarf_section * section, return hdrptr; } +static void +display_directory_table_v4 (unsigned char *start, unsigned char *end, + unsigned char **pdata) +{ + unsigned char *data = *pdata; + unsigned int last_dir_entry = 0; + + if (*data == 0) + printf (_("\n The Directory Table is empty.\n")); + else + { + printf (_("\n The Directory Table (offset 0x%lx):\n"), + (long)(data - start)); + + while (data < end && *data != 0) + { + printf (" %d\t%.*s\n", ++last_dir_entry, (int) (end - data), data); + + data += strnlen ((char *) data, end - data) + 1; + } + } + + /* Skip the NUL at the end of the table. */ + *pdata = data + 1; +} + +static void +display_file_name_table_v4 (unsigned char *start, unsigned char *end, + unsigned char **pdata) +{ + unsigned char *data = *pdata; + + if (*data == 0) + printf (_("\n The File Name Table is empty.\n")); + else + { + printf (_("\n The File Name Table (offset 0x%lx):\n"), + (long)(data - start)); + printf (_(" Entry\tDir\tTime\tSize\tName\n")); + + while (data < end && *data != 0) + { + unsigned char *name; + unsigned int bytes_read; + + printf (" %d\t", ++state_machine_regs.last_file_entry); + name = data; + data += strnlen ((char *) data, end - data) + 1; + + printf ("%s\t", + dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); + data += bytes_read; + printf ("%s\t", + dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); + data += bytes_read; + printf ("%s\t", + dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); + data += bytes_read; + printf ("%.*s\n", (int)(end - name), name); + + if (data == end) + { + warn (_("Corrupt file name table entry\n")); + break; + } + } + } + + /* Skip the NUL at the end of the table. */ + *pdata = data + 1; +} + +static int +display_dir_file_table_v5 (unsigned char *start, unsigned char *end, + unsigned char **pdata, char *table_name, + unsigned int offset_size) +{ + unsigned char *data = *pdata; + unsigned int bytes_read; + unsigned int format_count; + unsigned int *content_types; + unsigned int *content_forms; + unsigned int entry_count; + unsigned int i, j; + const unsigned char *name; + dwarf_vma offset; + unsigned int val; + + format_count = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + content_types = (unsigned int *) xmalloc (format_count * + sizeof (unsigned int)); + content_forms = (unsigned int *) xmalloc (format_count * + sizeof (unsigned int)); + for (j = 0; j < format_count; j++) + { + content_types[j] = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + content_forms[j] = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + } + + entry_count = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + + if (entry_count == 0) + printf (_("\n The %s Table is empty.\n"), table_name); + else + { + printf (_("\n The %s Table (offset 0x%lx):\n"), + table_name, (long)(data - start)); + + printf (_(" Entry")); + for (j = 0; j < format_count; j++) + { + printf ("\t"); + switch (content_types[j]) + { + case DW_LNCT_path: + printf (_("Path")); + break; + case DW_LNCT_subprogram_name: + printf (_("Name")); + break; + case DW_LNCT_directory_index: + printf (_("Dir")); + break; + case DW_LNCT_decl_file: + printf (_("File")); + break; + case DW_LNCT_decl_line: + printf (_("Line")); + break; + } + } + printf ("\n"); + } + + for (i = 0; i < entry_count; i++) + { + printf (" %d", i + 1); + for (j = 0; j < format_count; j++) + { + if (data >= end) + break; + switch (content_forms[j]) + { + case DW_FORM_string: + printf ("\t%.*s", (int) (end - data), data); + data += strnlen ((char *) data, end - data) + 1; + break; + case DW_FORM_line_strp: + SAFE_BYTE_GET_AND_INC (offset, data, offset_size, end); + name = fetch_indirect_line_string (offset); + printf ("\t%s", name); + break; + case DW_FORM_udata: + val = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + printf ("\t%u", val); + break; + default: + printf ("\t%s", _("(unrecognized FORM code)")); + data = end; + break; + } + } + printf ("\n"); + + /* PR 17512: file: 002-132094-0.004. */ + if (data >= end - 1) + break; + } + + free (content_types); + free (content_forms); + + *pdata = data; + return entry_count; +} + +static void +display_line_program (unsigned char *start, unsigned char *end, + unsigned char **pdata, char *table_name, + DWARF2_Internal_LineInfo *linfo, + unsigned char *standard_opcodes, + int is_logical) +{ + unsigned char *data = *pdata; + + if (data >= end) + { + printf (_(" No %s.\n"), table_name); + return; + } + + printf (" %s:\n", table_name); + + while (data < end) + { + unsigned char op_code; + dwarf_signed_vma adv; + dwarf_vma uladv; + unsigned int bytes_read; + unsigned int logical; + int i; + + printf (" [0x%08lx]", (long)(data - start)); + + op_code = *data++; + + if (op_code >= linfo->li_opcode_base) + { + op_code -= linfo->li_opcode_base; + uladv = (op_code / linfo->li_line_range); + if (linfo->li_max_ops_per_insn == 1) + { + uladv *= linfo->li_min_insn_length; + state_machine_regs.address += uladv; + printf (_(" Special opcode %d: " + "advance Address by %s to 0x%s"), + op_code, dwarf_vmatoa ("u", uladv), + dwarf_vmatoa ("x", state_machine_regs.address)); + } + else + { + state_machine_regs.address + += ((state_machine_regs.op_index + uladv) + / linfo->li_max_ops_per_insn) + * linfo->li_min_insn_length; + state_machine_regs.op_index + = (state_machine_regs.op_index + uladv) + % linfo->li_max_ops_per_insn; + printf (_(" Special opcode %d: " + "advance Address by %s to 0x%s[%d]"), + op_code, dwarf_vmatoa ("u", uladv), + dwarf_vmatoa ("x", state_machine_regs.address), + state_machine_regs.op_index); + } + adv = (op_code % linfo->li_line_range) + linfo->li_line_base; + state_machine_regs.line += adv; + printf (_(" and Line by %s to %d\n"), + dwarf_vmatoa ("d", adv), state_machine_regs.line); + if (is_logical) + append_logical (); + state_machine_regs.discriminator = 0; + } + else + { + switch (op_code) + { + case DW_LNS_extended_op: + data += process_extended_line_op (data, linfo->li_default_is_stmt, + end, is_logical); + break; + + case DW_LNS_copy: + printf (_(" Copy\n")); + if (is_logical) + append_logical (); + state_machine_regs.discriminator = 0; + break; + + case DW_LNS_advance_pc: + uladv = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + if (linfo->li_max_ops_per_insn == 1) + { + uladv *= linfo->li_min_insn_length; + state_machine_regs.address += uladv; + printf (_(" Advance PC by %s to 0x%s\n"), + dwarf_vmatoa ("u", uladv), + dwarf_vmatoa ("x", state_machine_regs.address)); + } + else + { + state_machine_regs.address + += ((state_machine_regs.op_index + uladv) + / linfo->li_max_ops_per_insn) + * linfo->li_min_insn_length; + state_machine_regs.op_index + = (state_machine_regs.op_index + uladv) + % linfo->li_max_ops_per_insn; + printf (_(" Advance PC by %s to 0x%s[%d]\n"), + dwarf_vmatoa ("u", uladv), + dwarf_vmatoa ("x", state_machine_regs.address), + state_machine_regs.op_index); + } + break; + + case DW_LNS_advance_line: + adv = read_sleb128 (data, & bytes_read, end); + data += bytes_read; + state_machine_regs.line += adv; + printf (_(" Advance Line by %s to %d\n"), + dwarf_vmatoa ("d", adv), + state_machine_regs.line); + break; + + case DW_LNS_set_file: + adv = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + printf (_(" Set File Name to entry %s in the File Name Table\n"), + dwarf_vmatoa ("d", adv)); + state_machine_regs.file = adv; + break; + + case DW_LNS_set_column: + uladv = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + printf (_(" Set column to %s\n"), + dwarf_vmatoa ("u", uladv)); + state_machine_regs.column = uladv; + break; + + case DW_LNS_negate_stmt: + adv = state_machine_regs.is_stmt; + adv = ! adv; + printf (_(" Set is_stmt to %s\n"), dwarf_vmatoa ("d", adv)); + state_machine_regs.is_stmt = adv; + break; + + case DW_LNS_set_basic_block: + printf (_(" Set basic block\n")); + state_machine_regs.basic_block = 1; + break; + + case DW_LNS_const_add_pc: + uladv = ((255 - linfo->li_opcode_base) / linfo->li_line_range); + if (linfo->li_max_ops_per_insn) + { + uladv *= linfo->li_min_insn_length; + state_machine_regs.address += uladv; + printf (_(" Advance PC by constant %s to 0x%s\n"), + dwarf_vmatoa ("u", uladv), + dwarf_vmatoa ("x", state_machine_regs.address)); + } + else + { + state_machine_regs.address + += ((state_machine_regs.op_index + uladv) + / linfo->li_max_ops_per_insn) + * linfo->li_min_insn_length; + state_machine_regs.op_index + = (state_machine_regs.op_index + uladv) + % linfo->li_max_ops_per_insn; + printf (_(" Advance PC by constant %s to 0x%s[%d]\n"), + dwarf_vmatoa ("u", uladv), + dwarf_vmatoa ("x", state_machine_regs.address), + state_machine_regs.op_index); + } + break; + + case DW_LNS_fixed_advance_pc: + SAFE_BYTE_GET_AND_INC (uladv, data, 2, end); + state_machine_regs.address += uladv; + state_machine_regs.op_index = 0; + printf (_(" Advance PC by fixed size amount %s to 0x%s\n"), + dwarf_vmatoa ("u", uladv), + dwarf_vmatoa ("x", state_machine_regs.address)); + break; + + case DW_LNS_set_prologue_end: + printf (_(" Set prologue_end to true\n")); + break; + + case DW_LNS_set_epilogue_begin: + printf (_(" Set epilogue_begin to true\n")); + break; + + case DW_LNS_set_isa: + uladv = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + printf (_(" Set ISA to %s\n"), dwarf_vmatoa ("u", uladv)); + break; + + case DW_LNS_set_subprogram: + /* This opcode is aliased with: */ + /* case DW_LNS_set_address_from_logical: */ + if (is_logical) + { + /* DW_LNS_set_subprogram */ + state_machine_regs.context = 0; + state_machine_regs.subprogram = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + printf (_(" Set subprogram to %u and reset context to 0\n"), + state_machine_regs.subprogram); + } + else + { + /* DW_LNS_set_address_from_logical */ + adv = read_sleb128 (data, & bytes_read, end); + data += bytes_read; + state_machine_regs.line += adv; + logical = state_machine_regs.line; + if (logical - 1 < logicals_count) + { + state_machine_regs.address = logicals_table[logical - 1].address; + state_machine_regs.op_index = logicals_table[logical - 1].op_index; + } + else + warn (_("Logical row number outside range of logicals table\n")); + printf (_(" Advance Line by %s to %u and set address from logical to 0x%s[%u]\n"), + dwarf_vmatoa ("d", adv), + logical, + dwarf_vmatoa ("x", state_machine_regs.address), + state_machine_regs.op_index); + } + break; + + case DW_LNS_inlined_call: + adv = read_sleb128 (data, & bytes_read, end); + data += bytes_read; + state_machine_regs.context = logicals_count + adv; + state_machine_regs.subprogram = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + printf (_(" Set context to %u and subprogram to %u\n"), + state_machine_regs.context, + state_machine_regs.subprogram); + break; + + case DW_LNS_pop_context: + logical = state_machine_regs.context; + printf (_(" Pop context to logical %u\n"), logical); + if (logical - 1 < logicals_count) + { + state_machine_regs.file = logicals_table[logical - 1].file; + state_machine_regs.line = logicals_table[logical - 1].line; + state_machine_regs.column = logicals_table[logical - 1].column; + state_machine_regs.discriminator = logicals_table[logical - 1].discriminator; + state_machine_regs.is_stmt = logicals_table[logical - 1].is_stmt; + state_machine_regs.context = logicals_table[logical - 1].context; + state_machine_regs.subprogram = logicals_table[logical - 1].subprogram; + } + else + warn (_("Context register outside range of logicals table\n")); + break; + + default: + printf (_(" Unknown opcode %d with operands: "), op_code); + + if (standard_opcodes != NULL) + for (i = standard_opcodes[op_code - 1]; i > 0 ; --i) + { + printf ("0x%s%s", dwarf_vmatoa ("x", read_uleb128 (data, + &bytes_read, end)), + i == 1 ? "" : ", "); + data += bytes_read; + } + putchar ('\n'); + break; + } + } + } + + putchar ('\n'); + *pdata = data; +} + static int display_debug_lines_raw (struct dwarf_section *section, unsigned char *data, unsigned char *end) { unsigned char *start = section->start; + unsigned int initial_length_size; + unsigned int offset_size; printf (_("Raw dump of debug contents of section %s:\n\n"), section->name); @@ -2720,10 +3279,15 @@ display_debug_lines_raw (struct dwarf_section *section, { static DWARF2_Internal_LineInfo saved_linfo; DWARF2_Internal_LineInfo linfo; + unsigned int logicals_table_offset = 0; + unsigned int actuals_table_offset = 0; + unsigned char *end_of_header_length; unsigned char *standard_opcodes; + unsigned char *start_of_line_program; + unsigned char *end_of_logicals; unsigned char *end_of_sequence; - unsigned int last_dir_entry = 0; int i; + unsigned char *hdrptr = NULL; if (const_strneq (section->name, ".debug_line.") /* Note: the following does not apply to .debug_line.dwo sections. @@ -2740,22 +3304,30 @@ display_debug_lines_raw (struct dwarf_section *section, Since the section is a fragment it does not have the details needed to fill out a LineInfo structure, so instead we use the details from the last full debug_line section that we processed. */ + start_of_line_program = data; end_of_sequence = end; + end_of_logicals = end; standard_opcodes = NULL; linfo = saved_linfo; reset_state_machine (linfo.li_default_is_stmt); } else { - unsigned char * hdrptr; - if ((hdrptr = read_debug_line_header (section, data, end, & linfo, - & end_of_sequence)) == NULL) + & end_of_sequence, + & initial_length_size, + & offset_size)) == NULL) return 0; printf (_(" Offset: 0x%lx\n"), (long)(data - start)); printf (_(" Length: %ld\n"), (long) linfo.li_length); printf (_(" DWARF Version: %d\n"), linfo.li_version); + if (linfo.li_version >= 5 + && linfo.li_version != DWARF2_LINE_EXPERIMENTAL_VERSION) + { + printf (_(" Address Size: %u\n"), linfo.li_address_size); + printf (_(" Segment Size: %u\n"), linfo.li_segment_size); + } printf (_(" Prologue Length: %d\n"), linfo.li_prologue_length); printf (_(" Minimum Instruction Length: %d\n"), linfo.li_min_insn_length); if (linfo.li_version >= 4) @@ -2765,6 +3337,13 @@ display_debug_lines_raw (struct dwarf_section *section, printf (_(" Line Range: %d\n"), linfo.li_line_range); printf (_(" Opcode Base: %d\n"), linfo.li_opcode_base); + end_of_header_length = data + initial_length_size + 2 + offset_size; + if (linfo.li_version >= 5 + && linfo.li_version != DWARF2_LINE_EXPERIMENTAL_VERSION) + end_of_header_length += 2; + start_of_line_program = end_of_header_length + linfo.li_prologue_length; + end_of_logicals = end; + reset_state_machine (linfo.li_default_is_stmt); /* Display the contents of the Opcodes table. */ @@ -2775,261 +3354,100 @@ display_debug_lines_raw (struct dwarf_section *section, for (i = 1; i < linfo.li_opcode_base; i++) printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]); - /* Display the contents of the Directory table. */ data = standard_opcodes + linfo.li_opcode_base - 1; - if (*data == 0) - printf (_("\n The Directory Table is empty.\n")); - else + if (linfo.li_version == DWARF2_LINE_EXPERIMENTAL_VERSION) { - printf (_("\n The Directory Table (offset 0x%lx):\n"), - (long)(data - start)); + /* Skip the fake directory and filename table. */ + data += 2; - while (*data != 0) - { - printf (" %d\t%s\n", ++last_dir_entry, data); + /* Skip the fake extended opcode that wraps the rest + of the section. */ + data += 5; - data += strnlen ((char *) data, end - data) + 1; - } - } + /* Read the logicals table offset and actuals table offset. */ + SAFE_BYTE_GET_AND_INC (logicals_table_offset, data, offset_size, end); + SAFE_BYTE_GET_AND_INC (actuals_table_offset, data, offset_size, end); - /* Skip the NUL at the end of the table. */ - data++; + start_of_line_program = end_of_header_length + logicals_table_offset; - /* Display the contents of the File Name table. */ - if (*data == 0) - printf (_("\n The File Name Table is empty.\n")); - else - { - printf (_("\n The File Name Table (offset 0x%lx):\n"), - (long)(data - start)); - printf (_(" Entry\tDir\tTime\tSize\tName\n")); + if (actuals_table_offset > 0) + end_of_logicals = end_of_header_length + actuals_table_offset; - while (*data != 0) - { - unsigned char *name; - unsigned int bytes_read; + putchar ('\n'); + printf (_(" Logicals Table Offset: 0x%x\n"), logicals_table_offset); + printf (_(" Actuals Table Offset: 0x%x\n"), actuals_table_offset); + } - printf (" %d\t", ++state_machine_regs.last_file_entry); - name = data; - data += strnlen ((char *) data, end - data) + 1; + /* Display the contents of the Directory table. */ + if (linfo.li_version >= 5) + display_dir_file_table_v5 (start, end, &data, _("Directory"), + offset_size); + else + display_directory_table_v4 (start, end, &data); - printf ("%s\t", - dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); - data += bytes_read; - printf ("%s\t", - dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); - data += bytes_read; - printf ("%s\t", - dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); - data += bytes_read; - printf ("%s\n", name); + /* PR 17512: file: 002-132094-0.004. */ + if (data >= end - 1) + break; - if (data == end) - { - warn (_("Corrupt file name table entry\n")); - break; - } - } + /* Display the contents of the File Name table. */ + if (linfo.li_version >= 5) + { + unsigned int count; + + count = display_dir_file_table_v5 (start, end, &data, + _("File Name"), offset_size); + state_machine_regs.last_file_entry = count - 1; } + else + display_file_name_table_v4 (start, end, &data); + + /* Display the contents of the Subprogram table. */ + if (linfo.li_version == DWARF2_LINE_EXPERIMENTAL_VERSION) + display_dir_file_table_v5 (start, end, &data, _("Subprogram"), + offset_size); - /* Skip the NUL at the end of the table. */ - data++; putchar ('\n'); saved_linfo = linfo; } - /* Now display the statements. */ - if (data >= end_of_sequence) - printf (_(" No Line Number Statements.\n")); - else - { - printf (_(" Line Number Statements:\n")); + if (data > start_of_line_program) + warn (_("Line table header is longer than header_length indicates\n")); + else if (data < start_of_line_program) + warn (_("Line table header is shorter than header_length indicates\n")); + data = start_of_line_program; - while (data < end_of_sequence) + if (linfo.li_version == DWARF2_LINE_EXPERIMENTAL_VERSION + && hdrptr != NULL + && actuals_table_offset > 0) + { + if (end_of_logicals > end) { - unsigned char op_code; - dwarf_signed_vma adv; - dwarf_vma uladv; - unsigned int bytes_read; - - printf (" [0x%08lx]", (long)(data - start)); - - op_code = *data++; - - if (op_code >= linfo.li_opcode_base) - { - op_code -= linfo.li_opcode_base; - uladv = (op_code / linfo.li_line_range); - if (linfo.li_max_ops_per_insn == 1) - { - uladv *= linfo.li_min_insn_length; - state_machine_regs.address += uladv; - printf (_(" Special opcode %d: " - "advance Address by %s to 0x%s"), - op_code, dwarf_vmatoa ("u", uladv), - dwarf_vmatoa ("x", state_machine_regs.address)); - } - else - { - state_machine_regs.address - += ((state_machine_regs.op_index + uladv) - / linfo.li_max_ops_per_insn) - * linfo.li_min_insn_length; - state_machine_regs.op_index - = (state_machine_regs.op_index + uladv) - % linfo.li_max_ops_per_insn; - printf (_(" Special opcode %d: " - "advance Address by %s to 0x%s[%d]"), - op_code, dwarf_vmatoa ("u", uladv), - dwarf_vmatoa ("x", state_machine_regs.address), - state_machine_regs.op_index); - } - adv = (op_code % linfo.li_line_range) + linfo.li_line_base; - state_machine_regs.line += adv; - printf (_(" and Line by %s to %d\n"), - dwarf_vmatoa ("d", adv), state_machine_regs.line); - } - else switch (op_code) - { - case DW_LNS_extended_op: - data += process_extended_line_op (data, linfo.li_default_is_stmt, end); - break; - - case DW_LNS_copy: - printf (_(" Copy\n")); - break; - - case DW_LNS_advance_pc: - uladv = read_uleb128 (data, & bytes_read, end); - data += bytes_read; - if (linfo.li_max_ops_per_insn == 1) - { - uladv *= linfo.li_min_insn_length; - state_machine_regs.address += uladv; - printf (_(" Advance PC by %s to 0x%s\n"), - dwarf_vmatoa ("u", uladv), - dwarf_vmatoa ("x", state_machine_regs.address)); - } - else - { - state_machine_regs.address - += ((state_machine_regs.op_index + uladv) - / linfo.li_max_ops_per_insn) - * linfo.li_min_insn_length; - state_machine_regs.op_index - = (state_machine_regs.op_index + uladv) - % linfo.li_max_ops_per_insn; - printf (_(" Advance PC by %s to 0x%s[%d]\n"), - dwarf_vmatoa ("u", uladv), - dwarf_vmatoa ("x", state_machine_regs.address), - state_machine_regs.op_index); - } - break; - - case DW_LNS_advance_line: - adv = read_sleb128 (data, & bytes_read, end); - data += bytes_read; - state_machine_regs.line += adv; - printf (_(" Advance Line by %s to %d\n"), - dwarf_vmatoa ("d", adv), - state_machine_regs.line); - break; - - case DW_LNS_set_file: - adv = read_uleb128 (data, & bytes_read, end); - data += bytes_read; - printf (_(" Set File Name to entry %s in the File Name Table\n"), - dwarf_vmatoa ("d", adv)); - state_machine_regs.file = adv; - break; - - case DW_LNS_set_column: - uladv = read_uleb128 (data, & bytes_read, end); - data += bytes_read; - printf (_(" Set column to %s\n"), - dwarf_vmatoa ("u", uladv)); - state_machine_regs.column = uladv; - break; - - case DW_LNS_negate_stmt: - adv = state_machine_regs.is_stmt; - adv = ! adv; - printf (_(" Set is_stmt to %s\n"), dwarf_vmatoa ("d", adv)); - state_machine_regs.is_stmt = adv; - break; - - case DW_LNS_set_basic_block: - printf (_(" Set basic block\n")); - state_machine_regs.basic_block = 1; - break; - - case DW_LNS_const_add_pc: - uladv = ((255 - linfo.li_opcode_base) / linfo.li_line_range); - if (linfo.li_max_ops_per_insn) - { - uladv *= linfo.li_min_insn_length; - state_machine_regs.address += uladv; - printf (_(" Advance PC by constant %s to 0x%s\n"), - dwarf_vmatoa ("u", uladv), - dwarf_vmatoa ("x", state_machine_regs.address)); - } - else - { - state_machine_regs.address - += ((state_machine_regs.op_index + uladv) - / linfo.li_max_ops_per_insn) - * linfo.li_min_insn_length; - state_machine_regs.op_index - = (state_machine_regs.op_index + uladv) - % linfo.li_max_ops_per_insn; - printf (_(" Advance PC by constant %s to 0x%s[%d]\n"), - dwarf_vmatoa ("u", uladv), - dwarf_vmatoa ("x", state_machine_regs.address), - state_machine_regs.op_index); - } - break; - - case DW_LNS_fixed_advance_pc: - SAFE_BYTE_GET_AND_INC (uladv, data, 2, end); - state_machine_regs.address += uladv; - state_machine_regs.op_index = 0; - printf (_(" Advance PC by fixed size amount %s to 0x%s\n"), - dwarf_vmatoa ("u", uladv), - dwarf_vmatoa ("x", state_machine_regs.address)); - break; - - case DW_LNS_set_prologue_end: - printf (_(" Set prologue_end to true\n")); - break; - - case DW_LNS_set_epilogue_begin: - printf (_(" Set epilogue_begin to true\n")); - break; - - case DW_LNS_set_isa: - uladv = read_uleb128 (data, & bytes_read, end); - data += bytes_read; - printf (_(" Set ISA to %s\n"), dwarf_vmatoa ("u", uladv)); - break; - - default: - printf (_(" Unknown opcode %d with operands: "), op_code); - - if (standard_opcodes != NULL) - for (i = standard_opcodes[op_code - 1]; i > 0 ; --i) - { - printf ("0x%s%s", dwarf_vmatoa ("x", read_uleb128 (data, - &bytes_read, end)), - i == 1 ? "" : ", "); - data += bytes_read; - } - putchar ('\n'); - break; - } + warn (_("Actuals table offset %s extends beyond end of section\n"), + dwarf_vmatoa ("u", actuals_table_offset)); + end_of_logicals = end; } - putchar ('\n'); - } + display_line_program (start, end_of_logicals, &data, + _("Logicals Statements"), + &linfo, standard_opcodes, 1); + if (data > end_of_logicals) + warn (_("Logicals table is longer than actuals_table_offset indicates\n")); + else if (data < end_of_logicals) + warn (_("Line table header is shorter than actuals_table_offset indicates\n")); + data = end_of_logicals; + reset_state_machine (linfo.li_default_is_stmt); + display_line_program (start, end_of_sequence, &data, + _("Actuals Statements"), + &linfo, standard_opcodes, 0); + free_logicals (); + } + else + { + display_line_program (start, end_of_sequence, &data, + _("Line Number Statements"), + &linfo, standard_opcodes, 0); + } + } return 1; @@ -3051,6 +3469,8 @@ display_debug_lines_decoded (struct dwarf_section *section, unsigned char *end) { static DWARF2_Internal_LineInfo saved_linfo; + unsigned int initial_length_size; + unsigned int offset_size; printf (_("Decoded dump of debug contents of section %s:\n\n"), section->name); @@ -3083,7 +3503,9 @@ display_debug_lines_decoded (struct dwarf_section *section, unsigned char *hdrptr; if ((hdrptr = read_debug_line_header (section, data, end, & linfo, - & end_of_sequence)) == NULL) + & end_of_sequence, + & initial_length_size, + & offset_size)) == NULL) return 0; reset_state_machine (linfo.li_default_is_stmt); @@ -3501,7 +3923,7 @@ display_debug_lines_decoded (struct dwarf_section *section, } static int -display_debug_lines (struct dwarf_section *section, void *file ATTRIBUTE_UNUSED) +display_debug_lines (struct dwarf_section *section, void *file) { unsigned char *data = section->start; unsigned char *end = data + section->size; @@ -3511,6 +3933,8 @@ display_debug_lines (struct dwarf_section *section, void *file ATTRIBUTE_UNUSED) if (do_debug_lines == 0) do_debug_lines |= FLAG_DEBUG_LINES_RAW; + load_debug_section (line_str, file); + if (do_debug_lines & FLAG_DEBUG_LINES_RAW) retValRaw = display_debug_lines_raw (section, data, end); @@ -7045,6 +7469,8 @@ struct dwarf_section_display debug_displays[] = display_debug_macro, &do_debug_macinfo, 1 }, { { ".debug_str", ".zdebug_str", NULL, NULL, 0, 0, 0 }, display_debug_str, &do_debug_str, 0 }, + { { ".debug_line_str", ".zdebug_line_str", NULL, NULL, 0, 0, 0 }, + display_debug_str, &do_debug_str, 0 }, { { ".debug_loc", ".zdebug_loc", NULL, NULL, 0, 0, 0 }, display_debug_loc, &do_debug_loc, 1 }, { { ".debug_pubtypes", ".zdebug_pubtypes", NULL, NULL, 0, 0, 0 }, diff --git a/binutils-2.25/binutils/dwarf.h b/binutils-2.25/binutils/dwarf.h index 124d9d6d..2a710836 100644 --- a/binutils-2.25/binutils/dwarf.h +++ b/binutils-2.25/binutils/dwarf.h @@ -40,6 +40,8 @@ typedef struct { dwarf_vma li_length; unsigned short li_version; + unsigned char li_address_size; + unsigned char li_segment_size; unsigned int li_prologue_length; unsigned char li_min_insn_length; unsigned char li_max_ops_per_insn; @@ -123,6 +125,7 @@ enum dwarf_section_display_enum macinfo, macro, str, + line_str, loc, pubtypes, gnu_pubtypes, diff --git a/binutils-2.25/binutils/readelf.c b/binutils-2.25/binutils/readelf.c index d630684b..83518c75 100644 --- a/binutils-2.25/binutils/readelf.c +++ b/binutils-2.25/binutils/readelf.c @@ -5319,6 +5319,7 @@ process_section_headers (FILE * file) || (do_debug_macinfo && const_strneq (name, "macinfo")) || (do_debug_macinfo && const_strneq (name, "macro")) || (do_debug_str && const_strneq (name, "str")) + || (do_debug_str && const_strneq (name, "line_str")) || (do_debug_loc && const_strneq (name, "loc")) || (do_debug_addr && const_strneq (name, "addr")) || (do_debug_cu_index && const_strneq (name, "cu_index")) @@ -11903,7 +11904,7 @@ static const char * arm_attr_tag_ABI_enum_size[] = static const char * arm_attr_tag_ABI_HardFP_use[] = {"As Tag_FP_arch", "SP only", "DP only", "SP and DP"}; static const char * arm_attr_tag_ABI_VFP_args[] = - {"AAPCS", "VFP registers", "custom"}; + {"AAPCS", "VFP registers", "custom", "compatible"}; static const char * arm_attr_tag_ABI_WMMX_args[] = {"AAPCS", "WMMX registers", "custom"}; static const char * arm_attr_tag_ABI_optimization_goals[] = @@ -13162,6 +13163,9 @@ print_mips_isa_ext (unsigned int isa_ext) case AFL_EXT_XLR: fputs ("RMI XLR", stdout); break; + case AFL_EXT_OCTEON3: + fputs ("Cavium Networks Octeon3", stdout); + break; case AFL_EXT_OCTEON2: fputs ("Cavium Networks Octeon2", stdout); break; |