binutils-gdb.git
7 years agoPR22397, BFD internal error when message locale isn't C
Alan Modra [Sun, 5 Nov 2017 05:52:55 +0000 (16:22 +1030)]
PR22397, BFD internal error when message locale isn't C

This adds positional parameter support to the bfd error handler,
something that was lost 2017-04-13 when _doprnt was added with commit
c08bb8dd.  The number of format args is now limited to 9, which is
sufficient for current _bfd_error_handler messages.  If someone
exceeds 9 args they get the joy of modifying this code to support more
args (shouldn't be too difficult).

PR 22397
* bfd.c (union _bfd_doprnt_args): New.
(PRINT_TYPE): Add FIELD arg.  Take value from args.
(_bfd_doprnt): Replace ap parameter with args.  Adjust all
PRINT_TYPE invocations and reading of format args to suit.
Move "%%" handling out of switch handling args.  Support
positional parameters.
(_bfd_doprnt_scan): New function.
(error_handler_internal): Call _bfd_doprnt_scan and read args.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Nov 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agopowerpc TLS in PIEs
Alan Modra [Sat, 4 Nov 2017 03:11:29 +0000 (13:41 +1030)]
powerpc TLS in PIEs

This patch removes unnecessary GOT IE TLS relocations in PIEs.  Useful
with --no-tls-optimize, or with an enormous TLS segment.  With the
default --tls-optimize in effect IE code sequences will be edited to
LE under the same circumstances we can remove the GOT reloc.

* elf32-ppc.c (got_entries_needed, got_relocs_needed): New functions.
(allocate_dynrelocs, ppc_elf_size_dynamic_sections): Use them here.
(ppc_elf_relocate_section): Don't output a dynamic relocation
for IE GOT entries in an executable.
* elf64-ppc.c (allocate_got): Trim unnecessary TPREL relocs.
(ppc64_elf_size_dynamic_sections): Likewise.
(ppc64_elf_relocate_section): Likewise.

7 years agoPowerPC readonly_dynrelocs
Alan Modra [Wed, 1 Nov 2017 21:35:03 +0000 (08:05 +1030)]
PowerPC readonly_dynrelocs

PowerPC64 lacked the mapfile textrel warning on finding dynamic relocs
in read-only sections.  This patch adds it, and tidies the
readonly_dynrelocs interface.  PowerPC doesn't need a SEC_ALLOC test
because !SEC_ALLOC sections are excluded by check_relocs so will never
have dyn_relocs.

* elf32-ppc.c (readonly_dynrelocs): Delete info param.  Update all
callers.  Don't bother with SEC_ALLOC test.  Return section pointer.
Move minfo call to..
(maybe_set_textrel): ..here.
* elf64-ppc.c (readonly_dynrelocs): Return section pointer.
(maybe_set_textrel): Call minfo to print textrel warning to map file.

7 years agohppa-linux TLS relocs
Alan Modra [Thu, 2 Nov 2017 01:39:34 +0000 (12:09 +1030)]
hppa-linux TLS relocs

This patch fixes various problems with TLS relocations.

1) Report an error if a symbol has both TLS and normal GOT entries.
2) The GOT entry size calculation was obscure and made use of the fact
   that a symbol shouldn't have both normal and TLS GOT entries.
3) The second word of a GD GOT entry sometimes omitted a dynamic
   reloc, which was fine except that doing so makes it impossible for
   ld.so to differentiate GD and LD entries.  Also, a NONE reloc was
   emitted.
4) Unnecessary relocs were emitted for GOT entries.
5) GOT relocs didn't take note of UNDEFWEAK_NO_DYNAMIC_RELOC.

* elf32-hppa.c (enum _tls_type): Move.
(struct elf32_hppa_link_hash_entry): Make tls_type a bitfield.
(elf32_hppa_check_relocs): Set DF_STATIC_TLS only for shared libraries.
Tidy tls_type handling.  Set symbol tls_type for GOT_TLS_LDM too.
(got_entries_needed, got_relocs_needed): New functions.
(allocate_dynrelocs): Use them.
(elf32_hppa_size_dynamic_sections): Likewise.
(elf32_hppa_relocate_section): Delete bogus FIXME.  Formatting.
Correct code emitting relocs on GD/IE got entries.  Report an
error when a symbol has both normal and TLS GOT relocs.

7 years agoPR22394, hppa-linux-ld fails to emit dynamic relocations
Alan Modra [Tue, 31 Oct 2017 07:43:03 +0000 (18:13 +1030)]
PR22394, hppa-linux-ld fails to emit dynamic relocations

gcc -mfast-indirect-calls emits a function pointer initialization
without a P% (plabel) modifier.  ld does not create the necessary
dynamic relocations for this to work.  It turns out that the problem
is caused by the non_got_ref symbol flag.  This flag is set for
non-pic by check_relocs to indicate that the symbol might need copy
relocations or dynamic relocations.  Later, the backend
adjust_dynamic_symbol clears the flag to indicate dynamic relocations
are needed, but leaves it set when copy relocations were created.  The
inversion in meaning is insane, but it's that way because the backend
adjust_dynamic_symbol function doesn't get to look at all symbols..
Anyway, the insanity works for non-function symbols.  However, the
flag is left set on any function symbol with a dynamic relocation.

This patch fixes the non_got_ref handling for function symbols, adds
-z nocopyreloc for hppa-elf, reports where textrel occurs, and expands
comments.  The check_relocs change just stops creation of dyn_relocs
we always threw away later.

PR 22394
* elf32-hppa.c (elf32_hppa_check_relocs): Don't create dyn_relocs
for plabels when non-pic.
(maybe_set_textrel): New function.
(readonly_dynrelocs): Move and rewrite.
(elf32_hppa_adjust_dynamic_symbol): Use it.  Don't create copy
relocs when def_regular or -z nocopyreloc.  Handle non_got_ref
for functions.  Expand non_got_ref comments.
(elf32_hppa_size_dynamic_sections): Use maybe_set_textrel.

7 years agoUse std::vector in h8300-tdep.c
Tom Tromey [Thu, 2 Nov 2017 04:46:40 +0000 (22:46 -0600)]
Use std::vector in h8300-tdep.c

This changes h8300-tdep.c to use std::vector, allowing the removal of
a cleanup.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* h8300-tdep.c (h8300_push_dummy_call): Use std::vector.

7 years agoIntroduce gdb_breakpoint_up
Tom Tromey [Thu, 2 Nov 2017 04:32:45 +0000 (22:32 -0600)]
Introduce gdb_breakpoint_up

This introduces gdb_breakpoint_up, a unique_ptr typedef that owns a
breakpoint.  It then changes set_momentary_breakpoint to return a
gdb_breakpoint_up and fixes up the fallout.  This then allows the
removal of make_cleanup_delete_breakpoint.

Once breakpoints are fully C++-ified, this typedef can be removed in
favor of a plain std::unique_ptr.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* breakpoint.c (set_momentary_breakpoint): Return
breakpoint_up.
(until_break_command): Update.
(new_until_break_fsm): Change argument types to
breakpoint_up.
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(do_delete_breakpoint_cleanup, make_cleanup_delete_breakpoint):
Remove.
* infcmd.c (finish_forward): Update.
* breakpoint.h (set_momentary_breakpoint)
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(make_cleanup_delete_breakpoint): Remove.
(struct breakpoint_deleter): New.
(breakpoint_up): New typedef.
* infrun.c (insert_step_resume_breakpoint_at_sal_1): Update.
(insert_exception_resume_breakpoint): Update.
(insert_exception_resume_from_probe): Update.
(insert_longjmp_resume_breakpoint): Update.
* arm-linux-tdep.c (arm_linux_copy_svc): Update.
* elfread.c (elf_gnu_ifunc_resolver_stop): Update.
* infcall.c (call_function_by_hand_dummy): Update

7 years agoUse unique_xmalloc_ptr in c_type_print_base
Tom Tromey [Thu, 2 Nov 2017 01:16:58 +0000 (19:16 -0600)]
Use unique_xmalloc_ptr in c_type_print_base

This changes c_type_print_base to use unique_xmalloc_ptr, removing a
cleanup.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* c-typeprint.c (c_type_print_base): Use gdb::unique_xmalloc_ptr.

7 years agoRemove cleanups from linux-tdep.c
Tom Tromey [Thu, 2 Nov 2017 01:11:20 +0000 (19:11 -0600)]
Remove cleanups from linux-tdep.c

This removes some cleanups from linux-tdep.c, replacing them with
def_vector or byte_vector as appropriate.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* linux-tdep.c (linux_core_info_proc_mappings): Use
gdb::def_vector.
(linux_get_siginfo_data): Return gdb::byte_vector.  Remove
"size" argument.
(linux_corefile_thread): Update.
(linux_make_corefile_notes): Remove unused variable.

7 years agoUse gdb::byte_vector in ppc-linux-tdep.c
Tom Tromey [Thu, 2 Nov 2017 00:52:30 +0000 (18:52 -0600)]
Use gdb::byte_vector in ppc-linux-tdep.c

This removes a cleanup from ppc-linux-tdep.c, replacing it with
gdb::byte_vector.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* ppc-linux-tdep.c (ppc_linux_get_syscall_number): Use
gdb::byte_vector.

7 years agoRemove make_cleanup_free_objfile
Tom Tromey [Thu, 2 Nov 2017 00:51:15 +0000 (18:51 -0600)]
Remove make_cleanup_free_objfile

