external/binutils.git
8 years agoRemove unused cli_command_loop declaration
Simon Marchi [Fri, 5 Aug 2016 20:26:18 +0000 (16:26 -0400)]
Remove unused cli_command_loop declaration

This declaration is not used anymore.

gdb/ChangeLog:

* event-top.h (cli_command_loop): Remove.

8 years agoAdd missing ChangLog enrtry
H.J. Lu [Fri, 5 Aug 2016 20:15:16 +0000 (13:15 -0700)]
Add missing ChangLog enrtry

8 years agoFix PR remote/20398: File-IO write always outputs "Quit"
Pedro Alves [Fri, 5 Aug 2016 18:54:11 +0000 (19:54 +0100)]
Fix PR remote/20398: File-IO write always outputs "Quit"

Commit bb7c96deb1a1 ("gdb/remote-fileio.c: Eliminate custom SIGINT
signal handler") regressed the File-IO support.

Failed output:

  (gdb) target remote :8888
  Remote debugging using :8888
  0x00008098 in _start ()
  (gdb) c
  Continuing.
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  [Inferior 1 (Remote target) exited normally]

Expected output:

  (gdb) target remote :8888
  Remote debugging using :8888
  0x00008098 in _start ()
  (gdb) c
  Continuing.
  i: 0
  i: 1
  i: 2
  i: 3
  i: 4
  i: 5
  i: 6
  i: 7
  i: 8
  i: 9
  [Inferior 1 (Remote target) exited normally]

The problem that the new File-IO quit handler forgets to check the
quit flag before calling throwing a quit.

gdb/ChangeLog:
2016-08-05  Pedro Alves  <palves@redhat.com>

PR remote/20398
* remote-fileio.c (remote_fileio_quit_handler): Check the quit
flag before calling quit.

8 years agogdb/NEWS: Mention that C++ is now the default
Pedro Alves [Fri, 5 Aug 2016 16:09:31 +0000 (17:09 +0100)]
gdb/NEWS: Mention that C++ is now the default

gdb/ChangeLog:
2016-08-05  Pedro Alves  <palves@redhat.com>

* NEWS: Mention that GDB and GDBserver build with a C++ compiler
by default.

8 years agogdb/configure --help: suggest --disable-build-with-cxx instead of --enable...
Pedro Alves [Fri, 5 Aug 2016 15:54:29 +0000 (16:54 +0100)]
gdb/configure --help: suggest --disable-build-with-cxx instead of --enable...

We build by default with a C++ compiler, but "configure --help" still
says "--enable-build-with-cxx", which hints that it is by default
disabled.  Update the --help text.

gdb/ChangeLog:
2016-08-05  Pedro Alves  <palves@redhat.com>

* build-with-cxx.m4: Change help string to be in terms of
--disable-build-with-cxx.
* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2016-08-05  Pedro Alves  <palves@redhat.com>

* configure: Regenerate.

8 years agoEnsure ARM VPUSH and VPOP instructions do not affect more than 16 registers.
Nick Clifton [Fri, 5 Aug 2016 10:26:13 +0000 (11:26 +0100)]
Ensure ARM VPUSH and VPOP instructions do not affect more than 16 registers.

PR gas/20429
* config/tc-arm.c (do_vfp_nsyn_push): Check that no more than 16
registers are pushed.
(do_vfp_nsyn_pop): Check that no more than 16 registers are
popped.
* testsuite/gas/arm/pr20429.s: New test.
* testsuite/gas/arm/pr20429.d: New test driver.
* testsuite/gas/arm/pr20429.1: Expected error output.

8 years agoFix the generation of alignment frags in code sections for AArch64.
Nick Clifton [Fri, 5 Aug 2016 09:37:57 +0000 (10:37 +0100)]
Fix the generation of alignment frags in code sections for AArch64.

PR gas/20364
* config/tc-aarch64.c (s_ltorg): Change the mapping state after
aligning the frag.
(aarch64_init): Treat rs_align frags in code sections as
containing code, not data.
* testsuite/gas/aarch64/pr20364.s: New test.
* testsuite/gas/aarch64/pr20364.d: New test driver.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 5 Aug 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years ago2016-08-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
Thomas Preud'homme [Thu, 4 Aug 2016 14:54:57 +0000 (15:54 +0100)]
2016-08-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add one parameter.
* bfd-in2.h: Regenerate.
* elf32-arm.c (struct elf32_arm_link_hash_table): Declare new
cmse_implib field.
(bfd_elf32_arm_set_target_relocs): Add new parameter to initialize
cmse_implib field in struct elf32_arm_link_hash_table.
(elf32_arm_filter_cmse_symbols): New function.
(elf32_arm_filter_implib_symbols): Likewise.
(elf_backend_filter_implib_symbols): Define to
elf32_arm_filter_implib_symbols.

ld/
* emultempl/armelf.em (cmse_implib): Declare and define this new
static variable.
(arm_elf_create_output_section_statements): Add new cmse_implib
parameter.
(OPTION_CMSE_IMPLIB): Define macro.
(PARSE_AND_LIST_LONGOPTS): Add entry for new --cmse-implib switch.
(PARSE_AND_LIST_OPTIONS): Likewise.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_CMSE_IMPLIB case.
* ld.texinfo (--cmse-implib): Document new option.
* testsuite/ld-arm/arm-elf.exp
(Secure gateway import library generation): New test.
(Secure gateway import library generation: errors): Likewise.
* testsuite/ld-arm/cmse-implib.s: New file.
* testsuite/ld-arm/cmse-implib-errors.out: Likewise.
* testsuite/ld-arm/cmse-implib.rd: Likewise.

8 years ago2016-08-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
Thomas Preud'homme [Thu, 4 Aug 2016 14:36:52 +0000 (15:36 +0100)]
2016-08-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (CMSE_PREFIX): Define macro.
(elf32_arm_stub_cmse_branch_thumb_only): Define stub sequence.
(cmse_branch_thumb_only): Declare stub.
(struct elf32_arm_link_hash_table): Define cmse_stub_sec field.
(elf32_arm_get_plt_info): Add globals parameter.  Use it to return
FALSE if there is no PLT.
(arm_type_of_stub): Adapt to new elf32_arm_get_plt_info signature.
(elf32_arm_final_link_relocate): Likewise.
(elf32_arm_gc_sweep_hook): Likewise.
(elf32_arm_gc_mark_extra_sections): Mark sections holding ARMv8-M
secure entry functions.
(arm_stub_is_thumb): Add case for arm_stub_cmse_branch_thumb_only.
(arm_dedicated_stub_output_section_required): Change to a switch case
and add a case for arm_stub_cmse_branch_thumb_only.
(arm_dedicated_stub_output_section_required_alignment): Likewise.
(arm_stub_dedicated_output_section_name): Likewise.
(arm_stub_dedicated_input_section_ptr): Likewise and remove
ATTRIBUTE_UNUSED for htab parameter.
(arm_stub_required_alignment): Likewise.
(arm_stub_sym_claimed): Likewise.
(arm_dedicated_stub_section_padding): Likewise.
(cmse_scan): New function.
(elf32_arm_size_stubs): Call cmse_scan for ARM M profile targets.
Set stub_changed to TRUE if such veneers were created.
(elf32_arm_swap_symbol_in): Add detection code for CMSE special
symbols.

include/
* arm.h (ARM_GET_SYM_CMSE_SPCL): Define macro.
(ARM_SET_SYM_CMSE_SPCL): Likewise.

ld/
* ld.texinfo (Placement of SG veneers): New concept entry.
* testsuite/ld-arm/arm-elf.exp
(Secure gateway veneers: no .gnu.sgstubs section): New test.
(Secure gateway veneers: wrong entry functions): Likewise.
(Secure gateway veneers (ARMv8-M Baseline)): Likewise.
(Secure gateway veneers (ARMv8-M Mainline)): Likewise.
* testsuite/ld-arm/cmse-veneers.s: New file.
* testsuite/ld-arm/cmse-veneers.d: Likewise.
* testsuite/ld-arm/cmse-veneers.rd: Likewise.
* testsuite/ld-arm/cmse-veneers.sd: Likewise.
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out: Likewise.
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out: Likewise.

8 years agoFix generation of relocs for 32-bit Sparc Solaris targets.
Stefan Trleman [Thu, 4 Aug 2016 13:57:23 +0000 (14:57 +0100)]
Fix generation of relocs for 32-bit Sparc Solaris targets.

PR gas/20427
* config/tc-sparc.c (cons_fix_new_sparc): Prevent the generation
of 64-bit relocation types when assembling for a 32-bit Solaris
target.

8 years agoDetermine target description for native aarch64
Yao Qi [Thu, 4 Aug 2016 10:37:57 +0000 (11:37 +0100)]
Determine target description for native aarch64

I find the following test fail when I test native aarch64 gdb with
arm program,

(gdb) PASS: gdb.base/attach-pie-noexec.exp: attach
set architecture arm^M
warning: Selected architecture arm is not compatible with reported target architecture aarch64^M
Architecture `arm' not recognized.^M
The target architecture is set automatically (currently aarch64)^M
(gdb) FAIL: gdb.base/attach-pie-noexec.exp: set architecture arm

GDB thinks the target is aarch64, but it isn't.  Nowadays, we are
using some entries AT_PHENT and AT_HWCAP in auxv to determine whether
the process is a 32-bit arm one or 64-bit aarch64 one, and get the
right gdbarch.  However, in the process of parsing auxv (in
inf_ptrace_auxv_parse), the size of int and data pointer of
target_gdbarch is used.  If debug program exists (in most of cases),
target_gdbarch is already set according to the debug program, which
is arm in my case.  Then, GDB can parse auxv successfully.  However,
in gdb.base/attach-pie-noexec.exp, the debug program is removed,
target_gdbarch is aarch64 when GDB parse auxv, so GDB can't parse
it successfully.

Instead of using auxv, we check the return value of ptrace NT_ARM_VFP.
If the program is an arm process, NT_ARM_VFP is OK, otherwise, error
is returned.

Additionally, we only return tdesc_arm_with_neon for arm process,
because neon is mandatory on ARMv8.

gdb:

2016-08-04  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (tdesc_arm_with_vfpv3): Remove the
declaration.
(aarch64_linux_read_description): Remove code on getting
auxv and select target description on it.  Select target
description by the result of NT_ARM_VFP ptrace request.

8 years agoQuiet ptrace error ESRCH in regsets_fetch_inferior_registers
Yao Qi [Thu, 4 Aug 2016 09:44:18 +0000 (10:44 +0100)]
Quiet ptrace error ESRCH in regsets_fetch_inferior_registers

When I run process-dies-while-detaching.exp with GDBserver, I see many
warnings printed by GDBserver,

ptrace(regsets_fetch_inferior_registers) PID=26183: No such process
ptrace(regsets_fetch_inferior_registers) PID=26183: No such process
ptrace(regsets_fetch_inferior_registers) PID=26184: No such process
ptrace(regsets_fetch_inferior_registers) PID=26184: No such process

regsets_fetch_inferior_registers is called when GDBserver resumes each
lwp.

 #2  0x0000000000428260 in regsets_fetch_inferior_registers (regsets_info=0x4690d0 <aarch64_regsets_info>, regcache=0x31832020)
    at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:5412
 #3  0x00000000004070e8 in get_thread_regcache (thread=0x31832940, fetch=fetch@entry=1) at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/regcache.c:58
 #4  0x0000000000429c40 in linux_resume_one_lwp_throw (info=<optimized out>, signal=0, step=0, lwp=0x31832830)
    at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:4463
 #5  linux_resume_one_lwp (lwp=0x31832830, step=<optimized out>, signal=<optimized out>, info=<optimized out>)
    at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:4573

The is the case that threads are disappeared when GDB/GDBserver resumes
them.  We check errno for ESRCH, and don't print error messages, like
what we are doing in regsets_store_inferior_registers.

gdb/gdbserver:

2016-08-04  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (regsets_fetch_inferior_registers): Check
errno is ESRCH or not.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 4 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR python/18565 - make Frame.function work for inline frames
Tom Tromey [Mon, 13 Jun 2016 02:45:29 +0000 (20:45 -0600)]
PR python/18565 - make Frame.function work for inline frames

PR python/18565 notes that calling frame filters don't work properly for
inlined functions.  This happens because Frame.function on an inline
frame will yield the wrong result.  This patch changes this code to use
find_frame_funname instead, which handles inline frames properly.

Built and regtested on x86-64 Fedora 24.

2016-08-03  Tom Tromey  <tom@tromey.com>

PR python/18565:
* python/py-frame.c (frapy_function): Use find_frame_funname.

2016-08-03  Tom Tromey  <tom@tromey.com>

PR python/18565:
* gdb.python/py-frame-inline.exp: Add Frame.function test.

8 years agoAvoid potential memory leak in find_frame_funname
Tom Tromey [Wed, 3 Aug 2016 14:27:56 +0000 (08:27 -0600)]
Avoid potential memory leak in find_frame_funname

The PR 18565 thread pointed out that, if cp_remove_params can throw
(we aren't quite sure), then find_frame_funname could leak some
memory.  This patch avoids any potential issue by rearranging some
code in find_frame_funname.

Built and regtested on x86-64 Fedora 24.

2016-08-03  Tom Tromey  <tom@tromey.com>

* stack.c (find_frame_funname): Avoid any possible leak in case
cp_remove_params can throw.

8 years agoUpdate NEWS to mention Python breakpoint events
Tom Tromey [Tue, 2 Aug 2016 22:52:59 +0000 (16:52 -0600)]
Update NEWS to mention Python breakpoint events

An earlier patch added three new breakpoint-related events to the
Python API.  However, at that time, I forgot to update NEWS.  This
patch supplies the missing entry.

2016-08-03  Tom Tromey  <tom@tromey.com>

* NEWS: Mention new Python breakpoint events.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 3 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd myself as Rust maintainer
Tom Tromey [Tue, 2 Aug 2016 22:58:37 +0000 (16:58 -0600)]
Add myself as Rust maintainer

A while ago, Pedro announced that I would be the Rust maintainer for
gdb.  However, I neglected to update the MAINTAINERS file until now.

2016-08-02  Tom Tromey  <tom@tromey.com>

* MAINTAINERS (Core): Add self as Rust maintainer.

8 years ago[GDBserver] Remove td_ta_event_addr td_ta_set_event and td_ta_event_getmsg
Yao Qi [Tue, 2 Aug 2016 15:04:09 +0000 (16:04 +0100)]
[GDBserver] Remove td_ta_event_addr td_ta_set_event and td_ta_event_getmsg

As a result of this commit,

  9b4c5f878ff39e04127a1ad95f6b3832afe6d278
  (Remove support for thread events without PTRACE_EVENT_CLONE in GDBServer.)

the last usage of td_ta_event_addr td_ta_set_event and
td_ta_event_getmsg were removed.  They are no longer used.  This patch
is to remove them.

gdb/gdbserver:

2016-08-02  Yao Qi  <yao.qi@linaro.org>

* thread-db.c (struct thread_db) <td_ta_event_getmsg_p>: Remove.
<td_ta_set_event_p, td_ta_event_addr_p>: Remove.
(thread_db_load_search): Update.
(try_thread_db_load_1): Don't look for td_ta_event_addr,
td_ta_set_event and td_ta_event_getmsg.

8 years agoPowerPC64 ld segfault with code in non-executable sections
Alan Modra [Tue, 2 Aug 2016 13:58:47 +0000 (23:28 +0930)]
PowerPC64 ld segfault with code in non-executable sections

PR ld/20428
* elf64-ppc.c (ppc_get_stub_entry): Don't segfault on NULL group.

8 years agoSynchronize libiberty sources with FSF GCC mainline version.
Nick Clifton [Tue, 2 Aug 2016 12:26:28 +0000 (13:26 +0100)]
Synchronize libiberty sources with FSF GCC mainline version.

include * libiberty.h (MAX_ALLOCA_SIZE): New macro.

libiberty * make-relative-prefix.c (make_relative_prefix_1): Fall back to
malloc if alloca argument is greater than MAX_ALLOCA_SIZE.

* cp-demangle.c (cplus_demangle_operators): Add f[lrLR].
(d_expression_1): Handle them.
(d_maybe_print_fold_expression): New.
(d_print_comp_inner): Use it.
(d_index_template_argument): Handle negative index.

* cp-demangle.c (cplus_demangle_operators): Add sP and sZ.
(d_print_comp_inner): Handle them.
(d_template_args_1): Split out from d_template_args.
(d_args_length): New.

PR c++/70926
* cplus-dem.c: Handle large values and overflow when demangling
length variables.
(demangle_template_value_parm): Read only until end of mangled string.
(do_hpacc_template_literal): Likewise.
(do_type): Handle overflow when demangling array indices.

* cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length
  VLAs.

PR c++/70498
* cp-demangle.c (d_expression_1): Formatting fix.

* cplus-dem.c (enum type_kind_t): Add tk_rvalue_reference
constant.
(demangle_template_value_parm): Handle tk_rvalue_reference
type kind.
(do_type): Support 'O' type id (rvalue references).

* testsuite/demangle-expected: Add tests.

PR c++/70498
* cp-demangle.c: Parse numbers as integer instead of long to avoid
overflow after sanity checks. Include <limits.h> if available.
(INT_MAX): Define if necessary.
(d_make_template_param): Takes integer argument instead of long.
(d_make_function_param): Likewise.
(d_append_num): Likewise.
(d_identifier): Likewise.
(d_number): Parse as and return integer.
(d_compact_number): Handle overflow.
(d_source_name): Change variable type to integer for parsed number.
(d_java_resource): Likewise.
(d_special_name): Likewise.
(d_discriminator): Likewise.
(d_unnamed_type): Likewise.
* testsuite/demangle-expected: Add regression test cases.

* configure: Remove SH5 support.

PR c++/69687
* cplus-dem.c: Include <limits.h> if available.
(INT_MAX): Define if necessary.
(remember_type, remember_Ktype, register_Btype, string_need):
Abort if we detect cases where we the size of the allocation would
overflow.

PR c++/70492
* cplus-dem.c (gnu_special): Handle case where consume_count returns
-1.

PR c++/67394
PR c++/70481
* cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing
btypevec/ktypevec.
* testsuite/demangle-expected: Add coverage tests.

8 years agoFix SH GOT allocation in the presence of linker garbage collection.
Nick Clifton [Tue, 2 Aug 2016 10:56:55 +0000 (11:56 +0100)]
Fix SH GOT allocation in the presence of linker garbage collection.

PR ld/17739
ld * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Define with
valye 'yes'.
* emulparams/shelf32.sh: Likewise.
* emulparams/shelf32.sh: Likewise.
* emulparams/shelf_nto.sh: Likewise.
* emulparams/shelf_nto.sh: Likewise.
* emulparams/shelf_vxworks.sh: Likewise.
* emulparams/shelf_vxworks.sh: Likewise.
* emulparams/shlelf32_linux.sh: Likewise.
* emulparams/shlelf32_linux.sh: Likewise.
* emulparams/shlelf_linux.sh: Likewise.
* emulparams/shlelf_linux.sh: Likewise.
* emulparams/shlelf_nto.sh: Likewise.
* emulparams/shlelf_nto.sh: Likewise.

bfd * elf32-sh.c (sh_elf_gc_sweep_hook): Delete.
(elf_backend_sweep_hook): Delete.

8 years agoAvoid compile time warning when building on 32-bit host.
Nick Clifton [Tue, 2 Aug 2016 10:06:28 +0000 (11:06 +0100)]
Avoid compile time warning when building on 32-bit host.

PR binutils/17512
* resbin.c (bin_to_res_version): Cast variables to correct type
for printing in error message.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 2 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years ago Fix some PowerPC VLE BFD issues and add some PowerPC VLE instructions.
Andrew Jenner [Mon, 1 Aug 2016 16:42:31 +0000 (09:42 -0700)]
    Fix some PowerPC VLE BFD issues and add some PowerPC VLE instructions.

        bfd/
        * elf32-ppc.c (is_branch_reloc): Recognise VLE branch relocations.
        (ppc_elf_howto_raw): Fix dst_mask of R_PPC_VLE_REL15.
        (ppc_elf_vle_split16): Clear field before inserting.

        opcodes/
        * ppc-opc.c (vle_opcodes): Alias 'e_cmpwi' to 'e_cmpi' and
        'e_cmplwi' to 'e_cmpli' instead.
        (OPVUPRT, OPVUPRT_MASK): Define.
        (powerpc_opcodes): Add E200Z4 insns.
        (vle_opcodes): Add context save/restore insns.

        include/
        * opcode/ppc.h (PPC_OPCODE_E200Z4): New define.

8 years agoUpdate NEWS post GDB 7.12 branch creation.
Joel Brobecker [Mon, 1 Aug 2016 15:28:26 +0000 (08:28 -0700)]
Update NEWS post GDB 7.12 branch creation.

gdb/ChangeLog:

* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.

8 years agoBump version to 7.12.50.DATE-git.
Joel Brobecker [Mon, 1 Aug 2016 15:23:20 +0000 (08:23 -0700)]
Bump version to 7.12.50.DATE-git.

Now that the GDB 7.12 branch has been created, we can
bump the version number.

gdb/ChangeLog:

GDB 7.12 branch created (41bfcd638a4e0e48b96ce4de2845372dea481322):
* version.in: Bump version to 7.12.50.DATE-git.

8 years agoSwap "single-process" and "multi-process" in process-dies-while-detaching.exp
Yao Qi [Thu, 28 Jul 2016 13:37:02 +0000 (14:37 +0100)]
Swap "single-process" and "multi-process" in process-dies-while-detaching.exp

"single-process" and "multi-process" are used in the test message of
process-dies-while-detaching.exp, but they are misplaced due to

    set mode [expr {$multi_process ? "single-process" : "multi-process"}]

This patch is to swap them.

gdb/testsuite:

2016-08-01  Yao Qi  <yao.qi@linaro.org>

* gdb.threads/process-dies-while-detaching.exp (do_test): Set
variable mode to "multi-process" if $multi_process is 1, otherwise
set it to "single-process".

8 years agoUpdate Swedish translation in bfd directory.
Nick Clifton [Mon, 1 Aug 2016 08:59:04 +0000 (09:59 +0100)]
Update Swedish translation in bfd directory.

8 years agoTweak gdb.cp tests for aarch32
Yao Qi [Mon, 1 Aug 2016 08:18:02 +0000 (09:18 +0100)]
Tweak gdb.cp tests for aarch32

There are some gdb.cp/ tests fails if the program is compiled for arm
32-bit but GDB/GDBserver is aarch64 64-bit program, because target triplet
doesn't match "arm*-*-*".  Instead, we can use is_aarch32_target.

gdb/testsuite:

2016-08-01  Yao Qi  <yao.qi@linaro.org>

* gdb.cp/anon-struct.exp: Check is_aarch32_target.
* gdb.cp/cpexprs.exp: Likewise.
* gdb.cp/m-static.exp: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 1 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 31 Jul 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 30 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogas: avoid spurious failures in non-ELF targets in the SPARC testsuite.
Jose E. Marchesi [Wed, 27 Jul 2016 13:59:16 +0000 (06:59 -0700)]
gas: avoid spurious failures in non-ELF targets in the SPARC testsuite.

Many of the existing sparc tests fail in non-ELF targets (coff and
a.out) due to spurious differences in the expected results:

- Unlike ELF, a.out text sections are aligned to 2**3 and padded
  accordingly.  The padding instruction is a `nop' (01 00 00 00).

- Likewise, coff text sections are also aligned to 2**3 and padded
  accordingly.  However, the padding instruction in these targets is an
  `illtrap 0' (00 00 00 00).

- Unlike ELF, a.out and coff binaries don't contain hardware
  capabilities bits that could be used by BFD to determine the opcodes
  architecture corresponding to the instructions encoded in the
  objects (v9, v9a, v9b, v9c, etc).  Consequently, in both a.out and
  coff tests we would need to pass proper `-m sparc:vXXX' options when
  invoking objdump before comparing results.

In order to fix these issues, the most obvious solution would be to have
three variants of .d files per impacted test.  For example, for save.d
we would have: save-elf.d, save-aout.d and save-coff.d.  Using the
`#source' directive, a single save.s file would provide the input for
all of them.  However, this approach has the following problems:

- The #target and #notarget .d directives are very limited: they use
  globs instead of regular expressions, and thus it is not possible (or
  too messy) to use them to discriminate between elf, coff and a.out
  sparc targets.

- It adds little or no value to have variants of all these tests for all
  the target types, and it would be a burden to maintain them.  Actually
  the features tested in the spuriously failing tests (relatively modern
  sparc instructions, registers and asis) are not really found in
  running coff or a.out sparc systems.

This patch changes sparc.exp so it will run these tests only in
ELF-targets, using the more standard `is_elf_format' from
binutils-common.exp instead of the ad-hoc (and less convenient, as it
must be called before _every_ single elf-only test) sparc_elf_setup.

Incidentally, the patch also fixes the #name entry for save-args.d.

Tested in sparc*-*-linux-gnu, sparc-aout and sparc-coff targets.

gas/ChangeLog:

2016-07-27  Jose E. Marchesi  <jose.marchesi@oracle.com>

* testsuite/gas/sparc/sparc.exp: Use is_elf_format to discriminate
ELF targets.
Run natural, natural-32, pr4587, ticc-imm-reg, v8-movwr-imm,
pause, save-args, cbcond, cfr, crypto edge, flush, hpcvis3, ima,
ld_st_fsr, ldtw_sttw, ldd_std, ldx_stx, ldx_efsr, mwait, mcdper,
sparc5vis4, xcrypto, v9branch1 and imm-plus-rreg only in ELF
targets.
(sparc_elf_setup): Delete.
* testsuite/gas/sparc/save-args.d: Fix a copy-paste typo in the
test's #name entry.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 29 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix decoding of Windows resources.
Nick Clifton [Thu, 28 Jul 2016 14:37:16 +0000 (15:37 +0100)]
Fix decoding of Windows resources.

PR binutils/17512
* rescoff.c (read_coff_res_dir): Fix detection of buffer overrun.
* resbin.c (bin_to_res_version): Allow for the padded length of a
version block to be longer than the recorded length.  Skip padding
bytes.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 28 Jul 2016 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMIPS/GAS: Implement microMIPS branch/jump compaction
Maciej W. Rozycki [Wed, 27 Jul 2016 16:27:55 +0000 (17:27 +0100)]
MIPS/GAS: Implement microMIPS branch/jump compaction

Convert microMIPS branches and jumps whose delay slot would be filled by
a generated NOP instruction to the corresponding compact form where one
exists, in a manner similar to MIPS16 JR->JRC and JALR->JALRC swap.

Do so even where the transformation switches from a 16-bit to a 32-bit
branch encoding for no benefit in code size reduction, as this is still
advantageous.  This is because a branch/NOP pair takes 2 pipeline slots
or a 2-cycle completion latency except in superscalar implementations.
Whereas a compact branch may or may not stall on its target fetch, so it
will at most have a 2-cycle completion latency and may have only 1 even
in scalar implementations, and in superscalar implementations it is
expected to have no worse latency as a branch/NOP pair has.  Also it
won't stall and therefore take the extra latency cycle in the not-taken
case.

Technically this is the same as MIPS16 compaction: for the qualifying
instruction encodings the APPEND_ADD_COMPACT machine code generation
method is selected where APPEND_ADD_WITH_NOP otherwise would and tells
the code generator in `append_insn' to convert the regular form of an
instruction to its corresponding compact form.  For this the opcode is
tweaked as necessary and the microMIPS opcode table is scanned for the
matching updated instruction.  A non-$0 `rt' operand to BEQ and BNE
instructions is moved to the `rs' operand field of BEQZC and BNEZC
encodings as required.

Unlike with MIPS16 compaction however we need to handle out-of-distance
branch relaxation as well.  We do this by deferring the generation of
any delay-slot NOP required to relaxation made in `md_convert_frag', by
converting the APPEND_ADD_WITH_NOP machine code generation to APPEND_ADD
where a relaxed instruction is recorded.  Relaxation then, depending on
actual code produced, chooses between either using a compact branch or
jump encoding and emitting the NOP outstanding if no compact encoding is
possible.

For code simplicity's sake the relaxation pass is retained even if the
principle of preferring a compact encoding to a 16-bit branch/NOP pair
means, in the absence of out-of-range branch relaxation, that a single
compact branch machine code instruction will eventually be produced from
a given assembly source instruction.

gas/
* config/tc-mips.c (RELAX_MICROMIPS_ENCODE): Add `nods' flag.
(RELAX_MICROMIPS_RELAX32, RELAX_MICROMIPS_TOOFAR16)
(RELAX_MICROMIPS_MARK_TOOFAR16, RELAX_MICROMIPS_CLEAR_TOOFAR16)
(RELAX_MICROMIPS_TOOFAR32, RELAX_MICROMIPS_MARK_TOOFAR32)
(RELAX_MICROMIPS_CLEAR_TOOFAR32): Shift bits.
(get_append_method): Also return APPEND_ADD_COMPACT for
microMIPS instructions.
(find_altered_mips16_opcode): Exclude macros from matching.
Factor code out...
(find_altered_opcode): ... to this new function.
(find_altered_micromips_opcode): New function.
(frag_branch_delay_slot_size): Likewise.
(append_insn): Handle microMIPS branch/jump compaction.
(macro_start): Likewise.
(relaxed_micromips_32bit_branch_length): Likewise.
(md_convert_frag): Likewise.
* testsuite/gas/mips/micromips.s: Add conditional explicit NOPs
for delay slot filling.
* testsuite/gas/mips/micromips-b16.s: Add explicit NOPs for
delay slot filling.
* testsuite/gas/mips/micromips-size-1.s: Likewise.
* testsuite/gas/mips/micromips.l: Adjust line numbers.
* testsuite/gas/mips/micromips-warn.l: Likewise.
* testsuite/gas/mips/micromips-size-1.l: Likewise.
* testsuite/gas/mips/micromips.d: Adjust padding.
* testsuite/gas/mips/micromips-trap.d: Likewise.
* testsuite/gas/mips/micromips-insn32.d: Likewise.
* testsuite/gas/mips/micromips-noinsn32.d: Likewise.
* testsuite/gas/mips/micromips@beq.d: Update patterns for
branch/jump compaction.
* testsuite/gas/mips/micromips@bge.d: Likewise.
* testsuite/gas/mips/micromips@bgeu.d: Likewise.
* testsuite/gas/mips/micromips@blt.d: Likewise.
* testsuite/gas/mips/micromips@bltu.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-4.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-4-64.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5pic.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5-64.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5pic-64.d: Likewise.
* testsuite/gas/mips/micromips@jal-svr4pic-local.d: Likewise.
* testsuite/gas/mips/micromips@jal-svr4pic-local-n32.d:
Likewise.
* testsuite/gas/mips/micromips@jal-svr4pic-local-n64.d:
Likewise.
* testsuite/gas/mips/micromips@loc-swap.d: Likewise.
* testsuite/gas/mips/micromips@loc-swap-dis.d: Likewise.
* testsuite/gas/mips/micromips@relax.d: Likewise.
* testsuite/gas/mips/micromips@relax-at.d: Likewise.
* testsuite/gas/mips/micromips@relax-swap3.d: Likewise.
* testsuite/gas/mips/branch-extern-2.d: Likewise.
* testsuite/gas/mips/branch-extern-4.d: Likewise.
* testsuite/gas/mips/branch-section-2.d: Likewise.
* testsuite/gas/mips/branch-section-4.d: Likewise.
* testsuite/gas/mips/branch-weak-2.d: Likewise.
* testsuite/gas/mips/branch-weak-5.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute-n32.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute-n64.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute-addend.d:
Likewise.
* testsuite/gas/mips/micromips-branch-absolute-addend-n32.d:
Likewise.
* testsuite/gas/mips/micromips-branch-absolute-addend-n64.d:
Likewise.
* testsuite/gas/mips/micromips-compact.d: New test.
* testsuite/gas/mips/mips.exp: Run the new test.

ld/
* testsuite/ld-mips-elf/micromips-branch-absolute.d: Update
patterns for branch compaction.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend.d:
Likewise.

opcodes/
* micromips-opc.c (micromips_opcodes): Reorder "bc" next to "b",
"beqzc" next to "beq", "bnezc" next to "bne" and "jrc" next to
"j".

8 years agoBegin implementing ARC NPS-400 Accelerator instructions
Graham Markall [Wed, 27 Jul 2016 14:57:18 +0000 (15:57 +0100)]
Begin implementing ARC NPS-400 Accelerator instructions

opcodes * arc-nps400-tbl.h: Change block comments to GNU format.
        * arc-dis.c: Add new globals addrtypenames,
        addrtypenames_max, and addtypeunknown.
        (get_addrtype): New function.
        (print_insn_arc): Print colons and address types when
        required.
        * arc-opc.c: Add MAKE_INSERT_NPS_ADDRTYPE macro and use to
        define insert and extract functions for all address types.
        (arc_operands): Add operands for colon and all address
        types.
        * arc-nps-400-tbl.h: Add NPS-400 BMU instructions to opcode table.
        * arc-opc.c: Add NPS_BD_TYPE and NPS_BMU_NUM operands,
        insert_nps_bd_num_buff and extract_nps_bd_num_buff functions.
        * arc-nps-400-tbl.h: Add NPS-400 PMU instructions to opcode table.
        * arc-opc.c: Add NPS_PMU_NXT_DST and NPS_PMU_NUM_JOB operands,
        insert_nps_pmu_num_job and extract_nps_pmu_num_job functions.

include * opcode/arc.h: Add ARC_OPERAND_ADDRTYPE,
        ARC_OPERAND_COLON. Add the arc_nps_address_type enum and
        ARC_NUM_ADDRTYPES.
        * opcode/arc.h: Add BMU to insn_class_t enum.
        * opcode/arc.h: Add PMU to insn_class_t enum.

gas     * config/tc-arc.c: Add new global arc_addrtype_hash.
        Define O_colon and O_addrtype.
        (debug_exp): Add O_colon and O_addrtype.
        (tokenize_arguments): Handle colon and address type
        tokens.
        (declare_addrtype): New function.
        (md_begin): Initialise arc_addrtype_hash.
        (arc_parse_name): Add lookup of address types.
(assemble_insn): Handle colons and address types by
        ignoring them.
        * testsuite/gas/arc/nps400-8.s: New file.
        * testsuite/gas/arc/nps400-8.d: New file.
        * testsuite/gas/arc/nps400-8.s: Add PMU instruction tests.
        * testsuite/gas/arc/nps400-8.d: Add expected PMU
        instruction output.

8 years agoRestrict linker garbage collection personality test to cfi enabled targets.
Nick Clifton [Wed, 27 Jul 2016 11:01:09 +0000 (12:01 +0100)]
Restrict linker garbage collection personality test to cfi enabled targets.

* testsuite/ld-gc/personality.d: Use "target cfi" to restrict the
test to targets which support cfi.

8 years agoFix seg-fault when running garbage collection on coff binaries.
Nick Clifton [Wed, 27 Jul 2016 09:49:32 +0000 (10:49 +0100)]
Fix seg-fault when running garbage collection on coff binaries.

PR ld/20401
* coffgen.c (fini_reloc_cookie_rels): Check for the extistence
of the coff_section_data before using it.

8 years agoFix warning in ldbuildid.c mingw32 code
Igor Kudrin [Wed, 27 Jul 2016 09:31:34 +0000 (19:01 +0930)]
Fix warning in ldbuildid.c mingw32 code

* ldbuildid.c (generate_build_id): Warning fix.

8 years agoFix aarch64_relocs.sh file mode
Alan Modra [Wed, 27 Jul 2016 06:55:29 +0000 (16:25 +0930)]
Fix aarch64_relocs.sh file mode

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 27 Jul 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoWean gdb and sim off private libbfd.h header
Alan Modra [Tue, 26 Jul 2016 23:30:03 +0000 (09:00 +0930)]
Wean gdb and sim off private libbfd.h header

The major reason this header was needed, bfd_default_set_arch_mach,
has now moved to bfd.h.

gdb/
* amd64-darwin-tdep.c: Don't include libbfd.h.
* i386-darwin-tdep.c: Likewise.
* rs6000-nat.c: Likewise.
* rs6000-tdep.c: Likewise.
sim/aarch64/
* memory.c: Don't include libbfd.h.
sim/rl78/
* load.c: Don't include libbfd.h.
(rl78_load): Don't use private iovec seek or read.
sim/rx/
* load.c: Don't include libbfd.h.
(rx_load): Don't use private iovec seek or read.

8 years agoFix PR server/20414 - x32 gdbserver always crashes inferior
Pedro Alves [Tue, 26 Jul 2016 21:21:27 +0000 (22:21 +0100)]
Fix PR server/20414 - x32 gdbserver always crashes inferior

Debugging an x32 process with an x32 gdbserver always results in:

 (gdb) c
 Continuing.

 Program received signal SIGSEGV, Segmentation fault.
 0xf7de9600 in _dl_debug_state () from target:/libx32/ld-linux-x32.so.2
 (gdb)

Looking at the remote debug logs reveals the problem, here:

  Packet received: T05swbreak:;06:a0d4ffff00000000;07:b8d3ffff00000000;10:0096def701000000;thread:p7d7a.7d7a;core:1;
                                                                          ^^^^^^^^^^^^^^^^

The underlined value is the expedited value of RIP (in little endian).
But notice that 01 in 0x01f7de9600, while gdb says the program stopped
at 0xf7de9600.  0x01ffffffff is over 32 bits, which indicates that
something wen't wrong somewhere in gdbserver.

The problem turns out to be in gdbserver's x86_get_pc / x86_set_pc
routines, where "unsigned long" is used assuming that it can fit a
64-bit value, while unsigned long is actually 32-bit on x32.  The
result is that collect_register_by_name / supply_register_by_name end
up reading/writing random bytes off the stack.

Fix this by using explicit uint64_t instead of unsigned long.
For consistency, use uint32_t instead of unsigned int in the 32-bit
paths.

gdb/gdbserver/ChangeLog:
2016-07-26  Pedro Alves  <palves@redhat.com>

PR server/20414
* linux-x86-low.c (x86_get_pc, x86_set_pc): Use uint64_t instead
of unsigned long for 64-bit registers and use uint32_t instead of
unsigned int for 32-bit registers.

8 years agoPR python/20190 - compute TLS symbol without a frame
Tom Tromey [Fri, 3 Jun 2016 20:11:08 +0000 (14:11 -0600)]
PR python/20190 - compute TLS symbol without a frame

PR python/20190 arose from an exception I noticed when trying to use
the Python unwinder for Spider Monkey in Firefox.

The problem is that the unwinder wants to examine the value of a
thread-local variable.  However, sympy_value rejects this because
symbol_read_needs_frame returns true for a TLS variable.

This problem arose once before, though in a different context:

https://sourceware.org/bugzilla/show_bug.cgi?id=11803

At the time Pedro and Daniel pointed out a simpler way to fix that bug
(see links in 20190 if you are interested); but for this new bug I
couldn't think of a similar fix and ended up implementing Daniel's
other suggestion:

https://sourceware.org/ml/gdb-patches/2010-07/msg00393.html

That is, this patch makes it possible to detect whether a symbol needs
a specific frame, or whether it just needs the inferior to have
registers.

Built and regtested on x86-64 Fedora 24.

2016-07-26  Tom Tromey  <tom@tromey.com>

* symtab.c (register_symbol_computed_impl): Update.
PR python/20190:
* value.h (symbol_read_needs): Declare.
(symbol_read_needs_frame): Add comment.
* symtab.h (struct symbol_computed_ops) <read_variable>: Update
comment.
<get_symbol_read_needs>: Rename.  Change return type.
* findvar.c (symbol_read_needs): New function.
(symbol_read_needs_frame): Rewrite.
(default_read_var_value): Use symbol_read_needs.
* dwarf2loc.c (struct symbol_needs_baton): Rename.
<needs>: Renamed from needs_frame.  Changed type.
(needs_frame_read_addr_from_reg, symbol_needs_get_reg_value)
(symbol_needs_read_mem, symbol_needs_frame_base)
(symbol_needs_frame_cfa, symbol_needs_tls_address)
(symbol_needs_dwarf_call): Rename.
(needs_dwarf_reg_entry_value): Update.
(symbol_needs_ctx_funcs, dwarf2_loc_desc_get_symbol_read_needs):
Rename and update.
(locexpr_get_symbol_read_needs, loclist_symbol_needs): Likewise.
(dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Update.
* defs.h (enum symbol_needs_kind): New.

2016-07-26  Tom Tromey  <tom@tromey.com>

PR python/20190:
* gdb.threads/tls.exp (check_thread_local): Add python symbol
test.

8 years agoMIPS/GAS: Respect the `insn32' mode in branch relaxation
Maciej W. Rozycki [Tue, 26 Jul 2016 16:50:55 +0000 (17:50 +0100)]
MIPS/GAS: Respect the `insn32' mode in branch relaxation

Complement:

commit 833794fc12d98139fc33f6b0b85feb03471007b7
Author: Maciej W. Rozycki <macro@linux-mips.org>
Date:   Tue Jun 25 18:02:34 2013 +0000

<https://sourceware.org/ml/binutils/2013-06/msg00104.html>, ("microMIPS
insn32 mode support"), and fix an issue with microMIPS branch relaxation
producing 16-bit instructions in the `insn32' mode.  Use equivalent
32-bit instruction sequences.

gas/
* config/tc-mips.c (RELAX_MICROMIPS_ENCODE): Add `insn32' flag.
(RELAX_MICROMIPS_INSN32): New macro.
(RELAX_MICROMIPS_UNCOND, RELAX_MICROMIPS_COMPACT)
(RELAX_MICROMIPS_LINK, RELAX_MICROMIPS_RELAX32)
(RELAX_MICROMIPS_TOOFAR16, RELAX_MICROMIPS_MARK_TOOFAR16)
(RELAX_MICROMIPS_CLEAR_TOOFAR16, RELAX_MICROMIPS_TOOFAR32)
(RELAX_MICROMIPS_MARK_TOOFAR32, RELAX_MICROMIPS_CLEAR_TOOFAR32):
Shift bits.
(append_insn): Record `mips_opts.insn32' with relaxed microMIPS
branches.
(relaxed_micromips_32bit_branch_length): Handle the `insn32'
mode.
(md_convert_frag): Likewise.
* testsuite/gas/mips/micromips-branch-relax.s: Add `insn32'
conditionals.
* testsuite/gas/mips/micromips-branch-relax.l: Update line
numbers accordingly.
* testsuite/gas/mips/micromips-branch-relax-pic.l: Likewise.
* testsuite/gas/mips/micromips-branch-relax-insn32.d: New test.
* testsuite/gas/mips/micromips-branch-relax-insn32-pic.d: New
test.
* testsuite/gas/mips/micromips-branch-relax-insn32.l: New
stderr output.
* testsuite/gas/mips/micromips-branch-relax-insn32-pic.l: New
stderr output.
* testsuite/gas/mips/mips.exp: Run the new tests.

8 years agoMIPS/BFD: Handle branches in PLT compression selection
Maciej W. Rozycki [Tue, 26 Jul 2016 16:45:00 +0000 (17:45 +0100)]
MIPS/BFD: Handle branches in PLT compression selection

Complement:

commit 1bbce132647e6d72aaa065cce5c1d5dd6585c2b2
Author: Maciej W. Rozycki <macro@linux-mips.org>
Date:   Mon Jun 24 23:55:46 2013 +0000

<https://sourceware.org/ml/binutils/2013-06/msg00077.html>, ("MIPS:
Compressed PLT/stubs support"), and also choose between regular and
compressed PLT entries as appropriate for any branches referring.

bfd/
* elfxx-mips.c (mips_elf_calculate_relocation): Handle branches
in PLT compression selection.
(_bfd_mips_elf_check_relocs): Likewise.

ld/
* testsuite/ld-mips-elf/compressed-plt-1.s: Add branch support.
* testsuite/ld-mips-elf/compressed-plt-1a.s: Likewise.
* testsuite/ld-mips-elf/compressed-plt-1b.s: Likewise.
* testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od: New
test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd: New
test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd:
New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

8 years agoFix PR gdb/20413 - x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER
Pedro Alves [Tue, 26 Jul 2016 18:35:40 +0000 (19:35 +0100)]
Fix PR gdb/20413 - x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER

An x32 gdb always issues this warning:

 (gdb) start
 Temporary breakpoint 1 at 0x4043e9: file foo.c, line 25.
 Starting program: a.out
 warning: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER: Input/output error

 Temporary breakpoint 1, main (argc=1, argv=0xffffd544) at foo.c:25
 25      {
 (gdb)

As described in Linux commit 55283e253771 (x32: Add ptrace for x32):

    [...] PTRACE_PEEKUSR and PTRACE_POKEUSR are only allowed to access
    segment and debug registers. [...]

The fix is to use PTRACE_GETREGS instead.

gdb/ChangeLog:
2016-07-26  Pedro Alves  <palves@redhat.com>

* nat/linux-ptrace.c: Include "gregset.h".
(linux_ptrace_test_ret_to_nx): Use PTRACE_GETREGS instead of
PTRACE_PEEKUSER.

8 years agoFix PR gdb/20287 - x32 and "gdb_static_assert (sizeof (nat_siginfo_t) == sizeof ...
Pedro Alves [Tue, 26 Jul 2016 18:35:40 +0000 (19:35 +0100)]
Fix PR gdb/20287 - x32 and "gdb_static_assert (sizeof (nat_siginfo_t) == sizeof (siginfo_t))"

Building an x32 gdb trips on a static assertion:

  In file included from .../src/gdb/common/common-defs.h:71:0,
   from .../src/gdb/nat/amd64-linux-siginfo.c:21:
  .../src/gdb/common/gdb_assert.h:26:66: error: size of array ‘never_defined_just_used_for_checking’ is negative
     extern int never_defined_just_used_for_checking[(expr) ? 1 : -1]
    ^
  .../src/gdb/nat/amd64-linux-siginfo.c:113:1: note: in expansion of macro ‘gdb_static_assert’
   gdb_static_assert (sizeof (nat_siginfo_t) == sizeof (siginfo_t));
   ^

The problem is that the way nat_siginfo_t is defined, it can only
match the host's siginfo_t object when gdb is built as a 64-bit
program.

Several bits of nat_siginfo_t are off:

- nat_siginfo_t's _pad field's definition is:

   int _pad[((128 / sizeof (int)) - 4)];

  while /usr/include/bits/siginfo.h has:

   # define __SI_MAX_SIZE     128
   # if __WORDSIZE == 64
   #  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 4)
   # else
   #  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
   # endif

  and __WORDSIZE == 32 for x32.  This is what causes the size of
  nat_siginfo_t to be wrong and the assertion to fail.

- the nat_clock_t type is incorrect for 64-bit.  We have this:

   /* For native 64-bit, clock_t in _sigchld is 64bit aligned at 4 bytes.  */
   typedef long __attribute__ ((__aligned__ (4))) nat_clock_t;

  however, /usr/include/bits/siginfo.h has:

   # if defined __x86_64__ && __WORDSIZE == 32
   /* si_utime and si_stime must be 4 byte aligned for x32 to match the
      kernel.  We align siginfo_t to 8 bytes so that si_utime and si_stime
      are actually aligned to 8 bytes since their offsets are multiple of
      8 bytes.  */
   typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
   #  define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
   # else
   typedef __clock_t __sigchld_clock_t;
   #  define __SI_ALIGNMENT
   # endif

  So we're currently forcing 4-byte alignment on clock_t, when it
  should only be so for x32, not 64-bit.

The fix:

 - Leaves nat_siginfo_t strictly for the 64-bit ABI.

 - Adds a new typedef for the siginfo type that ptrace uses
   (ptrace_siginfo_t).  An x32 gdb always gets/sets an x32 siginfo_t
   type with PTRACE_GETSIGINFO/PTRACE_SETSIGINFO.

 - Uses this new ptrace_siginfo_t type instead of nat_siginfo_t as the
   intermediate conversion type.

gdb/ChangeLog:
2016-07-26  Pedro Alves  <palves@redhat.com>

* amd64-linux-nat.c (amd64_linux_siginfo_fixup): Rename 'native'
parameter to 'ptrace'.
* nat/amd64-linux-siginfo.c (GDB_SI_SIZE): New define.
(nat_uptr_t): New an unsigned long.
(nat_clock_t): Remove attribute __aligned__.
(struct nat_timeval): Delete.
(nat_siginfo_t): Remove attribute __aligned__.
(ptrace_siginfo_t): Define.
(compat_siginfo_from_siginfo, siginfo_from_compat_siginfo)
(compat_x32_siginfo_from_siginfo)
(siginfo_from_compat_x32_siginfo): Make 'from' parameter const.
Convert through a ptrace_siginfo_t instead of a nat_siginfo_t.
Remove casts.
(amd64_linux_siginfo_fixup_common): Rename 'native' parameter to
'ptrace'.  Remove static assertions.
(top level): New static assertions.

gdb/gdbserver/ChangeLog:
2016-07-26  Pedro Alves  <palves@redhat.com>

* linux-x86-low.c (x86_siginfo_fixup): Rename 'native' parameter
to 'ptrace'.

8 years agoAdd support for creating uuid based build-id's in a MinGW32 environment.
Igor Kudrin [Tue, 26 Jul 2016 16:01:06 +0000 (17:01 +0100)]
Add support for creating uuid based build-id's in a MinGW32 environment.

ld * ldbuildid.c: Changes for MinGW32:
Include windows.h and rpcdce.h.
(validate_build_id_style): Allow "uuid" style.
(generate_build_id): Fill in id_bits using UuidCreate().

8 years ago[Gold, aarch64] Implement some AArch64 relocs.
Han Shen [Tue, 26 Jul 2016 15:49:12 +0000 (08:49 -0700)]
[Gold, aarch64] Implement some AArch64 relocs.

This CL implemented the following relocs for AArch64 target.
  - R_AARCH64_MOVW_UABS_G*
  - R_AARCH64_MOVW_SABS_G* relocations

gold/ChangeLog

2016-07-26 Igor Kudrin  <ikudrin@accesssoftek.com>

    * aarch64-reloc-property.cc (Rvalue_bit_select_impl): New class.
    (rvalue_bit_select): Use Rvalue_bit_select_impl.
    * aarch64-reloc.def (MOVW_UABS_G0, MOVW_UABS_G0_NC,
    MOVW_UABS_G1,
    MOVW_UABS_G1_NC, MOVW_UABS_G2, MOVW_UABS_G2_NC, MOVW_UABS_G3,
    MOVW_SABS_G0, MOVW_SABS_G1, MOVW_SABS_G2): New relocations.
    * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
    MOVW_UABS_* and MOVW_SABS_* relocations.
    (Target_aarch64::Scan::global): Likewise.
    (Target_aarch64::Relocate::relocate): Add cases and handlings
    for new MOVW_UABS_* and MOVW_SABS_* relocations.
    * testsuite/Makefile.am (aarch64_relocs): New test.
    * testsuite/Makefile.in: Regenerate.
    * testsuite/aarch64_globals.s: New test source file.
    * testsuite/aarch64_relocs.s: Likewise.
    * testsuite/aarch64_relocs.sh: New test script.

8 years agobtrace, testsuite: fix assembly source file selection
Markus Metzger [Fri, 22 Jul 2016 11:41:45 +0000 (13:41 +0200)]
btrace, testsuite: fix assembly source file selection

Some btrace tests use assembly source files.  They use the target triplet to
distinguish between x86_64 and ia32 ISA.  This does not work for -m32 tests
without setting the target triplet to i686-?-?.

Instead use is_amd64_regs_target to distinguish between x86_64 and ia32 ISA.

See also https://sourceware.org/ml/gdb-patches/2016-07/msg00256.html.

testsuite/
* gdb.btrace/record_goto.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/stepi.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/tailcall.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/tailcall-only.exp: Use is_amd64_regs_target for selecting
assembly source files.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 26 Jul 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoHandle correctly passing a bad interpreter name to new-ui
Simon Marchi [Mon, 25 Jul 2016 15:01:54 +0000 (11:01 -0400)]
Handle correctly passing a bad interpreter name to new-ui

When a bad interpreter name is passed to new-ui, such as:

  (gdb)  new-ui bloop /dev/pts/10

A partially created UI is left in the UI list, with interp set to NULL.
Trying to do anything that will print on this UI (such as "start") will
cause a segmentation fault.

Changes in v2:

  - Use with_test_prefix to namespace test procedures
  - Give an explicit stable test name
  - Add a "bad terminal path" test
  - Remove useless runto_main
  - Add missing intro comments

I did not factor out the pty spawn, as there is some magic involved I
don't quite understand.  But it wouldn't bring that much anyway.

gdb/ChangeLog:

* top.h (make_delete_ui_cleanup): New declaration.
* top.c (delete_ui_cleanup): New function.
(make_delete_ui_cleanup): New function.
(new_ui_command): Create restore_ui cleanup earlier, create a
delete_ui cleanup and discard it on success.

gdb/testsuite/ChangeLog:

* gdb.base/new-ui.exp (do_test_invalid_args): New
procedure.

8 years agolinux-procfs: Handle lowercase "t (tracing stop)" state
Pedro Alves [Mon, 25 Jul 2016 11:42:18 +0000 (12:42 +0100)]
linux-procfs: Handle lowercase "t (tracing stop)" state

Since Linux 2.6.33, /proc/PID/status shows "t (tracing stop)", with
lowercase 't'.  Because GDB is only expecting "T (tracing stop)", GDB
can incorrectly suppress errors in check_ptrace_stopped_lwp_gone:

 1578          if (!check_ptrace_stopped_lwp_gone (lp))
 1579            throw_exception (ex);

Ref: https://sourceware.org/ml/gdb-patches/2016-06/msg00072.html

2016-07-25  Pedro Alves  <palves@redhat.com>
    Jan Kratochvil  <jan.kratochvil@redhat.com>

* nat/linux-procfs.c (parse_proc_status_state): Handle lowercase
't'.

8 years agolinux-procfs: Introduce enum proc_state
Pedro Alves [Mon, 25 Jul 2016 11:42:17 +0000 (12:42 +0100)]
linux-procfs: Introduce enum proc_state

Parse the process's /proc/PID/status state into an enum instead of the
current scheme of passing state strings around.

gdb/ChangeLog:
2016-07-25  Pedro Alves  <palves@redhat.com>

* nat/linux-procfs.c (enum proc_state): New enum.
(parse_proc_status_state): New function.
(linux_proc_pid_get_state): Replace output string buffer parameter
with an output proc_state parameter.  Use parse_proc_status_state.
(linux_proc_pid_is_gone): Adjust to use proc_state values.
(linux_proc_pid_has_state): Change type of 'state' parameter; now
an enum proc_state.  Adjust to linux_proc_pid_get_state interface
change.
(linux_proc_pid_is_stopped)
(linux_proc_pid_is_trace_stopped_nowarn)
(linux_proc_pid_is_zombie_maybe_warn): Adjust to
linux_proc_pid_get_state interface change.

8 years agoAdd myself as a write-after-approval GDB maintainer.
Tim Wiederhake [Mon, 25 Jul 2016 09:12:01 +0000 (11:12 +0200)]
Add myself as a write-after-approval GDB maintainer.

8 years agobtrace: Resume recording after disconnect.
Tim Wiederhake [Mon, 25 Jul 2016 08:57:06 +0000 (10:57 +0200)]
btrace: Resume recording after disconnect.

This patch allows gdbserver to continue recording after disconnect.  On
reconnect, the recorded data is accessible to gdb as if no disconnect happened.

A possible application for this feature is remotely examine bugs that occur
at irregular intervals, where maintaining a gdb connection is inconvenient.

This also fixes the issue mentioned here:
https://sourceware.org/ml/gdb-patches/2015-11/msg00424.html

Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* NEWS: Resume btrace on reconnect.
* record-btrace.c: Added record-btrace.h include.
(record_btrace_open): Split into this and ...
(record_btrace_push_target): ... this.
(record_btrace_disconnect): New function.
(init_record_btrace_ops): Use record_btrace_disconnect.
* record-btrace.h: New file.
* remote.c: Added record-btrace.h include.
(remote_start_remote): Check recording status.
(remote_btrace_maybe_reopen): New function.

gdb/doc/ChangeLog:
* gdb.texinfo: Resume btrace on reconnect.

gdb/testsuite/ChangeLog:

* gdb.btrace/reconnect.c: New file.
* gdb.btrace/reconnect.exp: New file.

Change-Id: I95e8b0ab8a89e58591aba0e63818cee82fd211bc

8 years agoRevise targets able to run ELF 64k section test
Alan Modra [Mon, 25 Jul 2016 05:49:20 +0000 (15:19 +0930)]
Revise targets able to run ELF 64k section test

* testsuite/ld-elf/sec64k.exp: Run test for arc, msp430, or1k
and m32r.  Correct comment.  Relax ld -r match to account for
msp increased number of default sections.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 25 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 24 Jul 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoImplement catch syscall group
Gabriel Krisman Bertazi [Sat, 23 Jul 2016 21:38:24 +0000 (18:38 -0300)]
Implement catch syscall group

Implement support to add catchpoints for a group of related syscalls
using the syntax:

(gdb) catch syscall group:<group>
or
(gdb) catch syscall g:<group>

Several groups are predefined in the xml files for all architectures
supported by GDB over Linux.  They are based on the groups defined by
strace.

gdb/

* xml-syscall.c (get_syscalls_by_group): New.
(get_syscall_group_names): New.
(struct syscall_group_desc): New structure to store group data.
(struct syscalls_info): Include field to store the group list.
(sysinfo_free_syscall_group_desc): New.
(free_syscalls_info): Free group list.
(syscall_group_create_syscall_group_desc): New.
(syscall_group_add_syscall): New.
(syscall_create_syscall_desc): Add syscall to its groups.
(syscall_start_syscall): Load group attribute.
(syscall_group_get_group_by_name): New.
(xml_list_syscalls_by_group): New.
(xml_list_of_groups): New.
* xml-syscall.h (get_syscalls_by_group): Export function
to retrieve a list of syscalls filtered by the group name.
(get_syscall_group_names): Export function to retrieve the list
of syscall groups.
* break-catch-syscall.c (catch_syscall_split_args): Verify if
argument is a syscall group and expand it to a list of syscalls
when creating catchpoints.
(catch_syscall_completer): Add word completion for system call
groups.
* configure.ac: Include dependency for xsltproc when building
in maintainer-mode.
* break-catch-syscall.c (_initialize_breakpoint): Update catch
syscall command documentation.
* NEWS: Include section about catching groups of syscalls.
* configure: Regenerate.
* data-directory/Makefile.in: Generate syscall xml when building
in maintainer mode.
* syscalls/gdb-syscalls.dtd: Include group attribute to the
syscall element.
* syscalls/apply-defaults.xsl: New.
* syscalls/linux-defaults.xml.in: New.
* syscalls/aarch64-linux.xml: Rename to aarch64-linux.xml.in.
* syscalls/amd64-linux.xml: Rename to amd64-linux.xml.in.
* syscalls/arm-linux.xml: Rename to arm-linux.xml.in.
* syscalls/bfin-linux.xml: Rename to bfin-linux.xml.in.
* syscalls/i386-linux.xml: Rename to i386-linux.xml.in.
* syscalls/mips-n32-linux.xml: Rename to mips-n32-linux.xml.in.
* syscalls/mips-n64-linux.xml: Rename to mips-n64-linux.xml.in.
* syscalls/mips-o32-linux.xml: Rename to mips-o32-linux.xml.in.
* syscalls/ppc-linux.xml: Rename to ppc-linux.xml.in.
* syscalls/ppc64-linux.xml: Rename to ppc64-linux.xml.in.
* syscalls/s390-linux.xml: Rename to s390-linux.xml.in.
* syscalls/s390x-linux.xml: Rename to s390x-linux.xml.in.
* syscalls/sparc-linux.xml: Rename to sparc-linux.xml.in.
* syscalls/sparc64-linux.xml: Rename to sparc64-linux.xml.in.
* syscalls/aarch64-linux.xml: Regenerate.
* syscalls/amd64-linux.xml: Regenerate.
* syscalls/arm-linux.xml: Regenerate.
* syscalls/i386-linux.xml: Regenerate.
* syscalls/mips-n32-linux.xml: Regenerate.
* syscalls/mips-n64-linux.xml: Regenerate.
* syscalls/mips-o32-linux.xml: Regenerate.
* syscalls/ppc-linux.xml: Regenerate.
* syscalls/ppc64-linux.xml: Regenerate.
* syscalls/s390-linux.xml: Regenerate.
* syscalls/s390x-linux.xml: Regenerate.
* syscalls/sparc-linux.xml: Regenerate.
* syscalls/sparc64-linux.xml: Regenerate.

gdb/testsuite/

* gdb.base/catch-syscall.exp (do_syscall_tests): Add call
to test_catch_syscall_group.
(test_catch_syscall_group): New.

gdb/doc/

* gdb.texinfo (Set Catchpoints): Add 'group' argument to catch
syscall.

8 years agoFix ARMv8.1/v8.2 for hw watchpoint and breakpoint
Andrew Pinski [Sat, 23 Jul 2016 16:56:44 +0000 (09:56 -0700)]
Fix ARMv8.1/v8.2 for hw watchpoint and breakpoint

The problem here is ARMv8.1 (and ARMv8.2) define a
different debug version than ARMv8 (7 and 8 respectively).
This fixes hw watchpoints and breakpoints by checking
for those debug versions too.

Committed as obvious after a test on aarch64-linux-gnu
(on a ThunderX machine which has ARMv8.1 support enabled).

ChangeLog:
* nat/aarch64-linux-hw-point.c
(aarch64_linux_get_debug_reg_capacity): Handle
ARMv8.1 and ARMv8.2 debug versions.
* nat/aarch64-linux-hw-point.h
(AARCH64_DEBUG_ARCH_V8_1): New define.
(AARCH64_DEBUG_ARCH_V8_2): New define.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
8 years agoSupport JIT debugging on MS-Windows
Руслан Ижбулатов [Sat, 23 Jul 2016 08:38:03 +0000 (11:38 +0300)]
Support JIT debugging on MS-Windows

gdb/ChangeLog:
2016-06-30  Руслан Ижбулатов  <lrn1986@gmail.com>

PR gdb/14529
* windows-nat.c (signal_event_command): New command 'signal-event'
for W32 JIT debug support.
* NEWS: Add an entry about the new 'signal-event' command.

gdb/doc/ChangeLog:
2016-06-30  Руслан Ижбулатов  <lrn1986@gmail.com>

* gdb.texinfo (Cygwin Native): Document the new 'signal-event'
command.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 23 Jul 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR rust/20162 - fix gdb regressions caused by rust 1.10
Tom Tromey [Sun, 26 Jun 2016 17:06:44 +0000 (11:06 -0600)]
PR rust/20162 - fix gdb regressions caused by rust 1.10

PR rust/20162 started life as a reminder to test gdb with versions of
rust after 1.8; but now concerns some gdb regressions seen with rust
1.10 ("beta") and 1.11 ("nightly").

The failures turn out to be a discrepancy between how rustc emits
DWARF and how gdb interprets it.  In particular, rustc will emit DWARF
like:

 <2><bc>: Abbrev Number: 9 (DW_TAG_structure_type)
    <bd>   DW_AT_name        : (indirect string, offset: 0x46a): HasMethods
    <c1>   DW_AT_byte_size   : 4
...
 <3><cc>: Abbrev Number: 11 (DW_TAG_subprogram)
...
    <df>   DW_AT_name        : (indirect string, offset: 0x514f): new

gdb wants to see a separate top-level DW_TAG_subprogram that refers to
this one via DW_AT_specification; but rustc doesn't emit one.  By my
reading of DWARF 4 5.5.7, this is ok, and gdb is incorrect here.

Fixing this involved a new case in scan_partial_symbols, and then a
further change in process_structure_scope to account for the fact
that, in Rust, such functions are not methods and should not be
attached to the structure type.

Next, it turns out that rust is emitting bad values for
DW_AT_linkage_name, e.g.:

    <db>   DW_AT_linkage_name: (indirect string, offset: 0x422): _ZN7methods8{{impl}}3newE

The the "{{impl}}" stuff is apparently some side effect of a change to
the compiler's internal representation.  Oops!

This also had a simple fix -- disregard these mangled names.

With these changes, there are no regressions in the gdb Rust tests
with either 1.10 or 1.11.  1.9, the stable release, is still pretty
broken, but I think there's nothing much to do about that.

These changes are a bit hackish, but no worse, I think, than other
kinds of quirk handling already done in the DWARF parser.  I have
reported all the rustc bugs upstream.  I plan to remove these hacks
from gdb some suitable time after they have been fixed in released
versions of Rust.

2016-07-22  Tom Tromey  <tom@tromey.com>

PR rust/20162:
* dwarf2read.c (scan_partial_symbols) <DW_TAG_structure_type>:
Call scan_partial_symbols for children when reading a Rust CU.
(dwarf2_physname): Ignore invalid DW_AT_linkage_name generated by
rustc.
(process_structure_scope) <DW_TAG_subprogram>: Call
read_func_scope for Rust.

8 years agoGet "num" as unsigned in ctf
Yao Qi [Fri, 22 Jul 2016 15:31:41 +0000 (16:31 +0100)]
Get "num" as unsigned in ctf

I see the following fail due to the warning,

-trace-frame-collected^M
[warning] Extracting signed value from an unsigned int (num)^M
....
FAIL: gdb.trace/mi-trace-frame-collected.exp: ctf: -trace-frame-collected

In ctf metadata, "num" in "tsv" is defined as unint32_t,

  ctf_save_write_metadata (&writer->tcs,
   "event {\n\tname = \"tsv\";\n\tid = %u;\n"
   "\tfields := struct { \n"
   "\t\tuint64_t val;\n"
   "\t\tuint32_t num;\n"
   "\t};\n"
   "};\n", CTF_EVENT_ID_TSV);

so we should read it as unsigned.  The patch below fixes the fail by
changing to bt_ctf_get_uint64.

gdb:

2016-07-22  Yao Qi  <yao.qi@linaro.org>

* ctf.c (ctf_traceframe_info): Call bt_ctf_get_uint64 rather than
bt_ctf_get_int64.

8 years agoFix segfault in ARC linker when generating got entries for local symbols.
Cupertino Miranda [Fri, 22 Jul 2016 14:10:31 +0000 (15:10 +0100)]
Fix segfault in ARC linker when generating got entries for local symbols.

bfd * arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the case
where there's no elf_link_hash_entry while processing GOT_NORMAL got
entries.

ld * testsuite/ld-arc/got-01.d: New file.
* testsuite/ld-arc/got-01.s: New file.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 22 Jul 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoSet BFD_VERSION to 2.27.51
H.J. Lu [Thu, 21 Jul 2016 22:22:13 +0000 (15:22 -0700)]
Set BFD_VERSION to 2.27.51

bfd/

* version.m4 (BFD_VERSION): Set to 2.27.51.
* configure: Regenerated.

binutils/

* configure: Regenerated.

gas/

* configure: Regenerated.

gprof/

* configure: Regenerated.

ld/

* configure: Regenerated.

opcodes/

* configure: Regenerated.

8 years agoMove ChangeLog entry for PR ld/20376
H.J. Lu [Thu, 21 Jul 2016 22:17:37 +0000 (15:17 -0700)]
Move ChangeLog entry for PR ld/20376

8 years agoAllow empty struct expressions in Rust
Tom Tromey [Mon, 11 Jul 2016 21:02:10 +0000 (15:02 -0600)]
Allow empty struct expressions in Rust

I learned recently that empty struct expressions, like "X{}", have been
promoted from experimental to stable in Rust.  This patch changes the
Rust expression parser to allow this case.

New test case included.
Built and regtested on x86-64 Fedora 23, using Rust 1.11 beta.

2016-07-21  Tom Tromey  <tom@tromey.com>

* rust-lang.c (rust_tuple_struct_type_p): Return false for empty
structs.
* rust-exp.y (struct_expr_list): Allow empty elements.

2016-07-21  Tom Tromey  <tom@tromey.com>

* gdb.rust/simple.rs (main): Use empty struct expression.
* gdb.rust/simple.exp: Add tests for empty struct expression.

8 years agoAdd -Wunused-but-set-* to build
Tom Tromey [Mon, 6 Jun 2016 18:56:42 +0000 (12:56 -0600)]
Add -Wunused-but-set-* to build

This adds -Wunused-but-set-variable and -Wunused-but-set-parameter to
configure.

2016-07-21  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS) <build_warnings>: Add
-Wunused-but-set-parameter, -Wunused-but-set-variable.

2016-07-21  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.

8 years agoFix djgpp gdb build
Pedro Alves [Thu, 21 Jul 2016 12:02:34 +0000 (13:02 +0100)]
Fix djgpp gdb build

 - A few missing casts required by C++, resulting in:

   ../../src/gdb/ser-go32.c:795:21: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive]

   etc.

 - dos_noop has an incompatible prototype with struct serial_ops's
   setparity, resulting in:

    ../../src/gdb/ser-go32.c:874:1: error: invalid conversion from 'int (*)(serial*)' to 'int (*)(serial*, int)' [-fpermissive]

   (I thought of calling the ser-base.c default methods, but djgpp
   doesn't include ser-base.c in the build.)

gdb/ChangeLog:
2016-07-21  Pedro Alves  <palves@redhat.com>

* go32-nat.c (go32_create_inferior): Add cast.
* ser-go32.c (dos_noop): Delete.
(dos_flush_output, dos_setparity, dos_drain_output): New
functions.
(dos_write): Add cast.
(dos_ops): Use dos_flush_output, dos_setparity and
dos_drain_output.
* top.c (do_chdir_cleanup): Add cast.

8 years agoRemove unused variable in windows-nat.c
Pedro Alves [Thu, 21 Jul 2016 11:23:48 +0000 (12:23 +0100)]
Remove unused variable in windows-nat.c

Leave the call for side effects.

gdb/ChangeLog:
2016-07-21  Pedro Alves  <palves@redhat.com>

* windows-nat.c (handle_exception): Remove "th".

8 years agoRemove unused variable in gdb/varobj.c when built without Python support
Pedro Alves [Thu, 21 Jul 2016 14:29:58 +0000 (15:29 +0100)]
Remove unused variable in gdb/varobj.c when built without Python support

gdb/ChangeLog:
2016-07-21  Pedro Alves  <palves@redhat.com>

* varobj.c (varobj_value_get_print_value): Move "gdbarch" to block
scope that uses it.

8 years agoFix cast to 'gdb_breakpoint *'
Yao Qi [Thu, 21 Jul 2016 13:34:07 +0000 (14:34 +0100)]
Fix cast to 'gdb_breakpoint *'

c-mode buildbot catches a build problem,

gcc -g -O2    -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Wno-missing-prototypes -Werror -DGDBSERVER -c -o hostio.o -MT hostio.o -MMD -MP -MF .deps/hostio.Tpo ../../../binutils-gdb/gdb/gdbserver/hostio.c
../../../binutils-gdb/gdb/gdbserver/mem-break.c: In function find_gdb_breakpoint:
../../../binutils-gdb/gdb/gdbserver/mem-break.c:996:15: error: gdb_breakpoint undeclared (first use in this function)
       return (gdb_breakpoint *) bp;

we should use 'struct gdb_breakpoint' rather than 'gdb_breakpoint'.
Patch below fixes this.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* mem-break.c (find_gdb_breakpoint): Cast bp to
'struct gdb_breakpoint *' rather than 'gdb_breakpoint *'.

8 years agoSupport vCont s and S actions with software single step
Yao Qi [Thu, 21 Jul 2016 11:12:18 +0000 (12:12 +0100)]
Support vCont s and S actions with software single step

GDBserver with software single step should be able to claim supporting
vCont s and S actions, so that GDB knows the remote target can do
single step.  It doesn't matter to GDB that the single step in the
remote target is done via hardware or software.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* server.c (handle_v_requests): Support s and S actions
if target_supports_software_single_step return true.

8 years agoUse reinsert_breakpoint for vCont;s
Yao Qi [Thu, 21 Jul 2016 11:12:18 +0000 (12:12 +0100)]
Use reinsert_breakpoint for vCont;s

This patch is to teach GDBserver using software single step to handle
vCont;s.  Simply speaking, if the thread's resume request is resume_step,
install reinsert breakpoint at the next pcs when GDBserver is about to
resume threads.  These reinsert breakpoints of a thread are removed,
when GDBserver gets an event from that thread and reports it back to
GDB.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (resume_stopped_resumed_lwps): If resume request
is resume_step, call maybe_hw_step.
(linux_wait_1): Stop all threads, remove reinsert breakpoints,
and unstop them.
(linux_resume_one_lwp_throw): Don't assert the thread has reinsert
breakpoints or not.
(proceed_one_lwp): If resume request is resume_step, install
reinsert breakpoints and call maybe_hw_step.

8 years agoEnqueue signal even when resuming threads
Yao Qi [Thu, 21 Jul 2016 11:12:18 +0000 (12:12 +0100)]
Enqueue signal even when resuming threads

Nowadays, we only enqueue signal when we leave thread pending in
linux_resume_one_thread.  If lwp->resume->sig isn't zero (GDB wants
to resume with signal), we pass lwp->resume->sig to
linux_resume_one_lwp.

