binutils-gdb.git
7 years agoRemove a cleanup in Python
Tom Tromey [Mon, 1 May 2017 04:12:13 +0000 (22:12 -0600)]
Remove a cleanup in Python

This removes cleanups from gdbpy_decode_line, in favor of a use of
unique_xmalloc_ptr.

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

* python/python.c (gdbpy_decode_line): Use unique_xmalloc_ptr.

7 years agoAvoid some manual memory management in Python
Tom Tromey [Mon, 1 May 2017 04:10:41 +0000 (22:10 -0600)]
Avoid some manual memory management in Python

This changes a few places in the Python code to avoid manual memory
management, in favor of letting std::string do the work.

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

* python/python.c (compute_python_string): Return std::string.
(gdbpy_eval_from_control_command): Update.
(do_start_initialization): Use std::string.
* python/py-varobj.c (py_varobj_iter_next): Use string_printf, not
xstrprintf.
* python/py-breakpoint.c (local_setattro): Use string_printf, not
xstrprintf.

7 years agoReplace do_restore_instream_cleanup with scoped_restore
Tom Tromey [Mon, 1 May 2017 03:17:58 +0000 (21:17 -0600)]
Replace do_restore_instream_cleanup with scoped_restore

This changes the users of do_restore_instream_cleanup to use a
scoped_restore instead.  This patch is broken out because it warrants
some additional attention: in particular it's unclear to me whether
current_ui can change in the body of these functions -- but if it can,
then the cleanup would have modified a different UI's instream member.

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

* top.h (do_restore_instream_cleanup): Remove.
* top.c (do_restore_instream_cleanup): Remove.
(read_command_file): Use scoped_restore.
* cli/cli-script.c (execute_user_command): Use scoped_restore.

7 years agoUse a scoped_restore for command_nest_depth
Tom Tromey [Mon, 1 May 2017 03:15:58 +0000 (21:15 -0600)]
Use a scoped_restore for command_nest_depth

This changes a couple of places to use a scoped_restore when
manipulating command_nest_depth.

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

* cli/cli-script.c (execute_user_command)
(execute_control_command): Use scoped_restore.

7 years agoRemove user_call_depth
Tom Tromey [Mon, 1 May 2017 03:08:31 +0000 (21:08 -0600)]
Remove user_call_depth

This changes execute_user_command to remove user_call_depth, using the
size of user_args_stack instead.  This avoids a cleanup.

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

* cli/cli-script.c (do_restore_user_call_depth): Remove.
(execute_user_command): Remove user_call_depth; use
user_args_stack's size instead.

7 years agoRemove in_user_command
Tom Tromey [Mon, 1 May 2017 03:04:51 +0000 (21:04 -0600)]
Remove in_user_command

While working on the next patch in this series, I found that the
global in_user_command is not used.  This patch removes it.  (I didn't
think to check Insight until submitting this series; and it's not very
convenient to do so, so if someone has it checked out and could look
at it, that would be nice.)

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

* top.h (in_user_command): Remove.
* top.c (in_user_command): Remove.
* cli/cli-script.c (do_restore_user_call_depth)
(execute_user_command): Update.

7 years agoUse containers to avoid cleanups
Tom Tromey [Sat, 29 Apr 2017 05:34:32 +0000 (23:34 -0600)]
Use containers to avoid cleanups

This patch introduces the use of various containers -- std::vector,
std::string, or gdb::byte_vector -- in several spots in gdb that were
using xmalloc and a cleanup.

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

* valops.c (search_struct_method): Use gdb::byte_vector.
* valarith.c (value_concat): Use std::vector.
* target.c (memory_xfer_partial): Use gdb::byte_vector.
(simple_search_memory): Likewise.
* printcmd.c (find_string_backward): Use gdb::byte_vector.
* mi/mi-main.c (mi_cmd_data_write_memory): Use gdb::byte_vector.
* gcore.c (gcore_copy_callback): Use gdb::byte_vector.
* elfread.c (elf_rel_plt_read): Use std::string.
* cp-valprint.c (cp_print_value): Use gdb::byte_vector.
* cli/cli-dump.c (restore_section_callback): Use
gdb::byte_vector.

7 years agoUse unique_xmalloc_ptr in jit.c
Tom Tromey [Sat, 29 Apr 2017 05:08:16 +0000 (23:08 -0600)]
Use unique_xmalloc_ptr in jit.c

This removes some cleanups from jit.c by using unique_xmalloc_ptr
instead.

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

* jit.c (jit_reader_load_command): Use unique_xmalloc_ptr.

7 years agoReplace tui_restore_gdbout with scoped_restore
Tom Tromey [Sat, 29 Apr 2017 04:59:24 +0000 (22:59 -0600)]
Replace tui_restore_gdbout with scoped_restore

This patch replaces tui_restore_gdbout (a cleaup function) with a use
of scoped_restore.  This one is broken out into its own patch because
it might slightly change the behavior of gdb: it saves and restores
pagination_enabled, whereas the tui_restore_gdbout unconditionally set
pagination_enabled to 1; and I think this warrants closer review.

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

* tui/tui-regs.c (tui_restore_gdbout): Remove.
(tui_register_format): Use scoped_restore.

7 years agoMore uses of scoped_restore
Tom Tromey [Thu, 27 Apr 2017 04:53:40 +0000 (22:53 -0600)]
More uses of scoped_restore

There were a few more places in gdb that could easily use
scoped_restore, replacing some cleanups.

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

* reverse.c (exec_direction_default): Remove.
(exec_reverse_once): Use scoped_restore.
* remote.c (restore_remote_timeout): Remove.
(remote_flash_erase, remote_flash_write, remote_flash_done)
(readchar, remote_serial_write): Use scoped_restore.
* cli/cli-script.c (struct source_cleanup_lines_args)
(source_cleanup_lines): Remove.
(script_from_file): Use scoped_restore.
* cli/cli-cmds.c (source_verbose_cleanup): Remove.
(source_command): Use scoped_restore.

7 years agoRemove make_cleanup_free_so
Tom Tromey [Sat, 29 Apr 2017 04:43:54 +0000 (22:43 -0600)]
Remove make_cleanup_free_so

make_cleanup_free_so is used in a single spot.  This patch introduces
a unique pointer wrapper for struct so_list, and changes this spot to
use it.

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

* utils.h (make_cleanup_free_so): Remove.
* utils.c (do_free_so, make_cleanup_free_so): Remove.
* solist.h (struct so_deleter): New.
(so_list_up): New typedef.
* solib-svr4.c (svr4_read_so_list): Use so_list_up.

7 years agoRemove make_cleanup_restore_current_language
Tom Tromey [Thu, 27 Apr 2017 04:41:30 +0000 (22:41 -0600)]
Remove make_cleanup_restore_current_language

This patch replaces make_cleanup_restore_current_language with an RAII
class that saves the current language, and restores it when the object
is destroyed.

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

* utils.h (make_cleanup_restore_current_language): Remove.
* utils.c (do_restore_current_language)
(make_cleanup_restore_current_language): Remove.
* parse.c (parse_exp_in_context_1)
(parse_expression_with_language): Use
scoped_restore_current_language.
* mi/mi-main.c (mi_cmd_execute): Use
scoped_restore_current_language.
* language.h (scoped_restore_current_language): New class.

7 years agoRemove an unlink cleanup
Tom Tromey [Thu, 27 Apr 2017 04:12:50 +0000 (22:12 -0600)]
Remove an unlink cleanup

compile/compile.c had its own cleanup to unlink a file.  This patch
replaces this cleanup with gdb::unlinker.

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

* compile/compile.c (cleanup_unlink_file): Remove.
(compile_to_object): Use gdb::unlinker.
(eval_compile_command): Likewise.

7 years agoRemove make_cleanup_fclose
Tom Tromey [Thu, 27 Apr 2017 04:03:42 +0000 (22:03 -0600)]
Remove make_cleanup_fclose

After the preceding patches, make_cleanup_fclose is no longer used, so
remove it.

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

* utils.h (make_cleanup_fclose): Remove.
* utils.c (do_fclose_cleanup, make_cleanup_fclose): Remove.

7 years agoChange open_terminal_stream to return a gdb_file_up
Tom Tromey [Thu, 27 Apr 2017 04:03:08 +0000 (22:03 -0600)]
Change open_terminal_stream to return a gdb_file_up

This changes open_terminal_stream to return a gdb_file_up, eliminating
another use of make_cleanup_fclose.  Arguably perhaps new_ui should
take ownership of the files using a move, but there is at least one
spot where this isn't appropriate (or at least not currently done), so
I elected to use a more minimal approach.

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

* top.c (open_terminal_stream): Return gdb_file_up.
(new_ui_command): Update.

7 years agoUse gdb_file_up in source.c
Tom Tromey [Thu, 27 Apr 2017 03:56:14 +0000 (21:56 -0600)]
Use gdb_file_up in source.c

This changes some functions in source.c to use gdb_file_up.

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

* source.c (print_source_lines_base, forward_search_command)
(reverse_search_command): Use gdb_file_up.

7 years agoUse gdb_file_up in fbsd-nat.c
Tom Tromey [Thu, 27 Apr 2017 03:52:52 +0000 (21:52 -0600)]
Use gdb_file_up in fbsd-nat.c

This updates fbsd-nat.c to use gdb_file_up.  This removes a use of a
cleanup, and helps remove make_cleanup_fclose in a later patch.

