deliverable/binutils-gdb.git
9 years agoMore fixes for invalid memory accesses, uncovered by valgrind and binary fuzzers.
Nick Clifton [Tue, 11 Nov 2014 15:34:27 +0000 (15:34 +0000)] 
More fixes for invalid memory accesses, uncovered by valgrind and binary fuzzers.

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Initialise the parts of the
line number cache that would not be initialised by the copy from
the new line number table.
(coff_classify_symbol): Allow for _bfd_coff_internal_syment_name
returning NULL.
* coffgen.c (coff_get_normalized_symbols): Get the external
symbols before allocating space for the internal symbols, in case
the get fails.
* elf.c (_bfd_elf_slurp_version_tables): Only allocate a verref
array if one is needed.  Likewise with the verdef array.
* peXXigen.c (_bfd_XXi_swap_sym_in): Replace abort()'s with error
messages.
(_bfd_XXi_swap_aux_in): Make sure that all fields of the aux
structure are initialised.
(pe_print_edata): Avoid reading off the end of the data buffer.

9 years agoWarn users about mismatched PID namespaces
Daniel Colascione [Tue, 11 Nov 2014 14:18:23 +0000 (14:18 +0000)] 
Warn users about mismatched PID namespaces

Linux supports multiple "PID namespaces".  Processes in different PID
namespaces have different views of the system process list.  Sometimes,
a single process can appear in more than one PID namespace, but with a
different PID in each.  When GDB and its target are in different PID
namespaces, various features can break due to the mismatch between
what the target believes its PID to be and what GDB believes its PID
to be.  The most visible broken functionality is thread enumeration
silently failing.

This patch explicitly warns users against trying to debug across PID
namespaces.

The patch introduced no new failures in my test suite run on an x86_64
installation of Ubuntu 14.10.  It doesn't include a test: writing an
automated test that exercises this code would be very involved because
CLONE_NEWNS requires CAP_SYS_ADMIN; the easier way to reproduce the
problem is to start a new lxc container.

gdb/
2014-11-11  Daniel Colascione  <dancol@dancol.org>

Warn about cross-PID-namespace debugging.
* nat/linux-procfs.h (linux_proc_pid_get_ns): New prototype.
* nat/linux-procfs.c (linux_proc_pid_get_ns): New function.
* linux-thread-db.c (check_pid_namespace_match): New function.
(thread_db_inferior_created): Call it.

9 years agocoff coff
Alan Modra [Tue, 11 Nov 2014 12:12:03 +0000 (22:42 +1030)] 
coff coff

I missed this use of the loop induction variable outside the loop.

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Use updated lineno_count
when building func_table.

9 years agoAvoid coff OOM
Alan Modra [Tue, 11 Nov 2014 11:06:37 +0000 (21:36 +1030)] 
Avoid coff OOM

bfd_zalloc/bfd_zmalloc to fix uninitialized memory reads is too big a
hammer, when the size allocated depends on user input.  A typical
bfd_alloc, bfd_seek, bfd_bread sequence will give an error or warning
at the point the file read fails when some enormous item as described
by headers is not actually present in the file.  Nice operating system
allow memory overcommit.  But not if you write to the memory.  So
bfd_zalloc can cause an OOM, thrashing, or system hangs.

The patch also fixes a recently introduced endless loop on bad input.

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Don't bfd_zalloc, just
memset the particular bits we need.  Update src after hitting loop
"continue".  Don't count lineno omitted due to invalid symbols in
nbr_func, and update lineno_count.  Init entire terminating
lineno.  Don't both allocating terminator in n_lineno_cache.
Redirect sym->lineno pointer to where n_lineno_cache will be
copied, and free n_lineno_cache.
* pe-mips.c (NUM_HOWTOS): Typo fix.

9 years agold -r abort in _bfd_elf_write_section_eh_frame
Alan Modra [Tue, 11 Nov 2014 09:43:03 +0000 (20:13 +1030)] 
ld -r abort in _bfd_elf_write_section_eh_frame

Turning on .eh_frame processing for ld -r resulted in systemtap
tickling a ld bug.  Triggered by the zero terminator not being added
to .eh_frame in a separate file as it usually is (crtend.o), but
instead being present in the last .eh_frame section along with CIEs
and FDEs.  The 4-byte terminator makes the section size check fail
on 64-bit targets.

* elf-eh-frame (_bfd_elf_write_section_eh_frame): Adjust section
size check to account for possible zero terminator.

9 years agosymmisc.c: Remove trailing whitespace.
Doug Evans [Tue, 11 Nov 2014 01:19:57 +0000 (17:19 -0800)] 
symmisc.c: Remove trailing whitespace.

gdb/ChangeLog:

* symmisc.c (print_objfile_statistics): Remove trailing whitespace.
(maintenance_info_symtabs, maintenance_check_symtabs): Ditto.

9 years agosource.c (select_source_symtab): Rewrite to use ALL_SYMTABS.
Doug Evans [Tue, 11 Nov 2014 00:49:44 +0000 (16:49 -0800)] 
source.c (select_source_symtab): Rewrite to use ALL_SYMTABS.

gdb/ChangeLog:

* source.c (select_source_symtab): Rewrite to use ALL_SYMTABS.

9 years agoPR 17564: Fix objfile search order for static symbols.
Doug Evans [Mon, 10 Nov 2014 23:48:49 +0000 (15:48 -0800)] 
PR 17564: Fix objfile search order for static symbols.

When searching static symbols, gdb would search over all
expanded symtabs of all objfiles, and if that fails only then
would it search all partial/gdb_index tables of all objfiles.
This means that the user could get a random instance of the
symbol depending on what symtabs have been previously expanded.
Now the search is consistent, searching each objfile completely
before proceeding to the next one.

gdb/ChangeLog:

PR symtab/17564
* symtab.c (lookup_symbol_in_all_objfiles): Delete.
(lookup_static_symbol): Move definition to new location and rewrite.
(lookup_symbol_in_objfile): New function.
(lookup_symbol_global_iterator_cb): Call it.

gdb/testsuite/ChangeLog:

PR symtab/17564
* gdb.base/symtab-search-order.exp: New file.
* gdb.base/symtab-search-order.c: New file.
* gdb.base/symtab-search-order-1.c: New file.
* gdb.base/symtab-search-order-shlib-1.c: New file.

9 years agodaily update
Alan Modra [Mon, 10 Nov 2014 23:00:33 +0000 (09:30 +1030)] 
daily update

9 years agobfd/
Richard Sandiford [Mon, 10 Nov 2014 20:49:49 +0000 (20:49 +0000)] 
bfd/
2014-11-10  James Cowgill  <James.Cowgill@imgtec.com>

* elfxx-mips.c (_bfd_mips_elf_section_processing): don't force small
data sections to be PROGBITS

9 years agoMore fixes for assertion failures and out-of-bounds reads by readelf.
Nick Clifton [Mon, 10 Nov 2014 16:32:32 +0000 (16:32 +0000)] 
More fixes for assertion failures and out-of-bounds reads by readelf.