In order to reduce the difference between resuming thread with signal
and proceeding thread with signal, when we resume thread, we can
enqueue signal too, and proceed thread.  The signal will be consumed in
linux_resume_one_lwp_throw from lwp->pending_signals.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (proceed_one_lwp): Declare.
(linux_resume_one_thread): Remove local variable 'step'.
Lift code enqueue signal.  Call proceed_one_lwp instead of
linux_resume_one_lwp.

8 years agoUse enqueue_pending_signal in linux_resume_one_thread
Yao Qi [Thu, 21 Jul 2016 11:12:18 +0000 (12:12 +0100)]
Use enqueue_pending_signal in linux_resume_one_thread

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_resume_one_thread): Call
enqueue_pending_signal.

8 years agoSwitch current_thread to lwp's thread in install_software_single_step_breakpoints
Yao Qi [Thu, 21 Jul 2016 11:12:18 +0000 (12:12 +0100)]
Switch current_thread to lwp's thread in install_software_single_step_breakpoints

install_software_single_step_breakpoints has parameter lwp, but still
need to switch to current_thread.  In order to simplify its caller,
we do the current_thread save/restore inside install_software_single_step_breakpoints.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* gdbthread.h (make_cleanup_restore_current_thread): Declare.
* inferiors.c (do_restore_current_thread_cleanup): New function.
(make_cleanup_restore_current_thread): Likewise.
* linux-low.c (install_software_single_step_breakpoints): Call
make_cleanup_restore_current_thread.  Switch current_thread to
thread.

