Eliminate literal line numbers in so-impl-ld.exp

Remove literal line numbers from the regexps in so-impl-ld.exp.  Add
appropriate eye-catchers to solib1.c and refer to those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/solib1.c: Add eye-catchers.
	* gdb.base/so-impl-ld.exp: Match against eye-catchers instead of
	literal line numbers.
Eliminate literal line numbers in dbx.exp

Remove literal line numbers from the commands and regexps in dbx.exp.
Add appropriate eye-catchers to average.c and sum.c and refer to those
instead.

gdb/testsuite/ChangeLog:

	* gdb.base/average.c: Add eye-catchers.
	* gdb.base/sum.c: Likewise.
	* gdb.base/dbx.exp: Use eye-catchers to determine line numbers for
	regexps dynamically.
Eliminate literal line numbers in call-ar-st.exp

Remove literal line numbers from the regexps in call-ar-st.exp.  Add
appropriate eye-catchers to call-ar-st.c and refer to those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/call-ar-st.c: Add eye-catchers.
	* gdb.base/call-ar-st.exp: Refer to eye-catchers instead of
	literal line numbers.
Eliminate literal line numbers in call-rt-st.exp

Remove literal line numbers from the regexps in call-rt-st.exp.  Add
appropriate eye-catchers to call-rt-st.c and refer to those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/call-rt-st.c: Add eye-catchers.
	* gdb.base/call-rt-st.exp: Refer to eye-catchers instead of
	literal line numbers.
Eliminate literal line numbers in ending-run.exp

Remove literal line numbers from the regexps in ending-run.exp.  Add
appropriate eye-catchers to ending-run.c and refer to those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/ending-run.c: Add eye-catchers.
	* gdb.base/ending-run.exp: Refer to eye-catchers instead of
	literal line numbers.
Eliminate literal line numbers in foll-exec.exp

Remove literal line numbers from the regexps in foll-exec.exp.  Add
appropriate eye-catchers to foll-exec.c and execd-proc.c and refer to
those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/execd-prog.c: Add eye-catchers.
	* gdb.base/foll-exec.c: Likewise.
	* gdb.base/foll-exec.exp: Refer to eye-catchers instead of literal
	line numbers.
Eliminate literal line numbers in jump.exp

Remove literal line numbers from the regexps in jump.exp.  Add
appropriate eye-catchers to jump.c and refer to those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/jump.c: Add eye-catchers.
	* gdb.base/jump.exp: Refer to eye-catchers instead of literal line
	numbers.
Eliminate literal line numbers in shlib-call.exp

Remove the literal line number from a regexp in shlib-call.exp.  Add
an appropriate eye-catcher to shr2.c and refer to that instead.

gdb/testsuite/ChangeLog:

	* gdb.base/shr2.c: Add eye-catcher.
	* gdb.base/shlib-call.exp: Refer to eye-catcher instead of literal
	line number.
Eliminate literal line numbers in mi-console.exp

Remove the literal line number from a regexp in mi-console.exp.  Add
an appropriate eye-catcher to mi-console.c and refer to that instead.

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-console.c: Add eye-catcher.
	* gdb.mi/mi-console.exp (semihosted_string): Refer to eye-catcher
	instead of literal line number.
'callfuncs' test case: Fixes in conditionally compiled code

The C source file for the 'callfuncs' test case did not compile with
-DNO_PROTOTYPES or -DPROTOTYPES.  This patch fixes various syntax
errors under #ifdef NO_PROTOTYPES and a small typo under #ifdef
PROTOTYPES.

gdb/testsuite/ChangeLog:

	* gdb.base/callfuncs.c (t_float_many_args): Fix syntax error in
	code guarded by #ifdef NO_PROTOTYPES.
	(t_double_many_args): Likewise.
	(DEF_FUNC_MANY_ARGS_1): Likewise.
	(DEF_FUNC_VALUES_1): Likewise.
	(t_structs_ldc): Renamed from t_structs_fc in conditional code
	guarded by #ifdef PROTOTYPES.
Perform all tests in callfuncs.exp with and without C function prototypes

In callfuncs.exp, compile callfuncs.c with and without C function
header prototypes and execute all tests after each compilation.