PR binutils/17531
* (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.
(dump_section_as_strings): Add more string range checking.
(display_tag_value): Likewise.
(display_arm_attribute): Likewise.
(display_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_msp430x_attribute): Likewise.

9 years agoFix objcopy and strip so that they remove their temporary files even if an error...
Nick Clifton [Mon, 10 Nov 2014 14:28:43 +0000 (14:28 +0000)] 
Fix objcopy and strip so that they remove their temporary files even if an error occurs.

PR binutils/17552
* (copy_archive): Clean up temporary files even if an error
occurs.

9 years agoMore fixes for problems exposed by valgrind and the address sanitizer
Nick Clifton [Mon, 10 Nov 2014 14:18:45 +0000 (14:18 +0000)] 
More fixes for problems exposed by valgrind and the address sanitizer
when displaying the contents of corrupt files.

PR binutils/17521
* coff-i386.c (NUM_HOWTOS): New define.
(RTYPE2HOWTO): Use it.
(coff_i386_rtype_to_howto): Likewise.
(coff_i386_reloc_name_lookup): Likewise.
(CALC_ADDEND): Check that reloc r_type field is valid.
* coff-x86_64.c (NUM_HOWTOS): New define.
(RTYPE2HOWTO): Use it.
(coff_amd64_rtype_to_howto): Likewise.
(coff_amd64_reloc_name_lookup): Likewise.
(CALC_ADDEND): Check that reloc r_type field is valid.
* coffcode.h (coff_slurp_line_table): Check for symbol table
indexing underflow.
(coff_slurp_symbol_table): Use zalloc to ensure that all table
entries are initialised.
* coffgen.c (_bfd_coff_read_string_table): Initialise unused bits
in the string table.  Also ensure that the table is 0 terminated.
(coff_get_normalized_symtab): Check for symbol table indexing
underflow.
* opncls.c (bfd_alloc): Catch the case where a small negative size
can result in only 1 byte being allocated.
(bfd_alloc2): Use bfd_alloc.
* pe-mips.c (NUM_HOWTOS): New define.
(coff_mips_reloc_name_lookup): Use it.
(CALC_ADDEND): Check that reloc r_type field is valid.
* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Initialise unused entries
in the DataDirectory.
(pe_print_idata): Avoid reading beyond the end of the data block
wen printing strings.
(pe_print_edata): Likewise.
Check for table indexing underflow.
* peicode.h (pe_mkobject): Initialise the pe_opthdr field.
(pe_bfd_object_p): Allocate and initialize enough space to hold a
PEAOUTHDR, even if the opt_hdr field specified less.

9 years agoWork around GCC bug 63748
Ulrich Weigand [Mon, 10 Nov 2014 14:11:44 +0000 (15:11 +0100)] 
Work around GCC bug 63748

A recent change to eval.c triggered a GCC bug that causes a false positive
"may be used uninitialized" warning in evaluate_subexp_standard.  This seems
to be triggered by a specific CFG constructed via setjmp and gotos.

While the GCC bug is in the process of being fixed, there are released
compiler versions (in particular GCC 4.9) in the field that show this
problem.  In order to allow compiling GDB with one of those compilers,
this commit slightly reworks the CFG (in an equivalent way) of the
affected function, so that the GCC bug is no longer triggered.

gdb/ChangeLog:

* eval.c (evaluate_subexp_standard): Work around GCC bug 63748.

9 years agodaily update
Alan Modra [Sun, 9 Nov 2014 23:00:31 +0000 (09:30 +1030)] 
daily update

9 years agodaily update
Alan Modra [Sat, 8 Nov 2014 23:00:33 +0000 (09:30 +1030)] 
daily update

9 years agoCorrect buffer overrun test
Alan Modra [Sat, 8 Nov 2014 01:42:08 +0000 (12:12 +1030)] 
Correct buffer overrun test

* peXXigen.c (pe_print_idata): Revert last patch, cast lhs instead.

9 years agoFix a typo in gas/ChangeLog
H.J. Lu [Sat, 8 Nov 2014 01:47:54 +0000 (17:47 -0800)] 
Fix a typo in gas/ChangeLog

9 years agoFix race condition when using --threads with linker plugins.
Evgeniy Dushistov [Sat, 8 Nov 2014 00:12:58 +0000 (16:12 -0800)] 
Fix race condition when using --threads with linker plugins.

2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>

gold/
* plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
* plugin.h: add lock definition

9 years agodaily update
Alan Modra [Fri, 7 Nov 2014 23:01:06 +0000 (09:31 +1030)] 
daily update

9 years agoCast time value to unsigned long to print
H.J. Lu [Fri, 7 Nov 2014 21:41:02 +0000 (13:41 -0800)] 
Cast time value to unsigned long to print

* readelf.c (process_dynamic_section): Cast time value to unsigned
long to print.

9 years agoCast to unsigned long in range checks
H.J. Lu [Fri, 7 Nov 2014 21:39:15 +0000 (13:39 -0800)] 
Cast to unsigned long in range checks

* peXXigen.c (pe_print_idata): Cast to unsigned long in range
checks.

9 years agoX32: Add REX prefix to encode R_X86_64_GOTTPOFF
H.J. Lu [Fri, 7 Nov 2014 20:22:53 +0000 (12:22 -0800)] 
X32: Add REX prefix to encode R_X86_64_GOTTPOFF

Structions with R_X86_64_GOTTPOFF relocation must be encoded with REX
prefix even if it isn't required by destination register.  Otherwise
linker can't safely perform IE -> LE optimization.

bfd/

PR ld/17482
* elf64-x86-64.c (elf_x86_64_relocate_section): Update comments
for IE->LE transition.

gas/

PR ld/17482
* config/tc-i386.c (output_insn): Add a dummy REX_OPCODE prefix
for structions with R_X86_64_GOTTPOFF relocation for x32 if needed.

gas/testsuite/

PR ld/17482
* gas/i386/ilp32/x32-tls.d: New file.
* gas/i386/ilp32/x32-tls.s: Likewise.

ld/testsuite/

PR ld/17482
* ld-x86-64/tlsie4.dd: Updated.

9 years agogdb.base/sigstep.exp: xfail gdb/17511 on i?86 Linux
Pedro Alves [Fri, 7 Nov 2014 15:20:47 +0000 (15:20 +0000)] 
gdb.base/sigstep.exp: xfail gdb/17511 on i?86 Linux

Running gdb.base/sigstep.exp with --target=i686-pc-linux-gnu on a
64-bit kernel naturally trips on PR gdb/17511 as well, given this is a
kernel bug.

I haven't really tested a real 32-bit kernel/machine, but given the
code in question in the kernel is shared between 32-bit and 64-bit,
I'm quite sure the bug triggers in those cases as well.

So, simply xfail i?86-*-linux* too.

gdb/testsuite/
2014-11-07  Pedro Alves  <palves@redhat.com>

PR gdb/17511
* gdb.base/sigstep.exp (in_handler_map) <si+advance>: xfail
i?86-*-linux*.

9 years agoRevert old nexti prologue check and eliminate in_prologue
Pedro Alves [Fri, 7 Nov 2014 13:53:01 +0000 (13:53 +0000)] 
Revert old nexti prologue check and eliminate in_prologue

The in_prologue check in the nexti code is obsolete; this commit
removes that, and then removes the in_prologue function as nothing
else uses it.

Looking at the code in GDB that makes use in_prologue, all we find is
this one caller:

      if ((ecs->event_thread->control.step_over_calls == STEP_OVER_NONE)
  || ((ecs->event_thread->control.step_range_end == 1)
      && in_prologue (gdbarch, ecs->event_thread->prev_pc,
      ecs->stop_func_start)))
{
  /* I presume that step_over_calls is only 0 when we're
     supposed to be stepping at the assembly language level
     ("stepi").  Just stop.  */
  /* Also, maybe we just did a "nexti" inside a prolog, so we
     thought it was a subroutine call but it was not.  Stop as
     well.  FENN */
  /* And this works the same backward as frontward.  MVS */
  end_stepping_range (ecs);
  return;
}

This was added by:

 commit 100a02e1deec2f037a15cdf232f026dc79763bf8
 ...
     From Fernando Nasser:
     * infrun.c (handle_inferior_event): Handle "nexti" inside function
     prologues.

The mailing list thread is here:

  https://sourceware.org/ml/gdb-patches/2001-01/msg00047.html

Not much discussion there, and no test, but looking at the code around
what was patched in that revision, we see that the checks that detect
whether the program has just stepped into a subroutine didn't rely on
the unwinders at all back then.

From 'git show 100a02e1:gdb/infrun.c':

    if (stop_pc == ecs->stop_func_start         /* Quick test */
        || (in_prologue (stop_pc, ecs->stop_func_start) &&
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            !IN_SOLIB_RETURN_TRAMPOLINE (stop_pc, ecs->stop_func_name))
        || IN_SOLIB_CALL_TRAMPOLINE (stop_pc, ecs->stop_func_name)
        || ecs->stop_func_name == 0)
      {
        /* It's a subroutine call.  */

        if ((step_over_calls == STEP_OVER_NONE)
            || ((step_range_end == 1)
                && in_prologue (prev_pc, ecs->stop_func_start)))
          {
            /* I presume that step_over_calls is only 0 when we're
               supposed to be stepping at the assembly language level
               ("stepi").  Just stop.  */
            /* Also, maybe we just did a "nexti" inside a prolog,
               so we thought it was a subroutine call but it was not.
               Stop as well.  FENN */
            stop_step = 1;
            print_stop_reason (END_STEPPING_RANGE, 0);
            stop_stepping (ecs);
            return;
          }

Stripping the IN_SOLIB_RETURN_TRAMPOLINE checks for simplicity, we had:

    if (stop_pc == ecs->stop_func_start         /* Quick test */
        || in_prologue (stop_pc, ecs->stop_func_start)
        || ecs->stop_func_name == 0)
      {
        /* It's a subroutine call.  */

That is, detecting a subroutine call was based on prologue detection
back then.  So the in_prologue check in the current tree only made
sense back then as it was undoing a bad decision the in_prologue check
that used to exist above did.

Today, the check for a subroutine call relies on frame ids instead,
which are stable throughout the function.  So we can just remove the
in_prologue check for nexti, and the whole in_prologue function along
with it.

Tested on x86_64 Fedora 20, and also by nexti-ing manually a prologue.

gdb/
2014-11-07  Pedro Alves  <palves@redhat.com>

* infrun.c (process_event_stop_test) <subroutine check>: Don't
check if we did a "nexti" inside a prologue.
* symtab.c (in_prologue): Delete function.
* symtab.h (in_prologue): Delete declaration.

9 years agoAdd more fixes for inavlid memory accesses triggered by corrupt files.
Nick Clifton [Fri, 7 Nov 2014 13:39:45 +0000 (13:39 +0000)] 
Add more fixes for inavlid memory accesses triggered by corrupt files.

PR binutils/17531
* readelf.c (get_data): Avoid allocating memory when we know that
the read will fail.
(find_section_by_type): New function.
(get_unwind_section_word): Check for invalid symbol indicies.
Check for invalid reloc types.
(get_32bit_dynamic_section): Add range checks.
(get_64bit_dynamic_section): Add range checks.
(process_dynamic_section): Check for a corrupt time value.
(process_symbol_table): Add range checks.
(dump_section_as_strings): Add string length range checks.
(display_tag_value): Likewise.
(display_arm_attribute): Likewise.
(display_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_msp430x_attribute): Likewise.
(process_mips_specific): Add range check.

9 years agotekhex architecure
Alan Modra [Fri, 7 Nov 2014 10:52:02 +0000 (21:22 +1030)] 
tekhex architecure

is a don't care.

* tekhex.c (tekhex_set_arch_mach): Ignore unknown arch errors.

9 years agotekhex buffer management and symbol types
Alan Modra [Fri, 7 Nov 2014 09:59:43 +0000 (20:29 +1030)] 
tekhex buffer management and symbol types

Dramatically reduces memory consumption and processing time for large
all-zero data segments.  Allows multiple symbol types attached to a
given segment to survive objcopy.

* tekhex.c (CHUNK_SPAN): Define.
(struct data_struct <chunk_init>): Use one byte per span, update
all code accessing this field.
(find_chunk): Add create param, don't create new entry unless set.
(insert_byte): Don't save zeros.
(first_phase): Set section SEC_CODE or SEC_DATA flag depending
on symbol type.  Create an alternate section if both types of
symbol are given.  Attach type '2' and '6' symbols to absolute
section.
(move_section_contents): Fix caching of chunk.  Don't create chunk
when reading, or for writing zeros.
(tekhex_set_section_contents): Don't create initial chunks.
(tekhex_write_object_contents): Use CHUNK_SPAN.

9 years agoaoutx.h tidy
Alan Modra [Fri, 7 Nov 2014 09:48:25 +0000 (20:18 +1030)] 
aoutx.h tidy

Save a multiplication, and any concern that the buffer allocation
might be smaller than the amount read (as it could be if the header
size isn't a multiple of EXTERNAL_NLIST_SIZE).

* aoutx.h (aout_get_external_symbols): Tidy allocation of symbol buffer.

9 years agosymtab.h (lookup_global_symbol): Improve function comment.
Doug Evans [Fri, 7 Nov 2014 07:51:21 +0000 (23:51 -0800)] 
symtab.h (lookup_global_symbol): Improve function comment.

gdb/ChangeLog:

* symtab.h (lookup_global_symbol): Improve function comment.

9 years agoRename lookup_symbol_global to lookup_global_symbol.
Doug Evans [Fri, 7 Nov 2014 07:48:18 +0000 (23:48 -0800)] 
Rename lookup_symbol_global to lookup_global_symbol.

gdb/ChangeLog:

* symtab.c (lookup_global_symbol): Renamed from lookup_symbol_global.
All callers updated.
* symtab.h (lookup_global_symbol): Update decl.
(lookup_static_symbol): Move decl to better location.

9 years agosymtab.c (basic_lookup_symbol_nonlocal): Add comment.
Doug Evans [Fri, 7 Nov 2014 07:34:28 +0000 (23:34 -0800)] 
symtab.c (basic_lookup_symbol_nonlocal): Add comment.

gdb/ChangeLog:

* symtab.c (basic_lookup_symbol_nonlocal): Add comment.

9 years agoRename some "aux" functions.
Doug Evans [Fri, 7 Nov 2014 07:29:49 +0000 (23:29 -0800)] 
Rename some "aux" functions.

"aux" doesn't contribute anything to the name, and it makes the
reader wonder what it's supposed to mean.

gdb/ChangeLog:

* symtab.c (lookup_local_symbol): Renamed from lookup_symbol_aux_local.
All callers updated.
(lookup_symbol_in_all_objfiles): Renamed from
lookup_symbol_aux_symtabs.  All callers updated.
(lookup_symbol_via_quick_fns): Renamed from lookup_symbol_aux_quick.
All callers updated.
(lookup_symbol_in_objfile_symtabs): Renamed from
lookup_symbol_aux_objfile.  All callers updated.

9 years agolookup_symbol_in_block: Renamed from lookup_symbol_aux_block.
Doug Evans [Fri, 7 Nov 2014 07:04:15 +0000 (23:04 -0800)] 
lookup_symbol_in_block: Renamed from lookup_symbol_aux_block.

gdb/ChangeLog:

* symtab.c (lookup_symbol_in_block): Renamed from
lookup_symbol_aux_block.  All callers updated.

9 years agoRename lookup_symbol_static to lookup_symbol_in_static_block,
Doug Evans [Fri, 7 Nov 2014 06:56:46 +0000 (22:56 -0800)] 
Rename lookup_symbol_static to lookup_symbol_in_static_block,
and lookup_static_symbol_aux to lookup_static_symbol.

gdb/ChangeLog:

* symtab.c (lookup_static_symbol): Renamed from
lookup_static_symbol_aux.  All callers updated.
(lookup_symbol_in_static_block): Renamed from lookup_symbol_static.
All callers updated.

9 years agoNew macro ALL_BLOCK_SYMBOLS_WITH_NAME.
Doug Evans [Fri, 7 Nov 2014 06:50:12 +0000 (22:50 -0800)] 
New macro ALL_BLOCK_SYMBOLS_WITH_NAME.

gdb/ChangeLog:

* block.h (ALL_BLOCK_SYMBOLS_WITH_NAME): New macro.
* block.c (block_lookup_symbol): Use it.
* cp-support.c (make_symbol_overload_list_block): Use it.
* symtab.c (iterate_over_symbols): Use it.

9 years agoMove lookup_block_symbol to block.c, rename to block_lookup_symbol.
Doug Evans [Fri, 7 Nov 2014 06:32:25 +0000 (22:32 -0800)] 
Move lookup_block_symbol to block.c, rename to block_lookup_symbol.

There is another function, lookup_symbol_aux_block, and
the names lookup_block_symbol and lookup_symbol_aux_block don't
convey any real difference between them.

The difference is that lookup_block_symbol lives in the lower level
block API, and lookup_symbol_aux_block lives in the higher level symtab API.
This patch makes this distinction clear.

gdb/ChangeLog:

* symtab.c (lookup_block_symbol): Moved to ...
* block.c (block_lookup_symbol):  ... here and renamed.
All callers updated.
* block.h (block_lookup_symbol): Declare.
* symtab.h (lookup_block_symbol): Delete.

9 years agoRevert bfd_get_size checks
Alan Modra [Thu, 6 Nov 2014 23:07:39 +0000 (09:37 +1030)] 
Revert bfd_get_size checks

* archive.c (_bfd_slurp_extended_name_table): Revert bfd_get_size check.
* coffcode.h (coff_set_alignment_hook): Likewise.
(coff_slurp_line_table): Likewise.
* coffgen.c (coff_get_normalized_symtab): Likewise.
(_bfd_coff_get_external_symbols): Likewise.
* elf.c (bfd_elf_get_str_section): Likewise.
* tekhex.c (first_phase): Likewise.

9 years agoUse ALL_PRIMARY_SYMTABS instead of ALL_SYMTABS in some places.
Doug Evans [Fri, 7 Nov 2014 01:27:55 +0000 (17:27 -0800)] 
Use ALL_PRIMARY_SYMTABS instead of ALL_SYMTABS in some places.

Non-primary symtabs share the block vector with their primary symtabs.
In these cases there's no need to use ALL_SYMTABS.

gdb/ChangeLog:

* ada-lang.c (ada_make_symbol_completion_list): Use
ALL_PRIMARY_SYMTABS instead of ALL_SYMTABS.
* symtab.c (lookup_objfile_from_block): Ditto.

9 years agoForgotten ChangeLog entry for previous commit.
Doug Evans [Fri, 7 Nov 2014 01:24:12 +0000 (17:24 -0800)] 
Forgotten ChangeLog entry for previous commit.

gdb/ChangeLog:

* gdbtypes.h (TYPE_CODE_CLASS): Delete.  All uses changed to use
TYPE_CODE_STRUCT.

9 years agoDelete TYPE_CODE_CLASS, it's just an alias of TYPE_CODE_STRUCT.
Doug Evans [Fri, 7 Nov 2014 01:19:06 +0000 (17:19 -0800)] 
Delete TYPE_CODE_CLASS, it's just an alias of TYPE_CODE_STRUCT.

gdb/ChangeLog:

* gdbtypes.h (TYPE_CODE_CLASS): Delete.  All uses changed to use
TYPE_CODE_STRUCT.

9 years agosolib_global_lookup: Fetch arch from objfile, not target_gdbarch.
Doug Evans [Fri, 7 Nov 2014 01:10:51 +0000 (17:10 -0800)] 
solib_global_lookup: Fetch arch from objfile, not target_gdbarch.

gdb/ChangeLog:

* objfiles.c (get_objfile_arch): Constify.
* objfiles.h (get_objfile_arch): Update prototype.
* solib.c (solib_global_lookup): Fetch arch from objfile,
not target_gdbarch.

9 years agodaily update
Alan Modra [Thu, 6 Nov 2014 23:01:04 +0000 (09:31 +1030)] 
daily update

9 years agoAdd mach parameter to nios2_find_opcode_hash.
Sandra Loosemore [Thu, 6 Nov 2014 21:12:21 +0000 (13:12 -0800)] 
Add mach parameter to nios2_find_opcode_hash.

2014-11-06  Sandra Loosemore  <sandra@codesourcery.com>

include/opcode/
* nios2.h (nios2_find_opcode_hash): Add mach parameter to
declaration.  Fix obsolete comment.

opcodes/
* nios2-dis.c (nios2_find_opcode_hash): Add mach parameter.
(nios2_disassemble): Adjust call to nios2_find_opcode_hash.

gas/
* config/tc-nios2.c (nios2_diagnose_overflow): Adjust call to
nios2_find_opcode_hash.

9 years agoUpdate Nios II prologue analysis to remove detection of long-obsolete
Sandra Loosemore [Thu, 6 Nov 2014 20:56:27 +0000 (12:56 -0800)] 
Update Nios II prologue analysis to remove detection of long-obsolete
code sequences.

2014-11-06  Sandra Loosemore  <sandra@codesourcery.com>

gdb/
* nios2-tdep.c (wild_insn): Delete.
(profiler_insn, irqentry_insn): Delete.
(nios2_match_sequence): Delete.
(nios2_analyze_prologue): Update comments.  Remove matching
of obsolete profiler_insn and irqentry_insn sequences.

9 years agoPrevent archive memebers with illegal pathnames from being extracted from an archive.
Nick Clifton [Thu, 6 Nov 2014 14:49:10 +0000 (14:49 +0000)] 
Prevent archive memebers with illegal pathnames from being extracted from an archive.

PR binutils/17552, binutils/17533
* bucomm.c (is_valid_archive_path): New function.  Returns false
for absolute pathnames and pathnames that include /../.
* bucomm.h (is_valid_archive_path): Add prototype.
* ar.c (extract_file): Use new function to check for valid
pathnames when extracting files from an archive.
* objcopy.c (copy_archive): Likewise.
* doc/binutils.texi: Update documentation to mention the
limitation on pathname of archive members.

9 years agoRevert changes in previous deltas that introduced new failures into
Nick Clifton [Thu, 6 Nov 2014 14:39:58 +0000 (14:39 +0000)] 
Revert changes in previous deltas that introduced new failures into
the linker testsuite.

* aoutx.h (slurp_symbol_table): Revert previous delta.
(slurp_reloc_table): Likewise.
* compress.c (bfd_get_full_section_contents): Remove file size
test.
* coffgen.c (coff_get_normalized_symtab): Allow zero-sized symtabs
and do not complain about linker generated files.

9 years agobfd/elf-attrs.c: Fix possible infinite loop parsing attributes
Will Newton [Wed, 5 Nov 2014 15:24:30 +0000 (15:24 +0000)] 
bfd/elf-attrs.c: Fix possible infinite loop parsing attributes

Handle the case of a zero length section or sub-section in
_bfd_elf_parse_attributes and in doing so prevent an infinite loop
in the parser.

bfd/ChangeLog:

2014-11-06  Will Newton  <will.newton@linaro.org>

* elf-attrs.c (_bfd_elf_parse_attributes): Handle zero
length sections and sub-sections.

9 years agodaily update
Alan Modra [Wed, 5 Nov 2014 23:00:53 +0000 (09:30 +1030)] 
daily update

9 years agoMore fixes for memory problems uncovered by file fuzzers.
Nick Clifton [Wed, 5 Nov 2014 17:57:54 +0000 (17:57 +0000)] 
More fixes for memory problems uncovered by file fuzzers.

PR binutils/17512
* coffcode.h (handle_COMDAT): Replace abort with BFD_ASSERT.
Replace another abort with an error message.
(coff_slurp_line_table): Add more range checking.
* peXXigen.c (pe_print_debugdata): Add range checking.

9 years agoMore fixes for reading corrupt ELF files.
Nick Clifton [Wed, 5 Nov 2014 16:19:03 +0000 (16:19 +0000)] 
More fixes for reading corrupt ELF files.

PR binutils/15731
* readelf.c (printable_section_name): New function.
(printable_section_name_from_index): New function.
(dump_relocations): Use new function.
(process_program_headers, get_32bit_elf_symbols,
(get_64bit_elf_symbols, process_section_headers,
(process_section_groups, process_relocs, ia64_process_unwind,
(hppa_process_unwind, get_unwind_section_word, decode_arm_unwind,
(arm_process_unwind, process_version_sections,
(process_symbol_table, apply_relocations, get_section_contents,
(dump_section_as_strings, dump_section_as_bytes,
(display_debug_section, process_attributes, process_mips_specific,
(process_mips_specific process_gnu_liblist): Likewise.
(get_unwind_section_word): Check for a missing symbol table.
Replace aborts with error messages.
(arm_process_unwind): Check for a missing string table.
(process_attributes): Check for an attribute length that is too
small.
(process_mips_specific): Check for a corrupt GOT symbol offset.

9 years agoFix gnu11 fallout on Solaris 10+
Rainer Orth [Wed, 5 Nov 2014 14:07:38 +0000 (15:07 +0100)] 
Fix gnu11 fallout on Solaris 10+

* sigsetmask.c (_POSIX_SOURCE): Remove.

9 years agoFix segfault when creating a dso with discarded .dynsym section.
Matthew Fortune [Wed, 5 Nov 2014 10:56:59 +0000 (10:56 +0000)] 
Fix segfault when creating a dso with discarded .dynsym section.

bfd/

* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Fix segfault
when creating a dso with discarded dynsym section.

9 years agoUpdate .MIPS.abiflags to support MIPS R6
Matthew Fortune [Tue, 4 Nov 2014 23:37:28 +0000 (23:37 +0000)] 
Update .MIPS.abiflags to support MIPS R6

bfd/

* elfxx-mips.c (update_mips_abiflags_isa): Add E_MIPS_ARCH_32R6
and E_MIPS_ARCH_64R6 support.

ld/testsuite/

* ld-mips-elf/abiflags-strip10-ph.d: New file.
* ld-mips-elf/mips-eld.exp: Run the new test.

gas/

* config/tc-mips.c (mips_elf_final_processing): Add INSN_ISA32R6
and INSN_ISA64R6 support.

gas/testsuite/

* gas/mips/elf_arch_mips32r6.d: New file.
* gas/mips/elf_arch_mips64r6.d: New file.
* gas/mips/mips.exp: Run the new tests.

9 years ago2014-11-05 Jan-Benedict Glaw <jbglaw@lug-owl.de>
Jan-Benedict Glaw [Wed, 5 Nov 2014 09:08:37 +0000 (10:08 +0100)] 
2014-11-05  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

* readelf.c (process_mips_specific): Fix format string warning.

9 years agoMore fixes for processing corrupt files.
Nick Clifton [Wed, 5 Nov 2014 10:13:16 +0000 (10:13 +0000)] 
More fixes for processing corrupt files.

PR binutils/17512
* coffcode.h (coff_set_alignment_hook): Warn if the file lies
about the number of relocations it contains.
(coff_sort_func_alent): Return 0 if the pointers are NULL.
(coff_slurp_line_table): Add more range checks.  Do not free new
tables created when sorting line numbers.
* peXXigen.c (pe_print_idata): Add range checks.
(pe_print_edata): Likewise.
(rsrc_print_resource_entries): Likewise.  Avoid printing control
characters.  Terminate priniting if corruption is detected.
(rsrc_print_resource_directory): Terminate printing if an unknown
directory type is encountered.
(pe_print_debugdata): Fix off-by-one error.
(rsrc_count_entries): Add range checking.
(rsrc_parse_entry): Likewise.

9 years agoCast result of obstack_next_free
Alan Modra [Tue, 4 Nov 2014 22:48:27 +0000 (09:18 +1030)] 
Cast result of obstack_next_free

obstack_next_free is supposed to return a void*, rather than a char*
as it does currently.  Avoid warning on void* arithmetic when
obstack_next_free gets it proper return type.

* cp-valprint.c (cp_print_value_fields): Cast obstack_next_free
to char* before doing pointer arithmetic.

9 years agoUse obstack_blank_fast to shrink obstacks
Alan Modra [Tue, 4 Nov 2014 08:55:34 +0000 (19:25 +1030)] 
Use obstack_blank_fast to shrink obstacks

obstack_blank isn't the correct macro to call for shrinking obstacks
since it does size checking.

* charset.c (convert_between_encodings): Shrink obstack using
obstack_blank_fast.
* minsyms.c (install_minimal_symbols): Likewise.

9 years agoUpdate description of ownership of files in include/
Doug Evans [Wed, 5 Nov 2014 00:14:14 +0000 (16:14 -0800)] 
Update description of ownership of files in include/

9 years agoFix -Wshadow warning
Matthew Fortune [Tue, 4 Nov 2014 23:40:22 +0000 (23:40 +0000)] 
Fix -Wshadow warning

binutils/

* readelf.c (process_mips_specific): Rename index to idx.

9 years agodaily update
Alan Modra [Tue, 4 Nov 2014 23:01:00 +0000 (09:31 +1030)] 
daily update

9 years agotui: Fix newterm call for older ncurses
Simon Marchi [Tue, 4 Nov 2014 13:27:06 +0000 (08:27 -0500)] 
tui: Fix newterm call for older ncurses

Older versions of ncurses' newterm can't take NULL for their ofp and ifp
parameters. Newer versions can, and they fall back on stdout/stdin if
that is the case.

This patch explicitly passes stdout/stdin to the call to newterm to
avoid segfaulting with older ncurses.

gdb/Changelog:

2014-11-04  Simon Marchi  <simon.marchi@ericsson.com>

* tui/tui.c (tui_enable): Pass stdout and stdin to newterm.

9 years agogarbage collect gdb/breakpoint.c:breakpoint_thread_match
Pedro Alves [Tue, 4 Nov 2014 18:42:28 +0000 (18:42 +0000)] 
garbage collect gdb/breakpoint.c:breakpoint_thread_match

Used to be necessary for the thread-hop code, but that's gone now.
Nothing uses this anymore.

gdb/
2014-11-04  Pedro Alves  <palves@redhat.com>

* breakpoint.c (breakpoint_thread_match): Delete function.
* breakpoint.h (breakpoint_thread_match): Delete declaration.

9 years agoFix problem with linker created sections being mistakenly flagged
Nick Clifton [Tue, 4 Nov 2014 16:00:10 +0000 (16:00 +0000)] 
Fix problem with linker created sections being mistakenly flagged
as corrupt by the new error checking code in bfd_get_full_section_contents.

PR binutils/17512
* compress.c (bfd_get_full_section_contents): Improve test for
linker created objects.

9 years agoMore fixes for memory corruption when readelf processes corrupt files.
Nick Clifton [Tue, 4 Nov 2014 15:29:03 +0000 (15:29 +0000)] 
More fixes for memory corruption when readelf processes corrupt files.

PR binutils/17531
(get_32bit_program_headers): Verify program header entry size
before reading in the program headers.
(get_64bit_program_headers): Likewise.
(get_unwind_section_word): Do nothing if no section was provided.
Fail if the offset is outside of the section.
(print_dynamic_symbol): Catch out of range symbol indicies.
(process_mips_specific): Likewise.
(process_attributes): Make sure that there is enough space left in
the section before attempting to read the length of the next
attribute.

9 years agoFix a seg-fault triggered by reading a mal-formed archive.
Nick Clifton [Tue, 4 Nov 2014 13:15:37 +0000 (13:15 +0000)] 
Fix a seg-fault triggered by reading a mal-formed archive.

PR binutils/17533
* archive.c (_bfd_slurp_extended_name_table): Handle archives with
corrupt extended name tables.

9 years agoDon't use register keyword
Alan Modra [Tue, 4 Nov 2014 05:01:09 +0000 (15:31 +1030)] 
Don't use register keyword

* expr.c (expr_symbol_where): Don't use register keyword.
* app.c (app_push, app_pop, do_scrub_chars): Likewise.
* ecoff.c (add_string, add_ecoff_symbol, add_aux_sym_symint,
add_aux_sym_rndx, add_aux_sym_tir, add_procedure, add_file,
ecoff_build_lineno, ecoff_setup_ext, allocate_cluster.
allocate_scope, allocate_vlinks, allocate_shash,
allocate_thash, allocate_tag, allocate_forward, allocate_thead,
allocate_lineno_list): Likewise.
* frags.c (frag_more, frag_var, frag_variant, frag_wane): Likewise.
* input-file.c (input_file_push, input_file_pop): Likewise.
* input-scrub.c (input_scrub_push, input_scrub_next_buffer): Likewise.
* subsegs.c (subseg_change): Likewise.
* symbols.c (colon, symbol_table_insert, symbol_find_or_make)
(dollar_label_name, fb_label_name): Likewise.
* write.c (relax_align): Likewise.
* config/tc-alpha.c (s_alpha_pdesc): Likewise.
* config/tc-bfin.c (bfin_s_bss): Likewise.
* config/tc-i860.c (md_estimate_size_before_relax): Likewise.
* config/tc-m68hc11.c (md_convert_frag): Likewise.
* config/tc-m68k.c (m68k_ip, crack_operand): Likewise.
(md_convert_frag_1, s_even): Likewise.
* config/tc-mips.c (mips_clear_insn_labels): Likewise.
* config/tc-mn10200.c (md_begin): Likewise.
* config/tc-s390.c (s390_setup_opcodes, md_begin): Likewise.
* config/tc-sh.c (sh_elf_cons): Likewise.
* config/tc-tic4x.c (tic4x_cons, tic4x_stringer): Likewise.
* config/m68k-parse.y (m68k_reg_parse): Likewise.  Convert from K&R.
(yylex, m68k_ip_op, yyerror): Convert from K&R.

9 years agoUse frag_now_fix_octets in gas d10v, d30v
Alan Modra [Tue, 4 Nov 2014 04:11:00 +0000 (14:41 +1030)] 
Use frag_now_fix_octets in gas d10v, d30v

obstack_next_free is supposed to return a void* rather than the char*
it does currently, so expressions involving pointer arithmetic need
a cast.  Avoid the issue.

* config/tc-d10v.c (find_opcode): Call frag_now_fix_octets rather
than equivalent obstack_next_free expression.
* config/tc-d30v.c (find_format): Likewise.

9 years agoRegenerate spu overlay and icache manager files
Alan Modra [Tue, 4 Nov 2014 03:19:12 +0000 (13:49 +1030)] 
Regenerate spu overlay and icache manager files

Nothing to see here, just the changed placement of section headers.

* emultempl/spu_icache.o_c: Regenerate.
* emultempl/spu_ovl.o_c: Regenerate.

9 years agoProvide stat function for spu overlay manager iovec
Alan Modra [Tue, 4 Nov 2014 03:09:38 +0000 (13:39 +1030)] 
Provide stat function for spu overlay manager iovec

Commit f54498b4 broke spu-elf, specifically the change "Do not try to
load a string table bigger than the file", because bfd_get_size
returns zero for the spu built-in overlay manager bfd.

* elf32-spu.c (ovl_mgr_stat): New function.
(spu_elf_open_builtin_lib): Pass to bfd_openr_iovec.

9 years agoFixes for crashes running readelf.
Nick Clifton [Tue, 4 Nov 2014 11:58:16 +0000 (11:58 +0000)] 
Fixes for crashes running readelf.

PR binutils/17531
* readelf.c (get_data): If the reason parameter is null, do not
print any error messages.
(get_32bit_section_headers): Verify section header entry size
before reading in the section headers.
(get_64bit_section_headers): Likewise.
(process_section_headers): Pass FALSE to get_section_headers.
(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.

9 years agoFix evaluation of method calls under EVAL_SKIP.
Siva Chandra [Sat, 18 Oct 2014 13:14:00 +0000 (06:14 -0700)] 
Fix evaluation of method calls under EVAL_SKIP.

When evaluating method calls under EVAL_SKIP, the "object" and the
arguments to the method should also be evaluated under EVAL_SKIP,
instead of skipping to evaluate them as was being done previously.

gdb/ChangeLog:

PR c++/17494
* eval.c (evaluate_subexp_standard): Evaluate the "object" and
the method args also under EVAL_SKIP when evaluating method
calls under EVAL_SKIP.

gdb/testsuite/ChangeLog:

PR c++/17494
* gdb.cp/pr17494.cc: New file.
* gdb.cp/pr17494.exp: New file.

9 years agodaily update
Alan Modra [Mon, 3 Nov 2014 23:00:33 +0000 (09:30 +1030)] 
daily update

9 years agoWhen relaxing, update size of symbols.
Andrew Burgess [Mon, 27 Oct 2014 10:45:18 +0000 (10:45 +0000)] 
When relaxing, update size of symbols.

When performing linker relaxation, reduce the size of symbols that span
the deleted bytes.  This ensures that, for example, function symbols
will have the correct size.

bfd/ChangeLog:

* elf32-avr.c (elf32_avr_relax_delete_bytes): During linker
relaxation, reduce the size of symbols that span the deleted
bytes.

ld/ChangeLog:

* testsuite/ld-avr/relax-02.d: Update to check size of symbols has
changed.
* testsuite/ld-avr/relax-03.d: Likewise.

9 years agoWhen relaxing, update symbols at the very end of the section.
Andrew Burgess [Sat, 25 Oct 2014 14:08:14 +0000 (15:08 +0100)] 
When relaxing, update symbols at the very end of the section.

Symbols at the very end of a section were not being updated correctly
when linker relaxation takes place due to the use of '<' instead of
'<='.  Added a couple of tests to cover this behaviour.

bfd/ChangeLog:

* elf32-avr.c (elf32_avr_relax_delete_bytes): Modify symbols
located at the very end of the section.

ld/ChangeLog:

* ld/testsuite/ld-avr/relax-02.d: New file.
* ld/testsuite/ld-avr/relax-02.s: New file.
* ld/testsuite/ld-avr/relax-03.d: New file.
* ld/testsuite/ld-avr/relax-03.s: New file.

9 years agoMore fixes for buffer overruns instigated by corrupt binaries.
Nick Clifton [Mon, 3 Nov 2014 17:44:00 +0000 (17:44 +0000)] 
More fixes for buffer overruns instigated by corrupt binaries.

PR binutils/17512
* objdump.c (slurp_symtab): Fail gracefully if the table could not
be read.
(dump_relocs_in_section): Likewise.

* aoutx.h (slurp_symbol_table): Check that computed table size is
not bigger than the file from which is it being read.
(slurp_reloc_table): Likewise.
* coffcode.h (coff_slurp_line_table): Remove unneeded local
'warned'.  Do not try to print the details of a symbol with an
invalid index.
* coffgen.c (make_a_sectiobn_from_file): Check computed string
index against length of string table.
(bfd_coff_internal_syment_name): Check read in string offset
against length of string table.
(build_debug_section): Return a pointer to the section used.
(_bfd_coff_read_string_table): Store the length of the string
table in the coff_tdata structure.
(bfd_coff_free_symbols): Set the length of the string table to
zero when it is freed.
(coff_get_normalized_symtab): Check offsets against string table
or data table lengths as appropriate.
* cofflink.c (_bfd_coff_link_input_bfd): Check offset against
length of string table.
* compress.c (bfd_get_full_section_contents): Check computed size
against the size of the file.
* libcoff-in.h (obj_coff_strings_len): Define.
(struct coff_tdata): Add strings_len field.
* libcoff.h: Regenerate.
* peXXigen.c (pe_print_debugdata): Do not attempt to print the
data if the debug section is too small.
* xcofflink.c (xcoff_link_input_bfd):  Check offset against
length of string table.

9 years agoImport updated translations supplied by the Translation Project.
Nick Clifton [Mon, 3 Nov 2014 12:26:48 +0000 (12:26 +0000)] 
Import updated translations supplied by the Translation Project.

bfd, binutils, gprof, opcodes:
* po/fi.po: Updated Finnish translation.

binutils:
* po/sv.po: Updated Swedish translation.

gprof:
* po/hu.po: New Hungarian translation.

9 years agoAdd missing changelog entries
Yao Qi [Mon, 3 Nov 2014 12:12:18 +0000 (20:12 +0800)] 
Add missing changelog entries

Some changelog entries are missing in previous commits.  Add them.

9 years agoFixes a snafu checking the size of 20-bit immedaite values.
Nick Clifton [Mon, 3 Nov 2014 11:15:53 +0000 (11:15 +0000)] 
Fixes a snafu checking the size of 20-bit immedaite values.

* config/tc-msp430.c (msp430_srcoperand): Fix range test for
20-bit values.

9 years agomdebugread.c (parse_procedure): Delete unnecessary forward decl.
Doug Evans [Mon, 3 Nov 2014 05:34:59 +0000 (21:34 -0800)] 
mdebugread.c (parse_procedure): Delete unnecessary forward decl.

gdb/ChangeLog:

* mdebugread.c (parse_procedure): Delete unnecessary forward decl.

9 years agoxcoffread.c (process_linenos): Delete unnecessary code.
Doug Evans [Mon, 3 Nov 2014 04:17:12 +0000 (20:17 -0800)] 
xcoffread.c (process_linenos): Delete unnecessary code.

gdb/ChangeLog:

* xcoffread.c (process_linenos): Delete unnecessary zeroing of
main_subfile before returning.

9 years agodaily update
Alan Modra [Sun, 2 Nov 2014 23:01:00 +0000 (09:31 +1030)] 
daily update

9 years agoread_pieced_value do big endian processing only in case of valid gdb_regnum
Victor Kamensky [Sun, 2 Nov 2014 21:28:35 +0000 (13:28 -0800)] 
read_pieced_value do big endian processing only in case of valid gdb_regnum

During armv7b testing gdb.base/store.exp test was failling with
'GDB internal error' with the following message:

Temporary breakpoint 1, wack_double (u=
../../binutils-gdb/gdb/regcache.c:177: internal-error: register_size: Assertion `regnum >= 0 && regnum < (gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch))' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

It turns out that compiler generated DWARF with non-existent
register numbers. The compiler issue is present in both little endian
(armv7) and big endian (armv7b) (it is separate issue). Here is
example for one of formal parameters of wack_double function:

 <2><792>: Abbrev Number: 10 (DW_TAG_formal_parameter)
    <793>   DW_AT_name        : u
    <795>   DW_AT_decl_file   : 1
    <796>   DW_AT_decl_line   : 115
    <797>   DW_AT_type        : <0x57c>
    <79b>   DW_AT_location    : 6 byte block: 6d 93 4 6c 93 4   (DW_OP_reg29 (r29); DW_OP_piece: 4; DW_OP_reg28 (r28); DW_OP_piece: 4)

In both big and little endian cases gdbarch_dwarf2_reg_to_regnum
returns -1 which is stored into gdb_regnum. But it causes severe
problem only in big endian case because in read_pieced_value and
write_pieced_value functions BFD_ENDIAN_BIG related processing
happen regardless of gdb_regnum value, for example register_size
function is called and in case of gdb_regnum=-1, it cause
'GDB internal error' and crash.

Solution is to move BFD_ENDIAN_BIG related processing under
(gdb_regnum != -1) branch of processing.

gdb/ChangeLog:

2014-11-02  Victor Kamensky  <victor.kamensky@linaro.org>

* dwarf2loc.c (read_pieced_value): Do big endian
processing only if gdb_regnum is not -1.
(write_pieced_value): Ditto.

9 years agoARM: arm_breakpoint should be little endian form in case for arm BE8
Victor Kamensky [Sun, 2 Nov 2014 21:28:35 +0000 (13:28 -0800)] 
ARM: arm_breakpoint should be little endian form in case for arm BE8

tdep->arm_breakpoint, tdep->thumb_breakpoint, tdep->thumb2_breakpoint
should be set le_ variants in case of arm BE8 code. Those instruciton
sequences are writen to target with simple write_memory, without
regarding gdbarch_byte_order_for_code. But in BE8 case even data
memory is in big endian form, instructions are still in little endian
form.

Because of this issue there are many issues while running gdb test
case in armv7b mode. For example gdb.arch/arm-disp-step.exp test fails
because it gets SIGILL when displaced instrucion sequence reaches
break instruction, which is in wrong byte order.

Solution is to set tdep->xxx_breakpoint sequences in BE8 case (i.e
when gdbarch_byte_order_for_code is BFD_ENDIAN_BIG.

gdb/ChangeLog:

2014-11-02  Victor Kamensky  <victor.kamensky@linaro.org>

* arm-linux-tdep.c (arm_linux_init_abi): Use
info.byte_order_for_code to choose endianity of breakpoint
instructions snippets.

9 years agoARM: extract_arm_insn function need to read instrs correctly in be8 case
Victor Kamensky [Sun, 2 Nov 2014 21:28:35 +0000 (13:28 -0800)] 
ARM: extract_arm_insn function need to read instrs correctly in be8 case

extract_arm_insn function needs to read instructions in
gdbarch_byte_order_for_code byte order, because in case armv7b,
even data is big endian, instructions are still little endian.
Currently function uses gdbarch_byte_order which would be
big endian in armv7b case.

Because of this issue pretty much all gdb.reverse/ tests are
failing with 'Process record does not support instruction' message.

Fix is to change gdbarch_byte_order to gdbarch_byte_order_for_code,
when passed to extract_unsigned_integer that reads instruction.

gdb/ChangeLog:

2014-11-02  Victor Kamensky  <victor.kamensky@linaro.org>

* arm-tdep.c (extract_arm_insn): Use
gdbarch_byte_order_for_code to read arm instruction.

9 years agoMatch the working directory on remote host
Yao Qi [Sun, 2 Nov 2014 13:08:06 +0000 (21:08 +0800)] 
Match the working directory on remote host

The test in gdb.python/python.exp tests "extended-prompt" and expects
working directory is printed.  However, working directory on remote
host doesn't have "gdb/testsuite", so the test fails on remote host
like:

set extended-prompt \w ^M
^M
/home/yao FAIL: gdb.python/python.exp: set extended prompt working directory (timeout)

This patch is to get the working directory first, and use it to match
the output of "set extended-prompt \\w ".  It works for remote host
and non remote host.

gdb/testsuite:

2014-11-02  Yao Qi  <yao@codesourcery.com>

* gdb.python/python.exp: Get working directory and match the
output of "set extended-prompt \\w " with it.

9 years agodaily update
Alan Modra [Sat, 1 Nov 2014 23:00:42 +0000 (09:30 +1030)] 
daily update

9 years agoobjfiles.h: Remove some unused macros.
Doug Evans [Sat, 1 Nov 2014 04:46:08 +0000 (21:46 -0700)] 
objfiles.h: Remove some unused macros.

gdb/ChangeLog:

* objfiles.h (ALL_PSPACE_OBJFILES_SAFE): Delete, unused.
(ALL_PSPACE_SYMTABS, ALL_PSPACE_PRIMARY_SYMTABS): Ditto.

9 years agovalops.c: Fix some whitespace.
Doug Evans [Sat, 1 Nov 2014 03:20:48 +0000 (20:20 -0700)] 
valops.c: Fix some whitespace.

gdb/ChangeLog:

* valops.c (value_cast_pointers): Fix whitespace.
(typecmp, search_struct_method, value_struct_elt, find_oload_champ):
Ditto.

9 years agoFix %lx format used with bfd_size_type mismatch in readelf.c
Hans-Peter Nilsson [Sat, 1 Nov 2014 02:34:00 +0000 (03:34 +0100)] 
Fix %lx format used with bfd_size_type mismatch in readelf.c

* readelf.c (get_32bit_elf_symbols): Cast error
parameters of bfd_size_type with the %lx format to
unsigned long.

9 years agodaily update
Alan Modra [Fri, 31 Oct 2014 23:00:35 +0000 (09:30 +1030)] 
daily update

9 years agoMIPS: Add Octeon 3 support
Naveen H.S [Fri, 31 Oct 2014 20:48:04 +0000 (13:48 -0700)] 
MIPS: Add Octeon 3 support

binutils:
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.

gas:
2014-10-31  Andrew Pinski  <apinski@cavium.com>
            Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

* config/tc-mips.c (CPU_IS_OCTEON): Handle CPU_OCTEON3.
(mips_cpu_info_table): Octeon3 enables virt ase.
* doc/c-mips.texi: Document octeon3 as an acceptable value for
-march=.

gas/testsuite:
2014-10-31  Andrew Pinski  <apinski@cavium.com>
            Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

* gas/mips/mips.exp: Add support for Octeon3 architecture.
Also add in support for running Octeon3 tests.
* gas/mips/octeon3.d: New test.
* gas/mips/octeon3.s: New test source.

opcodes:
2014-10-31  Andrew Pinski  <apinski@cavium.com>
            Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

* mips-dis.c (mips_arch_choices): Add octeon3.
* mips-opc.c (IOCT): Include INSN_OCTEON3.
(IOCT2): Likewise.
(IOCT3): New define.
(IVIRT): New define.
(mips_builtin_opcodes): Add dmfgc0, dmtgc0, hypcall, mfgc0, mtgc0,
tlbinv, tlbinvf, tlbgr, tlbgwi, tlbginv, tlbginvf, tlbgwr, tlbgp, tlti
IVIRT instructions.
Extend mtm0, mtm1, mtm2, mtp0, mtp1, mtp2 instructions to take another
operand for IOCT3.

bfd:
2014-10-31  Andrew Pinski  <apinski@cavium.com>
            Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

* archures.c: Add octeon3 for mips target.
* bfd-in2.h: Regenerate.
* bfd/cpu-mips.c: Define I_mipsocteon3.
nfo_struct): Add octeon3 support.
* bfd/elfxx-mips.c: (_bfd_elf_mips_mach): Add support for
octeon3.
(mips_set_isa_flags): Add support for octeon3.
(bfd_mips_isa_ext): Add bfd_mach_mips_octeon3.
(mips_mach_extensions): Make bfd_mach_mips_octeon3 an
extension of bfd_mach_mips_octeon2.
(print_mips_isa_ext): Print the value of Octeon3.

9 years agoAdd forgotten changelog entry.
Andrew Pinski [Fri, 31 Oct 2014 20:24:24 +0000 (13:24 -0700)] 
Add forgotten changelog entry.
2014-10-21  Andrew Pinski  <apinski@cavium.com>

* config/tc-aarch64.c (aarch64_cpus):
Add thunderx.
* doc/c-aarch64.texi: Document that thunderx
is a valid processor name.

9 years agoAdd dlang demangling support to c++filt.
Iain Buclaw [Fri, 31 Oct 2014 18:38:39 +0000 (18:38 +0000)] 
Add dlang demangling support to c++filt.

binutils/ChangeLog:
* cxxfilt.c (main): Add case for dlang_demangling style.

9 years agoFix an (almost) infinite loop in the tekhex parser.
Nick Clifton [Fri, 31 Oct 2014 18:00:55 +0000 (18:00 +0000)] 
Fix an (almost) infinite loop in the tekhex parser.

PR binutils/17512
* tekhex.c (first_phase): Check that the section range is sane.

9 years agoAvoid allocating over-large buffers when parsing corrupt binaries.
Nick Clifton [Fri, 31 Oct 2014 16:36:31 +0000 (16:36 +0000)] 
Avoid allocating over-large buffers when parsing corrupt binaries.

PR binutils/17512
* coffgen.c (_bfd_coff_get_external_symbols): Do not try to load a
symbol table bigger than the file.
* elf.c (bfd_elf_get_str_section): Do not try to load a string
table bigger than the file.

* 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.

9 years agooops - changelog omitted from previous delta.
Nick Clifton [Fri, 31 Oct 2014 10:19:53 +0000 (10:19 +0000)] 
oops - changelog omitted from previous delta.

9 years agoIn response to a public outcry the strings program now defaults to using the
Nick Clifton [Fri, 31 Oct 2014 10:10:37 +0000 (10:10 +0000)] 
In response to a public outcry the strings program now defaults to using the
--all option which displays text from anywhere in the input file(s).  The
default used to be --data, which only displays text from loadable data sections,
but this requires the use of the BFD library.  Since the BFD library almost
certainly still contains buffer overrun and/or memory corruption bugs, and
since the strings program is often used to examine malicious code, it was
decided that the --data option option represents a possible security risk.

* 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
option.
* doc/binutils.texi (strings): Update documentation.  Include
description  of why the --data option might be unsafe.
* configure.ac: Add new option --disable-default-strings-all which
restores the old behaviour of strings using --data by default.  If
the option is not used make strings use --all by default.
* NEWS: Mention the new behaviour of strings.
* configure: Regenerate.
* config.in: Regenerate.

9 years agoAdd ability to add attributes to gdb.Objfile and gdb.Progspace objects.
Doug Evans [Fri, 31 Oct 2014 00:05:17 +0000 (17:05 -0700)] 
Add ability to add attributes to gdb.Objfile and gdb.Progspace objects.

gdb/ChangeLog:

* NEWS: Mention ability add attributes to gdb.Objfile and
gdb.Progspace objects.
* python/py-objfile.c (objfile_object): New member dict.
(objfpy_dealloc): Py_XDECREF dict.
(objfpy_initialize): Initialize dict.
(objfile_getset): Add __dict__.
(objfile_object_type): Set tp_dictoffset member.
* python/py-progspace.c (progspace_object): New member dict.
(pspy_dealloc): Py_XDECREF dict.
(pspy_initialize): Initialize dict.
(pspace_getset): Add __dict__.
(pspace_object_type): Set tp_dictoffset member.

gdb/doc/ChangeLog:

* python.texi (Progspaces In Python): Document ability to add
random attributes to gdb.Progspace objects.
(Objfiles In Python): Document ability to add random attributes to
gdb.objfile objects.

gdb/testsuite/ChangeLog:

* gdb.python/py-objfile.exp: Add tests for setting random attributes
in objfiles.
* gdb.python/py-progspace.exp: Add tests for setting random attributes
in progspaces.

9 years agodaily update
Alan Modra [Thu, 30 Oct 2014 23:00:33 +0000 (09:30 +1030)] 
daily update

This page took 0.047403 seconds and 4 git commands to generate.