8 years agoMake reinsert_breakpoint thread specific
Yao Qi [Thu, 21 Jul 2016 11:12:18 +0000 (12:12 +0100)]
Make reinsert_breakpoint thread specific

This patch makes reinsert_breakpoint thread specific, which means we
insert and remove reinsert_breakpoint breakpoints for a specific
thread.  This motivation of this change is that I'll use
reinsert_breakpoint for vCont;s on software single step target, so that
GDBserver may insert one reinsert_breakpoint for one thread doing
step-over, and insert one reinsert_breakpoint for another thread doing
vCont;s.  After the operation of one thread is finished, GDBserver must
remove reinsert_breakpoint for that thread only.

On the other hand, reinsert_breakpoint is used for step-over nowadays.
GDBserver inserts reinsert_breakpoint, and wait only from the thread
doing step-over.  After the step-over is done, GDBserver removes the
reinsert_breakpoint.  If there is still any threads need step-over, do
the same again until all threads are finished step-over.  In other words,
reinsert_breakpoint is globally thread specific, but in an implicit way.
It is natural to make it explicitly thread specific.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* mem-break.c (struct reinsert_breakpoint) <ptid>: New field.
(set_reinsert_breakpoint): New parameter ptid.  Callers updated.
(clone_one_breakpoint): Likewise.
(delete_reinsert_breakpoints): Change parameter to thread.
Callers updated.
(has_reinsert_breakpoints): Likewise.
(uninsert_reinsert_breakpoints): Likewise.
(reinsert_reinsert_breakpoints): Likewise.
* mem-break.h (set_reinsert_breakpoint): Update declaration.
(delete_reinsert_breakpoints): Likewise.
(reinsert_reinsert_breakpoints): Likewise.
(uninsert_reinsert_breakpoints): Likewise.
(has_reinsert_breakpoints): Likewise.

