daily update
Change the default implementation of to_traceframe_info to tcomplain

This patch is to change the default implementation of to_traceframe_info
from 'return NULL' to tcomplain, which is intended.  If new target
supports tracepoint, this method should be implemented, otherwise,
an error is thrown.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* target.h (struct target_ops) <to_traceframe_info>: Use
	TARGET_DEFAULT_NORETURN (tcomplain ()).
	* target-delegates.c: Regenerated.
Fix PR16508

This patch fixes PR16508, which is about MI "-trace-find frame-number 0"
behaves differently from CLI "tfind 0".  In CLI, we check both
status->running and status->filename, but in MI, we only check
status->running, which looks wrong to me.  This patch moves the code
of checking to a new function check_trace_running, and use it in
both CLI and MI.

This patch also adds a test case pr16508.exp, which fails without this
fix, and passes with the fix applied.

  FAIL: gdb.trace/pr16508.exp: interpreter-exec mi "-trace-find frame-number 0"

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	PR breakpoints/16508
	* tracepoint.c (check_trace_running): New function.
	(trace_find_command): Move code to check_trace_running and
	call check_trace_running.
	(trace_find_pc_command): Likewise.
	(trace_find_tracepoint_command): Likewise.
	(trace_find_line_command): Likewise.
	(trace_find_range_command): Likewise.
	* tracepoint.h (check_trace_running): Likewise.
	* mi/mi-main.c (mi_cmd_trace_find): Call check_trace_running.

gdb/testsuite:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/pr16508.exp: New file.
Add a newline in output messages

Hi,
GDB prints two warnings in one single line, as below:

 (gdb) p 1.2
 $1 = 1.2
 (gdb) enable $1.2
 History value must have integer type.Bad breakpoint number '$1'

This patch adds '\n' at the end of message.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* cli/cli-utils.c (get_number_trailer): Add '\n' at the end of
	message.
Handle parse number error in goto_bookmark_command

In GDB mainline, the error message for goto-bookmark
isn't perfect.

 (gdb) goto-bookmark 1.1
 goto-bookmark: no bookmark found for ''.

This patch tweaks the error message by checking the return value of
get_number.  With patch applied, it becomes:

 (gdb) goto-bookmark 1.1
 goto-bookmark: invalid bookmark number '1.1'.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* reverse.c (goto_bookmark_command): Add local 'p'.  Emit error
	early if get_number returns zero.  Use 'p' instead of 'args'.
Remove argument optional_p from get_tracepoint_by_number

This patch is to remove parameter optional_p as it is always true,
in order to simplify get_tracepoint_by_number.

'optional_p' was added by this change,

1999-11-18  Tom Tromey  <tromey@cygnus.com>

	* tracepoint.h (get_tracepoint_by_number): Updated
	declaration.
	* tracepoint.c (trace_pass_command): Better error message.
	Fixed logic when `all' not specified.
	(get_tracepoint_by_number): Added `optional_p' argument.  Fixed
	all callers.

