linux-nat.c: no need to block child signals so aggressively.

In http://sourceware.org/ml/gdb-patches/2013-08/msg00174.html , the
issue of child signal handling around ptrace option support discovery
being different between GDB and GDBserver came up.

I recalled adding these block_child_signals calls, and the "We don't
want those ptrace calls to be interrupted" comment, but not exactly
why.  So I looked into it.  My first guess is that I got confused.
The patch that added this
<http://sourceware.org/ml/gdb-patches/2009-04/msg00125.html> rewrote
the linux native async support completely, and the old async support
code had the SIGCHLD handler itself do waitpid, so in places that we'd
want a blocking waitpid, we'd have to have the signal handler blocked.
That was probably the mindset I had at the time.  Anyway, whatever the
case, looks like I was wrong on the need for this blocking.
Given GDBserver doesn't block like this, I investigated why this is
currently needed on GDB but not on GDBserver.

I removed the block_child_signals (and restore) calls, and hacked
linux-nat.c to call linux_test_for_tracefork in a loop, like:

 @@ -534,7 +534,10 @@ static int
  linux_supports_tracefork (int pid)
  {
    if (linux_supports_tracefork_flag == -1)
 -    linux_test_for_tracefork (pid);
 +    {
 +      while (1)
 +       linux_test_for_tracefork (pid);
 +    }
    return linux_supports_tracefork_flag;
  }

Running the resulting GDB, I then saw bad things happening.
Specifically, I'd end up with a bunch of zombies, and eventually, the
machine would refuse to spawn new processes, claming insufficient
resources.

The issue is that linux_test_for_tracefork test forks, and has the
child fork again.  If we don't block SIGCHLD on entry to the function,
the children will inherit SIGCHLD's action/disposition (meaning,
SIGCHLD will be unblocked in the child).  When the first child forks
again a second child, and that child exits, the first child gets a
SIGCHLD.  Now, when we try to wrap up for the whole options test, we
kill the first child, and collect the waitstatus.  Here, when SIGCHLD
isn't blocked, GDB will first see the child reporting a stop with
SIGCHLD.  gdbserver's ptrace options test does a PTRACE_KILL loop at
the end, which catches the SIGCHLD, and retries the kill.  The GDB
version did not do that.  So the GDB version would proceed, leaving
the child zombie (until GDB exists), as nothing collected its final
waitstatus.

So this patch makes the GDB version of linux_test_for_tracefork do the
exact same as the GDBserver version, removes all this unnecessary
blocking throughout, and adds a couple comments at places that do need
it -- namely: places where we'll use sleep with sigsuspend; and
linux_async_pipe, as that destroys the pipe the signal handler
touches.

Tested on x86_64 Fedora 17, sync and async.

gdb/
2013-08-19  Pedro Alves  <palves@redhat.com>

	* linux-nat.c (linux_test_for_tracefork)
	(linux_test_for_tracesysgood, linux_child_follow_fork)
	(lin_lwp_attach_lwp, linux_nat_resume): Don't block child signals.
	(linux_nat_wait_1): Extend comment.
	(linux_async_pipe): Add comment.