8 years agoRefactor clone_all_breakpoints
Yao Qi [Thu, 21 Jul 2016 11:12:18 +0000 (12:12 +0100)]
Refactor clone_all_breakpoints

This patch is to change the interface of clone_all_breakpoints, from
lists of breakpoints and raw_breakpoints to child thread and parent
thread.  I choose child thread to pass because we need the ptid of
the child thread in the following patch.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* inferiors.c (get_thread_process): Make parameter const.
* inferiors.h (get_thread_process): Update declaration.
* mem-break.c (clone_all_breakpoints): Remove all parameters.
Add new parameters child_thread and parent_thread.  Callers
updated.
* mem-break.h (clone_all_breakpoints): Update declaration.

8 years agoCreate sub classes of 'struct breakpoint'
Yao Qi [Thu, 21 Jul 2016 11:12:17 +0000 (12:12 +0100)]
Create sub classes of 'struct breakpoint'

Nowadays, there are three types of breakpoint in GDBserver,

 - gdb breakpoints,
 - reinsert breakpoints, used for software single step,
 - other breakpoints, used for tracepoint,

but we only have one 'struct breakpoint' for all of them.  Some fields
are only useful to one type of breakpoint.  For example, cond_list
and command_list are only used by gdb breakpoints, while handler is
only used by other breakpoints.

