A simple replacement of sprintf (xxx, "%s", xxx) with strcpy.

	* config/tc-score7.c: Replace sprintf with strcpy where
	appropriate.
Fix seg-faults when fetching the frags of local symbols.

	* config/tc-score7.c: (s7_b32_relax_to_b16): Use symbol_get_frag() to access a symbol's frag.
	* config/tc-score.c (s3_relax_branch_inst16): Likewise.
	(s3_relax_cmpbranch_inst32): Likewise.
make calls to help_list use enumerator

Currently there are many calls to help_list that pass the constant -1
as the "class" value.  However, the parameter is declared as being of
type enum command_class, and uses of the constant violate this
abstraction.

This patch fixes the error everywhere it occurs in the gdb sources.

Tested by rebuilding.

2014-06-13  Tom Tromey  <tromey@redhat.com>

	* cp-support.c (maint_cplus_command): Pass all_commands, not -1,
	to help_list.
	* guile/guile.c (info_guile_command): Pass all_commands, not -1,
	to help_list.
	* tui/tui-win.c (tui_command): Pass all_commands, not -1, to
	help_list.
	* tui/tui-regs.c (tui_reg_command): Pass all_commands, not -1, to
	help_list.Pass all_commands, not -1, to help_list.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, tekhex_dump_command)
	(binary_dump_command, binary_append_command): Pass all_commands,
	not -1, to help_list.
	* cli/cli-cmds.c (info_command, set_debug): Pass all_commands, not
	-1, to help_list.
	* valprint.c (set_print, set_print_raw): Pass all_commands, not
	-1, to help_list.
	* typeprint.c (set_print_type): Pass all_commands, not -1, to
	help_list.
	* top.c (set_history): Pass all_commands, not -1, to help_list.
	* target-descriptions.c (set_tdesc_cmd, unset_tdesc_cmd): Pass
	all_commands, not -1, to help_list.
	* symfile.c (overlay_command): Pass all_commands, not -1, to
	help_list.
	* spu-tdep.c (info_spu_command): Pass all_commands, not -1, to
	help_list.
	* serial.c (serial_set_cmd): Pass all_commands, not -1, to
	help_list.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Pass all_commands, not
	-1, to help_list.
	* remote.c (remote_command, set_remote_cmd): Pass all_commands,
	not -1, to help_list.
	* ravenscar-thread.c (set_ravenscar_command): Pass all_commands,
	not -1, to help_list.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd): Pass
	all_commands, not -1, to help_list.
	* macrocmd.c (macro_command): Pass all_commands, not -1, to
	help_list.
	* language.c (set_check): Pass all_commands, not -1, to help_list.
	* infcmd.c (unset_command): Pass all_commands, not -1, to
	help_list.
	* frame.c (set_backtrace_cmd): Pass all_commands, not -1, to
	help_list.
	* dwarf2read.c (set_dwarf2_cmd): Pass all_commands, not -1, to
	help_list.
	* dcache.c (set_dcache_command): Pass all_commands, not -1, to
	help_list.
	* breakpoint.c (save_command): Pass all_commands, not -1, to
	help_list.
	* ada-lang.c (maint_set_ada_cmd, set_ada_command): Pass
	all_commands, not -1, to help_list.
Add support for reading Aarch64 core dumps.

	* elfxx-aarch64.c (stdarg.h): Include.
	(string.h): Include.
	(_bfd_aarch64_elf_grok_prstatus): Updated.
	(_bfd_aarch64_elf_grok_psinfo): New function.
	(_bfd_aarch64_elf_write_core_note): New function.
	* elfxx-aarch64.h (elf_backend_grok_psinfo): Define.
	(elf_backend_write_core_note): Define.
daily update
Include --with-guile in 'show configuration's output.

	* top.c (print_gdb_configuration) [HAVE_GUILE]: Print --with-guile
	or --without-guile, according to how GDB was built.
daily update
daily update
Fix uninitialised CRIS insn

gas/
	* config/tc-cris.c (md_create_long_jump): Follow "short" jump
	with a nop rather than leaving uninitialised.
gas/testsuite/
	* gas/cris/rd-bkw4v32.d: Update.
Fix uninitialised ARM data

MALLOC_PERTURB_=1 results in "FAIL: PIC" on arm-vxworks, due to garbage
in words with got relocs.

	* config/tc-arm.c (s_arm_elf_cons): Initialise after frag_more.
	(md_apply_fix): Delete now unnecessary zeroing for BFD_RELOC_ARM_GOT*
	and BFD_RELOC_ARM_TLS* relocs.  Simplify BFD_RELOC_8 case.
Fix uninitialised VAX .got and .got.plt section