I have no way to test this patch.

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

* fbsd-nat.c (fbsd_find_memory_regions): Update.

7 years agoChange return type of find_and_open_script
Tom Tromey [Thu, 27 Apr 2017 03:49:55 +0000 (21:49 -0600)]
Change return type of find_and_open_script

This changes find_and_open_script to return a
gdb::optional<open_script>, where open_script is a new type
encapsulating the two return values.  The new type helps avoid
cleanups in the callers.

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

* cli/cli-cmds.c (find_and_open_script): Change return type.
Remove "streamp" and "full_path" parameters.
(source_script_with_search): Update.
* auto-load.c (source_script_file): Update.
* cli/cli-cmds.h (find_and_open_script): Change type.
(open_script): New struct.

7 years agoIntroduce and use gdb_file_up
Tom Tromey [Thu, 27 Apr 2017 03:39:46 +0000 (21:39 -0600)]
Introduce and use gdb_file_up

This introduces gdb_file_up, a unique pointer holding a FILE*, and
then changes some code in gdb to use it.  In particular
gdb_fopen_cloexec now returns a gdb_file_up.  This allow removing some
cleanups.

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

* xml-support.c (xml_fetch_content_from_file): Update.
* ui-file.c (stdio_file::open): Update.
* tracefile-tfile.c (tfile_start): Update.
* remote.c (remote_file_put, remote_file_get): Update.
* nat/linux-procfs.c (linux_proc_get_int)
(linux_proc_pid_get_state, linux_proc_tid_get_name): Update.
* nat/linux-osdata.c (linux_common_core_of_thread): Update.
(command_from_pid, commandline_from_pid, linux_xfer_osdata_cpus)
(print_sockets, linux_xfer_osdata_shm, linux_xfer_osdata_sem)
(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Update.
* nat/linux-btrace.c (linux_determine_kernel_start): Update.
* linux-nat.c (linux_proc_pending_signals): Update.
* dwarf2read.c (write_psymtabs_to_index): Use gdb_file_up.
(file_closer): Remove.
* compile/compile.c (compile_to_object): Update.
* common/filestuff.h (struct gdb_file_deleter): New.
(gdb_file_up): New typedef.
(gdb_fopen_cloexec): Change return type.
* common/filestuff.c (gdb_fopen_cloexec): Return gdb_file_up.
* cli/cli-dump.c (fopen_with_cleanup): Remove.
(dump_binary_file, restore_binary_file): Update.
* auto-load.c (auto_load_objfile_script_1): Update.

7 years agoIntroduce and use ui_out_emit_table
Tom Tromey [Sun, 23 Apr 2017 16:21:50 +0000 (10:21 -0600)]
Introduce and use ui_out_emit_table

This introduces ui_out_emit_table, similar to the other existing
ui_out RAII classes, and then uses it in a number of places.  This
replaces some cleanups.

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

* tracepoint.c (tvariables_info_1): Use ui_out_emit_table.
(info_static_tracepoint_markers_command): Likewise.
* solib.c (info_sharedlibrary_command): Use ui_out_emit_table.
* skip.c (skip_info): Use ui_out_emit_table.
* progspace.c (print_program_space): Use ui_out_emit_table.
* osdata.c (info_osdata): Use ui_out_emit_table.
* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Use
ui_out_emit_table.
* linux-thread-db.c (info_auto_load_libthread_db): Use
ui_out_emit_table.
* inferior.c (print_inferior): Use ui_out_emit_table.
* gdb_bfd.c (maintenance_info_bfds): Use ui_out_emit_table.
* breakpoint.c (breakpoint_1): Use ui_out_emit_table.
* auto-load.c (auto_load_info_scripts): Use ui_out_emit_table.
* ada-tasks.c (print_ada_task_info): Use ui_out_emit_table.
* ui-out.h (class ui_out_emit_table): New.

7 years agoAdd more targets to the list of architectures not supporting format changing during...
Nick Clifton [Thu, 3 Aug 2017 10:59:32 +0000 (11:59 +0100)]
Add more targets to the list of architectures not supporting format changing during linking.  Fix seg-faults triggered when this is attempted.

PR ld/21884
* testsuite/ld-elf/pr21884.d: Add AVR, HPPA, IA64, M68HC1x and
SCORE to list of targets not supporting file format changes during
linking.
* testsuite/ld-unique/pr21529.d: Likewise.
* emultempl/avrelf.em (_before_allocation): Skip for non-ELF
output formats.
(avr_elf_create_output_section_statements): Fail if the output
format is not ELF.
(avr_finish): Do not access the ELF header in non-ELF format
output bfds.
* emultempl/m68hc1xelf.em (_before_allocation): Skip for non-ELF
output formats.
(m68hc11elf_create_output_section_statements): Fail if the putput
format is not ELF.
(m68hc11elf_after_allocation): Skip for non-ELF output formats.

7 years agoELF checks for orphan placement
Alan Modra [Thu, 3 Aug 2017 04:31:34 +0000 (14:01 +0930)]
ELF checks for orphan placement

The loop checking for previous orphan placement should run even when
the output is non-ELF.

PR ld/21884
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Revert
last change.  Rename iself to elfinput.  Expand comments.  Condition
ELF checks on having both input and output ELF files.  Extract..
(elf_orphan_compatible): ..this new function.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 3 Aug 2017 00:01:14 +0000 (00:01 +0000)]
Automatic date update in version.in

7 years agoMIPS: Factor out FPU type naming in `gdbarch' debug
Maciej W. Rozycki [Wed, 2 Aug 2017 15:40:16 +0000 (16:40 +0100)]
MIPS: Factor out FPU type naming in `gdbarch' debug

Replace chains of conditional expressions used in target-dependent MIPS
`gdbarch' debug output to get a textual name of the FPU type with calls
to a helper decoder function, improving code readability.  No functional
change.

gdb/
* mips-tdep.c (mips_fpu_type_str): New function.
(mips_dump_tdep): Call it.

7 years agoCheck ELF section header only for ELF output
H.J. Lu [Wed, 2 Aug 2017 12:10:29 +0000 (05:10 -0700)]
Check ELF section header only for ELF output

When placing an orphan input section, check ELF section header only for
ELF output.

PR ld/21884
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check
ELF section header only for ELF output.
* testsuite/ld-elf/pr21884.d: New test.
* testsuite/ld-elf/pr21884.t: Likewise.
* testsuite/ld-elf/pr21884a.s: Likewise.
* testsuite/ld-elf/pr21884b.s: Likewise.

7 years agoRevert the last change to emultempl/elf32.em
H.J. Lu [Wed, 2 Aug 2017 12:08:41 +0000 (05:08 -0700)]
Revert the last change to emultempl/elf32.em

It will be replaced by a different fix.

* emultempl/elf32.em (_place_orphan): Revert the last change.

7 years agoAdd support for creating archives of slim-LTO modules using MRi script commands.
Nick Clifton [Wed, 2 Aug 2017 11:12:37 +0000 (12:12 +0100)]
Add support for creating archives of slim-LTO modules using MRi script commands.

PR 21702
* arsup.c (ar_addmod): Add plugin support for the MRI ADDMOD
command.

7 years agoFix assertion failure for xtensa linker.
Max Filippov [Wed, 2 Aug 2017 10:48:07 +0000 (11:48 +0100)]
Fix assertion failure for xtensa linker.

* emultempl/xtensaelf.em (xtensa_wild_group_interleave_callback):
Only check for by_name sorting.

7 years agoFix seg-fault when trying to place non-ELF orphan sections.
Nick Clifton [Wed, 2 Aug 2017 10:45:05 +0000 (11:45 +0100)]
Fix seg-fault when trying to place non-ELF orphan sections.

PR 21884
* emultempl/elf32.em (_place_orphan): Skip non-ELF binaries when
looking for sections to merge.

7 years agoFix potential illegal memory access in Xtensa port.
Max Filippov [Wed, 2 Aug 2017 09:38:09 +0000 (10:38 +0100)]
Fix potential illegal memory access in Xtensa port.

* xtensa-isa.c (xtensa_isa_init): Don't update lookup table
entries for sysregs with negative indices.

7 years agoFix gas and binutils testsuite failures for am33_2.0-linux target.
Nick Clifton [Wed, 2 Aug 2017 09:19:22 +0000 (10:19 +0100)]
Fix gas and binutils testsuite failures for am33_2.0-linux target.

gas * testsuite/gas/all/gas.exp: Add am33 to the skip lists of tests
passed over by the mn10300 target.
* testsuite/gas/elf/elf.exp: Likewise.
* testsuite/gas/elf/dwarf2-11.d: Correct skip of am33 target.
* testsuite/gas/elf/dwarf2-12.d: Likewise.
* testsuite/gas/elf/dwarf2-13.d: Likewise.
* testsuite/gas/elf/dwarf2-14.d: Likewise.
* testsuite/gas/elf/dwarf2-15.d: Likewise.
* testsuite/gas/elf/dwarf2-16.d: Likewise.
* testsuite/gas/elf/dwarf2-17.d: Likewise.
* testsuite/gas/elf/dwarf2-18.d: Likewise.
* testsuite/gas/elf/dwarf2-5.d: Likewise.
* testsuite/gas/elf/dwarf2-6.d: Likewise.
* testsuite/gas/elf/dwarf2-7.d: Likewise.

binutils * testsuite/binutils-all/objdump.exp (cpus_expected): Add am33-2.

7 years agoTeach readelf about IA64 MSB relocs.
Alan Modra [Wed, 2 Aug 2017 05:48:56 +0000 (15:18 +0930)]
Teach readelf about IA64 MSB relocs.

* readelf.c (is_32bit_abs_reloc): Add R_IA64_SECREL32MSB and
R_IA64_DIR32MSB.
(is_64bit_abs_reloc): Add R_IA64_DIR64MSB.
(is_64bit_pcrel_reloc): Add R_IA64_PCREL64MSB.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 2 Aug 2017 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoMIPS: Consistently use MIPS_FPU_TYPE for `gdbarch' member
Maciej W. Rozycki [Tue, 1 Aug 2017 18:32:25 +0000 (19:32 +0100)]
MIPS: Consistently use MIPS_FPU_TYPE for `gdbarch' member

Complement commit 74ed0bb4148e ("Replace current_gdbarch in *mips*"),
<https://sourceware.org/ml/gdb-patches/2008-06/msg00490.html>, and
consistently use the MIPS_FPU_TYPE macro to access the `->mips_fpu_type'
target-dependent `gdbarch' member.  No functional change.

gdb/
* mips-tdep.c (mips_gdbarch_init): Use MIPS_FPU_TYPE to access
`->mips_fpu_type'.