gdb/testsuite/ChangeLog:

	* gdb.base/callfuncs.exp: Remove 'prototypes' variable.  Move main
	logic into perform_all_tests() and invoke it with and without
	function header prototypes.
	(do_function_calls): Remove conditional XFAIL for PR 5318.
	(rerun_and_prepare): Remove duplicate code.
	(perform_all_tests): New.  Main logic moved here.
callfuncs.exp: Indent perform_all_tests()

The previous patch did not indent perform_all_tests() correctly after
moving the main logic into it, to avoid obscuring the functional
changes.  This patch fixes the indentation.

gdb/testsuite/ChangeLog:

	* gdb.base/callfuncs.exp (perform_all_tests): Re-indent.
Drop non-prototype C function header variants: solib1.c

Clean up solib1.c by removing the #ifdef PROTOTYPES conditional.

gdb/testsuite/ChangeLog:

	* gdb.base/solib1.c: Remove #ifdef PROTOTYPES, keep prototyped
	variant.
Drop non-prototype C function header variants: 'break' test case

Remove old-style function headers from break.c and break1.c.  Adjust
break.exp accordingly; in particular eliminate references to the
removed locations "breakpoint 9, 13, and 16" from break.exp.

gdb/testsuite/ChangeLog:

	* gdb.base/break.c: Remove #ifdef PROTOTYPES, keep prototyped
	variant.
	* gdb.base/break1.c: Likewise.
	* gdb.base/break.exp: Drop references to removed code.
Drop non-prototype C function header variants: 'list' test case

Remove old-style function header variants from list0.h and list1.c.
Fill the removed lines with comments or empty lines, such that the
line numbering is undisturbed.  Changes to the line numbering would
require heavy adjustments to list.exp, where many line numbers are
hard-coded, as well as a fair amount of knowledge about the source
code in and around certain lines.  Thus the dependency on the line
numbering can not be eliminated so easily, and it may not even be a
useful goal for a "list" test case.  Another option might be to adjust
the literal line numbers in list.exp, but even that is not as
straightforward as it may seem, since the test case expects certain
source lines to be exactly n lines apart.

gdb/testsuite/ChangeLog:

	* gdb.base/list0.h: Remove #ifdef PROTOTYPES, keep prototyped
	variant.  Preserve original line numbering.
	* gdb.base/list1.c: Likewise.
Drop non-prototype C function header variants: 'sepdebug' test case

Remove old-style function header variants from sepdebug.c.  Eliminate
references to the removed locations "breakpoint 9" and "breakpoint 13"
from sepdebug.exp.

gdb/testsuite/ChangeLog:

	* gdb.base/sepdebug.c: Remove #ifdef PROTOTYPES, keep prototyped
	variant.
	* gdb.base/sepdebug.exp: Drop references to removed code.
GDB testsuite: drop non-prototype C function header variants

Remove many old-style function header variants in C source files of
the GDB test suite, using the 'unifdef' tool with '-DPROTOTYPES=1'.

gdb/testsuite/ChangeLog:

	* gdb.base/annota1.c: Remove #ifdef PROTOTYPES, keep prototyped
	variant.
	* gdb.base/annota3.c: Likewise.
	* gdb.base/async.c: Likewise.
	* gdb.base/average.c: Likewise.
	* gdb.base/call-ar-st.c: Likewise.
	* gdb.base/call-rt-st.c: Likewise.
	* gdb.base/call-sc.c: Likewise.
	* gdb.base/call-strs.c: Likewise.
	* gdb.base/ending-run.c: Likewise.
	* gdb.base/execd-prog.c: Likewise.
	* gdb.base/exprs.c: Likewise.
	* gdb.base/foll-exec.c: Likewise.
	* gdb.base/foll-fork.c: Likewise.
	* gdb.base/foll-vfork.c: Likewise.
	* gdb.base/funcargs.c: Likewise.
	* gdb.base/gcore.c: Likewise.
	* gdb.base/jump.c: Likewise.
	* gdb.base/langs0.c: Likewise.
	* gdb.base/langs1.c: Likewise.
	* gdb.base/langs2.c: Likewise.
	* gdb.base/mips_pro.c: Likewise.
	* gdb.base/nodebug.c: Likewise.
	* gdb.base/opaque0.c: Likewise.
	* gdb.base/opaque1.c: Likewise.
	* gdb.base/recurse.c: Likewise.
	* gdb.base/run.c: Likewise.
	* gdb.base/scope0.c: Likewise.
	* gdb.base/scope1.c: Likewise.
	* gdb.base/setshow.c: Likewise.
	* gdb.base/setvar.c: Likewise.
	* gdb.base/shmain.c: Likewise.
	* gdb.base/shr1.c: Likewise.
	* gdb.base/shr2.c: Likewise.
	* gdb.base/sigall.c: Likewise.
	* gdb.base/signals.c: Likewise.
	* gdb.base/so-indr-cl.c: Likewise.
	* gdb.base/solib2.c: Likewise.
	* gdb.base/structs.c: Likewise.
	* gdb.base/sum.c: Likewise.
	* gdb.base/vforked-prog.c: Likewise.
	* gdb.base/watchpoint.c: Likewise.
	* gdb.reverse/shr2.c: Likewise.
	* gdb.reverse/until-reverse.c: Likewise.
	* gdb.reverse/ur1.c: Likewise.
	* gdb.reverse/watch-reverse.c: Likewise.