This replaces make_cleanup_free_objfile with std::unique_ptr.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* objfiles.c (do_free_objfile_cleanup): Remove.
* compile/compile-object-load.c (compile_object_load): Update.
* objfiles.h (make_cleanup_free_objfile): Remove.

7 years agoUse gdb::def_vector in sparc64-tdep.c
Tom Tromey [Wed, 1 Nov 2017 22:37:27 +0000 (16:37 -0600)]
Use gdb::def_vector in sparc64-tdep.c

This removes a cleanup from sparc64-tdep.c, replacing it with
gdb::def_vector.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* sparc64-tdep.c (do_examine): Use gdb::def_vector.
(adi_read_versions): Change "tags" to "gdb_byte *".
(adi_print_versions): Likewise.

7 years agoReplace start_rbreak_breakpoints and end_rbreak_breakpoints
Tom Tromey [Wed, 1 Nov 2017 15:00:09 +0000 (09:00 -0600)]
Replace start_rbreak_breakpoints and end_rbreak_breakpoints

This replaces start_rbreak_breakpoints and end_rbreak_breakpoints with
a new scoped class.  This allows the removal of a cleanup.

This also fixes an earlier memory leak regression, by changing
"string" to be a std::string.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* breakpoint.c
(scoped_rbreak_breakpoints::scoped_rbreak_breakpoints): Rename
from start_rbreak_breakpoints.
(scoped_rbreak_breakpoints): Rename from end_rbreak_breakpoints.
* breakpoint.h (class scoped_rbreak_breakpoints): New.
(start_rbreak_breakpoints, end_rbreak_breakpoints): Remove.
* symtab.c (do_end_rbreak_breakpoints): Remove.
(rbreak_command): Use scoped_rbreak_breakpoints, std::string.

7 years agoRemove directive-searched cleanups
Tom Tromey [Wed, 1 Nov 2017 14:32:13 +0000 (08:32 -0600)]
Remove directive-searched cleanups

This removes a few cleanups related to the "searched" field in
struct using_direct, replacing these with scoped_restore.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* cp-namespace.c (reset_directive_searched): Remove.
(cp_lookup_symbol_via_imports): Use scoped_restore.
* cp-support.c (reset_directive_searched): Remove.
(make_symbol_overload_list_using): Use scoped_restore.
* d-namespace.c (d_lookup_symbol_imports): Use scoped_restore.
(reset_directive_searched): Remove.

7 years agoUse unique_xmalloc_ptr in find_separate_debug_file_by_debuglink
Tom Tromey [Wed, 25 Oct 2017 21:52:23 +0000 (15:52 -0600)]
Use unique_xmalloc_ptr in find_separate_debug_file_by_debuglink

This changes find_separate_debug_file_by_debuglink to use
unique_xmalloc_ptr, removing some cleanups.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* symfile.c (find_separate_debug_file_by_debuglink): Use
unique_xmalloc_ptr.

7 years agoUse std::vector in compile-loc2c.c
Tom Tromey [Wed, 25 Oct 2017 21:46:31 +0000 (15:46 -0600)]
Use std::vector in compile-loc2c.c

This changes compile-loc2c.c to use std::vector, removing some
cleanups.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* compile/compile-loc2c.c (compute_stack_depth_worker): Change
type of "info".
(compute_stack_depth): Likewise.
(do_compile_dwarf_expr_to_c): Use std::vector.

7 years agoRemove cleanups from link_callbacks_einfo
Tom Tromey [Wed, 25 Oct 2017 21:44:56 +0000 (15:44 -0600)]
Remove cleanups from link_callbacks_einfo

This removes a cleanup from link_callbacks_einfo by using std::string.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* compile/compile-object-load.c (link_callbacks_einfo): Use
std::string.

7 years agoReplace really_free_pendings with a scoped_ class
Tom Tromey [Fri, 20 Oct 2017 15:30:48 +0000 (09:30 -0600)]
Replace really_free_pendings with a scoped_ class

This introduces scoped_free_pendings, and changes users of
really_free_pendings to use it instead, removing some clenaups.

I tried to examine the affected code to ensure there aren't dangling
cleanups in the vicinity.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (process_full_comp_unit, process_full_type_unit):
Use scoped_free_pendings.
* dbxread.c (dbx_symfile_read, dbx_psymtab_to_symtab_1): Use
scoped_free_pendings.
* xcoffread.c (xcoff_psymtab_to_symtab_1): Use scoped_free_pendings.
(xcoff_initial_scan): Likewise.
* buildsym.c (reset_symtab_globals): Update comment.
(scoped_free_pendings): Rename from really_free_pendings.
(prepare_for_building): Update comment.
(buildsym_init): Likewise.
* buildsym.h (class scoped_free_pendings): New class.
(really_free_pendings): Don't declare.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Nov 2017 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agox86: Remove func_pointer_refcount
H.J. Lu [Fri, 3 Nov 2017 18:14:56 +0000 (11:14 -0700)]
x86: Remove func_pointer_refcount

Since check_reloc is running after gc_sections, there is no need for
reference count.  If a function pointer relocation can be resolved at
run-time, there is no need for PLT and it doesn't count as non-GOT/PLT
relocation.  func_pointer_refcount can be removed.

* elf32-i386.c (elf_i386_check_relocs): Set plt.refcount to 1.
Don't use func_pointer_refcount.  Don't set plt.refcount nor
non_got_ref for function pointer reference.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Don't use
func_pointer_refcount.
(_bfd_x86_elf_copy_indirect_symbol): Don't copy
func_pointer_refcount.
(_bfd_x86_elf_hide_symbol): Don't use func_pointer_refcount.
* elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Likewise.
(elf_x86_link_hash_entry): Remove func_pointer_refcount.

7 years agoFix regression on ARM after Target FP patches
Ulrich Weigand [Fri, 3 Nov 2017 15:07:23 +0000 (16:07 +0100)]
Fix regression on ARM after Target FP patches

Commit edd079d9f6ca2f9ad21322b742269aec5de61190 exposed a pre-existing bug
in convert_doublest_to_floatformat.  In the specific case of converting
a zero value to a floatformat using a "special" byteorder (i.e. neither
floatformat_little nor floatformat_big), the output buffer was actually
left uninitialized.

gdb/ChangeLog:
2017-11-03  Ulrich Weigand  <uweigand@de.ibm.com>

* doublest.c (convert_doublest_to_floatformat): Fix uninitialized
output when converting a zero value to a special byteorder format.

7 years ago[ARC] Force the disassam to use the hexadecimal number for printing
claziss [Fri, 3 Nov 2017 14:36:42 +0000 (15:36 +0100)]
[ARC] Force the disassam to use the hexadecimal number for printing

Force printing of the short/signed values using hexadecimal
representation via disassembler option.

opcode/
2017-11-03  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-dis.c (print_hex): New variable.
        (parse_option): Check for hex option.
        (print_insn_arc): Use hexadecimal representation for short
        immediate values when requested.
        (print_arc_disassembler_options): Add hex option to the list.

binutils/
2017-11-03  Claudiu Zissulescu  <claziss@synopsys.com>

        * doc/binutils.texi (ARC): Update disassembler options.
        * testsuite/binutils-all/arc/hexprint.s: New file.
        * testsuite/binutils-all/arc/objdump.exp: Test hex printing feature.

7 years agoAdd option for Qualcomm Saphira part
Siddhesh Poyarekar [Fri, 3 Nov 2017 14:03:03 +0000 (19:33 +0530)]
Add option for Qualcomm Saphira part

This adds an option for the Qualcomm saphira core, the corresponding
gcc patch is here:

https://gcc.gnu.org/ml/gcc-patches/2017-10/msg02055.html

This was tested with an aarch64 build and make check and also by
building and running SPEC2006.

gas/
* config/tc-aarch64.c (aarch64_cpus): Add saphira.
* doc/c-aarch64.texi: Likewise.

7 years agoFix integer overflow problems when reading an ELF binary with corrupt augmentation...
Nick Clifton [Fri, 3 Nov 2017 13:57:15 +0000 (13:57 +0000)]
Fix integer overflow problems when reading an ELF binary with corrupt augmentation data.

PR 22386
* dwarf.c (read_cie): Use bfd_size_type for
augmentation_data_len.
(display_augmentation_data): New function.
(display_debug_frames): Use it.
Check for integer overflow when testing augmentation_data_len.

7 years ago[ARC] Sync opcode data base.
claziss [Fri, 3 Nov 2017 13:38:05 +0000 (14:38 +0100)]
[ARC] Sync opcode data base.

New EM and HS variants are developed, sync the data base to match them.