7 years agoS/390: Fix claimfile failures
Andreas Krebbel [Tue, 1 Aug 2017 13:13:40 +0000 (15:13 +0200)]
S/390: Fix claimfile failures

This fixes a segfault when trying to access the local_plt field in the
s390 specific elf data althoug the underlaying object is a generic elf
object.

This fixes the following testsuite failures:

< FAIL: plugin claimfile replace symbol with source
< FAIL: plugin claimfile resolve symbol with source
< FAIL: plugin claimfile replace file with source
< FAIL: plugin set symbol visibility with source
< FAIL: plugin ignore lib with source
< FAIL: plugin claimfile replace lib with source
< FAIL: plugin 2 with source lib
< FAIL: load plugin 2 with source
< FAIL: plugin 3 with source lib
< FAIL: load plugin 3 with source

bfd/ChangeLog:

2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
isn't the S/390 specific elf data.
* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.

7 years agox86: Update segment register check in Intel syntax
H.J. Lu [Tue, 1 Aug 2017 12:53:27 +0000 (05:53 -0700)]
x86: Update segment register check in Intel syntax

https://sourceware.org/ml/binutils/2009-04/msg00223.html

introduced a new Intel syntax parser which accepts

mov eax, fs:gs:[eax]

It ignores anything between ':'s after fs and treats

mov eax, DWORD PTR fs:foobar:16
mov eax, DWORD PTR fs:foobar:barfoo:16
mov eax, DWORD PTR fs:ds:16
mov eax, DWORD PTR fs:ds:cs:16

as

mov eax, DWORD PTR fs:16

This patch updates segment register check and only allows a single ':'.

PR gas/21874
* config/tc-i386-intel.c (i386_intel_operand): Update segment
register check.
* testsuite/gas/i386/intelok.s: Replace "fs:gs:[eax]" with
"fs:[eax]".
* testsuite/gas/i386/inval-seg.s: Add tests for invalid segment
register.
* testsuite/gas/i386/x86-64-inval-seg.s: Likewise.
* testsuite/gas/i386/inval-seg.l: Updated.
* testsuite/gas/i386/x86-64-inval-seg.l: Likewise.

7 years agoUpdated Swedish translation for the binutils sub-directory.
Nick Clifton [Tue, 1 Aug 2017 07:24:22 +0000 (08:24 +0100)]
Updated Swedish translation for the binutils sub-directory.

* po/sv.po: Updated Swedish translation.

7 years ago[GOLD] PowerPC recreate eh_frame for stubs on each relax pass
Alan Modra [Tue, 1 Aug 2017 04:38:53 +0000 (14:08 +0930)]
[GOLD] PowerPC recreate eh_frame for stubs on each relax pass

There is a very small but non-zero probability that a stub group
contains stubs on one relax pass, but does not on the next.  In that
case we would get an FDE covering a zero length address range.
(Actually, it's even worse.  Alignment padding for stubs can mean the
address for the non-existent stubs is past the end of the original
section to which stubs are attached, and due to the way
do_plt_fde_location calculates the length we can get a negative
length.)  Fixing this properly requires removing the FDE.

Also, I have been implementing the __tls_get_addr_opt support for
gold, and that stub needs something other than the default FDE.  The
necessary FDE will depend on the offset to the __tls_get_addr_opt
stub, which of course can change during relaxation.  That means at the
very least, rewriting the FDE on each pass, possibly changing the FDE
size.  I think that is better done by completely recreating PLT
eh_frame FDEs.

* ehframe.cc (Fde::operator==): New.
(Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): New.
* ehframe.h (Fde::operator==): Declare.
(Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): Likewise.
* layout.cc (Layout::remove_eh_frame_for_plt): New.
* layout.h (Layout::remove_eh_frame_for_plt): Declare.
* powerpc.cc (Target_powerpc::do_relax): Remove old eh_frame FDEs.
(Stub_table::add_eh_frame): Delete eh_frame_added_ condition.
Don't add eh_frame for empty stub section.
(Stub_table::remove_eh_frame): New.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 1 Aug 2017 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoUpdate myself in MAINTAINERS
Richard Henderson [Mon, 31 Jul 2017 18:44:29 +0000 (11:44 -0700)]
Update myself in MAINTAINERS

7 years agoFix bb instructions with double-word condition on hppa.
John David Anglin [Mon, 31 Jul 2017 16:51:25 +0000 (12:51 -0400)]
Fix bb instructions with double-word condition on hppa.

7 years agoImprove handling of ADD and SUB relocations on the RISCV target.
Kuan-Lin Chen [Mon, 31 Jul 2017 14:33:48 +0000 (15:33 +0100)]
Improve handling of ADD and SUB relocations on the RISCV target.

* elfxx-riscv.c (riscv_elf_add_sub_reloc): New function.
* (howto_table) [R_RISCV_ADD8]: Use riscv_elf_add_sub_reloc.
[R_RISCV_ADD16]: Likewise.
[R_RISCV_ADD32]: Likewise.
[R_RISCV_ADD64]: Likewise.
[R_RISCV_SUB6]: Likewise.
[R_RISCV_SUB8]: Likewise.
[R_RISCV_SUB16]: Likewise.
[R_RISCV_SUB32]: Likewise.
[R_RISCV_SUB64]: Likewise.

7 years agoFix compile time error when using ansidecl.h with an old version of GCC.
Nick Clifton [Mon, 31 Jul 2017 14:08:32 +0000 (15:08 +0100)]
Fix compile time error when using ansidecl.h with an old version of GCC.

PR 21850
* ansidecl.h (OVERRIDE): Protect check of __cplusplus value with
#idef __cplusplus.

7 years agoUpdate ChangeLog (missed that in my previous commit)
Xavier Roirand [Mon, 31 Jul 2017 12:36:24 +0000 (14:36 +0200)]
Update ChangeLog (missed that in my previous commit)

gdb/
        * ChangeLog: Add previous commit entry

Change-Id: Ic4f07cca66126e73340f032f19a2d5029bf0d40a

7 years ago[GOLD] PowerPC --no-tls-optimize
Alan Modra [Mon, 31 Jul 2017 10:23:49 +0000 (19:53 +0930)]
[GOLD] PowerPC --no-tls-optimize

This adds a --no-tls-optimize option for people who want to keep
__tls_get_addr calls in an executable rather than optimizing such code
sequences to IE/LE.

Also tidy some formatting errors, rename a variable to better reflect
its use, and tweak two functions that create pairs of GOT entries to
first check whether the GOT entry already exists before potentially
inserting the header via reserve(2).  Without the check it is possible
to waste one GOT entry.

