Prevent appending "-g" after "-g3" to compile options in info-macros.exp.

When upstream gcc is given a command line with the "-g" option after
"-g3", it doesn't generate a ".debug_macro" section.  This is because
the last option wins, thus downgrading the debug level again.  Without
any macro debug information in the executable, info-macros.exp
obviously produces many failures.

Since the "-g" option is appended by DejaGnu's target_compile whenever
the "debug" option is set, the fix just removes that option.

gdb/testsuite/ChangeLog:
	* gdb.base/info-macros.exp: Remove "debug" from the compile
	options.
Re-introduce '_start' labels and add alignment in dw2-dir-file-name test case.

On ppc64-linux a function symbol does not point to code, but to the
function descriptor.  Thus the previous change for this test case
broke it:

      https://sourceware.org/ml/gdb-patches/2014-01/msg00275.html

This patch reverts to the original method, re-introducing '_start'
symbols.  In addition, it adds sufficient alignment before the label,
such that the label never points into an alignment gap.

gdb/testsuite/ChangeLog:
	* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
	define "*_start" label.  Make "name" static.
	* gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
	${name} by references to ${name}_start.
Fix regression on s390x with entry-values.exp.

The trace-specific test case 'entry-values' concludes fairly late in
the process that this platform doesn't support trace.  Before that,
there are some platform specifics that don't work on s390x.  The fix
addresses two aspects:

(1) Removal of an excess space character in the regex for the
    disassembly.  This is needed when there is a function alignment
    gap, because then the hex address is immediately followed by a
    colon, like in the first 'nopr' line below:

    (gdb) disassemble foo+50,+10
    Dump of assembler code from 0x32 to 0x3c:
       0x0000000000000032 <foo+50>: br      %r4
       0x0000000000000034:  nopr    %r7
       0x0000000000000036:  nopr    %r7
       0x0000000000000038 <bar+0>:  stmg    %r11,%r15,88(%r15)
    End of assembler dump.

(2) Handling for the s390-specific call instruction.

gdb/testsuite/ChangeLog:
	* gdb.trace/entry-values.exp: Remove excess space character from
	regex patterns.  Handle s390 call instruction.
gdb/ChangeLog:
	* syscalls/s390x-linux.xml: New file.
	* syscalls/s390-linux.xml: New file.
	* s390-linux-tdep.c (XML_SYSCALL_FILENAME_S390): New macro.
	(XML_SYSCALL_FILENAME_S390X): Likewise.
	(op_svc): New enum value for SVC opcode.
	(s390_sigtramp_frame_sniffer): Replace literal by 'op_svc'.
	(s390_linux_get_syscall_number): New function.
	(s390_gdbarch_init): Register '*get_syscall_number' and the
	syscall xml file name.
	* data-directory/Makefile.in (SYSCALLS_FILES): Add
	"s390-linux.xml" and "s390x-linux.xml".
	* NEWS: Announce new feature.

gdb/testsuite/ChangeLog:
	* gdb.base/catch-syscall.exp: Activate test on s390*-linux.
Add check for invalid register in AVX512 gathers

AVX512 gather instructions shouldn't accept the same register for both
destination and index.

gas/

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

	PR gas/16489
	* config/tc-i386.c (check_VecOperands): Add check for invalid
	register set in AVX512 gathers.

gas/testsuite/

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

	PR gas/16489
	* gas/i386/vgather-check.s: Add tests for AVX512 gathers.
	* gas/i386/x86-64-vgather-check.s: Likewise.
	* gas/i386/vgather-check-error.l: Update correspondingly.
	* gas/i386/vgather-check-none.d: Likewise.
	* gas/i386/vgather-check-warn.d: Likewise.
	* gas/i386/vgather-check-warn.e: Likewise.
	* gas/i386/vgather-check.d: Likewise.
	* gas/i386/x86-64-vgather-check-error.l: Likewise.
	* gas/i386/x86-64-vgather-check-none.d: Likewise.
	* gas/i386/x86-64-vgather-check-warn.d: Likewise.
	* gas/i386/x86-64-vgather-check-warn.e: Likewise.
	* gas/i386/x86-64-vgather-check.d: Likewise.