This patch changes 'struct breakpoint' to a base class, which has fields
needed by all breakpoint types, also add three sub-classes to
'struct breakpoint' to these three types of breakpoints.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* mem-break.c (struct breakpoint) <cond_list>: Remove.
<command_list, handler>: Remove.
(struct gdb_breakpoint): New.
(struct other_breakpoint): New.
(struct reinsert_breakpoint): New.
(is_gdb_breakpoint): New function.
(any_persistent_commands): Update command_list if
is_gdb_breakpoint returns true.
(set_breakpoint): Create breakpoints according to their types.
(find_gdb_breakpoint): Return 'struct gdb_breakpoint *'.
(set_gdb_breakpoint_1): Likewise.
(set_gdb_breakpoint): Likewise.
(clear_breakpoint_conditions): Change parameter type to
'struct gdb_breakpoint *'.
(clear_breakpoint_commands): Likewise.
(clear_breakpoint_conditions_and_commands): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_breakpoint_condition): Likewise.
(add_commands_to_breakpoint): Likewise.
(check_breakpoints): Check other_breakpoint.
(clone_one_breakpoint): Clone breakpopint according to its type.
* mem-break.h (struct gdb_breakpoint): Declare.
(set_gdb_breakpoint): Update declaration.
(clear_breakpoint_conditions_and_commands): Likewise.
(add_breakpoint_condition): Likewise.
(add_breakpoint_commands): Likewise.
* server.c (process_point_options): Change parameter type to
'struct gdb_breakpoint *'.