* options.h (no_tls_optimize): New powerpc option.
* powerpc.cc (Target_powerpc::abiversion, set_abiversion): Formatting.
(Target_powerpc::stk_toc): Formatting, fix comment.
(Target_powerpc::Track_tls::tls_get_addr_state): Rename from
tls_get_addr.
(Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
Return TLSOPT_NONE when !tls_optimize.
(Target_powerpc::add_global_pair_with_rel): Check
for existing reloc before reserving.
(Target_powerpc::add_local_tls_pair): Likewise.

7 years agoFix compiling zlib using x86_64-musl.
Marty Plummer [Mon, 31 Jul 2017 09:31:18 +0000 (10:31 +0100)]
Fix compiling zlib using x86_64-musl.

PR 21861
* winduni.c (codepages): Use cp1252 for codepage 0.

7 years agoFix documentation about rot agent expression bytecode
Simon Marchi [Mon, 31 Jul 2017 09:22:21 +0000 (11:22 +0200)]
Fix documentation about rot agent expression bytecode

The rot agent expression bytecode rotates the three items on the top of
the stack.  It is not clear which way the rotation is.  However, the
documentation currently shows this as the effect of the instructions:

   a b c => c b a

which doesn't make sense, since the value b doesn't move.  The two
valid possibilities I see are

  a b c => b c a
  a b c => c a b

depending on which way you rotate.

When looking at the gdbserver code, the top of the stack becomes the
third item, and the next-to-top item becomes the top.  So the second
form would be the right one, since in this notation the top of the stack
is the rightmost element:

  a b c => c a b

I adjusted the symbolic description and added a bit of text to make it
more obvious.

gdb/doc/ChangeLog:

* agentexpr.texi (rot): Fix symbolic description, improve
textual description.

7 years agodarwin: handle recent version of dyld
Xavier Roirand [Fri, 9 Jun 2017 09:36:36 +0000 (11:36 +0200)]
darwin: handle recent version of dyld

gdb/
        * solib-darwin.c (DYLD_VERSION_MAX): Increase value.

Change-Id: I45da25f46b3e452d44993b122a994c818d00020b

7 years agoPR 21847, PowerPC64 --plt-localentry again
Alan Modra [Mon, 31 Jul 2017 00:48:46 +0000 (10:18 +0930)]
PR 21847, PowerPC64 --plt-localentry again

This makes ld warn about --plt-localentry if a version of glibc
without the necessary ld.so checks is detected, and revises the
documentation.

bfd/
* elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
without ld.so checks.
gold/
* powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry
without ld.so checks.
ld/
* ld.texinfo (plt-localentry): Revise.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 31 Jul 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 30 Jul 2017 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoPR 21847, Don't default PowerPC64 to --plt-localentry
Alan Modra [Sat, 29 Jul 2017 03:03:35 +0000 (12:33 +0930)]
PR 21847, Don't default PowerPC64 to --plt-localentry

The big comment in ppc64_elf_tls_setup says why.  I've also added some
code to the bfd linker that catches the -lpthread -lc symbol
differences and disable generation of optimized call stubs even when
--plt-localentry is activated.  Gold doesn't yet have that.

PR 21847
bfd/
* elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry.
(ppc64_elf_merge_symbol): Set non_zero_localentry.
(is_elfv2_localentry0): Test non_zero_localentry.
(ppc64_elf_tls_setup): Default to --no-plt-localentry.
gold/
* powerpc.cc (Target_powerpc::scan_relocs): Default to
--no-plt-localentry.
ld/
* ld.texinfo (plt-localentry): Document.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 29 Jul 2017 00:01:03 +0000 (00:01 +0000)]
Automatic date update in version.in

7 years agogold: Add put_ch_reserved to 64-bit Chdr_write
H.J. Lu [Fri, 28 Jul 2017 20:39:42 +0000 (13:39 -0700)]
gold: Add put_ch_reserved to 64-bit Chdr_write

The 64-bit ELF compression header has a reserved field.  It should be
cleared to avoid random bits in it.

elfcpp/

PR gold/21857
* elfcpp.h (Chdr_write): Add put_ch_reserved.
(Chdr_write<64, true>::put_ch_reserved): New.
(Chdr_write<64, false>::put_ch_reserved): Likewise.

gold/

PR gold/21857
* compressed_output.cc (Output_compressed_section::set_final_data_size):
Call put_ch_reserved to clear the reserved field for 64-bit ELF.

7 years agoAdd missing changelog
Andreas Krebbel [Fri, 28 Jul 2017 16:34:34 +0000 (18:34 +0200)]
Add missing changelog

7 years agoS/390: Fix segfault when linking -shared -nostartfiles
Andreas Krebbel [Fri, 28 Jul 2017 15:59:25 +0000 (17:59 +0200)]
S/390: Fix segfault when linking -shared -nostartfiles

Regression-tested on s390x.

bfd/ChangeLog:

2017-07-28  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
pointer check for htab->elf.irelplt.
* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.

7 years agoMake some improvements to how SORT_* specifiers and EXCLUDE_FILE specifiers are handl...
Andrew Burgess [Fri, 28 Jul 2017 12:01:10 +0000 (13:01 +0100)]
Make some improvements to how SORT_* specifiers and EXCLUDE_FILE specifiers are handled in the linker script grammar.

* ldgram.y (ldgram_had_keep): Make static.
(ldgram_vers_current_lang): Likewise.
(filename_spec): New rule.
(input_section_spec_no_keep): Use filename_spec.
(wildcard_maybe_exclude): New rule.
(wildcard_spec): Rename to...
(section_name_spec): ...this.
(section_NAME_list): Rename to...
(section_name_list): ...this.
(section_name_spec): Simplifiy and use wildcard_maybe_exclude.
* ldlang.c (placed_commons): Delete.
(lang_add_wild): No longer set placed_commons.
(print_wild_statement): Use full names for SORT specifiers.
* testsuite/ld-scripts/align.exp: Run new tests.
* testsuite/ld-scripts/align3.d: New file.
* testsuite/ld-scripts/align3.t: New file.
* testsuite/ld-scripts/align4.d: New file.
* testsuite/ld-scripts/align4.t: New file.
* testsuite/ld-scripts/align5.d: New file.
* testsuite/ld-scripts/align5.t: New file.
* testsuite/ld-scripts/exclude-file-5.d: New file.
* testsuite/ld-scripts/exclude-file-5.map: New file.
* testsuite/ld-scripts/exclude-file-5.t: New file.
* testsuite/ld-scripts/exclude-file-6.d: New file.
* testsuite/ld-scripts/exclude-file-6.map: New file.
* testsuite/ld-scripts/exclude-file-6.t: New file.
* NEWS: Mention the changes.

7 years agoFix problems parsing RISCV architecture extenstions in the assembler.
Andrew Waterman [Fri, 28 Jul 2017 09:02:57 +0000 (10:02 +0100)]
Fix problems parsing RISCV architecture extenstions in the assembler.

* config/tc-riscv.c (riscv_set_arch): Handle the Q subset like
all other subsets.
Obviate use-after-free.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 28 Jul 2017 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAdd myself as a write-after-approval GDB maintainer.
Xavier Roirand [Thu, 27 Jul 2017 13:53:02 +0000 (15:53 +0200)]
Add myself as a write-after-approval GDB maintainer.

gdb/Changelog:

2017-07-27  Xavier Roirand  <roirand@adacore.com>

        * MAINTAINERS (Write After Approval): Add Xavier Roirand.

Change-Id: Iee1dae7597da8f2c8c3098c14649ff400a81a388

7 years agoMove AVR .promemx.* sections into higher memory.
Georg-Johann Lay [Thu, 27 Jul 2017 13:17:14 +0000 (14:17 +0100)]
Move AVR .promemx.* sections into higher memory.

PR ld/21849
* scripttempl/avr.sc: Split .progmemx.* from .progmem.* and locate
former at a higher address.

7 years agoFix address violation issues encountered when parsing corrupt binaries.
Nick Clifton [Thu, 27 Jul 2017 11:04:50 +0000 (12:04 +0100)]
Fix address violation issues encountered when parsing corrupt binaries.

PR 21840
* mach-o.c (bfd_mach_o_read_symtab_strtab): Fail if the symtab
size is -1.
* nlmcode.h (nlm_swap_auxiliary_headers_in): Replace assertion
with error return.
* section.c (bfd_make_section_with_flags): Fail if the name or bfd
are NULL.
* vms-alpha.c (bfd_make_section_with_flags): Correct computation
of end pointer.
(evax_bfd_print_emh): Check for invalid string lengths.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 27 Jul 2017 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoGold: Fix mips.cc for GCC 4.2
H.J. Lu [Wed, 26 Jul 2017 17:39:20 +0000 (10:39 -0700)]
Gold: Fix mips.cc for GCC 4.2

GCC 4.2 fails to compile "(uint64_t) 0x800080008000" with

error: integer constant is too large for â€˜long’ type

This patch adds "llu" suffix to 0x800080008000 for GCC 4.2.

* mips.cc (Mips_relocate_functions): Add "llu" suffix to
0x800080008000.

7 years agoAdd "maint check xml-descriptions" to test builtin xml target descriptions
Yao Qi [Wed, 26 Jul 2017 13:55:31 +0000 (14:55 +0100)]
Add "maint check xml-descriptions" to test builtin xml target descriptions

Now, GDB is able to dynamically create i386-linux target descriptions
from features, instead of using pre-generated target descriptions.  These
pre-generated target descriptions are no longer used by GDB (note that
they are still used by GDBserver).

This patch add a new maint command "maint check xml-descriptions" to test
dynamically generated tdesc are identical to these generated from xml files.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* cli/cli-cmds.c (maintenancechecklist): New variable.
* gdbcmd.h (maintenancechecklist): Declare it.
* i386-linux-tdep.c (_initialize_i386_linux_tdep) [GDB_SELF_TEST]:
Call i386_linux_read_description with different masks.
* maint.c (maintenance_check_command): New function.
(_initialize_maint_cmds): Call add_prefix_cmd.
* target-descriptions.c (tdesc_reg): override operator != and ==.
(tdesc_type): Likewise.
(tdesc_feature): Likewise.
(target_desc): Likewise.
[GDB_SELF_TEST] (selftests::record_xml_tdesc): New function.
(maintenance_check_xml_descriptions): New function.
(_initialize_target_descriptions) Add command "xml-descriptions".
* target-descriptions.h (selftests::record_xml_tdesc): Declare.

gdb/testsuite:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* gdb.gdb/unittest.exp: Invoke command
"maintenance check xml-descriptions".

gdb/doc:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* gdb.texinfo (Maintenance Commands): Document command
"maint check xml-descriptions".

7 years agoLazily and dynamically create i386-linux target descriptions
Yao Qi [Wed, 26 Jul 2017 13:39:54 +0000 (14:39 +0100)]
Lazily and dynamically create i386-linux target descriptions

