Ensure internal_vproblem always prints the message

While working on internal_vproblem I noticed that the error/warning
message is suppressed if problem->should_quit is internal_problem_yes
or internal_problem_no.  This behaviour seems wrong.  This commit
modifies internal_vproblem to emit the message regardless of the
user's settings.

gdb/
2014-08-19  Gary Benson  <gbenson@redhat.com>

	* utils.c (internal_vproblem): Always print the message.
Introduce common/errors.h

This introduces common/errors.h.  This holds some error- and warning-
related declarations that can be used by the code in common, nat and
target.  Some of the declared functions must be provided by the client
as documented by the header file comments.

gdb/ChangeLog:

	* common/errors.h: New file.
	* common/errors.c: Likewise.
	* Makefile.in (SFILES): Add common/errors.c.
	(HFILES_NO_SRCDIR): Add common/errors.h.
	(COMMON_OBS): Add errors.o.
	(errors.o): New rule.
	* common/common-defs.h: Include errors.h.
	* utils.h (perror_with_name, error, verror, warning, vwarning):
	Don't declare.
	* common/common-utils.h: (malloc_failure, internal_error):
	Likewise.

gdb/gdbserver/ChangeLog:

	* Makefile.in (SFILES): Add common/errors.c.
	(OBS): Add errors.o.
	(IPA_OBS): Add errors-ipa.o.
	(errors.o): New rule.
	(errors-ipa.o): Likewise.
	* utils.h (perror_with_name, error, warning): Don't declare.
	* utils.c (warning): Renamed and rewritten as...
	(vwarning): New function.
	(error): Renamed and rewritten as...
	(verror): New function.
	(internal_error): Renamed and rewritten as...
	(internal_verror): New function.
Introduce common-types.h

This introduces common-types.h.  This file defines various standard
types used by gdb and gdbserver.

Currently these types are conditionally defined based on GDBSERVER.
The long term goal is to remove all such tests; however, this is
difficult as currently gdb uses definitions from BFD.  In the meantime
this is still a step in the right direction.

gdb/ChangeLog:

	* common/common-types.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add common/common-types.h.
	* common/common-defs.h: Include common-types.h.
	* defs.h (gdb_byte, CORE_ADDR, CORE_ADDR_MAX, LONGEST)
	(ULONGEST): Remove.

gdb/gdbserver/ChangeLog:

	* server.h: Add static assertion.
	(gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Remove.
Move print-utils.h to common-defs.h

This commit moves the inclusion of print-utils.h to common-defs.h
and removes all other inclusions.

gdb/ChangeLog:

	* common/common-defs.h: Include print-utils.h.
	* utils.h: Do not include print-utils.h.

gdb/gdbserver/ChangeLog:

	* utils.h: Do not include print-utils.h.
Introduce common-debug.h

This introduces common-debug.h.  This holds the functions debug_printf
and debug_vprintf, two functions that the common code can use to print
debugging messages.  Clients of the common code are expected to
implement debug_vprintf; a debug_vprintf function is written from
scratch for GDB, and gdbserver's existing debug_printf is repurposed
as debug_vprintf.

common/agent.c is changed to use debug_vprintf rather than
defining the macro DEBUG_AGENT depending on GDBSERVER.

nat/i386-dregs.c is changed to use the externally-implemented
debug_printf, rather than defining it itself.

gdb/ChangeLog:

	* common/common-debug.h: New file.
	* common/common-debug.c: Likewise.
	* debug.c: Likewise.
	* Makefile.in (SFILES): Add common/common-debug.c.
	(HFILES_NO_SRCDIR): Add common/common-debug.h.
	(COMMON_OBS): Add common-debug.o and debug.o.
	(common-debug.o): New rule.
	* common/common-defs.h: Include common-debug.h.
	* common/agent.c (debug_agent_printf): New function.
	(DEBUG_AGENT): Redefine.
	* nat/i386-dregs.c (debug_printf): Undefine.

gdb/gdbserver/ChangeLog:

	* Makefile.in (SFILES): Add common/common-debug.c.
	(OBS): Add common-debug.o.
	(common-debug.o): New rule.
	* debug.h (debug_printf): Don't declare.
	* debug.c (debug_printf): Renamed and rewritten as...
	(debug_vprintf): New function.
Replace static variables in the MSP430 simulator with fields in the cpu state structure.

	* msp430-sim.c: Move static hardware multiply support variables
	from here...
	* msp430-sim.h (msp430_cpu_state): ... into here ...
	* msp430-sim.c (get_op, put_op): ... and update references to use
	the msp430_cpu_state structure.
Fix --diable-shared --enable-plugins build breakage

Directories that don't use libtool need to add -ldl (on most *nix
hosts) to provide dlopen for libbfd.