opcodes/
2017-11-03  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-tbl.h (abss, abssh, adc, adcs, adds, aslacc, asls, aslsacc)
        (asrs, asrsr, cbflyhf0r, cbflyhf1r, cmacchfr, cmacchnfr, cmachfr)
        (cmachnfr, cmpychfr, cmpychnfr, cmpyhfmr, cmpyhfr, cmpyhnfr, divf)
        (dmachbl, dmachbm, dmachf, dmachfr, dmacwhf, dmpyhbl, dmpyhbm)
        (dmpyhf, dmpyhfr, dmpyhwf, dmpywhf, dsync, flagacc, getacc, macdf)
        (macf, macfr, macwhfl, macwhflr, macwhfm, macwhfmr, macwhkl)
        (macwhkul, macwhl, macwhul, mpydf, mpyf, mpyfr, mpywhfl, mpywhflr)
        (mpywhfm, mpywhfmr, mpywhkl, mpywhkul, mpywhl, mpywhul, msubdf)
        (msubf, msubfr, msubwhfl, msubwhflr, msubwhfm, msubwhfmr, mul64)
        (negs, negsh, normacc, qmachf, qmpyh, qmpyhf, rndh, satf, sath)
        (sbcs, setacc, sflag, sqrt, sqrtf, subs, swi_s, vabs2h, vabss2h)
        (vadd4b, vadds2, vadds2h, vadds4h, vaddsubs, vaddsubs2h)
        (vaddsubs4h, valgn2h, vasl2h, vasls2h, vasr2h, vasrs2h, vasrsr2h)
        (vext2bhl, vext2bhlf, vext2bhm, vext2bhmf, vlsr2h, vmac2hf)
        (vmac2hfr, vmac2hnfr, vmax2h, vmin2h, vmpy2h, vmpy2hf, vmpy2hfr)
        (vmpy2hwf, vmsub2hf, vmsub2hfr, vmsub2hnfr, vneg2h, vnegs2h)
        (vnorm2h, vpack2hbl, vpack2hblf, vpack2hbm, vpack2hbmf, vpack2hl)
        (vpack2hm, vperm, vrep2hl, vrep2hm, vsext2bhl, vsext2bhm, vsub4b)
        (vsubadds, vsubadds2h, vsubadds4h, vsubs2, vsubs2h, vsubs4h):
        Changed opcodes.
        (prealloc, prefetch*): Place them before ld instruction.
        * arc-opc.c (skip_this_opcode): Add ARITH class.

7 years agoSkip gdb.mi/list-thread-groups-available.exp if no xml support
Yao Qi [Fri, 3 Nov 2017 12:53:53 +0000 (12:53 +0000)]
Skip gdb.mi/list-thread-groups-available.exp if no xml support

I see the following test fail in gdb (configured --with-expat=no),

-list-thread-groups --available^M
&"warning: Can not parse XML OS data; XML support was disabled at compile time\n"^M
^error,msg="Can not fetch data now."^M
(gdb) ^M
FAIL: gdb.mi/list-thread-groups-available.exp: list available thread groups (unexpected output)

This patch skips it if XML parsing in GDB is disabled, like what you did
in gdb.mi/mi-info-os.exp.

gdb/testsuite:

2017-11-03  Yao Qi  <yao.qi@linaro.org>

* gdb.mi/list-thread-groups-available.exp: Skip it if XML parsing
in GDB is disabled.

7 years agoFix excessive memory allocation attempts and possible integer overfloaws when attempt...
Nick Clifton [Fri, 3 Nov 2017 11:55:21 +0000 (11:55 +0000)]
Fix excessive memory allocation attempts and possible integer overfloaws when attempting to read a COFF binary with a corrupt symbol count.

PR 22385
* coffgen.c (_bfd_coff_get_external_symbols): Check for an
overlarge raw syment count.
(coff_get_normalized_symtab): Likewise.

7 years agoSkip gdb.python/py-thrhandle.exp if python is not enabled.
Yao Qi [Fri, 3 Nov 2017 10:36:42 +0000 (10:36 +0000)]
Skip gdb.python/py-thrhandle.exp if python is not enabled.

gdb/testsuite:

2017-11-03  Yao Qi  <yao.qi@linaro.org>

* gdb.python/py-thrhandle.exp: Skip it if python is not
enabled.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Nov 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoaarch64: Remove AARCH64_FEATURE_F16 from AARCH64_ARCH_V8_2
Siddhesh Poyarekar [Thu, 2 Nov 2017 17:19:32 +0000 (22:49 +0530)]
aarch64: Remove AARCH64_FEATURE_F16 from AARCH64_ARCH_V8_2

The FP16 feature is optional in ARMv8.2, so it is wrong to add it to
the default AARCH64_ARCH_V8_2 feature flags.  This patch makes the
behaviour consistent with that of gcc, which also does not assume FP16
for ARMv8.2.

include/

* opcode/aarch64.h (AARCH64_ARCH_V8_2): Drop
AARCH64_FEATURE_F16.

7 years agoWork around integer overflows when readelf is checking for corrupt ELF notes when...
Mingi Cho [Thu, 2 Nov 2017 17:01:08 +0000 (17:01 +0000)]
Work around integer overflows when readelf is checking for corrupt ELF notes when run on a 32-bit host.

PR 22384
* readelf.c (print_gnu_property_note): Improve overflow checks so
that they will work on a 32-bit host.

7 years agoConstruct readonly regcache without address space
Yao Qi [Thu, 2 Nov 2017 15:15:42 +0000 (15:15 +0000)]
Construct readonly regcache without address space

The address space is useless to readonly regcache, so this patch removes
the parameter to construct readonly regcache.

address_space was added in regcache by 6c95b8d, but for read-write
regcache.  regcache::aspace is used for various breakpoint/watchpoint
checking, and these regcache are not read-only regcache.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* frame.c (do_frame_register_read): Remove aspace.
* jit.c (jit_frame_sniffer): Likwise.
* ppc-linux-tdep.c (ppu2spu_sniffer): Likewise.
* regcache.c (regcache::regcache): Pass nullptr.
(regcache_print): Caller updated.
* regcache.h (regcache::regcache): Remove one constructor
parameter aspace.

7 years agoconst-fy regcache::m_readonly_p
Yao Qi [Thu, 2 Nov 2017 15:15:42 +0000 (15:15 +0000)]
const-fy regcache::m_readonly_p

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* regcache.h (regcache) <m_readonly_p>: Change it to const bool.

7 years agoconst-fy regcache::m_aspace
Yao Qi [Thu, 2 Nov 2017 15:15:42 +0000 (15:15 +0000)]
const-fy regcache::m_aspace

regcache::m_aspace is a const, never changed during the lifetime of
regcache object.  The address_space object is a const object too.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* breakpoint.c (insert_single_step_breakpoints): Update.
* frame.c (struct frame_info) <aspace>: Add const.
(frame_save_as_regcache): Add const.
(get_frame_address_space): Return const address_space *.
* frame.h (get_frame_address_space): Update declaration.
* infrun.c (struct step_over_info) <aspace>: Add const.
(set_step_over_info): Make aspace const.
(displaced_step_prepare_throw): Change variable const.
(resume): Likewise.
(proceed): Likewise.
(adjust_pc_after_break): Likewise.
(save_waitstatus): Likewise.
(handle_signal_stop): Likewise.
(keep_going_pass_signal): Likewise.
* jit.c (jit_frame_sniffer): Add const.
* mips-tdep.c (mips_single_step_through_delay): Likewise.
* ppc-linux-tdep.c (ppu2spu_sniffer): Likewise.
* record-full.c (record_full_wait_1): Likewise.
* regcache.c (regcache::regcache): Change parameter to const.
* regcache.h (regcache::regcache): Likewise.
(regcache::aspace): Return const address_space *.
(regcache) <m_aspace>: Add const.

7 years agos/get_regcache_aspace (regcache)/regcache->aspace ()/g
Yao Qi [Thu, 2 Nov 2017 15:15:41 +0000 (15:15 +0000)]
s/get_regcache_aspace (regcache)/regcache->aspace ()/g

and remove get_regcache_aspace.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* darwin-nat.c (cancel_breakpoint): Use regcache->aspace ().
* frame.c (create_sentinel_frame): Likewise.
* infrun.c (displaced_step_prepare_throw): Likewise.
(resume): Likewise.
(thread_still_needs_step_over_bp): Likewise.
(proceed): Likewise.
(do_target_wait): Likewise.
(adjust_pc_after_break): Likewise.
(handle_syscall_event): Likewise.
(save_waitstatus): Likewise.
(handle_inferior_event_1): Likewise.
(handle_signal_stop): Likewise.
(keep_going_pass_signal): Likewise.
* linux-nat.c (status_callback): Likewise.
(save_stop_reason): Likewise.
(resume_stopped_resumed_lwps): Likewise.
* record-full.c (record_full_exec_insn): Likewise.
(record_full_wait_1): Likewise.
* regcache.c (get_regcache_aspace): Remove.
* regcache.h (get_regcache_aspace): Remove.

7 years agoRemove regcache_descr::nr_raw_registers
Yao Qi [Thu, 2 Nov 2017 15:15:41 +0000 (15:15 +0000)]
Remove regcache_descr::nr_raw_registers

struct regcache_descr has fields nr_raw_registers and gdbarch, and
nr_raw_registers can be got via gdbarch_num_regs (gdbarch), so it looks
nr_raw_registers is redundant.  This patch removes it and adds a protected
method num_raw_registers.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* regcache.c (struct regcache_descr) <nr_raw_registers>: Remove.
(init_regcache_descr): Use gdbarch_num_regs.
(regcache::regcache): Likewise.
(regcache::get_register_status): Likewise.
(regcache::assert_raw_regnum): Likewise.
(regcache::cooked_read): Likewise.
(regcache::cooked_read_value): Likewise.
(regcache::cooked_write): Likewise.
(regcache::dump): Likewise.
(regcache::num_raw_registers): New method.
* regcache.h (class regcache) <num_raw_registers>: New.

7 years agoNew method regcache::assert_regnum
Yao Qi [Thu, 2 Nov 2017 15:15:41 +0000 (15:15 +0000)]
New method regcache::assert_regnum