Cures these failures with MALLOC_PERTURB_=1
FAIL: GOT test (executable)
FAIL: GOT test (shared library)
FAIL: VAX export class call relocation test
FAIL: VAX export class data relocation test

	* elf32-vax.c (elf_vax_size_dynamic_sections): Clear linker
	created sections.
Fix uninitialised VAX insn

MALLOC_PERTURB_=1 results in "FAIL: VAX ELF relocations", due to object
file being emitted with uninitialised fields.  Since these fields had
RELA relocs the field value won't be used at final link time, so the
problem is only seen in relocatable object files.

This rewrite of md_apply_fix clears all fields with relocs, whereas
before some fields had non-zero values.

gas/
	* config/tc-vax.c (md_apply_fix): Rewrite.
	(tc_gen_reloc, vax_cons, vax_cons_fix_new): Style: Use NO_RELOC
	define rather than the equivalent BFD_RELOC_NONE.
gas/testsuite/
	* gas/vax/elf-rel.d: Update.
Fix TIC54X buffer overruns

MALLOC_PERTURB_=1 results in "FAIL: c54x macros".

	* config/tc-tic54x.c (tic54x_mlib): Don't write garbage past
	end of archive to temp file.
	(tic54x_start_line_hook): Start scan for parallel on next line,
	not one char into next line (which may overrun the buffer).
Fix unintitialised TIC6X data

MALLOC_PERTURB_=1 results in the following fails due to uninitialised
exindx data:

FAIL: C6X unwinding directives 1 (little endian)
FAIL: C6X unwinding directives 2 (big endian)
FAIL: C6X unwinding directives 3 (segment change)
FAIL: ld-tic6x/unwind-1
FAIL: ld-tic6x/unwind-2
FAIL: ld-tic6x/unwind-3
FAIL: ld-tic6x/unwind-4
FAIL: ld-tic6x/unwind-6

	* config/tc-tic6x.c (s_tic6x_ehtype): Clear after frag_more.
	(tic6x_output_exidx_entry): Likewise.
	(md_apply_fix): Simplify 1 byte md_number_to_chars.
Report an error on x86 pcrel BFD_RELOC_SIZE64

	* config/tc-i386.c (reloc): Don't avoid pcrel check for
	BFD_RELOC_SIZE64.  Return NO_RELOC on failing pcrel check.
Don't leave DLX the_insn uninitialised

In particular the_insn.reloc must be initialised, otherwise the early
exit cases for bad opcodes will result in cascading errors if
write_object_file is called after an error.

	* config/tc-dlx.c (machine_ip): Move initialisation of the_insn
	earlier.
Run write_object_file after errors

This is to fix unitialised memory access when printing listings.
Many targets don't initialise parts of insn frags or data frags that
have fixups, relying on md_apply_fix to finalise the frag.  Which is
fine normally, but means we need to run write_object_file after
errors, for listings.  Otherwise MALLOC_PERTURB_=1 causes errors like:
x86_64-linux  +FAIL: i386 mpx-inval-1
x86_64-linux  +FAIL: i386 inval-equ-1
x86_64-linux  +FAIL: i386 x86-64-mpx-inval-1

Running write_object_file after errors requires some tweaking to the
testsuite, since we then get extra errors reported from md_apply_fix.

gas/
	* write.h (subsegs_finish): Delete declaration.
	* write.c (subsegs_finish): Make static.
	(write_object_file): Call subsegs_finish from here.  Don't print
	warning and error count here..
	* as.c (main): ..do so here instead.  Remove dead code for "no
	object file generated".  Split out count strings to better support
	internationalisation.  Don't call subsegs_finish. Tidy setting of
	"keep_it".  Run write_object_file even after errors.
	(keep_it): Make static.
	* config/obj-elf.c (elf_frob_symbol): Remove assert.
	(elf_frob_file_before_adjust): Likewise.
gas/testsuite/
	* gas/elf/bad-group.s: Use %function.
	* gas/elf/bad-group.err: Expect correct line number.  Allow
	other errors.
	* gas/elf/bad-size.err: Allow other errors.  Match expected
	error somewhat more rigorously.
	* gas/i386/reloc32.l: Allow other errors.
	* gas/i386/mpx-inval-1.l: Match applied relocs.
	* gas/i386/x86-64-mpx-inval-1.l: Likewise, and nop padding.
	* gas/i386/x86-64-mpx-inval-2.l: Match nop padding, and allow
	other errors.
	* gas/macros/dot.s: Use .balign.
	* gas/macros/dot.l: Update alignment output.
	* gas/symver/symver6.l: Allow other errors.
Fix duplicated assignments to __rel_iplt and __rela_iplt symbols

