daily update
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.