class regcache has some methods checking the range of register number,
this patch is to move it in a new method assert_regnum.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* regcache.c (regcache::assert_regnum): New method.
(regcache::invalidate): Call assert_regnum.
(regcache::raw_update): Likewise.
(regcache::raw_write): Likewise.
(regcache::raw_read_part): Likewise.
(regcache::raw_write_part): Likewise.
(regcache::raw_supply): Likewise.
(regcache::raw_supply_integer): Likewise.
(regcache::raw_supply_zeroed): Likewise.
(regcache::raw_collect): Likewise.
(regcache::raw_collect_integer): Likewise.
* regcache.h (regcache::assert_regnum): Declare.

7 years agoRemove code wrapped by "#if 0"
Yao Qi [Thu, 2 Nov 2017 15:15:41 +0000 (15:15 +0000)]
Remove code wrapped by "#if 0"

These code wrapped by "#if 0" was added by af030b9a, which added the new
command to dump registers in 2002.  The email didn't mention this either
https://sourceware.org/ml/gdb-patches/2002-08/msg00227.html  It was there
for 15 years, and nobody needs it, so we can remove it.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* regcache.c (regcache::dump): Remove code.

7 years agoRemove regcache_descr fields sizeof_raw_register_status and sizeof_cooked_register_status
Yao Qi [Thu, 2 Nov 2017 15:05:12 +0000 (15:05 +0000)]
Remove regcache_descr fields sizeof_raw_register_status and sizeof_cooked_register_status

struct regcache_descr has two fields sizeof_raw_register_status
and sizeof_cooked_register_status, but they equal to nr_cooked_registers
and nr_raw_registers respectively, so this patch removes them.

gdb:

2017-11-02  Yao Qi  <yao.qi@linaro.org>

* regcache.c (struct regcache_descr) <sizeof_raw_register_status>:
Remove.
<sizeof_cooked_register_status>: Remove.
(init_regcache_descr): Update.
(regcache::regcache): Use nr_cooked_registers and nr_raw_registers.
(regcache::save): Likewise.
(regcache::dump): Likewise.

7 years ago[ARM] Help wince objdump on coproc tests
Thomas Preud'homme [Thu, 2 Nov 2017 14:16:22 +0000 (14:16 +0000)]
[ARM] Help wince objdump on coproc tests

Object files other than ELF do not have mapping symbols to indicate the
type of data for objdump to work reliably. This is why the following
tests FAIL on arm-wince-pe targets:
ARMv6T2 Thumb CoProcessor Instructions (1)
ARMv6T2 Thumb CoProcessor Instructions (2)

This patch adds the force-thumb disassembler option to objdump for this
test to PASS on these targets as well.

2017-11-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: Add
--disassembler-options=force-thumb to objdump options.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: Likewise.

7 years agoFT32: support for FT32B processor - part 2/2
James Bowman [Thu, 2 Nov 2017 01:34:25 +0000 (18:34 -0700)]
FT32: support for FT32B processor - part 2/2

FT32B is a new FT32 family member.
This patch adds support for the compressed instructions to gdb and sim.

gdb/ChangeLog:
        * ft32-tdep.c (ft32_fetch_instruction): New function.
        (ft32_analyze_prologue): Use ft32_fetch_instruction().

sim/ChangeLog:
        * ft32/interp.c (step_once): Add ft32 shortcode decoder.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Nov 2017 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFT32B is a new FT32 family member. It has a code compression scheme, which requires...
James Bowman [Wed, 1 Nov 2017 15:33:24 +0000 (15:33 +0000)]
FT32B is a new FT32 family member. It has a code compression scheme, which requires the use of linker relaxations. The change is quite large, so submission is in several parts.

Part 2 adds a relaxation pass, which actually implements the code compression scheme.

bfd * archures.c: Add bfd_mach_ft32b.
* cpu-ft32.c: Add arch_info_struct.
* elf32-ft32.c: Add R_FT32_RELAX, SC0, SC1,
DIFF32. (ft32_elf_relocate_section): Add clauses
for R_FT32_SC0, SC1, DIFF32.  (ft32_reloc_shortable,
elf32_ft32_is_diff_reloc, elf32_ft32_adjust_diff_reloc_value,
elf32_ft32_adjust_reloc_if_spans_insn,
elf32_ft32_relax_delete_bytes, elf32_ft32_relax_is_branch_target,
ft32_elf_relax_section): New function.
* reloc.c: Add BFD_RELOC_FT32_RELAX, SC0, SC1, DIFF32.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.

gas * config/tc-ft32.c (md_assemble): add relaxation reloc
BFD_RELOC_FT32_RELAX.  (md_longopts): Add "norelax" and
"no-relax". (md_apply_fix): Add reloc BFD_RELOC_FT32_DIFF32.
(relaxable_section, ft32_validate_fix_sub, ft32_force_relocation,
ft32_allow_local_subtract): New function.
* config/tc-ft32.h: remove unused MD_PCREL_FROM_SECTION.
* testsuite/gas/ft32/insnsc.s: New test exercising all FT32B
shortcodes.

include * elf/ft32.h: Add R_FT32_RELAX, SC0, SC1, DIFF32.

7 years agoPrevent illegal memory accesses when attempting to read excessively large COFF line...
Nick Clifton [Wed, 1 Nov 2017 15:21:46 +0000 (15:21 +0000)]
Prevent illegal memory accesses when attempting to read excessively large COFF line number tables.

PR 22376
* coffcode.h (coff_slurp_line_table): Check for an excessively
large line number count.

7 years agoUpdate check for invalid values in pe_bfd_read_buildid function.
Nick Clifton [Wed, 1 Nov 2017 12:37:33 +0000 (12:37 +0000)]
Update check for invalid values in pe_bfd_read_buildid function.

PR 22373
* peicode.h (pe_bfd_read_buildid): Revise check for invalid size
and offset in light of further possible bogus values.

7 years agoFix an invalid free called when attempting to link a COFF object against an ELF archi...
Nick Clifton [Wed, 1 Nov 2017 11:35:42 +0000 (11:35 +0000)]
Fix an invalid free called when attempting to link a COFF object against an ELF archive with --no-keep-memory enabled.

PR 22369
* coffgen.c (_bfd_coff_free_symbols): Fail if called on a non-COFF
file.
* cofflink.c (coff_link_check_archive_element): Skip non-COFF
members of an archive.

7 years ago[ARM] Fix Coprocessor instructions availability
Thomas Preud'homme [Wed, 1 Nov 2017 09:49:13 +0000 (09:49 +0000)]
[ARM] Fix Coprocessor instructions availability

A few coprocessor instructions introduced in ARMv2 are currently
accepted by GAS when targeting ARMv1 due to a typo in the code. This
patch fixes the issue and introduce a more fine grained testing for
coprocessor instructions availability. Coprocessor instructions are
grouped as follows:

* ARM coprocessor instructions introduced in ARMv2
  Includes: ldc, stc, mcr, mrc, cdp, ldcl, stcl
  Guarded by: ARM_EXT_V2
  Tests: copro-arm_v2plus-arm_v*.d

* ARM coprocessor instructions introduced in ARMv5
  Includes: ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2
  Guarded by: ARM_EXT_V5
  Tests: copro-arm_v5plus-arm_v*.d

* ARM coprocessor instructions introduced in ARMv5TE
  Includes: mcrr, mrrc
  Guarded by: ARM_EXT_V5E
  Tests: copro-arm_v5teplus-arm_v*.d

* ARM coprocessor instructions introduced in ARMv6
  Includes: mcrr2, mrrc2
  Guarded by: ARM_EXT_V6
  Tests: copro-arm_v6plus-arm_v*.d

* Thumb coprocessor instructions introduced in ARMv6T2
  Includes: ldc, ldcl, stc, stcl, mcr, mrc, mcrr, mrrc, cdp, ldc2,
  ldc2l, stc2, stc2l, cdp2, mcr2, mrc2, mcrr2, mrrc2
  Guarded by: ARM_EXT_V6T2
  Tests: copro-thumb_v6t2plus-thumb_v*.d

For each of these groups, at least 2 tests are performed:
* instructions are not available in earlier architecture
* instructions are available in architecture where they were introduced
More tests need to be performed when instructions in a group span
several assembly files.

Note that an instruction in the original coprocessor testcase is
changed to unified syntax to allow the testcase to be assembled for ARM
and Thumb state. Correct processing of legacy syntax is covered in other
testcases.

2017-11-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.c (arm_ext_v2): Define to ARM_EXT_V2 feature bit.
* testsuite/gas/arm/copro.s: Split into ...
* testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus.s: This while
changing it to unified syntax and ...
* testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus.s: this and ...
* testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus.s: This and ...
* testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus.s: This.
* testsuite/gas/arm/copro.d: Split into ...
* testsuite/gas/arm/copro-arm_v2plus-arm_v2.d: This but target ARMv2
and ...
* testsuite/gas/arm/copro-arm_v5plus-arm_v5.d: this but target ARMv5
and ...
* testsuite/gas/arm/copro-arm_v5teplus-arm_v5te.d: This but target
ARMv5TE and ...
* testsuite/gas/arm/copro-arm_v6plus-arm_v6.d: This but target ARMv6.
* testsuite/gas/arm/copro-arm_v2plus-arm_v1.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus-unavail.l: Expected
errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v5plus-arm_v4.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5teplus-arm_v5.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v6plus-arm_v5te.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-4.d: New testcase.
* testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-4.d: New testcase.