config/
	* plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
	LIBS via AC_SEARCH_LIBS.
gdb/
	* acinclude.m4 (GDB_AC_CHECK_BFD): Don't add -ldl.
	* config.in: Regenerate.
sim/ppc/
	* configure.ac: Invoke AC_PLUGINS.
	* config.in: Regenerate.

and regen lots of configure files.
Support _Complex in hard-VFP abi

Hi,
When we pass "-mfloat-abi=hard" flag in the GDB testing, we see the
following fails,

FAIL: gdb.base/callfuncs.exp: p t_float_complex_values(fc1, fc2)
FAIL: gdb.base/callfuncs.exp: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4)
FAIL: gdb.base/callfuncs.exp: p t_double_complex_values(dc1, dc2)
FAIL: gdb.base/callfuncs.exp: p t_double_complex_many_args(dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_values(ldc1, ldc2)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_many_args(ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4)
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex

The hard-VFP ABI was supported by GDB overal, done by this patch
https://sourceware.org/ml/gdb-patches/2009-07/msg00686.html but
"vectors and complex types are not currently supported", mentioned in
the patch.  As a result, these tests fail.

This patch is to support _Complex types in hard-VFP abi.  As specified
in "7.1.1, Procedure Call Standard for the ARM Arch", the layout of
_Complex types is a struct, which is identical to the layout on amd64,
so I copy Mark's comments to amd64 support.

Regression tested on arm-none-eabi target.  OK to apply?

gdb:

2014-08-19  Yao Qi  <yao@codesourcery.com>

	* arm-tdep.c (arm_vfp_cprc_sub_candidate): Handle _Complex
	types.
Set breakpoint on the right line

In gdb.base/watchpoint-hw-hit-once.exp, test scans source and set
breakpoint on the line having "break-at-exit",

  gdb_breakpoint [gdb_get_line_number "break-at-exit"]

However, in watchpoint-hw-hit-once.c, there are two lines having
this key word:

  dummy = 1;	/* Stub to catch break-at-exit after WATCHEE has been hit.  */
  dummy = 2;	/* break-at-exit */

so the test sets breakpoint on the first one, while I think it is
expected to set breakpoint on the second one, as far as I can tell
from the comments in watchpoint-hw-hit-once.c:

  /* Stub lines are present as no breakpoints/watchpoint gets hit if current PC
     already stays on the line PC while entering "step"/"continue".  */

This patch is to change the source matching pattern so that test
can correctly set breakpoint on the right line.  This patch fixes
a fail we found on arm-none-eabi target.

(gdb) PASS: gdb.base/watchpoint-hw-hit-once.exp: continue
continue^M
Continuing.^M
^M
*** EXIT code 0^M
[Inferior 1 (Remote target) exited normally]^M
(gdb) FAIL: gdb.base/watchpoint-hw-hit-once.exp: continue to break-at-exit (the program exited)

Run it again on x86_64-linux, no result changes.

gdb/testsuite:

2014-08-19  Yao Qi  <yao@codesourcery.com>

	* gdb.base/watchpoint-hw-hit-once.exp: Set breakpoint on the
	right line.
value_from_pointer: remove call to resolve_dynamic_type

The given type is expected to always be a TYPE_CODE_PTR, for which
resolve_dynamic_type does nothing.  So this patch removes this call.

gdb/ChangeLog:

        * value.c (value_from_pointer): Remove use of resolve_dynamic_type.
        Adjust code accordingly.  Adjust function description comment.
This patch set mainly aims at improving the S/390 disassembler's
readability and also fixes some minor issues.

  S/390: Split disassembler routine into smaller functions
  S/390: Fix disassembler's treatment of signed/unsigned operands
  S/390: Fix off-by-one error in disassembler initialization
  S/390: Simplify opcode search loop in disassembler
  S/390: Drop function pointer dereferences in disassembler
  S/390: Various minor simplifications in disassembler
This patch adds support for FreeBSD ARM in gas.
Before FreeBSD-8 there was/is no arm support from the OS side.
FreeBSD-9.x added ARM support but only for the OABI.
From FreeBSD-10 upwards there is EABI support.

    * Makefile.am: Add FreeBSD ARM support.
    * Mafefile.in: Regenerate.
    * configure.tgt: Add FreeBSD ARM support.
    * config/te-armfbsdeabi.h: New file.
    * config/te-armfbsdvfp.h: Likewise.
Convert target_structs vector to VEC

I thought that this home made implementation of a vector could be
replaced by the more standard VEC. The implementation seems to predate
the introduction of vec.h, so that would explain why it exists.

Ran make check before and after, no new failures.

gdb/ChangeLog:

2014-08-19  Simon Marchi  <simon.marchi@ericsson.com>

	* target.c (target_struct_size): Remove.
	(target_struct_allocsize): Remove.
	(DEFAULT_ALLOCSIZE): Remove.
	(target_ops_p): New typedef.
	(DEF_VEC_P (target_ops_p)): New vector type.
	(target_structs): Change type to VEC (target_ops_p).
	(add_target_with_completer): Replace "push" code by VEC_safe_push.
	(find_default_run_target): Rewrite for loop following changes to
	target_structs.
Remove stale comment

This comment is no longer true for watchpoints since commit 31e77af2
(PR breakpoints/7143 - Watchpoint does not trigger when first set).

gdb/testsuite/

	* gdb.base/watchpoint-hw-hit-once.c (main): Update comment.
Fix -fsanitize=address on unreadable inferior strings

echo 'void f(char *s){}main(){f((char *)1);}'|gcc -g -x c -;../gdb ./a.out -ex 'b f' -ex r
====ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000aaccf at pc 0x96eea7 bp 0x7fff75bdbc90 sp 0x7fff75bdbc80
READ of size 1 at 0x6020000aaccf thread T0
    #0 0x96eea6 in extract_unsigned_integer .../gdb/findvar.c:108
    #1 0x9df02b in val_print_string .../gdb/valprint.c:2513
[...]
0x6020000aaccf is located 1 bytes to the left of 8-byte region [0x6020000aacd0,0x6020000aacd8)
allocated by thread T0 here:
    #0 0x7f45fad26b97 in malloc (/lib64/libasan.so.1+0x57b97)
    #1 0xdb3409 in xmalloc common/common-utils.c:45
    #2 0x9d8cf9 in read_string .../gdb/valprint.c:1845
    #3 0x9defca in val_print_string .../gdb/valprint.c:2502
[..]
====ABORTING

gdb/
2014-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix -fsanitize=address on unreadable inferior strings.
	* valprint.c (val_print_string): Fix access before BUFFER.
Handle partially optimized out values similarly to unavailable values

This fixes PR symtab/14604, PR symtab/14605, and Jan's test at
https://sourceware.org/ml/gdb-patches/2014-07/msg00158.html, in a tree
with bddbbed reverted:

 2014-07-22  Pedro Alves  <palves@redhat.com>

 	* value.c (allocate_optimized_out_value): Don't mark value as
 	non-lazy.

The PRs are about variables described by the DWARF as being split over
multiple registers using DWARF piece information, but some of those
registers being marked as optimised out (not saved) by a later frame.
GDB currently incorrectly mishandles these partially-optimized-out
values.

Even though we can usually tell from the debug info whether a local or
global is optimized out, handling the case of a local living in a
register that was not saved in a frame requires fetching the variable.
GDB also needs to fetch a value to tell whether parts of it are
"<unavailable>".  Given this, it's not worth it to try to avoid
fetching lazy optimized-out values based on debug info alone.

So this patch makes GDB track which chunks of a value's contents are
optimized out like it tracks <unavailable> contents.  That is, it
makes value->optimized_out be a bit range vector instead of a boolean,
and removes the struct lval_funcs check_validity and check_any_valid
hooks.

Unlike Andrew's series which this is based on (at
https://sourceware.org/ml/gdb-patches/2013-08/msg00300.html, note some
pieces have gone in since), this doesn't merge optimized out and
unavailable contents validity/availability behind a single interface,
nor does it merge the bit range vectors themselves (at least yet).
While it may be desirable to have a single entry point that returns
existence of contents irrespective of what may make them
invalid/unavailable, several places want to treat optimized out /
unavailable / etc. differently, so each spot that potentially could
use it will need to be careful considered on case-by-case basis, and
best done as a separate change.