Remove regzmm from AVX2 gather assert

Since regzmm can't be used in AVX2 gather instructions, there is no need
to check regzmm in AVX2 gather assert.

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

	* config/tc-i386.c (check_VecOperands): Remove regzmm from AVX2
	gather assert.
Add .refsym to msp430 backend

* config/tc-msp430.c (msp430_refsym): New: ".refsym <symbol>"
* doc/c-msp430.texi (MSP430 Directives): Document it.

The purpose of this patch is to provide a way for one object file
to require the inclusion of another object, without having to
allocate space for a .word address reference.
	New gdbserver option --debug-format=timestamp.
	* NEWS: Mention it.

	gdbserver/
	* configure.ac (AC_CHECK_FUNCS): Add test for gettimeofday.
	* configure: Regenerate.
	* config.in: Regenerate.
	* Makefile.in (SFILES): Add debug.c.
	(OBS): Add debug.o.
	* debug.c: New file.
	* debug.h: New file.
	* linux-aarch64-low.c (*): Update all debugging printfs to use
	debug_printf instead of fprintf.
	* linux-arm-low.c (*): Ditto.
	* linux-cris-low.c (*): Ditto.
	* linux-crisv32-low.c (*): Ditto.
	* linux-m32r-low.c (*): Ditto.
	* linux-sparc-low.c (*): Ditto.
	* linux-x86.c (*): Ditto.
	* linux-low.c (*): Ditto.
	(linux_wait_1): Add calls to debug_enter, debug_exit.
	(linux_wait): Remove redundant debugging printf.
	(stop_all_lwps): Add calls to debug_enter, debug_exit.
	(linux_resume, unstop_all_lwps): Ditto.
	* mem-break.c (*): Update all debugging printfs to use
	debug_printf instead of fprintf.
	* remote-utils.c (*): Ditto.
	* thread-db.c (*): Ditto.
	* server.c #include <ctype.h>, "gdb_vecs.h".
	(debug_threads): Moved to debug.c.
	(*): Update all debugging printfs to use debug_printf instead of
	fprintf.
	(start_inferior): Replace call to fflush with call to debug_flush.
	(monitor_show_help): Mention set debug-format.
	(parse_debug_format_options): New function.
	(handle_monitor_command): Handle "monitor set debug-format".
	(gdbserver_usage): Mention --debug-format.
	(main): Parse --debug-format.
	* server.h (debug_threads): Declaration moved to debug.h.
	#include "debug.h".
	* tracepoint.c (trace_debug_1) [!IN_PROCESS_AGENT]: Add version of
	trace_debug_1 that uses debug_printf.
	(tracepoint_look_up_symbols): Update all debugging printfs to use
	debug_printf instead of fprintf.

	doc/
	* gdb.texinfo (Server): Mention --debug-format=all|none|timestamp.
	(gdbserver man): Ditto.

	testsuite/
	* gdb.server/server-mon.exp: Add tests for "set debug-format".
daily update
	* gdbthread.h (gdb_id_to_thread): Delete, unused.
Use gdb_byte * instead of void *

This patch changes the argument type to gdb_byte * in order to align
with the to_xfer_partial interface.

gdb:

2014-01-23  Yao Qi  <yao@codesourcery.com>

	* target.c (raw_memory_xfer_partial): Change argument type
	from void * to gdb_byte *.
	(memory_xfer_partial_1, memory_xfer_partial): Likewise.
fix crash in frame filters

apply_frame_filter calls ensure_python_env before computing the
gdbarch to use.  This means that python_gdbarch can be NULL while in
Python code, and if a frame filter depends on this somehow (easy to
do), gdb will crash.

The fix is to compute the gdbarch first.