Instead of using pre-generated target descriptions, this patch
changes GDB to lazily and dynamically create target descriptions
according to the target hardware capability (xcr0 in i386).
This support any combination of target features.

Some reg in target description has "regnum" attribute, so its register
number is got from the attribute value instead from sequential allocation.

  <reg name="xmm0" bitsize="128" type="vec128" regnum="32"/>

when target description is created, it should match the regnum, so this
patch adds a new field m_next_regnum to track it, if attribute number is
greater than the m_next_regnum, print the code to set register number
explicitly.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* i386-linux-tdep.c: Don't include features/i386/i386-*linux.c.
Include features/i386/32bit-*.c.
(i386_linux_read_description): Generate target description if it
doesn't exist.
(_initialize_i386_linux_tdep): Don't call _initialize_tdesc_i386
functions.
* features/i386/32bit-linux.c: Re-generated.
* features/i386/32bit-sse.c: Likewise.
* target-descriptions.c (print_c_feature::visit): Print code to
set register number if needed.
(print_c_feature) <m_next_regnum>: New field.

7 years agoGenerate c for feature instead of tdesc
Yao Qi [Wed, 26 Jul 2017 13:24:08 +0000 (14:24 +0100)]
Generate c for feature instead of tdesc

This patch changes Makefile and command "maint print c-files" so
that GDB can print c files for features instead target description.
Previously, we feed GDB a target description xml file, which generate
c files including multiple features.

With this patch, in Makefile, we wrap each feature xml file, and
create a temp target description which include only one feature.
Then, adjust the target description printer for them, and print
a c function for each given feature, so that we can use these
c functions later to create target description in a flexible way.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* features/Makefile (CFILES): Rename with TDESC_CFILES.
(FEATURE_XMLFILES): New.
(FEATURE_CFILES): New.
New rules.
(clean-cfiles): Remove generated c files.
* features/i386/32bit-avx.c: Generated.
  * features/i386/32bit-avx512.c: Generated.
  * features/i386/32bit-core.c: Generated.
  * features/i386/32bit-linux.c: Generated.
  * features/i386/32bit-mpx.c: Generated.
  * features/i386/32bit-pkeys.c: Generated.
  * features/i386/32bit-sse.c: Generated.
  * target-descriptions.c: Include algorithm.
(tdesc_element_visitor): Add method visit_end.
(print_c_tdesc): Implement visit_end.
(print_c_tdesc:: m_filename_after_features): Move it to
protected.
(print_c_feature): New class.
(maint_print_c_tdesc_cmd): Use print_c_feature if XML file
name starts with "i386/32bit-".

7 years agoUse visitor pattern for "maint print c-tdesc"
Yao Qi [Wed, 26 Jul 2017 11:56:54 +0000 (12:56 +0100)]
Use visitor pattern for "maint print c-tdesc"

Target description can be modeled as a tree, the target description
is the root node, features are children nodes, registers and types are
grand-children nodes.  So command "maint print c-tdesc" in effect
traverse/visit each node, and print them in c.  This can be
implemented by visitor pattern, this is the first reason.  Secondly,
I want to this command prints c files in a different way for some
specific xml files, but still print c files the same way for the rest
of xml files.  Third, I even want to print xml files from target
descriptions, so that GDBserver can use it to reply GDB's query
qXfer:features:read:target.xml.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* target-descriptions.c (tdesc_element_visitor): New class.
(tdesc_element): New class.
(tdesc_reg): Inherit from tdesc_element.
(tdesc_reg::accept): New function.
(tdesc_type): Inherit from tdesc_element.
(tdesc_type::accept): New function.
(tdesc_feature): Inherit from tdesc_element.
(tdesc_feature::accept): New function.
(target_desc): Inherit from tdesc_element.
(target_desc::target_desc): New.
(target_desc::~target_desc): New.
(target_desc::accept): New.
(allocate_target_description): Use new.
(free_target_description): Use delete.
(print_c_tdesc): New class.
(maint_print_c_tdesc_cmd): Adjust.

* features/aarch64.c: Re-generated.
* features/arc-arcompact.c: Re-generated.
* features/arc-v2.c: Re-generated.
* features/arm/arm-with-iwmmxt.c: Re-generated.
* features/arm/arm-with-m.c: Re-generated.
* features/arm/arm-with-m-fpa-layout.c: Re-generated.
* features/arm/arm-with-m-vfp-d16.c: Re-generated.
* features/arm/arm-with-neon.c: Re-generated.
* features/arm/arm-with-vfpv2.c: Re-generated.
* features/arm/arm-with-vfpv3.c: Re-generated.
* features/i386/amd64-avx-avx512.c: Re-generated.
* features/i386/amd64-avx-avx512-linux.c: Re-generated.
* features/i386/amd64-avx.c: Re-generated.
* features/i386/amd64-avx-linux.c: Re-generated.
* features/i386/amd64-avx-mpx-avx512-pku.c: Re-generated.
* features/i386/amd64-avx-mpx-avx512-pku-linux.c: Re-generated.
* features/i386/amd64-avx-mpx.c: Re-generated.
* features/i386/amd64-avx-mpx-linux.c: Re-generated.
* features/i386/amd64.c: Re-generated.
* features/i386/amd64-linux.c: Re-generated.
* features/i386/amd64-mpx.c: Re-generated.
* features/i386/amd64-mpx-linux.c: Re-generated.
* features/i386/i386-avx-avx512.c: Re-generated.
* features/i386/i386-avx-avx512-linux.c: Re-generated.
* features/i386/i386-avx.c: Re-generated.
* features/i386/i386-avx-linux.c: Re-generated.
* features/i386/i386-avx-mpx-avx512-pku.c: Re-generated.
* features/i386/i386-avx-mpx-avx512-pku-linux.c: Re-generated.
* features/i386/i386-avx-mpx.c: Re-generated.
* features/i386/i386-avx-mpx-linux.c: Re-generated.
* features/i386/i386.c: Re-generated.
* features/i386/i386-linux.c: Re-generated.
* features/i386/i386-mmx.c: Re-generated.
* features/i386/i386-mmx-linux.c: Re-generated.
* features/i386/i386-mpx.c: Re-generated.
* features/i386/i386-mpx-linux.c: Re-generated.
* features/i386/x32-avx-avx512.c: Re-generated.
* features/i386/x32-avx-avx512-linux.c: Re-generated.
* features/i386/x32-avx.c: Re-generated.
* features/i386/x32-avx-linux.c: Re-generated.
* features/i386/x32.c: Re-generated.
* features/i386/x32-linux.c: Re-generated.
* features/microblaze.c: Re-generated.
* features/microblaze-with-stack-protect.c: Re-generated.
* features/mips64-dsp-linux.c: Re-generated.
* features/mips64-linux.c: Re-generated.
* features/mips-dsp-linux.c: Re-generated.
* features/mips-linux.c: Re-generated.
* features/nds32.c: Re-generated.
* features/nios2.c: Re-generated.
* features/nios2-linux.c: Re-generated.
* features/rs6000/powerpc-32.c: Re-generated.
* features/rs6000/powerpc-32l.c: Re-generated.
* features/rs6000/powerpc-403.c: Re-generated.
* features/rs6000/powerpc-403gc.c : Re-generated.
* features/rs6000/powerpc-405.c: Re-generated.
* features/rs6000/powerpc-505.c: Re-generated.
* features/rs6000/powerpc-601.c: Re-generated.
* features/rs6000/powerpc-602.c: Re-generated.
* features/rs6000/powerpc-603.c: Re-generated.
* features/rs6000/powerpc-604.c: Re-generated.
* features/rs6000/powerpc-64.c: Re-generated.
* features/rs6000/powerpc-64l.c: Re-generated.
* features/rs6000/powerpc-7400.c: Re-generated.
* features/rs6000/powerpc-750.c: Re-generated.
* features/rs6000/powerpc-860.c: Re-generated.
* features/rs6000/powerpc-altivec32.c: Re-generated.
* features/rs6000/powerpc-altivec32l.c: Re-generated.
* features/rs6000/powerpc-altivec64.c: Re-generated.
* features/rs6000/powerpc-altivec64l.c: Re-generated.
* features/rs6000/powerpc-cell32l.c: Re-generated.
* features/rs6000/powerpc-cell64l.c: Re-generated.
* features/rs6000/powerpc-e500.c: Re-generated.
* features/rs6000/powerpc-e500l.c: Re-generated.
* features/rs6000/powerpc-isa205-32l.c: Re-generated.
* features/rs6000/powerpc-isa205-64l.c: Re-generated.
* features/rs6000/powerpc-isa205-altivec32l.c: Re-generated.
* features/rs6000/powerpc-isa205-altivec64l.c: Re-generated.
* features/rs6000/powerpc-isa205-vsx32l.c: Re-generated.
* features/rs6000/powerpc-isa205-vsx64l.c: Re-generated.
* features/rs6000/powerpc-vsx32.c: Re-generated.
* features/rs6000/powerpc-vsx32l.c: Re-generated.
* features/rs6000/powerpc-vsx64.c: Re-generated.
* features/rs6000/powerpc-vsx64l.c: Re-generated.
* features/rs6000/rs6000.c: Re-generated.
* features/s390-linux32.c: Re-generated.
* features/s390-linux32v1.c: Re-generated.
* features/s390-linux32v2.c: Re-generated.
* features/s390-linux64.c: Re-generated.
* features/s390-linux64v1.c: Re-generated.
* features/s390-linux64v2.c: Re-generated.
* features/s390-te-linux64.c: Re-generated.
* features/s390-tevx-linux64.c: Re-generated.
* features/s390-vx-linux64.c: Re-generated.
* features/s390x-linux64.c: Re-generated.
* features/s390x-linux64v1.c: Re-generated.
* features/s390x-linux64v2.c: Re-generated.
* features/s390x-te-linux64.c: Re-generated.
* features/s390x-tevx-linux64.c: Re-generated.
* features/s390x-vx-linux64.c: Re-generated.
* features/sparc/sparc32-solaris.c: Re-generated.
* features/sparc/sparc64-solaris.c: Re-generated.
* features/tic6x-c62x.c: Re-generated.
* features/tic6x-c62x-linux.c: Re-generated.
* features/tic6x-c64x.c: Re-generated.
* features/tic6x-c64x-linux.c: Re-generated.
* features/tic6x-c64xp.c: Re-generated.
* features/tic6x-c64xp-linux.c: Re-generated.