This fixes Jan's test, because value_available_contents_eq wasn't
considering optimized out value contents.  It does now, and because of
that it's been renamed to value_contents_eq.

A new intro comment is added to value.h describing "<optimized out>",
"<not saved>" and "<unavailable>" values.

gdb/
	PR symtab/14604
	PR symtab/14605
	* ada-lang.c (coerce_unspec_val_to_type): Use
	value_contents_copy_raw.
	* ada-valprint.c (val_print_packed_array_elements): Adjust.
	* c-valprint.c (c_val_print): Use value_bits_any_optimized_out.
	* cp-valprint.c (cp_print_value_fields): Let the common printing
	code handle optimized out values.
	(cp_print_value_fields_rtti): Use value_bits_any_optimized_out.
	* d-valprint.c (dynamic_array_type): Use
	value_bits_any_optimized_out.
	* dwarf2loc.c (entry_data_value_funcs): Remove check_validity and
	check_any_valid fields.
	(check_pieced_value_bits): Delete and inline ...
	(check_pieced_synthetic_pointer): ... here.
	(check_pieced_value_validity): Delete.
	(check_pieced_value_invalid): Delete.
	(pieced_value_funcs): Remove check_validity and check_any_valid
	fields.
	(read_pieced_value): Use mark_value_bits_optimized_out.
	(write_pieced_value): Switch to use
	mark_value_bytes_optimized_out.
	(dwarf2_evaluate_loc_desc_full): Copy the value contents instead
	of assuming the whole value is optimized out.
	* findvar.c (read_frame_register_value): Remove special handling
	of optimized out registers.
	(value_from_register): Use mark_value_bytes_optimized_out.
	* frame-unwind.c (frame_unwind_got_optimized): Use
	mark_value_bytes_optimized_out.
	* jv-valprint.c (java_value_print): Adjust.
	(java_print_value_fields): Let the common printing code handle
	optimized out values.
	* mips-tdep.c (mips_print_register): Remove special handling of
	optimized out registers.
	* opencl-lang.c (lval_func_check_validity): Delete.
	(lval_func_check_any_valid): Delete.
	(opencl_value_funcs): Remove check_validity and check_any_valid
	fields.
	* p-valprint.c (pascal_object_print_value_fields): Let the common
	printing code handle optimized out values.
	* stack.c (read_frame_arg): Remove special handling of optimized
	out values.  Fetch both VAL and ENTRYVAL before comparing
	contents.  Adjust to value_available_contents_eq rename.
	* valprint.c (valprint_check_validity)
	(val_print_scalar_formatted): Use value_bits_any_optimized_out.
	(val_print_array_elements): Adjust.
	* value.c (struct value) <optimized_out>: Now a VEC(range_s).
	(value_bits_any_optimized_out): New function.
	(value_entirely_covered_by_range_vector): New function, factored
	out from value_entirely_unavailable.
	(value_entirely_unavailable): Reimplement.
	(value_entirely_optimized_out): New function.
	(insert_into_bit_range_vector): New function, factored out from
	mark_value_bits_unavailable.
	(mark_value_bits_unavailable): Reimplement.
	(struct ranges_and_idx): New struct.
	(find_first_range_overlap_and_match): New function, factored out
	from value_available_contents_bits_eq.
	(value_available_contents_bits_eq): Rename to ...
	(value_contents_bits_eq): ... this.  Check both unavailable
	contents and optimized out contents.
	(value_available_contents_eq): Rename to ...
	(value_contents_eq): ... this.
	(allocate_value_lazy): Remove reference to the old optimized_out
	boolean.
	(allocate_optimized_out_value): Use
	mark_value_bytes_optimized_out.
	(require_not_optimized_out): Adjust to check whether the
	optimized_out vec is empty.
	(ranges_copy_adjusted): New function, factored out from
	value_contents_copy_raw.
	(value_contents_copy_raw): Also copy the optimized out ranges.
	Assert the destination ranges aren't optimized out.
	(value_contents_copy): Update comment, remove call to
	require_not_optimized_out.
	(value_contents_equal): Adjust to check whether the optimized_out
	vec is empty.
	(set_value_optimized_out, value_optimized_out_const): Delete.
	(mark_value_bytes_optimized_out, mark_value_bits_optimized_out):
	New functions.
	(value_entirely_optimized_out, value_bits_valid): Delete.
	(value_copy): Take a VEC copy of the 'optimized_out' field.
	(value_primitive_field): Remove special handling of optimized out.
	(value_fetch_lazy): Assert that lazy values have no unavailable
	regions.  Use value_bits_any_optimized_out.  Remove some special
	handling for optimized out values.
	* value.h: Add intro comment about <optimized out> and
	<unavailable>.
	(struct lval_funcs): Remove check_validity and check_any_valid
	fields.
	(set_value_optimized_out, value_optimized_out_const): Remove.
	(mark_value_bytes_optimized_out, mark_value_bits_optimized_out):
	New declarations.
	(value_bits_any_optimized_out): New declaration.
	(value_bits_valid): Delete declaration.
	(value_available_contents_eq): Rename to ...
	(value_contents_eq): ... this, and extend comments.

gdb/testsuite/
	PR symtab/14604
	PR symtab/14605
	* gdb.dwarf2/dw2-op-out-param.exp: Remove kfail branches and use
	gdb_test.
daily update
Fix typo in f7f2534e

	* Makefile.am: Typo fix.
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.