7 years agoPR22374, PowerPC unnecessary PLT entries
Alan Modra [Tue, 31 Oct 2017 11:43:21 +0000 (22:13 +1030)]
PR22374, PowerPC unnecessary PLT entries

We don't need a PLT entry when function pointer initialization in a
read/write section is the only reference to a given function symbol.
This patch prevents the unnecessary PLT entry, and ensures no dynamic
relocs are emitted when UNDEFWEAK_NO_DYNAMIC_RELOC says so.

bfd/
PR 22374
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't create a plt
entry when just a dynamic reloc can serve.  Ensure no dynamic
relocations when UNDEFWEAK_NO_DYNAMIC_RELOC by setting non_got_ref.
Expand and move the non_got_ref comment.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
ld/
* testsuite/ld-powerpc/ambiguousv2.d: Remove FIXME.

7 years agoPR22374 testcase, function pointer references in .data
Alan Modra [Tue, 31 Oct 2017 00:43:30 +0000 (11:13 +1030)]
PR22374 testcase, function pointer references in .data

Function pointer references in .data ought to use a dynamic reloc.
There shouldn't be any need for a PLT entry and definitely no copy
reloc.

This test fails on quite a few targets, but isn't something that
anyone should worry about too much.  It's really just a missed
optimization.

PR 22374
* testsuite/ld-elf/pr22374a.s,
* testsuite/ld-elf/pr22374b.s,
* testsuite/ld-elf/pr22374-1.r,
* testsuite/ld-elf/pr22374-2.r: New test.
* testsuite/ld-elf/elf.exp: Run it.

7 years agoTidy elf.exp
Alan Modra [Tue, 31 Oct 2017 07:49:21 +0000 (18:19 +1030)]
Tidy elf.exp

* testsuite/ld-elf/elf.exp: Merge some conditionals, a better
name than "shared library for next test", and use xfail arg
of run_ld_link_tests in a few places.

7 years agoUse console uiout when executing breakpoint commands
Simon Marchi [Wed, 1 Nov 2017 01:30:24 +0000 (21:30 -0400)]
Use console uiout when executing breakpoint commands

As reported here

  https://sourceware.org/ml/gdb/2017-10/msg00020.html

the output of certain commands, like backtrace, doesn't appear anywhere
when it is run as a breakpoint command and when using MI.

The reason is that the current_uiout is set to the mi_ui_out while these
commands run, whereas we want the output as CLI output.  Some commands
like "print" work, because they use printf_filtered (gdb_stdout, ...)
directly, bypassing the current ui_out.

The fix I did is to force setting the cli_uiout as the current_uiout
when calling execute_control_command.  I am not sure if this is the
right way to fix the problem, comments about the approach would be
appreciated.

I enhanced gdb.mi/mi-break.exp to test the backtrace command.

Regtested on the buildbot.

gdb/ChangeLog:

* cli/cli-script.c (execute_control_command): Rename to ...
(execute_control_command_1): ... this.
(execute_control_command): New function.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-break.exp (test_breakpoint_commands): Test backtrace
as a breakpoint command.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Nov 2017 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agotracepoint: Remove unnecessary const_cast
Simon Marchi [Tue, 31 Oct 2017 18:29:25 +0000 (14:29 -0400)]
tracepoint: Remove unnecessary const_cast

We are passing a const char * to a const char * parameter, the
const_cast is not necessary.

gdb/ChangeLog:

* tracepoint.c (tfind_command): Remove const_cast.

7 years agoFix illegal memory access triggered when parsing a PE binary with a corrupt data...
Nick Clifton [Tue, 31 Oct 2017 14:29:40 +0000 (14:29 +0000)]
Fix illegal memory access triggered when parsing a PE binary with a corrupt data dictionary.

PR 22373
* peicode.h (pe_bfd_read_buildid): Check for invalid size and data
offset values.

7 years agoRemind users to use the --use-dynamic command line option to dump dynamic relocations.
Nick Clifton [Tue, 31 Oct 2017 13:48:03 +0000 (13:48 +0000)]
Remind users to use the --use-dynamic command line option to dump dynamic relocations.

* readelf.c (process_relocs): Tell users if no static relocs were
found, but if they had added --use-dynamic to the command line
then relocs would have been displayed.

7 years agogdb/Makefile.in: fix 'make tags' failure
Mike Gulick [Tue, 31 Oct 2017 00:11:52 +0000 (20:11 -0400)]
gdb/Makefile.in: fix 'make tags' failure

'make tags' fails with the following error:

  make[2]: Entering directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb'
  make[2]: *** No rule to make target 'gdb.h', needed by 'TAGS'.  Stop.
  make[2]: Leaving directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb'

The file gdb/gdb.h was removed in commit
65630365f7d073430e62b4fe65f34dcdc0a4b05e.

gdb/ChangeLog:

2017-10-30  Mike Gulick  <mgulick@mathworks.com>

* Makefile.in (HFILES_NO_SRCDIR): Remove reference to gdb.h.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 31 Oct 2017 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoIntroduce in_inclusive_range, fix -Wtautological-compare warnings
Simon Marchi [Mon, 30 Oct 2017 18:27:30 +0000 (14:27 -0400)]
Introduce in_inclusive_range, fix -Wtautological-compare warnings

When compiling with clang or gcc 8, we see warnings like this:

/home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:10013:13: error: comparison of 0 <= unsigned expression is always true [-Werror,-Wtautological-compare]
      if (0 <= insn_op1 && 3 >= insn_op1)
          ~ ^  ~~~~~~~~
/home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:11722:20: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare]
      else if (opB >= 0 && opB <= 2)
               ~~~ ^  ~

This is because an unsigned integer (opB in this case) will always be >=
0.  It is still useful to keep both bounds of the range in the
expression, even if one is at the edge of the data type range.  This
patch introduces a utility function in_inclusive_range that gets rid of
the warning while conveying that we are checking for a range.

Tested by rebuilding.

gdb/ChangeLog:

* common/common-utils.h (in_inclusive_range): New function.
* arm-tdep.c (arm_record_extension_space): Use
in_inclusive_range.
(thumb_record_ld_st_reg_offset): Use in_inclusive_range.
* cris-tdep.c (cris_spec_reg_applicable): Use
in_inclusive_range.

7 years agoremote.c, QCatchSyscalls: Build std::string instead of unique_xmalloc_ptr
Pedro Alves [Mon, 30 Oct 2017 11:41:34 +0000 (11:41 +0000)]
remote.c, QCatchSyscalls: Build std::string instead of unique_xmalloc_ptr

Simplify the code a little bit using std::string + string_appendf.

gdb/ChangeLog:
2017-10-30  Pedro Alves  <palves@redhat.com>
    Simon Marchi <simon.marchi@ericsson.com>

* remote.c (remote_set_syscall_catchpoint): Build a std::string
instead of a gdb::unique_xmalloc_ptr, using string_appendf.

7 years agoIntroduce string_appendf/string_vappendf
Pedro Alves [Mon, 30 Oct 2017 11:41:34 +0000 (11:41 +0000)]
Introduce string_appendf/string_vappendf

string_appendf is like string_printf, but instead of allocating a new
string, it appends to an existing string.  This allows reusing a
std::string's memory buffer across several calls, for example.

gdb/ChangeLog:
2017-10-30  Pedro Alves  <palves@redhat.com>

* common/common-utils.c (string_appendf, string_vappendf): New
functions.
* common/common-utils.h (string_appendf, string_vappendf): New
declarations.
* unittests/common-utils-selftests.c (string_appendf_func)
(test_appendf_func, string_vappendf_wrapper, string_appendf_tests)
(string_vappendf_tests): New functions.
(_initialize_common_utils_selftests): Register "string_appendf" and
"string_vappendf tests".

7 years agoMerge/shared string_printf and string_vprintf unit tests
Pedro Alves [Mon, 30 Oct 2017 11:41:34 +0000 (11:41 +0000)]
Merge/shared string_printf and string_vprintf unit tests

Merge the string_printf and string_vprintf tests, running them all
against both functions.

gdb/ChangeLog:
2017-10-30  Pedro Alves  <palves@redhat.com>

* unittests/common-utils-selftests.c (format_func): New typedef.
(string_printf_tests, string_vprintf_tests): Tests factored out
and merged to ...
(test_format_func): ... this new function.
(string_printf_tests, string_vprintf_tests): Reimplement on top of
test_format_func.

7 years agodarwin-nat: Remove gdb.h include
Simon Marchi [Mon, 30 Oct 2017 02:37:11 +0000 (22:37 -0400)]
darwin-nat: Remove gdb.h include

gdb.h has been removed in

  Eliminate catch_exceptions/catch_exceptions_with_msg
  65630365f7d073430e62b4fe65f34dcdc0a4b05e

Remove the include in darwin-nat.c.  Tested by rebuilding.

gdb/ChangeLog:

* darwin-nat.c: Remove include of gdb.h.

7 years agofrv-elf --gc-sections failures
Alan Modra [Mon, 30 Oct 2017 01:32:42 +0000 (12:02 +1030)]
frv-elf --gc-sections failures

git commit 81742b83e9 exposed an frv-elf bug, with the object id not
matching the hash table id.