Remove PREFIX_EVEX_0F3A3E and PREFIX_EVEX_0F3A3F

	* i386-dis.c (PREFIX_EVEX_0F3A3E): Removed.
	(PREFIX_EVEX_0F3A3F): Likewise.
	* i386-dis-evex.h (evex_table): Updated.
	gdb/
	* Makefile.in (SFILES): Remove common/target-common.c and
	add target/waitstatus.c.
	(HFILES_NO_SRCDIR): Remove common/target-common.h and add
	target/resume.h, target/wait.h and target/waitstatus.h.
	(COMMON_OBS): Remove target-common.o and add
	waitstatus.o.
	(target-common.o): Remove.
	(waitstatus.o): New target object file.
	* common/target-common.c: Move contents to
	target/waitstatus.c and remove.
	* common/target-common.h: Move contents to other files and
	remove.
	(enum resume_kind: Move to target/resume.h.
	(TARGET_WNOHANG): Move to target/wait.h.
	(enum target_waitkind): Move to target/waitstatus.h.
	(struct target_waitstatus): Likewise.
	* target.h: Do not include target-common.h and
	include target/resume.h, target/wait.h and
	target/waitstatus.h.
	* target/resume.h: New file.
	* target/wait.h: New file.
	* target/waitstatus.h: New file.
	* target/waitstatus.c: New file.

	gdb/gdbserver/
	* Makefile.in (INCLUDE_CFLAGS): Include -I$(srcdir)/../.
	(SFILES): Remove $(srcdir)/common/target-common.c and
	add $(srcdir)/target/waitstatus.c.
	(OBS): Remove target-common.o and add waitstatus.o.
	(server_h): Remove $(srcdir)/../common/target-common.h and
	add $(srcdir)/../target/resume.h, $(srcdir)/../target/wait.h
	and $(srcdir)/../target/waitstatus.h.
	(target-common.o): Remove.
	(waitstatus.o): New target object file.
	* target.h: Do not include target-common.h and
	include target/resume.h, target/wait.h and
	target/waitstatus.h.
include/opcode/
	* mips.h (OP_OPTIONAL_REG): New mips_operand_type.
	(mips_optional_operand_p): New function.

opcodes/
	* mips-formats.h (OPTIONAL_REG, OPTIONAL_MAPPED_REG): New macros.
	* micromips-opc.c (decode_micromips_operand): Use OPTIONAL_REG
	and OPTIONAL_MAPPED_REG.
	* mips-opc.c (decode_mips_operand): Likewise.
	* mips16-opc.c (decode_mips16_operand): Likewise.
	* mips-dis.c (print_insn_arg): Handle OP_OPTIONAL_REG.

gas/
	* config/tc-mips.c (operand_reg_mask, match_operand): Handle
	OP_OPTIONAL_REG.
	(mips_ip, mips16_ip): Use mips_optional_operand_p to check
	for optional operands.
include/opcode/
	* mips.h (M_DEXT, M_DINS): Delete.

opcodes/
	* micromips-opc.c (micromips_opcodes): Replace "dext" and "dins"
	macro entries with "dextm", "dextu", "dinsm" and "dinsu" aliases.
	Use +H rather than +C for the real "dext".
	* mips-opc.c (mips_builtin_opcodes): Likewise.

gas/
	* config/tc-mips.c (report_bad_range, report_bad_field): Delete.
	(macro): Remove M_DEXT and M_DINS handling.

gas/testsuite/
	* gas/mips/ext-ill.l, gas/mips/mips64r2-ill.l: Expect DEXT and DINS
	error messages to have the same form as the EXT and INS ones.
	* gas/mips/micromips-insn32.d, gas/mips/micromips-noinsn32.d,
	gas/mips/micromips-trap.d, gas/mips/micromips.d,
	gas/mips/micromips@mips64r2.d, gas/mips/mips64r2.d: Expect
	"dext" and "dins" instead of "dextm", "dextu", "dinsm" and "dinsu".
include/opcode/
	* mips.h: Remove references to "+I" and imm2_expr.

gas/
	* config/tc-mips.c (imm2_expr): Delete.
	(md_assemble, match_insn, imm2_expr.X_op, mips_ip): Update accordingly.
daily update
merge from gcc
	* doublest.c (convert_floatformat_to_doublest): Use fmt->split_half
	for IBM long double nan and inf.
	(floatformat_is_negative, floatformat_classify,
	floatformat_mantissa): Similarly.
	(floatformat_ieee_single, floatformat_ieee_double,
	floatformat_ieee_quad, floatformat_arm_ext,
	floatformat_ia64_spill): Delete unused vars.
	(_initialize_doublest): Delete unused function.
	* gdbtypes.c (floatformats_ibm_long_double): Use new big- and
	little-endian variants of floatformat_ibm_long_double.
move gdbarch object from objfile to per-BFD

This moves the "gdbarch" field from the objfile into the BFD.

This field's value is derived from the BFD and is immutable over the
lifetime of the BFD.  This makes it a reasonable candidate for pushing
into the per-BFD object.

This is part of the long-term objfile splitting project.  In the long
run I think this patch will make it simpler to moves types from the
objfile to the per-BFD object; but the patch makes sense as a minor
cleanup by itself.

Built and regtested on x86-64 Fedora 18.

	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
	get_objfile_arch.
	* elfread.c (elf_rel_plt_read, elf_gnu_ifunc_record_cache)
	(elf_gnu_ifunc_resolve_by_got): Use get_objfile_arch.
	* jit.c (jit_object_close_impl): Update.
	* jv-lang.c (get_dynamics_objfile): Update.
	* linespec.c (add_minsym): Use get_dynamics_objfile.
	* objfiles.c (get_objfile_bfd_data): Initialize 'gdbarch' field.
	(allocate_objfile): Don't initialize 'gdbarch' field.
	(get_objfile_arch): Update.
	* objfiles.h (struct objfile_per_bfd_storage) <gdbarch>: New field,
	moved from...
	(struct objfile) <gdbarch>: ... here.  Remove.
	* stap-probe.c (stap_can_evaluate_probe_arguments): Use
	get_objfile_arch.
	* symfile.c (init_entry_point_info): Use get_objfile_arch.
fix PR python/15816

This fixes PR python/15816.

The bug here is that python-selftest.exp can fail:

    No symbol "RETURN_MASK_ALL" in current context.

RETURN_MASK_ALL is a macro, so if macros do not end up in the
debuginfo (very typical) then the test fails.

It seemed simplest to me to simply turn the RETURN_MASK_ defines into
enum constants.  This way they end up in the debuginfo and all is
well.

	PR python/15816:
	* exceptions.h (return_mask): Now an enum.
	(RETURN_MASK_QUIT, RETURN_MASK_ERROR, RETURN_MASK_ALL): Now
	enum constants.

Built and regtested on x86-64 Fedora 18.
	* blockframe.c: Remove #include "psymtab.h".
	* cp-support.c: Ditto.
	* source.c: Ditto.
	* stack.c: Ditto.
	* dbxread.c (record_minimal_symbol): Make 'name' argument const.
	Update.
	(read_dbx_dynamic_symtab): Make 'name' const.  Remove casts.
	* buildsym.c (subfile_stack): Move here from buildsym.h.
	(pending_macros): Ditto.
	(get_macro_table): New function.
	(buildsym_init): Initialize subfile_stack.
	* coffread.c (type_vector,type_vector_length): Moved here from
	buildsym.h.
	(INITIAL_TYPE_VECTOR_LENGTH): Ditto.
	(coff_symtab_read): Use it.
	* dbxread.c (read_ofile_symtab): Delete init of subfile_stack.
	* dwarf2read.c (macro_start_file): Replace uses of pending_macros
	with call to get_macro_table.
	* stabsread.c (type_vector,type_vector_length): Moved here from
	buildsym.h.
	(INITIAL_TYPE_VECTOR_LENGTH): Ditto.
	* buildsym.h (get_macro_table): Declare.
daily update
	* elflink.c (_bfd_elf_define_linkage_sym): Don't set STV_INTERNAL
	symbols to STV_HIDDEN.
	* elflink.c (_bfd_elf_merge_symbol): Set *poldbfd, *poldweak,
	and *poldalignment before exiting when !relocs_compatible.
Fix typo
2013-08-21  Tristan Gingold  <gingold@adacore.com>

	* coff-rs6000.c (_bfd_xcoff_sizeof_headers): Also count
	.ovrflo sections.
	* coffcode.h (coff_compute_section_file_positions): Force
	match between file offset and vma offset.
Fix whitespace.