7 years agoCentralize i386 linux target descriptions
Yao Qi [Wed, 26 Jul 2017 11:36:42 +0000 (12:36 +0100)]
Centralize i386 linux target descriptions

This patch moves all the tdesc_i386*_linux target descriptions to a
function i386_linux_read_description, which returns the right target
description according to xcr0.  This also remove the duplication in
getting target descriptions in corefile and native target.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* i386-linux-tdep.c (i386_linux_read_description): New function.
(i386_linux_core_read_description): Call
i386_linux_read_description.
* i386-linux-tdep.h (i386_linux_read_description): Declare.
(tdesc_i386_linux, tdesc_i386_mmx_linux): Remove declarations.
(tdesc_i386_avx_linux, tdesc_i386_mpx_linux): Likewise
(tdesc_i386_avx_mpx_linux, tdesc_i386_avx_avx512_linux): Likewise.
(tdesc_i386_avx_mpx_avx512_pku_linux): Likewise.
* x86-linux-nat.c (x86_linux_read_description): Call
i386_linux_read_description.

7 years agoAdd optional argument to command "maint prints c-tdesc"
Yao Qi [Wed, 26 Jul 2017 11:03:47 +0000 (12:03 +0100)]
Add optional argument to command "maint prints c-tdesc"

Nowadays, we need two steps to print c files for xml target description,
that is, 1) read xml target description in, update the current tdesc,
2) visit the current tdesc, print the c file.  It is unnecessary to
involve in current tdesc, and some validations in each gdbarch are
performed unnecessarily, which will reject some target descriptions if
they are missing some mandatory feature.

This patch adds an optional argument to "maint print c-tdesc", which
is an XML file target description, so that we can combine the two
steps above into one step, and don't have to involve in global current
tdesc.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* NEWS: Mention it.
* features/Makefile (%.c: %.xml): Pass the xml file name to
command "maint print c-tdesc".
* target-descriptions.c (maint_print_c_tdesc_cmd): Get file
name from 'arg'.

gdb/doc:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* gdb.texinfo (Maintenance Commands): Document optional
argument of "maint print c-tdesc".

7 years agoClass-fy target_desc
Yao Qi [Wed, 26 Jul 2017 09:37:17 +0000 (10:37 +0100)]
Class-fy target_desc

This patch adds ctor and dtor in target_desc.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* target-descriptions.c (target_desc): Add ctor and dtor.  Do
in-class initialization.
(tdesc_create_feature): Call new instead of XCNEW.
(free_target_description): Ue delete.

7 years agoAdd enum for result of fast_tracepoint_collecting
Simon Marchi [Wed, 26 Jul 2017 08:55:35 +0000 (10:55 +0200)]
Add enum for result of fast_tracepoint_collecting

I got confused by the result value of fast_tracepoint_collecting, while
it sounds like it would return true/false (whether the thread is
collecting or not), it actually returns:

  0: not collecting
  1: in the jump pad, before the relocated instruction
  2: in the jump pad, at or after the relocated instruction

To avoid confusion, I think it would be nice to make it return an enum.
If you can help find a shorter but still relavant name, it would be
awesome.  Otherwise, we'll go with that, fast_tpoint_collect_result,
which is at least consistent with the existing
fast_tpoint_collect_status.

gdb/gdbserver/ChangeLog:

* tracepoint.h (enum class fast_tpoint_collect_result): New
enumeration.
(fast_tracepoint_collecting): Change return type to
fast_tpoint_collect_result.
* tracepoint.c (fast_tracepoint_collecting): Likewise.
* linux-low.h: Include tracepoint.h.
(struct lwp_info) <collecting_fast_tracepoint>: Change type to
fast_tpoint_collect_result.
* linux-low.c (handle_tracepoints): Adjust.
(linux_fast_tracepoint_collecting): Change return type to
fast_tpoint_collect_result.
(maybe_move_out_of_jump_pad, linux_wait_for_event_filtered,
linux_wait_1, stuck_in_jump_pad_callback,
lwp_signal_can_be_delivered, linux_resume_one_lwp_throw,
proceed_one_lwp): Adjust to type change.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Jul 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix two NetBSD-specific typos in the configure.nat conversion.
John Baldwin [Sat, 15 Jul 2017 15:30:40 +0000 (08:30 -0700)]
Fix two NetBSD-specific typos in the configure.nat conversion.

- Add the '-lkvm' library requirement for NetBSD/sparc64.
- Fix spelling of 'nbsdelf' host.

gdb/Changelog:

* configure.nat: Add "-lkvm" for NetBSD/sparc64 and fix typo.

7 years agoMake amd64_x32_init_abi and amd64_init_abi argument constant
Yao Qi [Tue, 25 Jul 2017 14:25:38 +0000 (15:25 +0100)]
Make amd64_x32_init_abi and amd64_init_abi argument constant

gdb:

2017-07-25  Yao Qi  <yao.qi@linaro.org>

* amd64-tdep.c (amd64_init_abi): Make argument default_tdesc
constant.
(amd64_x32_init_abi): Likewise.
* amd64-tdep.h (amd64_init_abi): Update declaration.
(amd64_x32_init_abi): Likewise.

7 years agoFix thinko in previous change to elf32-msp430.c
Nick Clifton [Tue, 25 Jul 2017 11:47:46 +0000 (12:47 +0100)]
Fix thinko in previous change to elf32-msp430.c

7 years agoFix typos in error and option messages in OPCODES library.
Nick Clifton [Tue, 25 Jul 2017 11:12:16 +0000 (12:12 +0100)]
Fix typos in error and option messages in OPCODES library.

