Simplify REGISTRY cleanup usages

In registry.c:registry_clear_data, the registered data is iterated and
invoke each 'free' function with the data passed:

  for (registration = data_registry->registrations, i = 0;
       i < fields->num_data;
       registration = registration->next, i++)
    if (fields->data[i] != NULL && registration->data->free != NULL)
      adaptor (registration->data->free, container, fields->data[i]);

we can see that data is passed to function 'free' and data is not NULL.
In each usage, we don't have to get the data again through key and
do NULL pointer checking.  This patch is to simplify them.

gdb:

2013-10-29  Yao Qi  <yao@codesourcery.com>

	* auto-load.c (auto_load_pspace_data_cleanup): Get data from
	parameter 'arg' instead of from program_space_data.
	* objfiles.c (objfiles_pspace_data_cleanup): Likewise.
	* solib-darwin.c (darwin_pspace_data_cleanup): Likewise.
	* solib-dsbt.c (dsbt_pspace_data_cleanup): Likewise.
	* solib-svr4.c (svr4_pspace_data_cleanup): Likewise.
	* inflow.c (inflow_inferior_data_cleanup): Get data from
	parameter 'arg' instead of inferior_data.
	* registry.h: Add comments.
New remove-symbol-file command.

New command for removing symbol files added via
the add-symbol-file command.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

	* breakpoint.c (disable_breakpoints_in_freed_objfile): New function.
	* objfiles.c (free_objfile): Notify free_objfile.
	(is_addr_in_objfile): New function.
	* objfiles.h (is_addr_in_objfile): New declaration.
	* printcmd.c (clear_dangling_display_expressions): Act upon free_objfile
	events instead of solib_unloaded events.
	(_initialize_printcmd): Register observer for free_objfile instead
	of solib_unloaded notifications.
	* solib.c (remove_user_added_objfile): New function.
	* symfile.c (remove_symbol_file_command): New command.
	(_initialize_symfile): Add remove-symbol-file.
gdb/doc
	* observer.texi: New free_objfile event.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
Documentation for the remove-symbol-file command.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

	* NEWS: Add description of the remove-symbol-file command.
gdb/doc
	* gdb.texinfo (Commands to Specify Files): Add description
	of the remove-symbol-file command.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
Create target sections for user-added symbol files.

Add the sections of the symbol files that are provided via
'add-symbol-file' to the set of current target sections.
User-added sections are removed upon notification of free_objfile
when their corresponding object file is deleted.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

	* exec.h (add_target_sections_of_objfile): New declaration.
	* exec.c (add_target_sections_of_objfile): New function.
	* symfile.c (add_symbol_file_command): Update current target sections.
	(symfile_free_objfile): New function.
	(_initialize_symfile): Register observer for free_objfile events.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
Function is_elf_target.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

gdb/testsuite
	* lib/gdb.exp (is_elf_target): New function.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
Test adding and removing a symbol file at runtime.

This test exercises the commands 'add-symbol-file'
and 'remove-symbol-file'.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

gdb/testsuite
	* gdb.base/sym-file-lib.c: New file.
	* gdb.base/sym-file-loader.c: New file.
	* gdb.base/sym-file-loader.h: New file.
	* gdb.base/sym-file-main.c: New file.
	* gdb.base/sym-file.exp: New file.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
Print <unavailable> for unavailable registers in info register output.

  https://sourceware.org/ml/gdb-patches/2013-08/msg00171.html

gdb/ChangeLog

	* infcmd.c (default_print_one_register_info): Use val_print to
	print all values even optimized out or unavailable ones.  Don't
	try to print a raw form of optimized out or unavailable values.

gdb/testsuite/ChangeLog

	* gdb.trace/unavailable.exp (gdb_unavailable_registers_test):
	Expect <unavailable> pattern.
gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables defining change-log-default-name.

These references to ChangeLog-mi are stale.
testsuite/gdb.mi/ChangeLog-mi doesn't exist anymore, since:

...
commit 2dd627049d915a78ba15b65ab718d54958d115bf
Author: Andrew Cagney <cagney@redhat.com>
Date:   Sat Jun 23 21:47:09 2001 +0000

    Rename gdb.mi/ChangeLog-mi to gdb.mi/ChangeLog.  Update everything.