GDB testsuite: Fix warnings with -std=gnu11

Since upstream GCC has changed the default C language dialect to
'gnu11', it yields multiple warnings in the GDB testsuite for missing
function return types and implicit function declarations.  This patch
attempts to fix these.

gdb/testsuite/ChangeLog:

	* gdb.ada/cond_lang/foo.c (callme): Add return type.
	* gdb.base/call-sc.c (zed): Likewise.
	* gdb.base/checkpoint.c (main): Likewise.
	* gdb.base/dump.c (main): Likewise.
	* gdb.base/gcore.c (main): Likewise.
	* gdb.base/huge.c (main): Likewise.
	* gdb.base/multi-forks.c (main): Likewise.
	* gdb.base/pr10179-a.c (main): Likewise.
	* gdb.base/savedregs.c (main): Likewise.
	* gdb.base/sigaltstack.c (main): Likewise.
	* gdb.base/siginfo.c (main): Likewise.
	* gdb.base/structs.c (zed): Likewise.
	* gdb.mi/mi-stack.c (callee3, callee2, callee1, main): Likewise.
	* gdb.mi/mi-syn-frame.c (main): Likewise.
	* gdb.mi/until.c (foo, main): Likewise.
	* gdb.base/global-var-nested-by-dso.c (b_main, c_main): Declare.
	* gdb.base/solib-weak.c (foo): Declare.
	* gdb.base/attach-twice.c: Include stdio.h.
	* gdb.base/weaklib1.c: Likewise.
	* gdb.base/weaklib2.c: Likewise.
	* gdb.base/catch-signal-fork.c: Include stdio.h and sys/wait.h.
	* gdb.mi/mi-condbreak-call-thr-state-mt.c: Include stdio.h and
	unistd.h.
	* gdb.base/attach-pie-misread.c: Include stdlib.h.
	* gdb.mi/mi-exit-code.c: Likewise.
	* gdb.base/break-interp-lib.c: Include string.h.
	* gdb.base/coremaker.c: Likewise.
	* gdb.base/testenv.c: Likewise.
	* gdb.python/py-finish-breakpoint.c: Likewise.
	* gdb.base/inferior-died.c: Include sys/wait.h.
	* gdb.base/fileio.c: Include time.h.
	* gdb.base/async-shell.c: Include unistd.h.
	* gdb.base/dprintf-non-stop.c: Likewise.
	* gdb.base/info-os.c: Likewise.
	* gdb.mi/mi-console.c: Likewise.
	* gdb.mi/watch-nonstop.c: Likewise.
	* gdb.python/py-events.c: Likewise.
	* gdb.base/async.c (baz): Move up before its invocation.
	* gdb.base/code_elim2.c (my_global_func): Likewise.
	* gdb.base/skip-solib-lib.c (multiply): Likewise.
	* gdb.base/advance.c (func2): Likewise.
More fixes for readelf problems reading corrupt files.

	PR binutils/17531
	* readelf.c (process_version_sections): If the read of the version
	def information fails, make sure that the external verdef data is
	not used.
	(get_dynamic_data): Do not attempt to allocate memory for more
	dynamic data than there is in the file.  If the read fails, free
	the allocated buffer.
	(process_symbol_table): Do not print dynamic information if we
	were unable to read the dynamic symbol table.
	(print_gnu_note): Do not print the note if the descsz is too
	small.
[AArch64] Remove example processors from GAS.