and fix more nds32 dependencies.

	* scripttempl/elf.sc: Edit out __rela_iplt symbol assignments from
	.rel sections, and __rel_iplt from .rela sections.
	* scripttempl/nds32elf.sc: Likewise.
	* Makefile.am (ends32*.c): Depend on nds32elf.sc.
	* Makefile.in: Regenerate.
fix incorrect comments in minsyms.h

minsyms.h incorrectly claims that a couple of functions call
prim_record_minimal_symbol_full with COPY_NAME=0 -- but actually they
pass 1.  Passing 1 is the correct behavior, so this patch fixes the
documentation.

I'm checking this in as obvious.

2014-06-16  Tom Tromey  <tromey@redhat.com>

	* minsyms.h (prim_record_minimal_symbol)
	(prim_record_minimal_symbol_and_info): Update comments.
"$ gdb PROGRAM" vs "(gdb) file PROGRAM" difference; warn on failure to remove breakpoint.

Turns out there's a difference between loading the program with "gdb
PROGRAM", vs loading it with "(gdb) file PROGRAM".  The latter results
in the objfile ending up with OBJF_USERLOADED set, while not with the
former.  (That difference seems bogus, but still that's not the point
of this patch.  We can revisit that afterwards.)

The new code that suppresses breakpoint removal errors for
add-symbol-file objects ends up being too greedy:

      /* In some cases, we might not be able to remove a breakpoint in
         a shared library that has already been removed, but we have
         not yet processed the shlib unload event.  Similarly for an
         unloaded add-symbol-file object - the user might not yet have
         had the chance to remove-symbol-file it.  shlib_disabled will
         be set if the library/object has already been removed, but
         the breakpoint hasn't been uninserted yet, e.g., after
         "nosharedlibrary" or "remove-symbol-file" with breakpoints
         always-inserted mode.  */
      if (val
          && (bl->loc_type == bp_loc_software_breakpoint
              && (bl->shlib_disabled
                  || solib_name_from_address (bl->pspace, bl->address)
                  || userloaded_objfile_contains_address_p (bl->pspace,
                                                            bl->address))))
        val = 0;

as it turns out that OBJF_USERLOADED can be set for objfiles loaded by
some other means not add-symbol-file.  In this case, symbol-file (or
"file", which is really just "exec-file"+"symbol-file").

Recall that add-symbol-file is documented as:

 (gdb) help add-symbol-file
 Load symbols from FILE, assuming FILE has been dynamically loaded.
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

And it's the "dynamically loaded" aspect that the breakpoint.c code
cares about.  So make add-symbol-file set OBJF_SHARED on its objfiles
too, and tweak the breakpoint.c code to look for OBJF_SHARED instead
of OBJF_USERLOADED.

This restores back the missing breakpoint removal warning when we let
sss-bp-on-user-bp-2.exp run on native GNU/Linux
(https://sourceware.org/ml/gdb-patches/2014-06/msg00335.html):

 (gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: define stepi_del_break
 stepi_del_break
 warning: Error removing breakpoint 3
 (gdb) FAIL: gdb.base/sss-bp-on-user-bp-2.exp: stepi_del_break

I say "restores" because this was GDB's behavior in 7.7 and earlier.

And, likewise, "file" with no arguments only started turning
breakpoints set in the main executable to "<pending>" with the
remote-symbol-file patch (63644780).  The old behavior is now
restored, and we break-unload-file.exp test now exercizes both "gdb;
file PROGRAM" and "gdb PROGRAM".

gdb/
2014-06-16  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (insert_bp_location, remove_breakpoint_1): Adjust.
	(disable_breakpoints_in_freed_objfile): Skip objfiles that don't
	have OBJF_SHARED set.
	* objfiles.c (userloaded_objfile_contains_address_p): Rename to...
	(shared_objfile_contains_address_p): ... this.  Check OBJF_SHARED
	instead of OBJF_USERLOADED.
	* objfiles.h (OBJF_SHARED): Update comment.
	(userloaded_objfile_contains_address_p): Rename to ...
	(shared_objfile_contains_address_p): ... this, and update
	comments.
	* symfile.c (add_symbol_file_command): Also set OBJF_SHARED in the
	new objfile.
	(remove_symbol_file_command): Skip objfiles that don't have
	OBJF_SHARED set.

gdb/testsuite/
2014-06-16  Pedro Alves  <palves@redhat.com>

	* gdb.base/break-main-file-remove-fail.c: New file.
	* gdb.base/break-main-file-remove-fail.exp: New file.
	* gdb.base/break-unload-file.exp: Use build_executable instead of
	prepare_for_testing.
	(test_break): New parameter "initial_load".  Handle it.
	(top level): Add initial_load cmdline/file axis.