Built and regtested on x86-64 Fedora 18.
New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16491:
	* python/py-framefilter.c (apply_frame_filter): Call
	ensure_python_env after computing gdbarch.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16491:
	* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
	string from an inferior frame.
	* gdb.python/py-framefilter-mi.exp: Update.
fix erroneous error-handling in frame filter code

This fixes PR python/16487.

The bug here is that the function-name-handling code in py_print_frame
had a small logic error (really a misplaced closing brace).  This
error could lead to a Py_DECREF(NULL), which crashes.

This patch fixes the bug in the obvious way.

Built and regtested on x86-64 Fedora 18.  New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16487:
	* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
	on a NULL pointer.  Move "goto error" to correct place.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16487:
	* gdb.python/py-framefilter.exp: Add test using "Error" filter.
	* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
	classes.
avoid python exception in FrameDecorator.py

This fixes a bug in FrameDecorator.py.

FrameVars seems to assume that Frame.block can return None if there is
no block.  However, it actually throws an exception.

I saw this bug while developing a frame filter, but unfortunately I
don't know how to reproduce it.  It seems to me that the SAL tests in
_is_limited_frame should exclude the bad cases; and in my attempts to
write a test they do.

Nevertheless I think the fix is reasonably obvious and ought to go in.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16485:
	* python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args):
	Handle exception from frame.block.
	(FrameVars.fetch_frame_locals): Likewise.
Issue a linker error if TLS sections are not adjacent

Bad linker script may lead to TLS sections separated by non-TLS sections
in output.  This patch changes linker assert to a linker error to
provide better linker diagnosis.

	PR ld/16498
	* elf.c (_bfd_elf_map_sections_to_segments): Issue a linker error
	if TLS sections are not adjacent.
Remove the display of known MCU names from the MSP430 port of GAS.

New MSP430 MCU parts are being created by TI all the time and the
list is basically always out of date.  Instead any name will be
accepted by the -mmcu= command line option.  ISA selection is now
based upon the -mcpu= command line option, just as is done for GCC.

gas/ChangeLog
	* config/tc-msp430.c (show_mcu_list): Delete.
	(md_parse_option): Accept any MCU name.  Accept several more
	variants for the -mcpu option.
	(md_show_usage): Do not call show_mcu_list.
daily update
Fixes powerpc64le ld segfaults when --emit-relocs is used.

ELFv2 needs fewer relocs to annotate plt call stubs.  I correctly
allocated a smaller buffer and wrote the proper relocs, but stupidly
bumped the reloc count as for ELFv1.

	* elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed
	to get_relocs for ELFv2.
TLS orphan section placement

Ensures TLS orphans are placed adjacent to existing TLS sections,
and fixes places where the output_section_statement flags (which might
not be set) were tested when bfd_section flags were available.

	* ldlang.c (lang_output_section_find_by_flags): Be careful to
	test look->bfd_section->flags if available rather than
	look->flags.  Separate SEC_THREAD_LOCAL handling from
	SEC_READONLY loop, and rewrite.
Change len's type to ULONGEST: remote_write_bytes_aux

Hi,
This patch changes the type of 'len' from ssize_t to ULONGEST.

At the beginning Siddhesh Poyarekar proposed this patch

  [PATCH] Memory reads and writes should have size_t length
  https://sourceware.org/ml/gdb-patches/2012-05/msg01073.html

to change type of 'len' to size_t.  However, after Jan's review, we
decide to change it to ssize_t, because callers of these functions
may pass signed type to them.

AFAICS, the target layer is a boundary.  In one side, we pass size_t
or ssize_t to target related APIs, and in the other side, the
implementation side, we used LONGEST (ULONGEST in latest code) because
of to_xfer_partial.

Since remote_write_bytes_aux and remote_write_bytes belong to the
implementation of remote target, we should use ULONGEST for len, IMO.

Regression tested on x86_64-linux.  Is it OK?

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_write_bytes_aux): Change type of 'len' to
	ULONGEST.  Don't check 'len' is negative.
	(remote_write_bytes):  Change type of 'len' to ULONGEST.