8 years agoPass breakpoint type in set_breakpoint_at
Yao Qi [Thu, 21 Jul 2016 11:12:17 +0000 (12:12 +0100)]
Pass breakpoint type in set_breakpoint_at

Nowadays, set_breakpoint_at creates breakpoint of type
other_breakpoint, but we also use set_breakpoint_at
in set_reinsert_breakpoint to create breakpoint, so that
we have to overwrite the breakpoint type like this,

  bp = set_breakpoint_at (stop_at, NULL);
  bp->type = reinsert_breakpoint;

which looks not very good.  This patch changes set_breakpoint_at
to receive breakpoint type.  Since set_breakpoint_at is
used in many places, I rename it to set_breakpoint_type_at, and wrap
it with set_breakpoint_at, and pass other_breakpoint.  In this way,
we can call set_breakpoint_type_at with reinsert_breakpoint in
set_reinsert_breakpoint too, and code looks cleaner.

gdb/gdbserver:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* mem-break.c (set_breakpoint_at): Rename it to ...
(set_breakpoint_type_at): ... it.
(set_breakpoint_at): Call set_breakpoint_type_at.
(set_reinsert_breakpoint): Call set_breakpoint_type_at.
* mem-break.h (set_breakpoint_at): Update comments.

8 years agoSkip gdb.server/ tests if lack of XML support
Yao Qi [Thu, 21 Jul 2016 08:22:29 +0000 (09:22 +0100)]
Skip gdb.server/ tests if lack of XML support