* elf32-frv.c (ELF_TARGET_ID): Don't define for generic
elf target.

7 years agorelocs_compatible test for gc-sections
Alan Modra [Sun, 29 Oct 2017 23:50:29 +0000 (10:20 +1030)]
relocs_compatible test for gc-sections

I noticed when looking at pr22300 that before calling check_relocs we
have an elf_object_id test (added for pr11933) as well as the
relocs_compatible test.  I believe backend gc_mark_hook and
gc_sweep_hook ought to be protected similarly from being confused by
unexpected relocations (for example, both elf64-ppc.c and elf32-ppc.c
use _bfd_elf_relocs_compatible, so I think it would be possible for
the ppc64 gc_mark_hook to be presented with a ppc32 relocatable
object).

* elflink.c (elf_gc_sweep): Test elf_object_id in addition to
relocs_compatible.
(bfd_elf_gc_sections): Likewise.

7 years agoFix hppa-linux pr22269-1 fail
Alan Modra [Fri, 27 Oct 2017 04:34:25 +0000 (15:04 +1030)]
Fix hppa-linux pr22269-1 fail

Adds UNDEFWEAK_NO_DYNAMIC_RELOC in the rest of places needed in this
file, reduces dynamic relocations in a number of cases, and removes
some bogus code that was attempting to handle dynamic common symbols
specially.

PR 22269
* elf32-hppa.c (elf32_hppa_check_relocs): Move SEC_ALLOC test to
ensure non_got_ref is not set due to debug references.
(elf32_hppa_adjust_dynamic_symbol): Tidy plabel handling.  Use
SYMBOL_CALLS_LOCAL and UNDEFWEAK_NO_DYNAMIC_RELOC when determining
need for a plt entry.
(allocate_dynrelocs): Similarly for got entries.  Tidy code discarding
dynamic relocs when pic.  Remove bogus code attempting to handle
commons.
(elf32_hppa_relocate_section): Similarly.  Delete resolved_to_zero
and simplify.
(elf32_hppa_finish_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC
and SYMBOL_REFERENCES_LOCAL in GOT handling.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 30 Oct 2017 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoxtensa-xtregs: Fix formatting issues
Simon Marchi [Sun, 29 Oct 2017 17:01:19 +0000 (13:01 -0400)]
xtensa-xtregs: Fix formatting issues

Fix a few formatting issues in that file.

gdb/ChangeLog:

* xtensa-xtregs.c: Fix formatting issues.

7 years agoxtensa-xtregs: Constify field
Simon Marchi [Sun, 29 Oct 2017 05:13:33 +0000 (01:13 -0400)]
xtensa-xtregs: Constify field

Fix:

In file included from /home/emaisin/src/binutils-gdb/gdb/xtensa-linux-nat.c:46:0:
/home/emaisin/src/binutils-gdb/gdb/xtensa-xtregs.c:37:1: error: ISO C++ forbids converting a string constant to 'char*' [-Werror=write-strings]
 };
 ^

gdb/ChangeLog:

* xtensa-xtregs.c (xtensa_regtable_t) <name>: Constify.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 29 Oct 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoMake gdb.selected_thread().inferior return a new reference
Maksim Dzabraev [Sat, 28 Oct 2017 18:14:34 +0000 (01:14 +0700)]
Make gdb.selected_thread().inferior return a new reference

thpy_get_inferior function should return a new reference to the
existing inferior object, and therefore should increment its refcount.

Fixed bug looks like this.
If multiple time call gdb.selected_thread ().inferior, gdb throws exception:

(gdb) pi gdb.selected_thread().inferior
<gdb.Inferior object at 0x7f1952bea698>
(gdb) pi gdb.selected_thread().inferior
Python Exception <type 'exceptions.AttributeError'> 'NoneType' object
has no attribute 'inferior':
Error while executing Python code.
(gdb) info threads
  Id   Target Id         Frame
* 1    Thread 0x7f54f0474740 (LWP 584) "mc" 0x00007f54ef055c33 in

7 years agoPR22361 readelf buffer overflow on fuzzed archive header
Alan Modra [Sat, 28 Oct 2017 11:01:16 +0000 (21:31 +1030)]
PR22361 readelf buffer overflow on fuzzed archive header

PR 22361
* readelf.c (process_archive_index_and_symbols): Ensure ar_size
field is zero terminated for strtoul.
(setup_archive, get_archive_member_name): Likewise.

7 years agoPR22300, Abort in elf32_hppa_relocate_section building polyml
Alan Modra [Sat, 28 Oct 2017 03:40:55 +0000 (14:10 +1030)]
PR22300, Abort in elf32_hppa_relocate_section building polyml

polyml produces object files with the wrong OS/ABI for hppa-linux.
This, along with the fact that elf32-hppa.c is using the strictest
backend relocs_compatible, results in wrong merging of ELF symbols.

So, remove the relocs_compatible check in _bfd_elf_merge_symbol.
_bfd_elf_merge_symbol is only called nowadays from within blocks
protected by is_elf_hash_table, so "we are doing an ELF link" as the
removed comment says, is true.

Also relax relocs_compatible for hppa and powerpc.  relocs_compatible
is used for more than just merging symbols, as the name suggests.
This allows objects that are in fact reasonably compatible to be
linked.

PR 22300
* elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
* elf32-hppa.c (elf_backend_relocs_compatible): Define.
* elf32-ppc.c (elf_backend_relocs_compatible): Define.
* elf64-ppc.c (elf_backend_relocs_compatible): Define.

7 years agoRemove find_inferior usage for thread_search
Simon Marchi [Sat, 28 Oct 2017 03:44:12 +0000 (23:44 -0400)]
Remove find_inferior usage for thread_search

Replace it with for_each_thread.  While at it, we can inline the
callback code.  One little change is that I am using the
prev_general_thread variable instead of current_gen_ptid, since they
should have the same value.

gdb/gdbserver/ChangeLog:

* target.c (struct thread_search): Remove.
(thread_search_callback): Remove.
(prepare_to_access_memory): Use for_each_thread instead of
find_inferior.  Inline code from thread_search_callback.

7 years agoRemove usage of find_inferior in resume
Simon Marchi [Sat, 28 Oct 2017 03:43:11 +0000 (23:43 -0400)]
Remove usage of find_inferior in resume

Change find_inferior with find_thread.  Since we can now pass arguments
directly instead of through a void pointer, we don't need the
visit_actioned_threads_data structure anymore.

gdb/gdbserver/ChangeLog:

* server.c (struct visit_actioned_threads_data): Remove.
(visit_actioned_threads): Change prototype to take arguments
directly.
(resume): Use find_thread instead of find_inferior.

7 years agoRemove usages of find_inferior in handle_status
Simon Marchi [Sat, 28 Oct 2017 03:41:49 +0000 (23:41 -0400)]
Remove usages of find_inferior in handle_status

Replace one with find_thread, the other with for_each_thread.

gdb/gdbserver/ChangeLog:

* server.c (queue_stop_reply_callback): Change prototype, return
void.
(find_status_pending_thread_callback): Remove.
(handle_status): Replace find_inferior with find_thread and
for_each_thread.

7 years agocommon-utils-selftests.c: Add ATTRIBUTE_PRINTF
Simon Marchi [Sat, 28 Oct 2017 03:36:19 +0000 (23:36 -0400)]
common-utils-selftests.c: Add ATTRIBUTE_PRINTF

Fix this, when building with clang:

/home/emaisin/src/binutils-gdb/gdb/unittests/common-utils-selftests.c:50:40: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
  std::string result = string_vprintf (fmt, vp);
                                       ^~~
gdb/ChangeLog:

* unittests/common-utils-selftests.c (format): Add
ATTRIBUTE_PRINTF.

7 years agoC++ify xml-syscall.c
Simon Marchi [Sat, 28 Oct 2017 02:23:33 +0000 (22:23 -0400)]
C++ify xml-syscall.c

This patch C++ifies the structures in xml-syscall.c, by using
std::vector instead of VEC, and std::string instead of char*.
Using a unique_ptr in syscall_parse_xml allows to remove a cleanup.

Something that seems strange with the existing code, if you look at
syscalls_info_free_syscalls_desc and
syscalls_info_free_syscall_group_desc, they free the structure elements
(the strings and vectors), but they don't free the syscall_desc and
syscall_group_desc structure themselves.  I don't see anything freeing
those currently.  Any idea why?  According to the comment above
syscalls_info_free_syscall_group_desc, it kinda looks like it's on
purpose.  With this patch, those structures are deleted when the vector
that contains them gets deleted.

The only time I'm aware a syscalls_info structure gets deleted is in the
case the data directory changes during runtime, in init_syscalls_info.
If tried that use case (including under valgrind):

 (gdb) catch syscall
 (gdb) set data-directory another-data-directory
 (gdb) catch syscall

I confirmed that the syscalls_info structure got deleted and recreated,
and everything seemed fine.

Regtested on the buildbot.

gdb/ChangeLog:

