and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

  1. 11 Aug, 2017 11 commits
    • H.J. Lu's avatar
      x86: Add R_X86_64_GPOFF/R_386_GPOFF relocation · 8a034336
      H.J. Lu authored
      On x86, a segment register is used as thread pointer to access thread
      local storage (TLS) with __thread.  TLS is an OS-dependent, user-space
      feature.
      
      Here is a proposal to add R_X86_64_GPOFF/R_386_GPOFF relocation to
      access symbol with an offset to global pointer, __gp.  The assembly
      syntax is
      
      1. Load value of foo relative to __gp, pointed by %seg, into %reg:
      
      	op %seg:foo@GPOFF, %reg
      
      2. Store value in %reg to foo relative to __gp, pointed by %seg:
      
      	op %reg, %seg:foo@GPOFF
      
      3. Compute offset of foo to __gp:
      
      	lea foo@GPOFF, %reg
      	.long foo@GPOFF
      
      Linker sets __gp to the middle of the section which contains definitions
      of symbols with GPOFF relocations and the maximum offset is [-2G, 2G).
      Run-time must initialize the segment register, %seg, with the address of
      global pointer, __gp.
      
      bfd/
      
      	* elf32-i386.c (elf_howto_table): Add R_386_GPOFF.
      	(R_386_ext2): Replace R_386_GOT32X with R_386_GPOFF.
      	(elf_i386_reloc_type_lookup): Support BFD_RELOC_GPREL32.
      	(elf_i386_link_hash_entry): Add has_gpoff_reloc.
      	(elf_i386_link_hash_table): Add gp.
      	(elf_i386_link_hash_newfunc): Initialize has_gpoff_reloc to 0.
      	(elf_i386_copy_indirect_symbol): Also copy has_gpoff_reloc.
      	(elf_i386_check_relocs): Add a fake local symbol and set
      	has_gpoff_reloc for GPOFF relocation.
      	(elf_i386_allocate_local_dynrelocs): Skip local symbol with
      	GPOFF relocation.
      	(elf_i386_finish_local_dynamic_symbol): Likewise.
      	(elf_i386_relocate_section): Process GPOFF relocation.
      	(elf_i386_link_check_relocs): Cache and hide __gp symbol.
      	(elf_i386_setup_gp): New function.
      	(elf_i386_setup_gp_from_local_symbol): Likewise.
      	(elf_i386_final_link): Likewise.
      	(bfd_elf32_bfd_final_link): New.
      	* elf64-x86-64.c (elf_howto_table): Add R_X86_64_GPOFF.
      	(R_X86_64_standard): Replace R_X86_64_REX_GOTPCRELX with
      	R_X86_64_GPOFF.
      	(x86_64_reloc_map): Add BFD_RELOC_GPREL32.
      	(elf_x86_64_link_hash_entry): Add has_gpoff_reloc.
      	(elf_x86_64_link_hash_table): Add gp.
      	(elf_x86_64_link_hash_newfunc): Initialize has_gpoff_reloc to 0.
      	(elf_x86_64_copy_indirect_symbol): Also copy has_gpoff_reloc.
      	(elf_x86_64_check_relocs): Add a fake local symbol and set
      	has_gpoff_reloc for GPOFF relocation.
      	(elf_x86_64_allocate_local_dynrelocs): Skip local symbol with
      	GPOFF relocation.
      	(elf_x86_64_finish_local_dynamic_symbol): Likewise.
      	(elf_x86_64_relocate_section): Process GPOFF relocation.
      	(elf_x86_64_link_check_relocs): Cache and hide __gp symbol.
      	(elf_x86_64_setup_gp): New function.
      	(elf_x86_64_setup_gp_from_local_symbol): Likewise.
      	(elf_x86_64_final_link): Likewise.
      	(bfd_elf64_bfd_final_link): New.
      	(bfd_elf32_bfd_final_link): Likewise.
      
      gas/
      
      	* config/tc-i386.c (GP_symbol): New.
      	(gotrel): Add "GPOFF".
      	(lex_got): Support BFD_RELOC_GPREL32.
      	(i386_displacement): Disallow BFD_RELOC_GPREL32 relocation
      	with base or index registers.
      	(md_undefined_symbol): Create GP_symbol if needed.
      	(tc_gen_reloc): Handle BFD_RELOC_GPREL32.
      	* config/tc-i386.h (GLOBAL_POINTER_NAME): New.
      	* testsuite/gas/i386/gpoff.d: New file.
      	* testsuite/gas/i386/gpoff.s: Likewise.
      	* testsuite/gas/i386/inval-gpoff.l: Likewise.
      	* testsuite/gas/i386/inval-gpoff.s: Likewise.
      	* testsuite/gas/i386/x86-64-gpoff.d: Likewise.
      	* testsuite/gas/i386/x86-64-gpoff.s: Likewise.
      	* testsuite/gas/i386/x86-64-inval-gpoff.l: Likewise.
      	* testsuite/gas/i386/x86-64-inval-gpoff.s: Likewise.
      	* testsuite/gas/i386/i386.exp: Run gpoff, inval-gpoff,
      	x86-64-gpoff and x86-64-inval-gpoff.
      
      include/
      
      	* elf/i386.h (R_386_GPOFF): New relocation.
      	* elf/x86-64.h (R_X86_64_GPOFF): Likewise.
      
      ld/
      
      	* testsuite/ld-i386/gpoff-1a.S: New file.
      	* testsuite/ld-i386/gpoff-1b.c: Likewise.
      	* testsuite/ld-i386/gpoff-2a.S: Likewise.
      	* testsuite/ld-i386/gpoff-2b.c: Likewise.
      	* testsuite/ld-i386/gpoff-3.d: Likewise.
      	* testsuite/ld-i386/gpoff-3.s: Likewise.
      	* testsuite/ld-i386/gpoff-4.d: Likewise.
      	* testsuite/ld-i386/gpoff-4.s: Likewise.
      	* testsuite/ld-i386/gpoff-5.d: Likewise.
      	* testsuite/ld-i386/gpoff-5.s: Likewise.
      	* testsuite/ld-i386/gpoff-6.d: Likewise.
      	* testsuite/ld-i386/gpoff-6.s: Likewise.
      	* testsuite/ld-i386/gpoff-7.d: Likewise.
      	* testsuite/ld-i386/gpoff-7.s: Likewise.
      	* testsuite/ld-i386/gpoff-8.s: Likewise.
      	* testsuite/ld-i386/gpoff-8.t: Likewise.
      	* testsuite/ld-i386/gpoff-8a.d: Likewise.
      	* testsuite/ld-i386/gpoff-8b.d: Likewise.
      	* testsuite/ld-i386/gpoff-8c.d: Likewise.
      	* testsuite/ld-i386/gpoff-8d.d: Likewise.
      	* testsuite/ld-i386/gpoff-8e.d: Likewise.
      	* testsuite/ld-i386/gpoff-8f.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-1a.S: Likewise.
      	* testsuite/ld-x86-64/gpoff-1b.c: Likewise.
      	* testsuite/ld-x86-64/gpoff-2a.S: Likewise.
      	* testsuite/ld-x86-64/gpoff-2b.c: Likewise.
      	* testsuite/ld-x86-64/gpoff-3.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-3.s: Likewise.
      	* testsuite/ld-x86-64/gpoff-4.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-4.s: Likewise.
      	* testsuite/ld-x86-64/gpoff-5.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-5.s: Likewise.
      	* testsuite/ld-x86-64/gpoff-6.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-6.s: Likewise.
      	* testsuite/ld-x86-64/gpoff-7.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-7.s: Likewise.
      	* testsuite/ld-x86-64/gpoff-8.s: Likewise.
      	* testsuite/ld-x86-64/gpoff-8.t: Likewise.
      	* testsuite/ld-x86-64/gpoff-8a.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-8b.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-8c.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-8d.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-8e.d: Likewise.
      	* testsuite/ld-x86-64/gpoff-8f.d: Likewise.
      	* testsuite/ld-i386/i386.exp: Run R_386_GPOFF tests.
      	* testsuite/ld-x86-64/x86-64.exp: Run R_X86_64_GPOFF tests.
      8a034336
    • H.J. Lu's avatar
      x86: Allocate space for symbol names with symbol table · 98c5dfc9
      H.J. Lu authored
      When synthesizing symbols for PLT entries, allocate space for symbol
      names with @plt suffixes together with symbol table so that all memory
      is returned when symbol table is freed.
      
      	PR binutils/21943
      	* elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
      	for @plt suffixes first.
      	* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
      98c5dfc9
    • Nick Clifton's avatar
      Add -z globalaudit linker command line option to set the DF_GLOBALAUDIT flag... · 93ab9c0d
      Nick Clifton authored
      Add -z globalaudit linker command line option to set the DF_GLOBALAUDIT flag bit in the dynamic tags.
      
      	* emultempl/elf32.em (handle_option): Accept the -z globalaudit
      	command line option.
      	* lexsup.c (elf_static_list_options): Add -z globalaudit.
      	* ld.texinfo: Document the support for the new command line
      	option.
      	* NEWS: Mention the new feature.
      	* testsuite/ld-elf/audit.exp: Add a test of the -z globalaudit
      	command line option.
      	* testsuite/ld-elf/globalaudit.rd: New file: Expected output from
      	readelf.
      93ab9c0d
    • H.J. Lu's avatar
      Add 2 more tests for PR ld/21884 · 9593aade
      H.J. Lu authored
      	PR ld/21884
      	* testsuite/ld-i386/i386.exp: Run pr21884.
      	* testsuite/ld-x86-64/x86-64.exp: Likewise.
      	* testsuite/ld-i386/pr21884.d: New file.
      	* testsuite/ld-i386/pr21884.t: Likewise.
      	* testsuite/ld-x86-64/pr21884.d: Likewise.
      	* testsuite/ld-x86-64/pr21884.t: Likewise.
      9593aade
    • H.J. Lu's avatar
      Also disallow global alias of common symbol · 76db0a2e
      H.J. Lu authored
      We can't create alias of common symbol.  Local alias of common symbol has
      been disallowed.  But global alias of common symbol is disallowed when the
      common symbol is seen first and silently dropped otherwise.  This patch
      disallows alias of common symbol in all cases.
      
      gas/
      
      	PR gas/21667
      	* read.c (pseudo_set): Update error message for alias of common
      	symbol.
      	* write.c (write_object_file): Disallow both local and global
      	aliases of common symbol.
      	* testsuite/gas/elf/common5a.d: New file.
      	* testsuite/gas/elf/common5a.l: Likewise.
      	* testsuite/gas/elf/common5a.s: Likewise.
      	* testsuite/gas/elf/common5b.d: Likewise.
      	* testsuite/gas/elf/common5b.l: Likewise.
      	* testsuite/gas/elf/common5b.s: Likewise.
      	* testsuite/gas/elf/common5c.d: Likewise.
      	* testsuite/gas/elf/common5c.s: Likewise.
      	* testsuite/gas/elf/common5d.d: Likewise.
      	* testsuite/gas/elf/common5d.s: Likewise.
      	* testsuite/gas/elf/elf.exp: Run common5a, common5b, common5c
      	and common5d.
      76db0a2e
    • Pedro Alves's avatar
      More gdb/skip.c C++ification · de7985c3
      Pedro Alves authored
      - Make skiplist_entry a class with private data members.
      - Move all construction logic to the ctor.
      - Make skip_file_p etc be methods of skiplist_entry.
      - Use std::list for the skip entries chain.  Make the list own its
        elements.
      - Get rid of the ALL_SKIPLIST_ENTRIES/ALL_SKIPLIST_ENTRIES_SAFE
        macros, use range-for / iterators instead.
      - function_name_is_marked_for_skip 'function_sal' argument must be
        non-NULL, so make it a reference instead.
      
      All skiplist_entry invariants are now controlled by skiplist_entry
      methods/internals.  Some gdb_asserts disappear for being redundant.
      
      gdb/ChangeLog:
      2017-08-11  Pedro Alves  <palves@redhat.com>
      
      	* infrun.c (process_event_stop_test): Adjust
      	function_name_is_marked_for_skip call.
      	* skip.c: Include <list>.
      	(skiplist_entry): Make it a class with private fields, and
      	getters/setters.
      	(skiplist_entry_chain): Delete.
      	(skiplist_entries): New.
      	(skiplist_entry_count): Delete.
      	(highest_skiplist_entry_num): New.
      	(ALL_SKIPLIST_ENTRIES, ALL_SKIPLIST_ENTRIES_SAFE): Delete.
      	(add_skiplist_entry): Delete.
      	(skiplist_entry::skiplist_entry): New.
      	(skiplist_entry::add_entry): New.
      	(skip_file_command, skip_function): Adjust.
      	(compile_skip_regexp): Delete.
      	(skip_command): Don't compile regexp here.  Adjust to use
      	skiplist_entry::add_entry.
      	(skip_info): Adjust to use range-for and getters.
      	(skip_enable_command, skip_disable_command): Adjust to use
      	range-for and setters.
      	(skip_delete_command): Adjust to use std::list.
      	(add_skiplist_entry): Delete.
      	(skip_file_p): Delete, refactored as ...
      	(skiplist_entry::do_skip_file_p): ... this new method.
      	(skip_gfile_p): Delete, refactored as ...
      	(skiplist_entry::do_gskip_file_p): ... this new method.
      	(skip_function_p, skip_rfunction_p): Delete, refactored as ...
      	(skiplist_entry::skip_function_p): ... this new method.
      	(function_name_is_marked_for_skip): Now returns bool, and takes
      	the function sal by const reference.  Adjust to use range-for and
      	skiplist_entry methods.
      	(_initialize_step_skip): Remove references to
      	skiplist_entry_chain, skiplist_entry_count.
      	* skip.h (function_name_is_marked_for_skip): Now returns bool, and
      	takes the function sal by const reference.
      de7985c3
    • Yao Qi's avatar
      Reset *THIS_CACHE in frame_unwind_try_unwinder in case of exception · be7d3cd5
      Yao Qi authored
      It is required that unwinder->sniffer should set *this_cache to NULL if
      the unwinder is not applicable or exception is thrown, so
      78ac5f83 adds clear_pointer_cleanup to set
      *this_cache to NULL in case of exception in order to fix PR 14100.
      https://sourceware.org/ml/gdb-patches/2012-08/msg00075.html
      
      This patch removes that clear_pointer_cleanup, and catch all exception in
      the caller of unwinder->sniffer.  In case of exception, reset *this_case.
      
      gdb:
      
      2017-08-11  Yao Qi  <yao.qi@linaro.org>
      
      	* dwarf2-frame.c (clear_pointer_cleanup): Remove.
      	(dwarf2_frame_cache): Remove reset_cache_cleanup.
      	(dwarf2_frame_cache):
      	* frame-unwind.c (frame_unwind_try_unwinder): Catch
      	RETURN_MASK_ALL and set *this_case to NULL.
      	* frame-unwind.h: Update comments.
      be7d3cd5
    • Yao Qi's avatar
      Class-fy dwarf2_frame_state_reg_info · 1c90d9f0
      Yao Qi authored
      This patch adds dwarf2_frame_state_reg_info ctor, dtor, copy ctor,
      assignment operator, and move assignment.  This patch also adds unit test
      to execute_cfa_program to cover the changes.
      
      gdb:
      
      2017-08-11  Yao Qi  <yao.qi@linaro.org>
      
      	* dwarf2-frame.c (dwarf2_frame_state_alloc_regs): Remove.
      	(dwarf2_frame_state_copy_regs): Remove.
      	(dwarf2_frame_state_free_regs): Remove.
      	(dwarf2_frame_state::~dwarf2_frame_state): Remove.
      	(dwarf2_restore_rule): Call method .alloc_regs instead of
      	dwarf2_frame_state_alloc_regs.
      	(execute_cfa_program): Likewise.  Call dwarf2_frame_state_reg_info
      	constructor.  Call std::move.
      	(dwarf2_fetch_cfa_info): Don't call dwarf2_frame_state_copy_regs.
      	(dwarf2_frame_cache): Likewise.
      
      	[GDB_SELF_TEST]: Include selftest.h and
      	selftest-arch.h.
      	[GDB_SELF_TEST] (execute_cfa_program_test): New function.
      	(_initialize_dwarf2_frame) [GDB_SELF_TEST]: Register
      	execute_cfa_program_test.
      
      	* dwarf2-frame.h (dwarf2_frame_state_reg_info): Add ctor, dtor,
      	copy ctor, assignment operator, move assignment.
      	<alloc_regs>: New method.
      	<swap>: New method.
      	(struct dwarf2_frame_state): Delete dtor.
      	(dwarf2_frame_state_alloc_regs): Remove declaration.
      	* sparc-tdep.c (sparc_execute_dwarf_cfa_vendor_op): Don't call
      	dwarf2_frame_state_alloc_regs, use .alloc_regs instead.
      1c90d9f0
    • Yao Qi's avatar
      Class-fy dwarf2_frame_state · afe37d6b
      Yao Qi authored
      This patch adds ctor and dtor to dwarf2_frame_state, so that we can
      remove one cleanup "old_chain".
      
      gdb:
      
      2017-08-11  Yao Qi  <yao.qi@linaro.org>
      
      	* dwarf2-frame.c (dwarf2_frame_state_free): Remove.
      	(dwarf2_frame_state::dwarf2_frame_state): New.
      	(dwarf2_frame_state::~dwarf2_frame_state): New.
      	(dwarf2_fetch_cfa_info): Update.
      	(dwarf2_frame_cache): Remove old_chain.  Change 'fs' to an object
      	rather than a pointer.  Update code.
      	* dwarf2-frame.h (struct dwarf2_frame_state): Declare ctor and
      	dtor.
      	<data_align, code_align, retaddr_column>: Change them to const.
      	<armcc_cfa_offsets_sf, armcc_cfa_offsets_reversed>: Change them
      	to bool.
      afe37d6b
    • Yao Qi's avatar
      Move dwarf2_frame_state_reg.exp_len to union .loc · b348037f
      Yao Qi authored
      dwarf2_frame_state_reg.exp_len is only used together with .loc.exp, so
      it makes more sense to exp_len to the union as well.
      
      gdb:
      
      2017-08-11  Yao Qi  <yao.qi@linaro.org>
      
      	* dwarf2-frame.h (struct dwarf2_frame_state_reg) <exp_len>: Remove.
      	<loc.exp>: New field.
      	* dwarf2-frame.c (execute_cfa_program): Update.
      	(dwarf2_frame_prev_register): Update.
      b348037f
    • GDB Administrator's avatar
      Automatic date update in version.in · 5af3691c
      GDB Administrator authored
      5af3691c
  2. 10 Aug, 2017 5 commits
    • Pedro Alves's avatar
      Allow gdb::unique_xmalloc_ptr<T[]> · e7c9de26
      Pedro Alves authored
      Currently, if you try to use the array version of
      gdb::unique_xmalloc_ptr (i.e., std::unique_ptr) in order to have
      access to operator[], like:
      
        gdb::unique_xmalloc_ptr<char[]> buf ((char *) xmalloc (10));
        return buf[0];
      
      then the build fails, like:
      
        /usr/include/c++/5.3.1/bits/unique_ptr.h: In instantiation of ‘std::unique_ptr<_Tp [], _Dp>::~unique_ptr() [with _Tp = char; _Dp = gdb::xfree_deleter<char []>]’:
        main.c:30:61:   required from here
        /usr/include/c++/5.3.1/bits/unique_ptr.h:484:17: error: no match for call to ‘(std::unique_ptr<char [], gdb::xfree_deleter<char []> >::deleter_type {aka gdb::xfree_deleter<char []>}) (char*&)’
            get_deleter()(__ptr);
      		   ^
        In file included from src/gdb/common/common-defs.h:92:0,
      		   from src/gdb/defs.h:28,
      		   from src/gdb/main.c:20:
        src/gdb/common/gdb_unique_ptr.h:34:8: note: candidate: void gdb::xfree_deleter<T>::operator()(T*) const [with T = char []]
           void operator() (T *ptr) const { xfree (ptr); }
      	  ^
        src/gdb/common/gdb_unique_ptr.h:34:8: note:   no known conversion for argument 1 from ‘char*’ to ‘char (*)[]’
        Makefile:1911: recipe for target 'main.o' failed
        make: *** [main.o] Error 1
      
      The problem is that we're missing an xfree_deleter specialization for
      arrays.
      
      gdb/ChangeLog:
      2017-08-10  Pedro Alves  <palves@redhat.com>
      
      	* common/gdb_unique_ptr.h (xfree_deleter<T[]>): Define.
      e7c9de26
    • Nick Clifton's avatar
      Add support for PE startup files that want to define their own constructor and... · ca6f2be7
      Nick Clifton authored
      Add support for PE startup files that want to define their own constructor and desctructor sequencing.
      
      	* scripttempl/pep.sc: Enclose __CTOR_LIST__, ___CTOR_LIST__,
      	__DTOR_LIST__ and ___DTOR_LIST__ in PROVIDE statements so that
      	they can be overrridden by crt input files.
      	* scripttempl/pe.sc: Likewise.
      ca6f2be7
    • Nick Clifton's avatar
      Fix memory corruption when assembling an i386 darwin source file. · 4c2da80c
      Nick Clifton authored
      	PR gas/21939
      	* config/obj-macho.c (obj_mach_o_set_indirect_symbols): Increase
      	size of indirect_syms array so that it is large enough to hold
      	every symbol if necessary.
      4c2da80c
    • Nick Clifton's avatar
      Fix out of bounds memory access when trying to allocate space for a note of size -1. · 957e1fc1
      Nick Clifton authored
      	PR 21933
      	* elf.c (elf_read_notes): Check for a note size of -1.
      957e1fc1
    • GDB Administrator's avatar
      Automatic date update in version.in · 3ecaa9fd
      GDB Administrator authored
      3ecaa9fd
  3. 09 Aug, 2017 19 commits
    • H.J. Lu's avatar
      LD_CLASS: Check .libs/ld-new for linker first · 7ed1dab9
      H.J. Lu authored
      When --enable-shared is used, ./ld-new may be a shell script and the
      real linker is .libs/ld-new.  We should check .libs/ld-new first.
      
      	* testsuite/config/default.exp (LD_CLASS): Check .libs/ld-new
      	for linker first.
      7ed1dab9
    • John Baldwin's avatar
      Replace home-grown linked-lists in FreeBSD's native target with STL lists. · e8c6b620
      John Baldwin authored
      FreeBSD's native target uses linked-lists to keep track of pending fork
      events and fake vfork done events.  Replace the first list with std::list
      and the second with std::forward_list.
      
      gdb/ChangeLog:
      
      	* fbsd-nat.c (struct fbsd_fork_info): Remove.
      	(fbsd_pending_children): Use std::list.
      	(fbsd_remember_child): Likewise.
      	(fbsd_is_child_pending): Likewise.
      	(fbsd_pending_vfork_done): Use std::forward_list.
      	(fbsd_add_vfork_done): Likewise.
      	(fbsd_is_vfork_done_pending): Likewise.
      	(fbsd_next_vfork_done): Likewise.
      e8c6b620
    • John Baldwin's avatar
      Replace remaining cleanups in fbsd-nat.c. · e4a26669
      John Baldwin authored
      - Use a custom deleter with std::unique_ptr to free() memory returned
        by kinfo_getvmmap().
      - Use std::string with string_printf() to generate the pathname of the
        procfs 'map' file.
      - Use gdb::byte_vector to manage the dynamic buffer for
        TARGET_OBJECT_AUXV and the dynamically allocated array of LWP IDs.
      
      gdb/ChangeLog:
      
      	* fbsd-nat.c [HAVE_KINFO_GETVMMAP] (struct free_deleter): New.
      	(fbsd_find_memory_regions): Use free_deleter with std::unique_ptr.
      	[!HAVE_KINFO_GETVMMAP] (fbsd_find_memory_regions): Use std::string
      	for `mapfilename'.
      	(fbsd_xfer_partial): Use gdb::byte_vector.
      	(fbsd_add_threads): Likewise.
      e4a26669
    • John Baldwin's avatar
      Fix compile in the !HAVE_KINFO_GETVMMAP case. · 142311d3
      John Baldwin authored
      gdb/ChangeLog:
      
      	* fbsd-nat.c: [!HAVE_KINFO_GETVMMAP]: Include <sys/user.h> and
      	"filestuff.h".
      	(fbsd_find_memory_regions): Fix `mapfile' initialization.
      142311d3
    • H.J. Lu's avatar
      Run PR ld/17618 test only with 64-bit ELF linker · 978c0540
      H.J. Lu authored
      PR ld/17618 test requires 64-bit linker to run.  Set LD_CLASS to "64bit"
      for 64-bit ELF linker and run PR ld/17618 test only if $LD_CLASS is
      "64bit".  More checks can be added to support 64-bit linkers in non-ELF
      format.
      
      	* testsuite/config/default.exp (LD_CLASS): New.  Set to "64bit"
      	for 64-bit ELF linker.
      	* testsuite/ld-x86-64/pr17618.d (#notarget): Removed.
      	* testsuite/ld-x86-64/x86-64.exp: Run pr17618 only for 64-bit
      	linker.
      978c0540
    • Simon Marchi's avatar
      doc: Fix copy-pasto in Z0 packet documentation · 0968fbae
      Simon Marchi authored
      The documentation for the cmd_list field of the Z0 packet refers to its
      content as a conditional expression, which seems like a copy-paste error
      from the cond_list field.
      
      gdb/doc/ChangeLog:
      
      	* gdb.texinfo (Packets): Fix Z0 cmd_list doc referring to
      	conditional expression.
      0968fbae
    • Tom Tromey's avatar
      C++-ify skip.c · 42fa2e0e
      Tom Tromey authored
      I happened to notice that skiplist_entry, in skip.c, contains a
      gdb::optional<compiled_regex> -- but that this object's destructor is
      never run.  This can result in a memory leak.
      
      This patch fixes the bug by applying a bit more C++: changing this
      code to use new and delete, and std::unique_ptr; and removing cleanups
      in the process.
      
      Built and regression tested on x86-64 Fedora 25.
      
      ChangeLog
      2017-08-09  Tom Tromey  <tom@tromey.com>
      
      	* skip.c (skiplist_entry): New constructor.
      	(skiplist_entry::enabled, skiplist_entry::function_is_regexp)
      	(skiplist_entry::file_is_glob): Now bool.
      	(skiplist_entry::file, skiplist_entry::function): Now
      	std::string.
      	(make_skip_entry): Return a unique_ptr.  Use new.
      	(free_skiplist_entry, free_skiplist_entry_cleanup)
      	(make_free_skiplist_entry_cleanup): Remove.
      	(skip_command, skip_disable_command, add_skiplist_entry)
      	(skip_form_bytes, compile_skip_regexp, skip_command, skip_info)
      	(skip_file_p, skip_gfile_p, skip_function_p, skip_rfunction_p)
      	(function_name_is_marked_for_skip): Update.
      	(skip_delete_command): Update.  Use delete.
      42fa2e0e
    • Jiong Wang's avatar
      [ARM] Don't warn on REG_SP when used in CRC32 instructions · cc4a945a
      Jiong Wang authored
      According to ARMv8-A architecture manual, REG_SP is allowed in CRC32
      instructions in Thumb mode.  It is REG_PC that will cause unpredictable
      behaviours on both ARM and Thumb.
      
      This patch removes the incorrect warning on Thumb mode.
      
      Meanwhile the disassembler is updated to use format "<bitfield>R" instead of
      "<bitfield>S".  "<bitfield>S" is not used elsewhere. so I have deleted related
      code from the disassembler.
      
      gas/
      	* config/tc-arm.c (do_crc32_1): Remove warning on REG_SP for thumb_mode.
      	* testsuite/gas/arm/crc32-armv8-a-bad.d: Update exepcted result.
      	* testsuite/gas/arm/crc32-armv8-r-bad.d: Likewise.
      	* testsuite/gas/arm/crc32-armv8-a.d: Likewise.
      	* testsuite/gas/arm/crc32-armv8-r.d: Likewise.
      	* testsuite/gas/arm/crc32-armv8-ar-bad.s: Update test case.
      	* testsuite/gas/arm/crc32-armv8-ar.s: Likewise.
      	* testsuite/gas/arm/crc32-bad.l: Update expected error message.
      
      opcode/
      	* arm-dis.c (thumb32_opcodes): Use format 'R' instead of 'S' for
      	register operands in CRC instructions.
      	(print_insn_thumb32): Remove "<bitfield>S" support.  Updated the
      	comments.
      cc4a945a
    • Jiong Wang's avatar
      [AArch64] Implement gdbarch_core_read_description · cd3af38d
      Jiong Wang authored
      Recommit with missing header files added.
      
      gdb/
      	* aarch64-linux-tdep.c: Include "auxv.h" and "elf/common.h".
      	(aarch64_linux_core_read_description): New function.
      	(aarch64_linux_init_abi): Register gdbarch_core_read_description.
      cd3af38d
    • Jiong Wang's avatar
      Revert "[AArch64] Implement gdbarch_core_read_description" · 0f76ffaf
      Jiong Wang authored
      This reverts commit b1a6c1ce.
      0f76ffaf
    • Jiong Wang's avatar
      [AArch64] Implement gdbarch_core_read_description · b1a6c1ce
      Jiong Wang authored
      Currently, AArch64 only have one target description which is tdesc_aarch64.  So,
      we haven't implemented any target description detection mechanism for core file.
      
      This patch is an initial implementation of core_read_description method.  Future
      features can use this to return selected description.
      
      gdb/
      	* aarch64-linux-tdep.c (aarch64_linux_core_read_description): New
      	function.
      	(aarch64_linux_init_abi): Register gdbarch_core_read_description.
      b1a6c1ce
    • Pedro Alves's avatar
      Make cp_comp_to_string return a gdb::unique_xmalloc_ptr<char> · 29592bde
      Pedro Alves authored
      To help avoid issues like the one fixed by e88e8651 ("Fix memory
      leak in cp-support.c").
      
      gdb/ChangeLog:
      2017-08-09  Pedro Alves  <palves@redhat.com>
      
      	* cp-name-parser.y (cp_comp_to_string): Return a
      	gdb::unique_xmalloc_ptr<char>.
      	* cp-support.c (replace_typedefs_qualified_name)
      	(replace_typedefs): Adjust to use gdb::unique_xmalloc_ptr<char>.
      	(cp_canonicalize_string_full): Use op= instead of explicit
      	convertion.
      	(cp_class_name_from_physname, method_name_from_physname)
      	(cp_func_name, cp_remove_params): Adjust to use
      	gdb::unique_xmalloc_ptr<char>.
      	* cp-support.h (cp_comp_to_string): Return a
      	gdb::unique_xmalloc_ptr<char>.
      	* python/py-type.c (typy_lookup_type): Adjust to use
      	gdb::unique_xmalloc_ptr<char>.
      29592bde
    • H.J. Lu's avatar
      gdb: Fix build failure with GCC 7 · b3340438
      H.J. Lu authored
      Fix:
      
      /export/gnu/import/git/sources/binutils-gdb/gdb/dwarf2read.c: In function ‘const char* dwarf2_string_attr(die_info*, unsigned int, dwarf2_cu*)’:
      /export/gnu/import/git/sources/binutils-gdb/gdb/dwarf2read.c:17626:39: error: enum constant in boolean context [-Werror=int-in-bool-context]
          || attr->form == DW_FORM_string || DW_FORM_GNU_str_index
      
      	* dwarf2read.c (dwarf2_string_attr): Fix a typo.
      b3340438
    • Yao Qi's avatar
      Fix memory leak in cp-support.c · e88e8651
      Yao Qi authored
      The return value of cp_comp_to_string was never freed, creating a
      sizable memory leak detectable with valgrind.
      
      ==21225== 8 bytes in 1 blocks are definitely lost in loss record 4,599 of 10,949^M
      ==21225==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)^M
      ==21225==    by 0x4C2FDEF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)^M
      ==21225==    by 0x76CB31: d_growable_string_resize (cp-demangle.c:3963)^M
      ==21225==    by 0x76CB31: d_growable_string_init (cp-demangle.c:3942)^M
      ==21225==    by 0x76CB31: cplus_demangle_print (cp-demangle.c:4308)^M
      ==21225==    by 0x4C9535: cp_comp_to_string(demangle_component*, int) (cp-name-parser.y:1972)^M
      ==21225==    by 0x53E1D4: cp_canonicalize_string_full[abi:cxx11](char const*, char const* (*)(type*, void*), void*) (cp-support.c:530)^M
      ==21225==    by 0x53E360: cp_canonicalize_string_no_typedefs[abi:cxx11](char const*) (cp-support.c:548)^M
      ==21225==    by 0x5D51D2: find_linespec_symbols(linespec_state*, VEC_symtab_ptr*, char const*, VEC_symbolp**, VEC_bound_minimal_symbol_d**) (linespec.c:4030)^M
      ==21225==    by 0x5D6CF6: linespec_parse_basic (linespec.c:1907)
      
      ==21279== 32 bytes in 1 blocks are definitely lost in loss record 6,066 of 10,947^M
      ==21279==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)^M
      ==21279==    by 0x4C2FDEF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)^M
      ==21279==    by 0x76CB31: d_growable_string_resize (cp-demangle.c:3963)^M
      ==21279==    by 0x76CB31: d_growable_string_init (cp-demangle.c:3942)^M
      ==21279==    by 0x76CB31: cplus_demangle_print (cp-demangle.c:4308)^M
      ==21279==    by 0x4C9535: cp_comp_to_string(demangle_component*, int) (cp-name-parser.y:1972)^M
      ==21279==    by 0x53EF14: cp_canonicalize_string[abi:cxx11](char const*) (cp-support.c:569)^M
      ==21279==    by 0x561B75: dwarf2_canonicalize_name(char const*, dwarf2_cu*, obstack*) [clone .isra.210] (dwarf2read.c:20159)
      
      This patch fixes the leak.  It is a regression by 2f408ecb.
      
      gdb:
      
      2017-08-09  Alex Lindsay  <alexlindsay239@gmail.com>
      	    Yao Qi  <yao.qi@linaro.org>
      
      	* cp-support.c (cp_canonicalize_string_full): Use
      	gdb::unique_xmalloc_ptr<char>.
      	(cp_canonicalize_string): Likewise.
      e88e8651
    • Yao Qi's avatar
      Clean up x86 non-linux GDBserver target descriptions · f5a29eb0
      Yao Qi authored
      In GDBserver, only tdesc_i386 and tdesc_amd64 are used.  There is no point
      of generating these *.dat files (which are used to generate *.c files during
      GDBserver build.).
      
      gdb:
      
      2017-08-09  Yao Qi  <yao.qi@linaro.org>
      
      	* features/Makefile (WHICH): Remove i386/ non-linux stuff.
      	* regformats/i386/amd64-avx-avx512.dat: Remove.
      	* regformats/i386/amd64-avx-mpx-avx512-pku.dat: Remove.
      	* regformats/i386/amd64-avx-mpx.dat:Remove.
      	* regformats/i386/amd64-avx.dat: Remove.
      	* regformats/i386/amd64-mpx.dat: Remove.
      	* regformats/i386/i386-avx-avx512.dat: Remove.
      	* regformats/i386/i386-avx-mpx-avx512-pku.dat: Remove.
      	* regformats/i386/i386-avx-mpx.dat: Remove.
      	* regformats/i386/i386-mmx.dat: Remove.
      	* regformats/i386/i386-mpx.dat: Remove.
      
      gdb/gdbserver:
      
      2017-08-09  Yao Qi  <yao.qi@linaro.org>
      
      	* configure.srv (srv_i386_regobj): Remove i386-avx.o,
      	i386-avx-avx512.o, i386-avx-mpx-avx512-pku.o, i386-mpx.o,
      	i386-avx-mpx.o and i386-mmx.o.
      	(srv_amd64_regobj): Remove amd64-avx.o, amd64-avx-avx512.o,
      	amd64-avx-mpx-avx512-pku.o, amd64-mpx.o and amd64-avx-mpx.o.
      	(srv_i386_xmlfiles): Remove i386/i386-avx.xml,
      	i386/i386-avx-avx512.xml, i386/i386-avx-mpx-avx512-pku.xml,
      	i386/i386-mpx.xml, i386/i386-avx-mpx.xml and i386/i386-mmx.xml.
      	(srv_amd64_xmlfile):i386/amd64-avx.xml, i386/amd64-avx-avx512.xml,
      	i386/amd64-avx-mpx-avx512-pku.xml, i386/amd64-mpx.xml,
      	i386/amd64-avx-mpx.xml.
      f5a29eb0
    • Yao Qi's avatar
      Remove x32 non-linux target descriptions · 57757c2f
      Yao Qi authored
      x32 non-linux target descriptions are not used in GDB or GDBserver.  This
      patch removes them.
      
      gdb:
      
      2017-08-09  Yao Qi  <yao.qi@linaro.org>
      
      	* amd64-tdep.h (tdesc_x32): Remove the declaration.
      	* amd64-tdep.c: Don't include features/i386/x32*.c.
      	(_initialize_amd64_tdep): Don't call initialize_tdesc_x32*
      	functions.
      	* features/Makefile (WHICH): Remove i386/x32, i386/x32-avx,
      	and i386/x32-avx-avx512.
      	(XMLTOC): Remove i386/x32-avx.xml, i386/x32-avx-avx512.xml,
      	and i386/x32.xml.
      	* features/i386/x32-avx-avx512.c: Removed.
      	* features/i386/x32-avx-avx512.xml: Removed.
      	* features/i386/x32-avx.c: Removed.
      	* features/i386/x32-avx.xml: Removed.
      	* features/i386/x32.c: Removed.
      	* features/i386/x32.xml: Removed.
      	* regformats/i386/x32-avx-avx512.dat: Removed.
      	* regformats/i386/x32-avx.dat: Removed.
      	* regformats/i386/x32.dat: Removed.
      
      gdb/gdbserver:
      
      2017-08-09  Yao Qi  <yao.qi@linaro.org>
      
      	* configure.srv (srv_amd64_regobj): Remove x32.o, x32-avx.o
      	and x32-avx-avx512.o.
      	(srv_amd64_xmlfiles): Remove i386/x32.xml, i386/x32-avx.xml
      	i386/x32-avx-avx512.xml.
      57757c2f
    • H.J. Lu's avatar
      ld: Require GCC 5 or above for 3 x86 tests · 25d28c91
      H.J. Lu authored
      Require GCC 5 or above for 3 x86 tests which fail with GCC 4.9.3.
      
      	PR ld/21924
      	* testsuite/ld-i386/i386.exp: Require GCC 5 or above for
      	"weakundef1 with PIE" test.
      	* testsuite/ld-x86-64/tls.exp: Require GCC 5 or above for
      	"tlsdesc1" and "tlsdesc1 with PIE" tests.
      25d28c91
    • H.J. Lu's avatar
      ld: Add a ',' after -Wl,--rpath · 9165f454
      H.J. Lu authored
      	* configure.ac (TESTBFDLIB): Add a ',' after -Wl,--rpath.
      	* configure: Regenerated.
      9165f454
    • GDB Administrator's avatar
      Automatic date update in version.in · a26c49b7
      GDB Administrator authored
      a26c49b7
  4. 08 Aug, 2017 5 commits