but after this patch,

 FYI: remove `static's from cli-utils.c
 https://sourceware.org/ml/gdb-patches/2011-03/msg00636.html

'optional_p' passed to get_tracepoint_by_number become always true.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* breakpoint.c (get_tracepoint_by_number): Remove argument
	optional_p.  All callers updated.  Adjust comments.  Update
	output message.
	* breakpoint.h (get_tracepoint_by_number): Update declaration.
Patch for PR binutils/16664 which triggers a seg-fault when attempting to
display the contents of a corrupt attribute section.

	* readelf.c (process_attributes): Add checks for corrupt
	attribute section names.

	* elf-attrs.c (_bfd_elf_parse_attributes): Add checks for corrupt
	attribute section names.
	* gas/tc-avr.c: Add new devices
	avr25: ata5272, attiny828
	avr35: ata5505, attiny1634
	avr4: atmega8a, ata6285, ata6286, atmega48pa
	avr5: at90pwm161, ata5790, ata5795, atmega164pa, atmega165pa,
	atmega168pa, atmega32a, atmega64rfr2, atmega644rfr2, atmega64a,
	atmega16hva2
	avr51: atmega128a, atmega1284
	avrxmega2: atxmega16a4u, atxmega16c4, atxmega32a4u, atxmega32c4,
	atxmega32e5, atxmega16e5, atxmega8e5
	avrxmega4: atxmega64a3u, atxmega64a4u, atxmega64b1, atxmega64b3,
	atxmega64c3, atxmega64d4
	avrxmega6: atxmega128a3u, atxmega128b3, atxmega128c3,
	atxmega128d4, atxmega192a3u, atxmega192c3, atxmega256a3u,
	atxmega256c3, atxmega384c3, atxmega384d3
	avrxmega7: atxmega128a4u
	* doc/c-avr.texi: Ditto.
Fix sol-thread.c build failure.

Some updates where needed after the minimal symbol handling got changed
a little. This patch makes those changes.

gdb/ChangeLog:

        * sol-thread.c: #include "symtab.h", "minsym.h" and "objfiles.h".
        (ps_pglobal_lookup): Use BMSYMBOL_VALUE_ADDRESS instead of
        SYMBOL_VALUE_ADDRESS.
        (info_cb): MSYMBOL_PRINT_NAME instead of SYMBOL_PRINT_NAME.
Disable --long-plt test for arm-nacl targets.

ld/testsuite/
	* ld-arm/arm-elf.exp (armelftests_common): Move long-plt case ...
	(armelftests_nonacl): ... here.
Apply ld-arm/gc-hidden-1 to all ELF targets, not just *eabi* targets

ld/testsuite/
	* ld-arm/gc-hidden-1.d: Remove target, add not-target to match
	other ELF-only tests in this directory.  Loosen regexps so they
	don't care what the exact addresses are.
daily update
btrace, test: fix gdb.btrace/data test

The format of the output changed.  Fix the test.

testsuite/
	* gdb.btrace/data.exp: Update expected output.
AIX 32-bit core loading, high section addresses.

I noticed GDB was failing to enable threading support for 32-bit AIX
cores.  I traced it to failure to read variables from libpthreads.a.
The issue is that data for that library is loaded at a high address,
and bfd is sign extending the section addresses:

 (gdb) info files
 Symbols from "/home/palves/crash".
 Local core dump file:
	 `/home/palves/core', file type aixcoff-rs6000.
	 0x2ff22000 - 0x2ff23000 is .stack
	 0x20000000 - 0x200316e0 is .data
	 0x20000e90 - 0x200016c0 is .data
	 0xfffffffff0254000 - 0xfffffffff0297920 is .data
	 0xfffffffff07b46a8 - 0xfffffffff07b47c8 is .data
	 0xfffffffff0298000 - 0xfffffffff029bfcc is .data
	 0xfffffffff06dafe0 - 0xfffffffff07b3838 is .data
 Local exec file:
	 `/home/palves/crash', file type aixcoff-rs6000.
	 Entry point: 0x20001394
	 0x10000150 - 0x10000e90 is .text
	 0x20000e90 - 0x2000149c is .data
	 0x2000149c - 0x200016c0 is .bss
	 0xd053b124 - 0xd053e15f is .text in /usr/lib/libpthreads.a(shr_comm.o)
	 0xf0254000 - 0xf0297920 is .data in /usr/lib/libpthreads.a(shr_comm.o)
	 0xf0254450 - 0xf0297920 is .bss in /usr/lib/libpthreads.a(shr_comm.o)
	 0xd053a280 - 0xd053aabe is .text in /usr/lib/libcrypt.a(shr.o)
	 0xf07b46a8 - 0xf07b47c8 is .data in /usr/lib/libcrypt.a(shr.o)
	 0xf07b47c8 - 0xf07b47c8 is .bss in /usr/lib/libcrypt.a(shr.o)
	 0xd04fb180 - 0xd053917e is .text in /usr/lib/libpthreads.a(shr_xpg5.o)
	 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
	 0xf029bf64 - 0xf029bfcc is .bss in /usr/lib/libpthreads.a(shr_xpg5.o)
	 0xd0100900 - 0xd04fa39c is .text in /usr/lib/libc.a(shr.o)
	 0xf06dafe0 - 0xf07b3838 is .data in /usr/lib/libc.a(shr.o)
	 0xf0751e94 - 0xf07b3838 is .bss in /usr/lib/libc.a(shr.o)

Notice:
	...
	0xfffffffff0298000 - 0xfffffffff029bfcc is .data
	...

Those are the bfd section start/end addresses.  It't not visible here:

         ...
	 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
         ...

... just because GDB trims that number to 32-bit when printing.

GDB then fails to find the memory for libpthreads.a variables in the
core, and falls back to reading it directly from the executable (which
yields the values as originally initialized in the code).

E.g.:

 (gdb) p &__n_pthreads
 $2 = (<data variable, no debug info> *) 0xf074fda8 <__n_pthreads>
 (gdb) p __n_pthreads
 $1 = -1

That should have returned 2 instead of -1.

bfd/
2014-03-07  Pedro Alves  <palves@redhat.com>

	* rs6000-core.c (rs6000coff_core_p): Cast pointers to bfd_vma
	through ptr_to_uint instead of through long.
Make the go32-nat.c target inherit inf-child.c.

So that all native targets inherit a single "superclass".

Target methods that are set to or do the same as inf-child.c's are
removed.

Tested by cross building on Fedora 17.

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

	* go32-nat.c: Include inf-child.h.
	(go32_ops): Delete global.
	(go32_close, go32_detach, go32_prepare_to_store, go32_can_run):
	Delete methods.
	(go32_create_inferior): Push the passed in target pointer instead
	of referencing go32_ops.
	(init_go32_ops): Delete function.  Moved parts to _initialize_go32_nat.
	(go32_target): New function, based on init_go32_ops, but inherit
	inf_child_target.
	(_initialize_go32_nat): Use go32_target.  Move parts of
	init_go32_ops here.
daily update
target.h: Expands complete_target_initialization and add_target comments.

Expand a bit the comments to answer some questions I had when looking
at why a target of mine would not have some default methods set.

gdb/ChangeLog:

        * target.h (complete_target_initialization, add_target):
        Add comment.
read_cutu_die_from_dwo: Misc minor cleanups.

	* dwarf2read.c (read_cutu_die_from_dwo): Fix function comment.
	Remove unused local comp_dir_attr.  Assert exactly one of
	stub_comp_unit_die, stub_comp_dir is non-NULL.
* dwarf2read.c (read_str_index): Rename local dwo_name to objf_name.
Better overflow checking for powerpc64 relocations

R_PPC64_ADDR16 is used in three contexts:
- .short data relocation
- 16-bit signed insn fields, eg. addi
- 16-bit unsigned insn fields, eg. ori
In the first case we want to allow both signed and unsigned 16-bit
values, the latter two ought to error if the field exceeds the range
of values allowed for 16-bit signed and unsigned integers
respectively.  These conflicting requirements meant that ld had to
choose the least restrictive overflow checks, and thus it is possible
to construct testcases where an addi field overflows but is not
reported by ld.  Many relocations dealing with 16-bit insn fields have
this problem.  What's more, some relocations that are only ever used
for signed fields of instructions woodenly copied the lax overflow
checking of R_PPC64_ADDR16.

bfd/
	* elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed
	for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN,
	R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS,
	R_PPC64_REL16 entries.  Use complain_overflow_dont for R_PPC64_TOC.
	(ppc64_elf_relocate_section): Modify overflow test for 16-bit
	fields in instructions to signed/unsigned according to whether
	the field takes a signed or unsigned value.
gold/
	* powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
	CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
	(Powerpc_relocate_functions::has_overflow_unsigned): New function.
	(Powerpc_relocate_functions::has_overflow_bitfield,
	overflowed): Use the above.
	(Target_powerpc::Relocate::relocate): Correct overflow checking
	for a number of relocations.  Modify overflow test for 16-bit
	fields in instructions to signed/unsigned according to whether
	the field takes a signed or unsigned value.