* xml-syscall.c (struct syscall_desc): Add constructor.
<name>: Change type to std::string.
(syscall_desc_up): New typedef.
(syscall_desc_p): Remove typeder.
(DEF_VEC_P(syscall_desc_p)): Remove.
(struct syscall_group_desc): Add constructor.
<name>: Change type to std::string.
<syscalls>: Change type to std::vector.
(syscall_group_desc_up): New typedef.
(syscall_group_desc_p): Remove typedef.
(DEF_VEC_P(syscall_group_desc_p)): Remove.
(struct syscalls_info) <syscalls>: Change type to std::vector of
unique_ptr.
<groups>: Likewise.
<my_gdb_datadir>: Change type to std::string.
(syscalls_info_up): New typedef.
(allocate_syscalls_info): Remove.
(syscalls_info_free_syscalls_desc): Remove.
(syscalls_info_free_syscall_group_desc): Remove.
(free_syscalls_info): Remove.
(make_cleanup_free_syscalls_info): Remove.
(syscall_group_create_syscall_group_desc): Adjust.
(syscall_group_add_syscall): Adjust.
(syscall_create_syscall_desc): Adjust.
(syscall_parse_xml): Adjust, use unique_ptr instead of cleanup.
(init_syscalls_info): Adjust.
(syscall_group_get_group_by_name): Adjust.
(xml_get_syscall_number): Adjust.
(xml_get_syscall_name): Adjust.
(xml_list_of_syscalls): Adjust.
(xml_list_syscalls_by_group): Adjust.
(xml_list_of_groups): Adjust.

7 years agoGet rid of VEC(probe_p)
Simon Marchi [Sat, 28 Oct 2017 02:05:42 +0000 (22:05 -0400)]
Get rid of VEC(probe_p)

Replace the remaining usages of VEC(probe_p) with std::vector.

Regtested on the buildbot.

gdb/ChangeLog:

* probe.h: Don't include gdb_vecs.h.
(DEF_VEC_P (probe_p)): Remove.
(find_probes_in_objfile): Return an std::vector.
* probe.c (find_probes_in_objfile): Likewise.
* breakpoint.c (breakpoint_objfile_data)
<longjmp_probes>: Change type to std::vector.
<exception_probes>: Likewise.
(free_breakpoint_probes): Don't manually free vectors.
(create_longjmp_master_breakpoint): Adjust.
(create_exception_master_breakpoint): Adjust.
* solib-svr4.c (svr4_create_probe_breakpoints): Change
parameter type, adjust.
(svr4_create_solib_event_breakpoints): Adjust.

7 years agoAllocate breakpoint_objfile_data with new
Simon Marchi [Sat, 28 Oct 2017 02:01:21 +0000 (22:01 -0400)]
Allocate breakpoint_objfile_data with new

Allocate with new and free with delete.  This allows using an
std::vector in the following patch.

I renamed free_breakpoint_probes to free_breakpoint_objfile_data,
because it now doesn't only free the probes vector, but also the
breakpoint_objfile_data structure itself.

gdb/ChangeLog:

* breakpoint.c (breakpoint_objfile_data): Initialize fields.
(get_breakpoint_objfile_data): Allocate breakpoint_objfile_data
with new.
(free_breakpoint_probes): Rename to ...
(free_breakpoint_objfile_data): ... this, and call delete on
bp_objfile_data..

7 years agoGet rid of VEC(loaded_script_ptr)
Simon Marchi [Sat, 28 Oct 2017 01:55:42 +0000 (21:55 -0400)]
Get rid of VEC(loaded_script_ptr)

Direct replacement with std::vector.  This allows removing a cleanup as
well.

Regtested on the buildbot.

gdb/ChangeLog:

* auto-load.c: Don't include gdb_vecs.h, include algorithm.
(loaded_script_ptr): Remove typedef.
(DEF_VEC_P (loaded_script_ptr)): Remove.
(struct collect_matching_scripts_data): Add constructor.
<scripts_p>: Change type to (pointer to) std::vector.
(collect_matching_scripts_data): Adjust.
(sort_scripts_by_name): Make suitable for std::sort.
(print_scripts): Don't sort vector, adjust to std::vector.
(auto_load_info_scripts): Sort vectors, adjust to std::vector.

7 years agoGet rid of VEC(filename_language)
Simon Marchi [Sat, 28 Oct 2017 01:47:30 +0000 (21:47 -0400)]
Get rid of VEC(filename_language)

This patch removes VEC(filename_language), replacing its usage with
std::vector.  filename_language::ext is changed to an std::string at the
same time.

Regtested on the buildbot.

gdb/ChangeLog:

* symfile.c (filename_language): Make struct, not typedef.  Add
constructor.
<ext>: Change type to std::string.
(DEF_VEC_O (filename_language)): Remove.
(filename_language_table): Change type to std::vector.
(add_filename_language): Adjust.
(set_ext_lang_command): Adjust.
(info_ext_lang_command): Adjust.
(deduce_language_from_filename): Adjust.
(class scoped_restore_filename_language_table): Remove.
(test_filename_language): Use scoped_restore.
(test_set_ext_lang_command): Use scoped_restore, adjust to
std::vector change.

7 years agoAdd tests for filename_language
Simon Marchi [Sat, 28 Oct 2017 01:46:49 +0000 (21:46 -0400)]
Add tests for filename_language

The next patch touches the filename_language area, but I noticed there
is no test exercising that.  This patch adds some selftests for
add_filename_language, deduce_language_from_filename and
set_ext_lang_command.  Because these tests add entries to the global
filename_language_table vector, it is not possible to run them
successfully multiple times in a same GDB instance.  They can
potentially interfere with each other for the same reason.  I therefore
added the scoped_restore_filename_language_table class that is used to
make sure tests leave that global vector in the same state they found it
(it is replaced in the following patch by a simple scoped_restore).

gdb/ChangeLog:

* symfile.c: Include selftest.h.
(class scoped_restore_filename_language_table): New.
(test_filename_language): New test.
(test_set_ext_lang_command): New test.
(_initialize_symfile): Register tests.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 28 Oct 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoUse SaL symbol name when reporting breakpoint locations
Keith Seitz [Fri, 27 Oct 2017 17:57:23 +0000 (10:57 -0700)]
Use SaL symbol name when reporting breakpoint locations

Currently, "info break" can show some (perhaps) unexpected results when
setting a breakpoint on an inlined function:

(gdb) list
1 #include <stdio.h>
2
3 static inline void foo()
4 {
5         printf("Hello world\n");
6 }
7
8 int main()
9 {
10         foo();
11         return 0;
12 }
13
(gdb) b foo
Breakpoint 1 at 0x400434: file foo.c, line 5.
(gdb) i b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x0000000000400434 in main at foo.c:5

GDB reported that we understood what "foo" was, but we then report that the
breakpoint is actually set in main. While that is literally true, we can
do a little better.

This is accomplished by copying the symbol for which the breakpoint was set
into the bp_location.  From there, print_breakpoint_location can use this
information to print out symbol information (if available) instead of calling
find_pc_sect_function.

With the patch installed,

(gdb) i b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x0000000000400434 in foo at foo.c:5

gdb/ChangeLog:

* breakpoint.c (print_breakpoint_location): Use the symbol saved
in the bp_location, falling back to find_pc_sect_function when
needed.
(add_location_to_breakpoint): Save sal->symbol.
* breakpoint.h (struct bp_location) <symbol>: New field.
* symtab.c (find_function_start_sal): Save the symbol into the SaL.
* symtab.h (struct symtab_and_line) <symbol>: New field.

gdb/testsuite/ChangeLog:

* gdb.opt/inline-break.exp (break_info_1): New procedure.
Test "info break" for every inlined function breakpoint.

7 years ago[AArch64] Mark LR clobbered by BL in inline asm
Yao Qi [Fri, 27 Oct 2017 14:29:24 +0000 (15:29 +0100)]
[AArch64] Mark LR clobbered by BL in inline asm

LR is a caller-save register, so, if inline asm does BL (which touches
LR), we should mark LR clobbered.

gdb/testsuite:

2017-10-27  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/insn-reloc.c (can_relocate_bl): Mark "x30" clobbered.

7 years agodwarf: Read register number as unsigned in DW_CFA_def_cfa*
Simon Marchi [Fri, 27 Oct 2017 13:01:36 +0000 (09:01 -0400)]
dwarf: Read register number as unsigned in DW_CFA_def_cfa*

When displaying the .debug_frame section, the register numbers in the
DW_CFA_def_cfa* statements are read as signed numbers.  I have come
across a target that has register 121, encoded as 0x79 in unsigned LEB128.
Interpreting this as signed results in -7, which makes readelf display
"r-7".

The DWARF5 standard (6.4.2.2) states that the register numbers should be
treated as unsigned LEB128.

Simply replacing READ_SLEB with READ_ULEB resulted in warnings like
these:

/home/emaisin/src/binutils-gdb/binutils/dwarf.c: In function â€˜display_debug_frames’:
/home/emaisin/src/binutils-gdb/binutils/dwarf.c:355:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
       if ((var) != _val)     \
                 ^
/home/emaisin/src/binutils-gdb/binutils/dwarf.c:7866:8: note: in expansion of macro â€˜READ_ULEB’
        READ_ULEB (fc->cfa_reg);
        ^
... so I also changed Frame_Chunk::cfa_reg to an unsigned int.

binutils/ChangeLog:

* dwarf.c (struct Frame_Chunk) <cfa_reg>: Change type to
unsigned int.
(display_debug_frames): Read CFA reg as an unsigned number.

7 years agoAdd PR mention to previous commit
Simon Marchi [Fri, 27 Oct 2017 12:57:10 +0000 (08:57 -0400)]
Add PR mention to previous commit

7 years agoFix broken recursion detection when printing static members
Patrick Frants [Fri, 27 Oct 2017 02:26:08 +0000 (22:26 -0400)]
Fix broken recursion detection when printing static members