I recently see some gdb.server/*.exp fails in my native gdb testing,
in which libexpat isn't available, so GDB isn't able to parse xml file.
It causes gdb.server/ tests fails because GDB can't get registers
correctly from GDBserver.

(gdb) PASS: gdb.server/connect-without-multi-process.exp: multiprocess=off: break main
target remote localhost:2352^M
Remote debugging using localhost:2352^M
warning: Can not parse XML target description; XML support was disabled at compile time^M
Reading /lib/ld-linux-armhf.so.3 from remote target...^M
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.^M
Reading /lib/ld-linux-armhf.so.3 from remote target...^M
Reading symbols from target:/lib/ld-linux-armhf.so.3...Reading /lib/ld-2.17.so.debug from remote target...^M
Reading /lib/.debug/ld-2.17.so.debug from remote target...^M
(no debugging symbols found)...done.^M
Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000efffbe00000000808d0f4d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000^
0x4d0f8d80 in _start () from target:/lib/ld-linux-armhf.so.3^M

Without XML support in GDB, it can't parse xml sent by GDBserver, and has
to fall back to the oldest arch.  However, GDBserver doesn't know this
(IMO, this is a defect in RSP), and still choose the right target
description to create regcache and 'g' packet.  If the port only has
one target description or coincidentally two sides choose the same
target description, there is no such issue.  Otherwise, GDB is broken
on read registers.

This patch is to skip gdbserver tests if XML is not support and the
target has multiple target descriptions.

gdb/testsuite:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* lib/gdbserver-support.exp (skip_gdbserver_tests): Return 1
if gdb_skip_xml_test is true on some targets.

8 years agoFix typo fsqrt -> sqrtf.
Nick Clifton [Thu, 21 Jul 2016 08:23:16 +0000 (09:23 +0100)]
Fix typo fsqrt -> sqrtf.

8 years agooops - forgot to include binutils.texi in the previous delta.
Nick Clifton [Thu, 21 Jul 2016 08:20:10 +0000 (09:20 +0100)]
oops - forgot to include binutils.texi in the previous delta.

8 years agoUse fsqrt() to calculate float (rather than double) square root.
Nick Clifton [Thu, 21 Jul 2016 08:17:54 +0000 (09:17 +0100)]
Use fsqrt() to calculate float (rather than double) square root.

* simulator.c (fsqrts): Use fsqrt rather than sqrt.

8 years agoFix fail in gdb.server/solib-list.exp
Yao Qi [Thu, 21 Jul 2016 08:15:21 +0000 (09:15 +0100)]
Fix fail in gdb.server/solib-list.exp

If I run single test solib-list.exp, it is OK.  If I run two, as below,
there are fails,

$ make check RUNTESTFLAGS="server-run.exp solib-list.exp"
FAIL: gdb.server/solib-list.exp: non-stop 0: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 0: p libvar
FAIL: gdb.server/solib-list.exp: non-stop 1: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 1: p libvar

in gdb.log,

/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/server-run/server-run /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list

server-run is spawned, which is wrong.  If I only run solib-list.exp, ld-linux
is spawned, which is right.

/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2346 /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list

in test, we spawn gdbserver this way,

    # Note we pass ${interp_system}, the program gdbserver spawns, as
    # argument here, instead of using gdb_load, because we don't want
    # to download the interpreter to the target (it's already there)
    # or to the test output directory.
    set res [gdbserver_spawn "${interp_system} ${remote_binfile}"]

in gdbserver_spawn -> gdbserver_download_current_prog, if
last_loaded_file is set (when you run multiple tests), it is
returned.

This patch is to unset last_loaded_file in solib-list.exp.

gdb/testsuite:

2016-07-21  Yao Qi  <yao.qi@linaro.org>

* gdb.server/solib-list.exp: Unset last_loaded_file.

8 years agoUse variable args in run_ld_link_exec_tests
Alan Modra [Thu, 21 Jul 2016 00:06:37 +0000 (09:36 +0930)]
Use variable args in run_ld_link_exec_tests

If the last parameter of a tcl function is "args" then it can take
zero or more arguments.  Make use of this language feature in
run_ld_link_exec_tests.

* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Replace
"targets_to_xfail" parameter with "args".
* testsuite/ld-elf/compress.exp: Remove empty list of xfails on
all calls to run_ld_link_exec_tests.
* testsuite/ld-elf/dwarf.exp: Likewise.
* testsuite/ld-elf/indirect.exp: Likewise.
* testsuite/ld-elf/wrap.exp: Likewise.
* testsuite/ld-i386/i386.exp: Likewise.
* testsuite/ld-i386/no-plt.exp: Likewise.
* testsuite/ld-i386/tls.exp: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
* testsuite/ld-pie/pie.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-size/size.exp: Likewise.
* testsuite/ld-x86-64/mpx.exp: Likewise.
* testsuite/ld-x86-64/no-plt.exp: Likewise.
* testsuite/ld-x86-64/tls.exp: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-elf/elf.exp: Likewise.  Reorder args when providing
xfails and simplify lists.
* testsuite/ld-elf/shared.exp: Likewise.

8 years agoFix implib test failures
Alan Modra [Wed, 20 Jul 2016 05:36:49 +0000 (15:06 +0930)]
Fix implib test failures

bfd/
* elf.c (_bfd_elf_filter_global_symbols): Skip local symbols.
(swap_out_syms): Return an error when not finding ELF output
section rather than asserting.
* elflink.c (elf_output_implib): Call bfd_set_error on no symbols.
ld/
* testsuite/lib/ld-lib.exp (run_ld_link_tests): Add optional
parameter to pass list of xfails.
* testsuite/ld-elf/elf.exp: Add xfails for implib tests.  Tidy
implib test formatting.  Don't set .data start address.
* testsuite/ld-elf/implib.s: Remove first .bss directive and
replace second one with equivalent .section directive.
* testsuite/ld-elf/empty-implib.out: Add expected final error.
* testsuite/ld-elf/implib.rd: Update.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 21 Jul 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoUse a real vfork done event on FreeBSD when available.
John Baldwin [Sat, 16 Jul 2016 17:14:08 +0000 (10:14 -0700)]
Use a real vfork done event on FreeBSD when available.

FreeBSD 12 recently added a new ptrace event to indicate when the vfork
parent resumes after the child process stops sharing the address space.
Use this event to report a proper TARGET_WAITKIND_VFORK_DONE rather than
faking a vfork done event after a delay.

gdb/ChangeLog:

* fbsd-nat.c (fbsd_enable_proc_events): Enable "PTRACE_VFORK"
events.
(fbsd_pending_vfork_done): Only define if "PTRACE_VFORK" is not
defined.
(fbsd_add_vfork_done): Likewise.
(fbsd_is_vfork_done_pending): Likewise.
(fbsd_next_vfork_done): Likewise.
(fbsd_resume): Only ignore pending vfork done events if
"PTRACE_VFORK" is not defined.
(fbsd_wait): Only look for pending vfork done events if
"PTRACE_VFORK" is not defined.
[PTRACE_VFORK]: Handle "PL_FLAG_VFORKED" and "PL_FLAG_VFORK_DONE"
events.
(fbsd_follow_fork): Only fake a vfork done event if "PTRACE_VFORK"
is not defined.

8 years agoEnable ptrace events on new child processes.
John Baldwin [Sat, 16 Jul 2016 00:01:21 +0000 (17:01 -0700)]
Enable ptrace events on new child processes.

New child processes on FreeBSD do not inherit optional ptrace events
such as fork and LWP events from the parent process.  Instead,
explicitly enable events on new children when reporting a fork
event.

gdb/ChangeLog:

* fbsd-nat.c (fbsd_wait): Use "fbsd_enable_proc_events" on
new child processes.

8 years agoConsolidate code to enable optional FreeBSD native target event reporting.
John Baldwin [Fri, 15 Jul 2016 21:03:10 +0000 (14:03 -0700)]
Consolidate code to enable optional FreeBSD native target event reporting.

Add a new function to enable optional event reporting for FreeBSD native
targets.  Specifically, use this to enable fork and LWP events.
The bodies of fbsd_enable_follow_fork and fbsd_enable_lwp_events have been
subsumed into the new function.  In addition, use the PT_GET_EVENT_MASK
and PT_EVENT_SET_MASK requests added in FreeBSD 12 when present to enable
these events.

gdb/ChangeLog:

* fbsd-nat.c (fbsd_enable_lwp_events): Remove function.
(fbsd_enable_proc_events): New function.
(fbsd_enable_follow_fork): Remove function.
(fbsd_post_startup_inferior): Use "fbsd_enable_proc_events".
(fbsd_post_attach): Likewise.