...
commit 48efe7049b1c286c702621e2f3e89e4584df2bd2
Author: Andrew Cagney <cagney@redhat.com>
Date:   Mon Jan 12 15:16:44 2004 +0000

    Eliminate the old mi/tui specific ChangeLog files as in ...

    Added Files:
        mi/ChangeLog-1999-2003 testsuite/gdb.mi/ChangeLog-1999-2003
        tui/ChangeLog-1998-2003
    Removed Files:
        mi/ChangeLog testsuite/gdb.mi/ChangeLog tui/ChangeLog


Tested with 'make check RUNTESTFLAGS="--directory=gdb.mi"' on x86_64 Fedora 17.

gdb/testsuite/
2013-10-29  Pedro Alves  <palves@redhat.com>

	* gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs
	variable setting change-log-default-name to ChangeLog-mi.
ChangeLog entries for the remove-symbol-file commits.
undef reg in gdb_curses.h

I tried to build gdb on the AIX machine in the GCC compile farm
(gcc111), but it failed in a couple of spots because gdb uses "reg" as
a variable name and the AIX <curses.h> defines "reg" to "register".

I saw that we already had a workaround for this lurking in utils.c, so
I just moved that to gdb_curses.h.

This fixed the problem on AIX and still builds on x86-64 Fedora 18.

2013-10-29  Tom Tromey  <tromey@redhat.com>

	* utils.c (reg): Move undefinition...
	* gdb_curses.h: ... here.  Update comment to mention AIX.
ld/ELF: refine fake STT_FILE symbol emission

There's no real need to emit these always: They're needed only if we
indeed want to emit a localized symbol. Hence defer emission until we
at least did the basic early checks that would lead to no such symbol
getting emitted. This in particular avoids emitting such a symbol in
the majority of (if not all) "ld -r" cases.

I hope my set of cross build tests caught all the test cases needing
adjustment - please forgive if I missed a few.

bfd/
2013-10-29  Jan Beulich <jbeulich@suse.com>

	* elflink.c (struct elf_outext_info): Add field file_sym_done.
	(bfd_elf_final_link): Initialize new field. Move fake STT_FILE
	symbol emission from here ...
	(elf_link_output_extsym): ... to here.

gas/testsuite/
2013-10-29  Jan Beulich <jbeulich@suse.com>

	* gas/microblaze/relax_size.elf: Drop expectation of no longer
	present STT_FILE symbol.
	* gas/microblaze/relax_size2.elf: Likewise.

ld/testsuite/
2013-10-29  Jan Beulich <jbeulich@suse.com>

	* ld-cris/tls-e-tpoffcomm1.d: Drop expectation of no longer
	present STT_FILE symbol.
	* ld-mmix/bpo-18.d: Likewise.
	* ld-mmix/bpo-22.d: Likewise.
	* ld-mmix/greg-6.d: Likewise.
	* ld-mmix/greg-7.d: Likewise.
	* ld-mmix/loc4.d: Likewise.
	* ld-mmix/local1.d: Likewise.
	* ld-mmix/local3.d: Likewise.
	* ld-mmix/local5.d: Likewise.
	* ld-mmix/local7.d: Likewise.
	* ld-mmix/loct-1.d: Likewise.
	* ld-sh/sh64/abi32.xd: Likewise.
	* ld-sh/sh64/abi64.xd: Likewise.
	* ld-sh/sh64/cmpct1.xd: Likewise.
	* ld-sh/sh64/crange1.rd: Likewise.
	* ld-sh/sh64/crange2.rd: Likewise.
	* ld-sh/sh64/crange3-cmpct.rd: Likewise.
	* ld-sh/sh64/crange3-media.rd: Likewise.
	* ld-sh/sh64/crange3.rd: Likewise.
	* ld-sh/sh64/crangerel1.rd: Likewise.
	* ld-sh/sh64/crangerel2.rd: Likewise.
	* ld-sh/sh64/mix1.xd: Likewise.
	* ld-sh/sh64/mix2.xd: Likewise.
	* ld-sh/sh64/shdl32.xd: Likewise.
	* ld-sh/sh64/shdl64.xd: Likewise.
daily update
daily update
BFD: elf64-x86-64-nacl: Correct 9-byte nop sequence used in PLT0 entry.

bfd/
	* elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Correct 9-byte nop
	sequence to match what the assembler generates.
linux-tdep.c: Fix "warning: 'siginfo_size' may be used uninitialized..."

	* linux-tdep.c (linux_corefile_thread_callback): Preinitialize
	siginfo_size.