PR 21739
opcodes * arc-opc.c (insert_rhv2): Use lower case first letter in error
message.
(insert_r0): Likewise.
(insert_r1): Likewise.
(insert_r2): Likewise.
(insert_r3): Likewise.
(insert_sp): Likewise.
(insert_gp): Likewise.
(insert_pcl): Likewise.
(insert_blink): Likewise.
(insert_ilink1): Likewise.
(insert_ilink2): Likewise.
(insert_ras): Likewise.
(insert_rbs): Likewise.
(insert_rcs): Likewise.
(insert_simm3s): Likewise.
(insert_rrange): Likewise.
(insert_r13el): Likewise.
(insert_fpel): Likewise.
(insert_blinkel): Likewise.
(insert_pclel): Likewise.
(insert_nps_bitop_size_2b): Likewise.
(insert_nps_imm_offset): Likewise.
(insert_nps_imm_entry): Likewise.
(insert_nps_size_16bit): Likewise.
(insert_nps_##NAME##_pos): Likewise.
(insert_nps_##NAME): Likewise.
(insert_nps_bitop_ins_ext): Likewise.
(insert_nps_##NAME): Likewise.
(insert_nps_min_hofs): Likewise.
(insert_nps_##NAME): Likewise.
(insert_nps_rbdouble_64): Likewise.
(insert_nps_misc_imm_offset): Likewise.
* riscv-dis.c (print_riscv_disassembler_options): Fix typo in
option description.

gas * testsuite/gas/arc/add_s-err.s: Update expected error message.

7 years agoCatch exceptions thrown from gdbarch_skip_prologue
Yao Qi [Tue, 25 Jul 2017 10:38:50 +0000 (11:38 +0100)]
Catch exceptions thrown from gdbarch_skip_prologue

PR 21555 is caused by the exception during the prologue analysis when re-set
a breakpoint.

(gdb) bt
 #0  memory_error_message (err=TARGET_XFER_E_IO, gdbarch=0x153db50, memaddr=93824992233232) at ../../binutils-gdb/gdb/corefile.c:192
 #1  0x00000000005718ed in memory_error (err=TARGET_XFER_E_IO, memaddr=memaddr@entry=93824992233232) at ../../binutils-gdb/gdb/corefile.c:220
 #2  0x00000000005719d6 in read_memory_object (object=object@entry=TARGET_OBJECT_CODE_MEMORY, memaddr=93824992233232, memaddr@entry=1, myaddr=myaddr@entry=0x7fffffffd0a0 "P\333S\001", len=len@entry=1) at ../../binutils-gdb/gdb/corefile.c:259
 #3  0x0000000000571c6e in read_code (len=1, myaddr=0x7fffffffd0a0 "P\333S\001", memaddr=<optimized out>) at ../../binutils-gdb/gdb/corefile.c:287
 #4  read_code_unsigned_integer (memaddr=memaddr@entry=93824992233232, len=len@entry=1, byte_order=byte_order@entry=BFD_ENDIAN_LITTLE)                          at ../../binutils-gdb/gdb/corefile.c:362
 #5  0x000000000041d4a0 in amd64_analyze_prologue (gdbarch=gdbarch@entry=0x153db50, pc=pc@entry=93824992233232, current_pc=current_pc@entry=18446744073709551615, cache=cache@entry=0x7fffffffd1e0) at ../../binutils-gdb/gdb/amd64-tdep.c:2310
 #6  0x000000000041e404 in amd64_skip_prologue (gdbarch=0x153db50, start_pc=93824992233232) at ../../binutils-gdb/gdb/amd64-tdep.c:2459
 #7  0x000000000067bfb0 in skip_prologue_sal (sal=sal@entry=0x7fffffffd4e0) at ../../binutils-gdb/gdb/symtab.c:3628
 #8  0x000000000067c4d8 in find_function_start_sal (sym=sym@entry=0x1549960, funfirstline=1) at ../../binutils-gdb/gdb/symtab.c:3501
 #9  0x000000000060999d in symbol_to_sal (result=result@entry=0x7fffffffd5f0, funfirstline=<optimized out>, sym=sym@entry=0x1549960) at ../../binutils-gdb/gdb/linespec.c:3860
....
 #16 0x000000000054b733 in location_to_sals (b=b@entry=0x15792d0, location=0x157c230, search_pspace=search_pspace@entry=0x1148120, found=found@entry=0x7fffffffdc64) at ../../binutils-gdb/gdb/breakpoint.c:14211
 #17 0x000000000054c1f5 in breakpoint_re_set_default (b=0x15792d0) at ../../binutils-gdb/gdb/breakpoint.c:14301
 #18 0x00000000005412a9 in breakpoint_re_set_one (bint=bint@entry=0x15792d0) at ../../binutils-gdb/gdb/breakpoint.c:14412

This problem can be fixed by

 - either each prologue analyzer doesn't throw exception,
 - or catch the exception thrown from gdbarch_skip_prologue,

I choose the latter because the former needs to fix *every* prologue
analyzer to not throw exception.

This error can be reproduced by changing reread.exp.  The test reread.exp
has already test that breakpoint can be reset correctly after the
executable is re-read.  This patch extends this test by compiling test c
file with and without -fPIE.

(gdb) run ^M
The program being debugged has been started already.^M
Start it from the beginning? (y or n) y^M
x86_64/gdb/testsuite/outputs/gdb.base/reread/reread' has changed; re-reading symbols.
Error in re-setting breakpoint 1: Cannot access memory at address 0x555555554790^M
Error in re-setting breakpoint 2: Cannot access memory at address 0x555555554790^M
Starting program: /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.base/reread/reread ^M
This is foo^M
[Inferior 1 (process 27720) exited normally]^M
(gdb) FAIL: gdb.base/reread.exp: opts= "-fPIE" "ldflags=-pie" : run to foo() second time (the program exited)

This patch doesn't re-indent the code, to keep the patch simple.

gdb:

2017-07-25  Yao Qi  <yao.qi@linaro.org>

PR gdb/21555
* arch-utils.c (gdbarch_skip_prologue_noexcept): New function.
* arch-utils.h (gdbarch_skip_prologue_noexcept): Declare.
* infrun.c: Include arch-utils.h
(handle_step_into_function): Call gdbarch_skip_prologue_noexcept.
(handle_step_into_function_backward): Likewise.
* symtab.c (skip_prologue_sal): Likewise.

gdb/testsuite:

2017-07-25  Yao Qi  <yao.qi@linaro.org>

PR gdb/21555
* gdb.base/reread.exp: Wrap the whole test with two kinds of
compilation flags, with -fPIE and without -fPIE.

7 years ago[ARM] Access FPSCR on vfpv2
Yao Qi [Fri, 21 Jul 2017 15:35:23 +0000 (16:35 +0100)]
[ARM] Access FPSCR on vfpv2

GDB can fetch or store FPSCR on vfpv3, which has 32 VFP registers, but
fail to do so on vfpv2, which has 16 VFP registers.  GDB code is incorrect
for vfpv2,

       else if (tdep->vfp_register_count > 0
         && regno >= ARM_D0_REGNUM
       && regno <= ARM_D0_REGNUM + tdep->vfp_register_count)

while FPSCR register number is defined as ARM_D0_REGNUM + 32.

  ARM_D0_REGNUM, /* VFP double-precision registers.  */
  ARM_D31_REGNUM = ARM_D0_REGNUM + 31,
  ARM_FPSCR_REGNUM,

The code above uses "<=" rather than "<", in order to put FPSCR in the
range, but it is only correct when tdep->vfp_register_count is 32.  On
vpfv2, it is 16, and FPSCR is out of the range, so fetch_vfp_regs or
store_vfp_regs are not called.

gdb:

2017-07-25  Yao Qi  <yao.qi@linaro.org>

PR tdep/21717
* arm-linux-nat.c (arm_linux_fetch_inferior_registers): Update
condition for FPSCR.
(arm_linux_store_inferior_registers): Likewise.

7 years agoUpdated French translation for the BFD library.
Nick Clifton [Tue, 25 Jul 2017 08:46:14 +0000 (09:46 +0100)]
Updated French translation for the BFD library.

7 years agoAdd a linker branch optimization for the MSP430.
Benjamin Green [Tue, 25 Jul 2017 08:41:23 +0000 (09:41 +0100)]
Add a linker branch optimization for the MSP430.

PR 21824
* elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
16-bit absolute branches into 10-bit pc-relative branches on the
MSP430 as well as the MSP430X.

7 years agooops - add changelog entry accidentally omitted from previous delta.
Nick Clifton [Tue, 25 Jul 2017 08:39:13 +0000 (09:39 +0100)]
oops - add changelog entry accidentally omitted from previous delta.

7 years agoStop readelf from returning an error status if asked to dump an emoty section.
Nick Clifton [Tue, 25 Jul 2017 08:35:36 +0000 (09:35 +0100)]
Stop readelf from returning an error status if asked to dump an emoty section.

PR 21820
* readelf.c (dump_section_as_strings): Do not fail if the section
was empty.
(dump_section_as_bytes): Likewise.

7 years ago__tls_get_addr_opt stub eh_frame info
Alan Modra [Tue, 25 Jul 2017 04:22:32 +0000 (13:52 +0930)]
__tls_get_addr_opt stub eh_frame info

Since the __tls_get_addr_opt stub saves LR and makes a call, eh_frame
info should be generated to describe how to unwind through the stub.

The patch also changes the way the backend iterates over stubs, from
looking at all sections in stub_bfd to which all dynamic sections are
attached as well, to iterating over the group list, which gets just
the stub sections.  Most binaries will have just one or two stub
groups, so this is a little faster.

bfd/
* elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
(stub_eh_frame_size): New function.
(ppc_size_one_stub): Set group tls_get_addr_opt_bctrl.
(group_sections): Init group tls_get_addr_opt_bctrl.
(ppc64_elf_size_stubs): Update sizing and initialization of
.eh_frame.  Iteration over stubs via group list.
(ppc64_elf_build_stubs): Iterate over stubs via group list.
(ppc64_elf_finish_dynamic_sections): Update finalization of
.eh_frame.
ld/
* testsuite/ld-powerpc/tlsopt5.s: Add cfi.
* testsuite/ld-powerpc/tlsopt5.d: Update.
* testsuite/ld-powerpc/tlsopt5.wf: New file.
* testsuite/ld-powerpc/powerpc.exp: Perform new tlsopt5 test.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Jul 2017 00:01:08 +0000 (00:01 +0000)]
Automatic date update in version.in

7 years agos390-vregs.exp: Fix Tcl error after non-zero-pad patch
Andreas Arnez [Mon, 24 Jul 2017 16:35:30 +0000 (18:35 +0200)]
s390-vregs.exp: Fix Tcl error after non-zero-pad patch

s390-vregs.exp yields a Tcl error:

  ERROR: can't read "i": no such variable
      while executing
  "expr $a_high * ($i + 1) * $a_high "
      (procedure "hex128" line 2)
      invoked from within
  "hex128 $a_high $a_low $b_high $b_low"
  ...

This is a regression, caused by commit 30a254669b16b8 -- "Don't always
zero pad in print_*_chars".  That patch introduced a new procedure
"hex128" for formatting a 128-bit value as hex, but it accidentally moved
the calculation of the 128-bit value into that new procedure as well
instead of leaving it in the original context.  This is fixed.

gdb/testsuite/ChangeLog:

* gdb.arch/s390-vregs.exp: Calculate parameters to hex128 in the
calling context.
(hex128): Drop erroneous calculation of parameters.

7 years ago[AArch64] Fix the bit pattern order in the comments in auto-generated file
Jiong Wang [Mon, 24 Jul 2017 10:26:58 +0000 (11:26 +0100)]
[AArch64] Fix the bit pattern order in the comments in auto-generated file

The bit pattern comment in "aarch64_opcode_lookup_1" is reversed.

This patch fixed this.

opcode/
* aarch64-gen.c (print_decision_tree_1): Reverse the index of PATTERN to
correct the print.
* aarch64-dis-2.c: Regenerated.

7 years agoFix another memory access error triggered by attempting to parse a corrupt binary.
Nick Clifton [Mon, 24 Jul 2017 13:04:04 +0000 (14:04 +0100)]
Fix another memory access error triggered by attempting to parse a corrupt binary.

PR 21813
(alpha_vms_object_p): Check for a truncated record.

7 years agoFix address violation errors parsing corrupt binary files.
Nick Clifton [Mon, 24 Jul 2017 12:49:22 +0000 (13:49 +0100)]
Fix address violation errors parsing corrupt binary files.

PR 21813
binutils* rddbg.c (read_symbol_stabs_debugging_info): Check for an empty
string whilst concatenating symbol names.

bfd * mach-o.c (bfd_mach_o_canonicalize_relocs): Pass the base address
of the relocs to the canonicalize_one_reloc routine.
* mach-o.h (struct bfd_mach_o_backend_data): Update the prototype
for the _bfd_mach_o_canonicalize_one_reloc field.
* mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add
res_base parameter.  Use to check for corrupt pair relocs.
* mach-o-aarch64.c (bfd_mach_o_arm64_canonicalize_one_reloc):
Likewise.
* mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc):
Likewise.
* mach-o-x86-64.c (bfd_mach_o_x86_64_canonicalize_one_reloc):
Likewise.

* vms-alpha.c (_bfd_vms_slurp_eihd): Make sure that there is
enough data in the record before attempting to parse it.
(_bfd_vms_slurp_eeom): Likewise.

(_bfd_vms_slurp_egsd): Check for an invalid section index.
(image_set_ptr): Likewise.
(alpha_vms_slurp_relocs): Likewise.

7 years agoStop the generation of mapping symbols in the debug sections of ARM and AArch64 binaries.
Nick Clifton [Mon, 24 Jul 2017 10:32:57 +0000 (11:32 +0100)]
Stop the generation of mapping symbols in the debug sections of ARM and AArch64 binaries.

PR 21809
* config/tc-aarch64.c (aarch64_init_frag): Do not set a mapping
state for frags in debug sections.
* config/tc-arm.c (arm_init_frag): Likewise.

7 years agoImprove "unrecognized relocation" error messages to add the suggestion that the linke...
Nick Clifton [Mon, 24 Jul 2017 10:27:33 +0000 (11:27 +0100)]
Improve "unrecognized relocation" error messages to add the suggestion that the linker might be out of date.

PR 21803
* reloc.c (_bfd_unrecognized_reloc): New function.  Reports
an unrecognized reloc and sets the bfd_error value.
* libbfd.h: Regenerate.
* elf32-arm.c (elf32_arm_final_link_relocate): Use the new
function.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.

7 years ago[ARC] Fix big-endian ld tests errors.
claziss [Mon, 24 Jul 2017 08:10:21 +0000 (10:10 +0200)]
[ARC] Fix big-endian ld tests errors.

A set of small patches that are fixing big-endian observed errors.

ld/
2017-07-24  Claudiu Zissulescu  <claziss@synopsys.com>

* testsuite/ld-arc/jli-overflow.d: Force testing for little
endian.
* testsuite/ld-arc/tls_gd-01.d: Fix string to match bigendian
systems.
* testsuite/ld-arc/tls_ie-01.d: Fix test for bigendian systems.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Jul 2017 00:00:58 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years ago* dwarf2dbg.c (dwarf2dbg_final_check): Rename local variable exp from expr.
Hans-Peter Nilsson [Sun, 23 Jul 2017 22:53:34 +0000 (00:53 +0200)]
* dwarf2dbg.c (dwarf2dbg_final_check): Rename local variable exp from expr.

Trying to build (for mmix-knuth-mmixware but I don't think that
matters) yields the following (repeatable on e.g. CompileFarm gcc20
sporting gcc-4.7.2 as default):

gcc -DHAVE_CONFIG_H -I. -I/home/hp/binutils/src/gas  -I. -I/home/hp/binutils/src/gas -I../bfd -I/home/hp/binutils/src/gas/config -I/home/hp/binutils/src/gas/../include -I/home/hp/binutils/src/gas/.. -I/home/hp/binutils/src/gas/../bfd -DLOCALEDIR="\"/usr/local/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -Wwrite-strings -I/home/hp/binutils/src/gas/../zlib -g -O2 -MT dwarf2dbg.o -MD -MP -MF .deps/dwarf2dbg.Tpo -c -o dwarf2dbg.o /home/hp/binutils/src/gas/dwarf2dbg.c
cc1: warnings being treated as errors
/home/hp/binutils/src/gas/dwarf2dbg.c: In function 'dwarf2dbg_final_check':
/home/hp/binutils/src/gas/dwarf2dbg.c:2246: error: declaration of 'expr' shadows a global declaration
/home/hp/binutils/src/gas/expr.h:180: error: shadowed declaration is here
make[4]: *** [dwarf2dbg.o] Error 1

IIRC this is a false namespace clash and the warning is not observable
with a new-enough gcc.  Committed as obvious.

brgds, H-P
PS. Idea: -Wcompiler; warn about constructs problematic with e.g. old gcc. 1/2 ;-)

7 years agoCorrect eh_frame info for __glink_PLTresolve
Alan Modra [Sun, 23 Jul 2017 10:33:40 +0000 (20:03 +0930)]
Correct eh_frame info for __glink_PLTresolve

My PPC64_OPT_LOCALENTRY patch of June 1, git commit f378ab099d, and
the later gold change, git commit 7ee7ff7015, added an insn in
__glink_PLTresolve which needs a corresponding adjustment in the
eh_frame info for asynchronous exceptions to unwind correctly.

It would have been OK for both ABIs to use +5 for the advance before
restore of LR, since we can put the DW_CFA_restore_extended on any
insn after the actual restore and before the r12/r0 copy is clobbered,
but it's slightly better to delay as much as possible.  There are
then more addresses where fewer CFA program insns are executed.

bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Correct advance to
restore of LR.
gold/
* powerpc.cc (glink_eh_frame_fde_64v2): Correct advance to
restore of LR.
(glink_eh_frame_fde_64v1): Advance to restore of LR at latest
possible insn.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Jul 2017 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoUse std::vector in struct catch_syscall_inferior_data
Tom Tromey [Wed, 19 Jul 2017 00:23:32 +0000 (18:23 -0600)]
Use std::vector in struct catch_syscall_inferior_data

This changes struct catch_syscall_inferior_data to use a std::vector
rather than a VEC.  It also changes it to be allocated with new and
destroyed with delete.

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

* break-catch-syscall.c (struct catch_syscall_inferior_data)
<syscalls_counts>: Now a std::vector.
(get_catch_syscall_inferior_data): Use "new".
(catch_syscall_inferior_data_cleanup): Use "delete".
(insert_catch_syscall, remove_catch_syscall)
(clear_syscall_counts): Update.

7 years agoUse std::vector in syscall_catchpoint
Tom Tromey [Mon, 17 Jul 2017 22:58:22 +0000 (16:58 -0600)]
Use std::vector in syscall_catchpoint

This changes syscall_catchpoint to use a std::vector rather than a VEC
for "syscalls_to_be_caught".  This simplifies the code a bit.

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

* break-catch-syscall.c (syscall_catchpoint)
<syscalls_to_be_caught>: Now a std::vector<int>
(~syscall_catchpoint): Remove.
(insert_catch_syscall, remove_catch_syscall)
(breakpoint_hit_catch_syscall, print_one_catch_syscall)
(print_mention_catch_syscall, print_recreate_catch_syscall):
Update.
(create_syscall_event_catchpoint): Change type of "filter"
parameter.
(catch_syscall_split_args): Return a std::vector.
(catch_syscall_command_1, catching_syscall_number_1): Update.

7 years agoC++-ify break-catch-throw
Tom Tromey [Sat, 3 Jun 2017 14:06:36 +0000 (08:06 -0600)]
C++-ify break-catch-throw

This changes exception_catchpoint's "exception_rx' member to be a
std::string, and updating the users.

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

* break-catch-throw.c (struct exception_catchpoint)
<exception_rx>: Now a std::string.
(~exception_catchpoint): Remove.
(print_one_detail_exception_catchpoint): Update.
(handle_gnu_v3_exceptions): Change type of except_rx.
(extract_exception_regexp): Return a std::string.
(catch_exception_command_1): Update.

7 years agoC++-ify break-catch-sig
Tom Tromey [Sat, 3 Jun 2017 13:53:26 +0000 (07:53 -0600)]
C++-ify break-catch-sig

This changes signal_catchpoint to be more of a C++ class, using
std::vector and updating the users.

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

* break-catch-sig.c (gdb_signal_type): Remove typedef.
(struct signal_catchpoint) <signals_to_be_caught>: Now a
std::vector.
<catch_all>: Now a bool.
(~signal_catchpoint): Remove.
(signal_catchpoint_insert_location)
(signal_catchpoint_remove_location)
(signal_catchpoint_breakpoint_hit, signal_catchpoint_print_one)
(signal_catchpoint_print_mention)
(signal_catchpoint_print_recreate)
(signal_catchpoint_explains_signal): Update.
(create_signal_catchpoint): Change type of "filter" and
"catch_all".
(catch_signal_split_args): Return a std::vector.  Change type of
"catch_all".
(catch_signal_command): Update.