Recursion detection for static members was broken.  The implementation
uses a growing (and shrinking) obstack object to simulate a stack of
addresses (CORE_ADDR).  Pushing addresses is implemented by calling
obstack_grow(), while popping is implemented by calling obstack_free().
The latter is problematic because obstack_free() expects a pointer to
the base of an object.  When popping elements of the stack however,
obstack_free() was called with the new top, which potentially is not the
same as the base of the stack.  This is unintended use and the effect is
that obstack->next_free and obstack->object_base members are assigned
the value of the new top, which equals an empty stack.  Summary: popping
elements would always result in an empty stack, which breaks the
recursion detection.

The fix shrinks the stack using obstack_blank_fast() with a negative
value as described at the bottom of this page:
https://gcc.gnu.org/onlinedocs/libiberty/Extra-Fast-Growing.html "You
can use obstack_blank_fast with a “negative” size argument to make the
current object smaller.  Just don’t try to shrink it beyond zero
length—there’s no telling what will happen if you do that. Earlier
versions of obstacks allowed you to use obstack_blank to shrink objects.
This will no longer work."

The reproducer is added to gdb.cp/classes.exp, which fails without this
patch.

gdb/ChangeLog:

* cp-valprint.c (cp_print_value_fields): Use obstack_blank_fast
to rewind obstack.

gdb/testsuite/ChangeLog:

* gdb.cp/classes.exp (test_static_members): Test printing
Outer::instance.
* gdb.cp/classes.c (struct Inner, struct Outer): New.
(Inner::instance, Outer::instance): New.

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

7 years agoGarbage collect remote.c:remote_async_terminal_ours_p
Pedro Alves [Thu, 26 Oct 2017 18:53:03 +0000 (19:53 +0100)]
Garbage collect remote.c:remote_async_terminal_ours_p

remote.c:remote_async_terminal_ours_p stopped being useful after
048094accce2 ("target remote: Don't rely on immediate_quit (introduce
quit handlers)") and commit 41fd2b0f5d95 ("Make input_fd be per UI"),
which turned remote's terminal_inferior/ours methods into nops.

gdb/ChangeLog:
2017-10-26  Pedro Alves  <palves@redhat.com>

* remote.c (remote_async_terminal_ours_p): Delete.
(remote_open_1, remote_terminal_inferior, remote_terminal_ours):
Remove references to 'remote_async_terminal_ours_p'.

7 years agox86: Check invalid XMM register in AVX512 gathers
H.J. Lu [Thu, 26 Oct 2017 18:16:41 +0000 (11:16 -0700)]
x86: Check invalid XMM register in AVX512 gathers

Extend invalid register check for AVX512 gathers to XMM register.

PR gas/22352
* config/tc-i386.c (check_VecOperands): Also check XMM register
for invalid register in AVX512 gathers.
* testsuite/gas/i386/vgather-check.s: Add tests for AVX512
gathers with XMM register.
* testsuite/gas/i386/x86-64-vgather-check.s: Likewise.
* testsuite/gas/i386/vgather-check-error.l: Updated.
* testsuite/gas/i386/vgather-check-none.d: Likewise.
* testsuite/gas/i386/vgather-check-warn.d: Likewise.
* testsuite/gas/i386/vgather-check-warn.e: Likewise.
* testsuite/gas/i386/vgather-check.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-error.l: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-none.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-warn.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-warn.e: Likewise.
* testsuite/gas/i386/x86-64-vgather-check.d: Likewise.

7 years ago[PR21703]Adjust pr21703 tests on various targets.
Renlin Li [Thu, 26 Oct 2017 14:40:45 +0000 (15:40 +0100)]
[PR21703]Adjust pr21703 tests on various targets.

xfail tests for certain targets.
Check shared library support for shared test.
Relax pr21703-r.sd and pr21703-shared.sd with additional "#..." pattern lines.

ld/

* testsuite/ld-elf/elf.exp: xfail pr21703 tests on specific targets.
Only run shared lib test for targets which support it.
* testsuite/ld-elf/pr21703-r.sd: Adjust the expected output.
* testsuite/ld-elf/pr21703-shared.sd: Likewise.

7 years agoAs Alan predicted at https://sourceware.org/ml/binutils/2017-10/msg00137.html the...
James Greenhalgh [Thu, 26 Oct 2017 10:30:40 +0000 (11:30 +0100)]
As Alan predicted at https://sourceware.org/ml/binutils/2017-10/msg00137.html the values in some Arm tests need updating after recent changes. These looked a bit spooky at first, but they are just a difference in the order we emit veneers and far jumps, so are not so scary after all.

Checked with an arm-none-eabi tester and an arm-none-linux-gnueabi tester with no issues.

* testsuite/ld-arm/cortex-a8-far.d: Update expected disassembly.
* testsuite/ld-arm/farcall-group-size2: Likewise.
* testsuite/ld-arm/farcall-group.d: Likewise.

7 years agoRemove regular_breakpoint_inserted_here_p declaration
Yao Qi [Thu, 26 Oct 2017 08:53:38 +0000 (09:53 +0100)]
Remove regular_breakpoint_inserted_here_p declaration

There is no regular_breakpoint_inserted_here_p definition at all, so
this patch removes the declaration.

gdb:

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

* breakpoint.h (regular_breakpoint_inserted_here_p): Remove.

7 years agoconst-fy breakpoint_ops->breakpoint_hit parameter aspace
Yao Qi [Thu, 26 Oct 2017 08:46:16 +0000 (09:46 +0100)]
const-fy breakpoint_ops->breakpoint_hit parameter aspace

gdb:

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

* break-catch-sig.c (signal_catchpoint_breakpoint_hit): Make
aspace const.
* break-catch-syscall.c (breakpoint_hit_catch_syscall):
Likewise.
* breakpoint.c (bpstat_check_location): Remove cast.
(breakpoint_hit_catch_fork): Make aspce const.
(breakpoint_hit_catch_solib): Likewise.
(breakpoint_hit_catch_exec): Likewise.
(breakpoint_hit_ranged_breakpoint): Likewise.
(breakpoint_hit_watchpoint): Likewise.
(base_breakpoint_breakpoint_hit): Likewise.
(bkpt_breakpoint_hit): Likewise.
(dprintf_breakpoint_hit): Likewise.
(tracepoint_breakpoint_hit): Likewise.
* breakpoint.h (breakpoint_ops) <breakpoint_hit>: Likewise.

7 years agoconst-fy function parameter struct address_space *aspace
Yao Qi [Thu, 26 Oct 2017 08:46:16 +0000 (09:46 +0100)]
const-fy function parameter struct address_space *aspace

This patch changes the parameter "struct address_space *aspace" to "const
address_space *aspace" in many functions.

gdb:

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

* breakpoint.c (breakpoint_location_address_match): Change
"struct address_space *" to "const address_space".
(breakpoint_location_address_range_overlap): Likewise.
(breakpoint_here_p): Likewise.
(breakpoint_in_range_p): Likewise.
(moribund_breakpoint_here_p): Likewise.
(bp_location_inserted_here_p): Likewise.
(software_breakpoint_inserted_here_p): Likewise.
(hardware_breakpoint_inserted_here_p): Likewise.
(hardware_watchpoint_inserted_in_range): Likewise.
(bpstat_check_location): Likewise.
(bpstat_stop_status): Likewise.
(breakpoint_address_match): Likewise.
(breakpoint_address_match_range): Likewise.
(breakpoint_location_address_match): Likewise.
(breakpoint_location_address_range_overlap): Likewise.
(insert_single_step_breakpoint): Likewise.
(breakpoint_has_location_inserted_here): Likewise.
(single_step_breakpoint_inserted_here_p): Likewise.
(pc_at_non_inline_function): Likewise.
* breakpoint.h (bpstat_stop_status): Update declaration.
(breakpoint_here_p): Likewise.
(breakpoint_in_range_p): Likewise.
(moribund_breakpoint_here_p): Likewise.
(breakpoint_inserted_here_p): Likewise.
(software_breakpoint_inserted_here_p): Likewise.
(hardware_breakpoint_inserted_here_p): Likewise.
(breakpoint_has_location_inserted_here): Likewise.
(single_step_breakpoint_inserted_here_p): Likewise.
(hardware_watchpoint_inserted_in_range): Likewise.
(breakpoint_address_match): Likewise.
(insert_single_step_breakpoint): Likewise.
(pc_at_non_inline_function): Likewise.
* gdbthread.h (thread_has_single_step_breakpoint_here): Likewise.
* record.c (record_check_stopped_by_breakpoint): Likewise.
* record.h (record_check_stopped_by_breakpoint): Likewise.
* thread.c (thread_has_single_step_breakpoint_here): Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 26 Oct 2017 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agotestsuite/gas/all/fill-1.s: Use L2 rather than .L2.
Hans-Peter Nilsson [Wed, 25 Oct 2017 23:11:06 +0000 (01:11 +0200)]
testsuite/gas/all/fill-1.s: Use L2 rather than .L2.

For some targets, like mmix-knuth-mmixware, .L2 (and .L1) are invalid
symbols.

7 years agold: Correct -z ibt documentation
H.J. Lu [Wed, 25 Oct 2017 15:44:54 +0000 (08:44 -0700)]
ld: Correct -z ibt documentation

* ld.texinfo: Correct -z ibt.