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

  1. 23 May, 2018 1 commit
    • Gary Benson's avatar
      linux: Add maintenance commands to test libthread_db · ab3d1b33
      Gary Benson authored
      This commit adds two new commands which may be used to test thread
      debugging libraries used by GDB:
      
        * "maint check libthread-db" tests the thread debugging library GDB
           is using for the current inferior.
      
        * "maint set/show check-libthread-db" selects whether libthread_db
           tests should be run automatically as libthread_db is auto-loaded.
           The default is to not run tests automatically.
      
      The test itself is a basic integrity check exercising all libthread_db
      functions used by GDB on GNU/Linux systems.  By extension this also
      exercises the proc_service functions provided by GDB that libthread_db
      uses.
      
      This functionality is useful for NPTL developers and libthread_db
      developers.  It could also prove useful investigating bugs reported
      against GDB where the thread debugging library or GDB's proc_service
      layer is suspect.
      
      gdb/ChangeLog:
      
      	* linux-thread-db.c (valprint.h): New include.
      	(struct check_thread_db_info): New structure.
      	(check_thread_db_on_load, tdb_testinfo): New static globals.
      	(check_thread_db, check_thread_db_callback): New functions.
      	(try_thread_db_load_1): Run integrity checks if requested.
      	(maintenance_check_libthread_db): New function.
      	(_initialize_thread_db): Register "maint check libthread-db"
      	and "maint set/show check-libthread-db".
      	* NEWS: Mention the above new commands.
      
      gdb/doc/ChangeLog:
      
      	* gdb.texinfo (Maintenance Commands): Document "maint check
      	libthread-db" and "maint set/show check-libthread-db".
      
      gdb/testsuite/ChangeLog:
      
      	* gdb.threads/check-libthread-db.exp: New file.
      	* gdb.threads/check-libthread-db.c: Likewise.
      ab3d1b33
  2. 21 May, 2018 4 commits
    • Simon Marchi's avatar
      Fix copy-pasto, allocate objfile_per_bfd_storage with obstack_new · 184cde75
      Simon Marchi authored
      I realized after pushing that I made a copy-pasto, I had:
      
        # define HAVE_IS_TRIVIALLY_COPYABLE 1
      
      instead of
      
        # define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1
      
      with the consequence that IsMallocable was always std::true_type (and
      was therefore not enforcing anything).  Fixing that mistake triggered a
      build failure:
      
      /home/simark/src/binutils-gdb/gdb/objfiles.c:150:12:   required from here
      /home/simark/src/binutils-gdb/gdb/common/poison.h:228:3: error: static assertion failed: Trying to use XOBNEW with a non-POD data type.
      
      I am not sure why I did not see this when I originally wrote the patch
      (but I saw and fixed other failures).  In any case, I swapped XOBNEW
      with obstack_new to get rid of it.
      
      Regtested on the buildbot.
      
      gdb/ChangeLog:
      
      	* common/traits.h (HAVE_IS_TRIVIALLY_COPYABLE): Rename the wrong
      	instance to...
      	(HAVE_IS_TRIVIALLY_CONSTRUCTIBLE): ... this.
      	* objfiles.c (get_objfile_bfd_data): Allocate
      	objfile_per_bfd_storage with obstack_new when allocating on
      	obstack.
      184cde75
    • Simon Marchi's avatar
      Use XOBNEW/XOBNEWVEC/OBSTACK_ZALLOC when possible · e39db4db
      Simon Marchi authored
      Since XOBNEW/XOBNEWVEC/OBSTACK_ZALLOC are now poisoned to prevent using
      them with non-trivially-constructible objects, it is worth using them
      over plain obstack_alloc.  This patch changes the locations I could find
      where we can do that change easily.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (cache_symbol): Use XOBNEW and/or XOBNEWVEC and/or
      	OBSTACK_ZALLOC.
      	* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
      	* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
      	* mdebugread.c (mdebug_build_psymtabs): Likewise.
      	(add_pending): Likewise.
      	(parse_symbol): Likewise.
      	(parse_partial_symbols): Likewise.
      	(psymtab_to_symtab_1): Likewise.
      	(new_psymtab): Likewise.
      	(elfmdebug_build_psymtabs): Likewise.
      	* minsyms.c (terminate_minimal_symbol_table): Likewise.
      	* objfiles.c (get_objfile_bfd_data): Likewise.
      	(objfile_register_static_link): Likewise.
      	* psymtab.c (allocate_psymtab): Likewise.
      	* stabsread.c (read_member_functions): Likewise.
      	* xcoffread.c (xcoff_end_psymtab): Likewise.
      e39db4db
    • Simon Marchi's avatar
      Introduce obstack_new, poison other "typed" obstack functions · 284a0e3c
      Simon Marchi authored
      Since we use obstacks with objects that are not default constructible,
      we sometimes need to manually call the constructor by hand using
      placement new:
      
        foo *f = obstack_alloc (obstack, sizeof (foo));
        f = new (f) foo;
      
      It's possible to use allocate_on_obstack instead, but there are types
      that we sometimes want to allocate on an obstack, and sometimes on the
      regular heap.  This patch introduces a utility to make this pattern
      simpler if allocate_on_obstack is not an option:
      
        foo *f = obstack_new<foo> (obstack);
      
      Right now there's only one usage (in tdesc_data_init).
      
      To help catch places where we would forget to call new when allocating
      such an object on an obstack, this patch also poisons some other methods
      of allocating an instance of a type on an obstack:
      
        - OBSTACK_ZALLOC/OBSTACK_CALLOC
        - XOBNEW/XOBNEW
        - GDBARCH_OBSTACK_ZALLOC/GDBARCH_OBSTACK_CALLOC
      
      Unfortunately, there's no way to catch wrong usages of obstack_alloc.
      
      By pulling on that string though, it tripped on allocating struct
      template_symbol using OBSTACK_ZALLOC.  The criterion currently used to
      know whether it's safe to "malloc" an instance of a struct is whether it
      is a POD.  Because it inherits from struct symbol, template_symbol is
      not a POD.  This criterion is a bit too strict however, it should still
      safe to allocate memory for a template_symbol and memset it to 0.  We
      didn't use is_trivially_constructible as the criterion in the first
      place only because it is not available in gcc < 5.  So here I considered
      two alternatives:
      
      1. Relax that criterion to use std::is_trivially_constructible and add a
         bit more glue code to make it work with gcc < 5
      2. Continue pulling on the string and change how the symbol structures
         are allocated and initialized
      
      I managed to do both, but I decided to go with #1 to keep this patch
      simpler and more focused.  When building with a compiler that does not
      have is_trivially_constructible, the check will just not be enforced.
      
      gdb/ChangeLog:
      
      	* common/traits.h (HAVE_IS_TRIVIALLY_COPYABLE): Define if
      	compiler supports std::is_trivially_constructible.
      	* common/poison.h: Include obstack.h.
      	(IsMallocable): Define to is_trivially_constructible if the
      	compiler supports it, define to true_type otherwise.
      	(xobnew): New.
      	(XOBNEW): Redefine.
      	(xobnewvec): New.
      	(XOBNEWVEC): Redefine.
      	* gdb_obstack.h (obstack_zalloc): New.
      	(OBSTACK_ZALLOC): Redefine.
      	(obstack_calloc): New.
      	(OBSTACK_CALLOC): Redefine.
      	(obstack_new): New.
      	* gdbarch.sh: Include gdb_obstack in gdbarch.h.
      	(gdbarch_obstack): New declaration in gdbarch.h, definition in
      	gdbarch.c.
      	(GDBARCH_OBSTACK_CALLOC, GDBARCH_OBSTACK_ZALLOC): Use
      	obstack_calloc/obstack_zalloc.
      	(gdbarch_obstack_zalloc): Remove.
      	* target-descriptions.c (tdesc_data_init): Use obstack_new.
      284a0e3c
    • GDB Administrator's avatar
      Automatic date update in version.in · b1aed5de
      GDB Administrator authored
      b1aed5de
  3. 20 May, 2018 1 commit
  4. 19 May, 2018 3 commits
  5. 18 May, 2018 17 commits
    • H.J. Lu's avatar
      x86: Don't set eh->local_ref to 1 for versioned symbol · 97373b2e
      H.J. Lu authored
      bfd_hide_sym_by_version can't be used to check if a versioned symbol is
      hidden.  It has to be synced with _bfd_elf_link_assign_sym_version to
      get the correct answer.
      
      bfd/
      
      	PR ld/23194
      	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
      	set eh->local_ref to 1 if a symbol is versioned and there is a
      	version script.
      
      ld/
      
      	PR ld/23194
      	* testsuite/ld-i386/i386.exp: Run pr23194.
      	* testsuite/ld-x86-64/x86-64.exp: Likewise.
      	* testsuite/ld-i386/pr23194.d: New file.
      	* testsuite/ld-i386/pr23194.map: Likewise.
      	* testsuite/ld-i386/pr23194.s: Likewise.
      	* testsuite/ld-x86-64/pr23194.d: Likewise.
      	* testsuite/ld-x86-64/pr23194.map: Likewise.
      	* testsuite/ld-x86-64/pr23194.s: Likewise.
      97373b2e
    • H.J. Lu's avatar
      ld: Run pr23189 for all targets · 941036f4
      H.J. Lu authored
      Since the pr23189 test isn't Linux specific, run it for all targets.
      
      	* testsuite/ld-i386/i386.exp: Run pr23189 for all targets.
      	* testsuite/ld-x86-64/x86-64.exp: Likewise.
      941036f4
    • Tom Tromey's avatar
      Allocate dwz_file with new · 7ff8cb8c
      Tom Tromey authored
      This adds a constructor to struct dwz_file and arranges for it to be
      allocated with "new" and wrapped in a unique_ptr.  This cuts down on
      the amount of manual memory management that must be done.
      
      Regression tested by the buildbot.
      
      gdb/ChangeLog
      2018-05-18  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2read.c (struct dwz_file): Add constructor, initializers.
      	<dwz_bfd>: Now a gdb_bfd_ref_ptr.
      	(~dwarf2_per_objfile): Update
      	(dwarf2_get_dwz_file): Use new.
      	* dwarf2read.h (struct dwarf2_per_objfile) <dwz_file>: Now a
      	unique_ptr.
      7ff8cb8c
    • Jim Wilson's avatar
      RISC-V: Add RV32E support. · 7f999549
      Jim Wilson authored
      	Kito Cheng  <kito.cheng@gmail.com>
      	Monk Chiang  <sh.chiang04@gmail.com>
      
      	bfd/
      	* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Handle
      	EF_RISCV_RVE.
      
      	binutils/
      	* readelf.c (get_machine_flags): Handle EF_RISCV_RVE.
      
      	gas/
      	* config/tc-riscv.c (rve_abi): New.
      	(riscv_set_options): Add rve field.  Initialize it.
      	(riscv_set_rve) New function.
      	(riscv_set_arch): Support 'e' ISA subset.
      	(reg_lookup_internal): If rve, check register is available.
      	(riscv_set_abi): New parameter rve.
      	(md_parse_option): Pass new argument to riscv_set_abi.
      	(riscv_after_parse_args): Call riscv_set_rve.  If rve_abi, set
      	EF_RISCV_RVE.
      	* doc/c-riscv.texi (-mabi): Document new ilp32e argument.
      
      	include/
      	* elf/riscv.h (EF_RISCV_RVE): New define.
      7f999549
    • Tom Tromey's avatar
      Allocate dwp_file with new · 400174b1
      Tom Tromey authored
      This adds a constructor and initializer to dwp_file and changes it to
      be allocated with "new".  This removes a bit of manual refcount
      management.
      
      Tested by the buildbot.
      
      gdb/ChangeLog
      2018-05-18  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2read.h (struct dwarf2_per_objfile) <dwp_file>: Now a
      	unique_ptr.
      	* dwarf2read.c (struct dwp_file): Add constructor and
      	initializers.
      	(open_and_init_dwp_file): Return a unique_ptr.
      	(dwarf2_per_objfile, create_dwp_hash_table)
      	(create_dwo_unit_in_dwp_v1, create_dwo_unit_in_dwp_v2)
      	(lookup_dwo_unit_in_dwp): Update.
      	(open_and_init_dwp_file, get_dwp_file): Update.
      400174b1
    • Tom Tromey's avatar
      Use new to allocate mapped_index · 3063847f
      Tom Tromey authored
      This changes struct mapped_index to be allocated with new.  This
      simplifies the creation a bit (see dwarf2_read_index) and also removes
      a somewhat ugly explicit destructor call from ~dwarf2_per_objfile.
      
      Tested by the buildbot.
      
      gdb/ChangeLog
      2018-05-18  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2read.c (dwarf2_per_objfile): Update.
      	(struct mapped_index): Add initializers.
      	(dwarf2_read_index): Use new.
      	(dw2_symtab_iter_init): Update.
      	* dwarf2read.h (struct dwarf2_per_objfile) <index_table>: Now a
      	unique_ptr.
      3063847f
    • Jim Wilson's avatar
      RISC-V: Fix ld-elf/pr22269* testcases. · 6487709f
      Jim Wilson authored
      	bfd/
      	* elfnn-riscv.c (allocate_dynrelocs): Discard dynamic relocations if
      	UNDEFWEAK_NO_DYNAMIC_RELOC is true.
      	(riscv_elf_relocate_section): Don't generate dynamic relocation if
      	UNDEFWEAK_NO_DYNAMIC_RELOC is true.
      	(riscv_elf_finish_dynamic_symbol): Likewise.
      6487709f
    • Simon Marchi's avatar
      Remove mapped_index::total_size · d3d02dee
      Simon Marchi authored
      It is unused.
      
      gdb/ChangeLog:
      
      	* dwarf2read.c (mapped_index) <total_size>: Remove.
      d3d02dee
    • Simon Marchi's avatar
      format_pieces-selftests.c: Silence ARI warnings · 1d143c36
      Simon Marchi authored
      Silence this:
      
      unittests/format_pieces-selftests.c:51: warning: code: Do not use printf("%ll"), instead use printf("%s",phex()) to dump a `long long' value
      unittests/format_pieces-selftests.c:56: warning: code: Do not use printf("%ll"), instead use printf("%s",phex()) to dump a `long long' value
      
      gdb/ChangeLog:
      
      	* unittests/format_pieces-selftests.c (test_format_specifier):
      	Add ARI comments.
      1d143c36
    • Tom Tromey's avatar
      Show padding in ptype/o output · ce1e8424
      Tom Tromey authored
      I was recently using ptype/o to look at the layout of some objects in
      gdb.  I noticed that trailing padding was not shown -- but I wanted to
      be able to look at that, too.
      
      This patch changes ptype/o to also print trailing holes.
      
      Tested on x86-64 Fedora 26.
      
      gdb/ChangeLog
      2018-05-18  Tom Tromey  <tom@tromey.com>
      
      	* c-typeprint.c (maybe_print_hole): New function.
      	(c_print_type_struct_field_offset): Update.
      	(c_type_print_base_struct_union): Call maybe_print_hole.
      
      gdb/testsuite/ChangeLog
      2018-05-18  Tom Tromey  <tom@tromey.com>
      
      	* gdb.base/ptype-offsets.exp: Update.
      ce1e8424
    • John Darrington's avatar
      Add support for the Freescale s12z processor. · 7b4ae824
      John Darrington authored
      bfd	* Makefile.am: Add s12z files.
      	* Makefile.in: Regenerate.
      	* archures.c: Add bfd_s12z_arch.
      	* bfd-in.h: Add exports of bfd_putb24 and bfd_putl24.
      	* bfd-in2.h: Regenerate.
      	* config.bfd: Add s12z target.
      	* configure.ac: Add s12z target.
      	* configure: Regenerate.
      	* cpu-s12z.c: New file.
      	* elf32-s12z.c: New file.
      	* libbfd.c (bfd_putb24): New function.
      	(bfd_putl24): New function.
      	* libbfd.h: Regenerate.
      	* reloc.c: Add s12z relocations.
      	(bfd_get_reloc_size): Handle size 5 relocs.
      	* targets.c: Add s12z_elf32_vec.
      
      opcodes	* Makefile.am: Add support for s12z architecture.
      	* configure.ac: Likewise.
      	* disassemble.c: Likewise.
      	* disassemble.h: Likewise.
      	* Makefile.in: Regenerate.
      	* configure: Regenerate.
      	* s12z-dis.c: New file.
      	* s12z.h: New file.
      
      include	* elf/s12z.h: New header.
      
      ld	* Makefile.am: Add support for s12z architecture.
      	* configure.tgt: Likewise.
      	* Makefile.in: Regenerate.
      	* emulparams/m9s12zelf.sh: New file.
      	* scripttempl/elfm9s12z.sc: New file.
      	* testsuite/ld-discard/static.d: Expect to fail for the s12z
      	target.
      	* testsuite/ld-elf/endsym.d: Likewise.
      	* testsuite/ld-elf/merge.d: Likewise.
      	* testsuite/ld-elf/pr14926.d: Skip for the s12z target.
      	* testsuite/ld-elf/sec64k.exp: Likewise.
      	* testsuite/ld-s12z: New directory.
      	* testsuite/ld-s12z/opr-linking.d: New file.
      	* testsuite/ld-s12z/opr-linking.s: New file.
      	* testsuite/ld-s12z/relative-linking.d: New file.
      	* testsuite/ld-s12z/relative-linking.s: New file.
      	* testsuite/ld-s12z/z12s.exp: New file.
      
      gas	* Makefile.am: Add support for s12z target.
      	* Makefile.in: Regenerate.
      	* NEWS: Mention the new support.
      	* config/tc-s12z.c: New file.
      	* config/tc-s12z.h: New file.
      	* configure.tgt: Add  s12z support.
      	* doc/Makefile.am: Likewise.
      	* doc/Makefile.in: Regenerate.
      	* doc/all.texi: Add s12z documentation.
      	* doc/as.textinfo: Likewise.
      	* doc/c-s12z.texi: New file.
      	* testsuite/gas/s12z: New directory.
      	* testsuite/gas/s12z/abs.d: New file.
      	* testsuite/gas/s12z/abs.s: New file.
      	* testsuite/gas/s12z/adc-imm.d: New file.
      	* testsuite/gas/s12z/adc-imm.s: New file.
      	* testsuite/gas/s12z/adc-opr.d: New file.
      	* testsuite/gas/s12z/adc-opr.s: New file.
      	* testsuite/gas/s12z/add-imm.d: New file.
      	* testsuite/gas/s12z/add-imm.s: New file.
      	* testsuite/gas/s12z/add-opr.d: New file.
      	* testsuite/gas/s12z/add-opr.s: New file.
      	* testsuite/gas/s12z/and-imm.d: New file.
      	* testsuite/gas/s12z/and-imm.s: New file.
      	* testsuite/gas/s12z/and-opr.d: New file.
      	* testsuite/gas/s12z/and-opr.s: New file.
      	* testsuite/gas/s12z/and-or-cc.d: New file.
      	* testsuite/gas/s12z/and-or-cc.s: New file.
      	* testsuite/gas/s12z/bfext-special.d: New file.
      	* testsuite/gas/s12z/bfext-special.s: New file.
      	* testsuite/gas/s12z/bfext.d: New file.
      	* testsuite/gas/s12z/bfext.s: New file.
      	* testsuite/gas/s12z/bit-manip.d: New file.
      	* testsuite/gas/s12z/bit-manip.s: New file.
      	* testsuite/gas/s12z/bit.d: New file.
      	* testsuite/gas/s12z/bit.s: New file.
      	* testsuite/gas/s12z/bra-expression-defined.d: New file.
      	* testsuite/gas/s12z/bra-expression-defined.s: New file.
      	* testsuite/gas/s12z/bra-expression-undef.d: New file.
      	* testsuite/gas/s12z/bra-expression-undef.s: New file.
      	* testsuite/gas/s12z/bra.d: New file.
      	* testsuite/gas/s12z/bra.s: New file.
      	* testsuite/gas/s12z/brclr-symbols.d: New file.
      	* testsuite/gas/s12z/brclr-symbols.s: New file.
      	* testsuite/gas/s12z/brset-clr-opr-imm-rel.d: New file.
      	* testsuite/gas/s12z/brset-clr-opr-imm-rel.s: New file.
      	* testsuite/gas/s12z/brset-clr-opr-reg-rel.d: New file.
      	* testsuite/gas/s12z/brset-clr-opr-reg-rel.s: New file.
      	* testsuite/gas/s12z/brset-clr-reg-imm-rel.d: New file.
      	* testsuite/gas/s12z/brset-clr-reg-imm-rel.s: New file.
      	* testsuite/gas/s12z/brset-clr-reg-reg-rel.d: New file.
      	* testsuite/gas/s12z/brset-clr-reg-reg-rel.s: New file.
      	* testsuite/gas/s12z/clb.d: New file.
      	* testsuite/gas/s12z/clb.s: New file.
      	* testsuite/gas/s12z/clr-opr.d: New file.
      	* testsuite/gas/s12z/clr-opr.s: New file.
      	* testsuite/gas/s12z/clr.d: New file.
      	* testsuite/gas/s12z/clr.s: New file.
      	* testsuite/gas/s12z/cmp-imm.d: New file.
      	* testsuite/gas/s12z/cmp-imm.s: New file.
      	* testsuite/gas/s12z/cmp-opr-inc.d: New file.
      	* testsuite/gas/s12z/cmp-opr-inc.s: New file.
      	* testsuite/gas/s12z/cmp-opr-rdirect.d: New file.
      	* testsuite/gas/s12z/cmp-opr-rdirect.s: New file.
      	* testsuite/gas/s12z/cmp-opr-reg.d: New file.
      	* testsuite/gas/s12z/cmp-opr-reg.s: New file.
      	* testsuite/gas/s12z/cmp-opr-rindirect.d: New file.
      	* testsuite/gas/s12z/cmp-opr-rindirect.s: New file.
      	* testsuite/gas/s12z/cmp-opr-sxe4.d: New file.
      	* testsuite/gas/s12z/cmp-opr-sxe4.s: New file.
      	* testsuite/gas/s12z/cmp-opr-xys.d: New file.
      	* testsuite/gas/s12z/cmp-opr-xys.s: New file.
      	* testsuite/gas/s12z/cmp-s-imm.d: New file.
      	* testsuite/gas/s12z/cmp-s-imm.s: New file.
      	* testsuite/gas/s12z/cmp-s-opr.d: New file.
      	* testsuite/gas/s12z/cmp-s-opr.s: New file.
      	* testsuite/gas/s12z/cmp-xy.d: New file.
      	* testsuite/gas/s12z/cmp-xy.s: New file.
      	* testsuite/gas/s12z/com-opr.d: New file.
      	* testsuite/gas/s12z/com-opr.s: New file.
      	* testsuite/gas/s12z/complex-shifts.d: New file.
      	* testsuite/gas/s12z/complex-shifts.s: New file.
      	* testsuite/gas/s12z/db-tb-cc-opr.d: New file.
      	* testsuite/gas/s12z/db-tb-cc-opr.s: New file.
      	* testsuite/gas/s12z/db-tb-cc-reg.d: New file.
      	* testsuite/gas/s12z/db-tb-cc-reg.s: New file.
      	* testsuite/gas/s12z/dbCC.d: New file.
      	* testsuite/gas/s12z/dbCC.s: New file.
      	* testsuite/gas/s12z/dec-opr.d: New file.
      	* testsuite/gas/s12z/dec-opr.s: New file.
      	* testsuite/gas/s12z/dec.d: New file.
      	* testsuite/gas/s12z/dec.s: New file.
      	* testsuite/gas/s12z/div.d: New file.
      	* testsuite/gas/s12z/div.s: New file.
      	* testsuite/gas/s12z/eor.d: New file.
      	* testsuite/gas/s12z/eor.s: New file.
      	* testsuite/gas/s12z/exg.d: New file.
      	* testsuite/gas/s12z/exg.s: New file.
      	* testsuite/gas/s12z/ext24-ld-xy.d: New file.
      	* testsuite/gas/s12z/ext24-ld-xy.s: New file.
      	* testsuite/gas/s12z/inc-opr.d: New file.
      	* testsuite/gas/s12z/inc-opr.s: New file.
      	* testsuite/gas/s12z/inc.d: New file.
      	* testsuite/gas/s12z/inc.s: New file.
      	* testsuite/gas/s12z/inh.d: New file.
      	* testsuite/gas/s12z/inh.s: New file.
      	* testsuite/gas/s12z/jmp.d: New file.
      	* testsuite/gas/s12z/jmp.s: New file.
      	* testsuite/gas/s12z/jsr.d: New file.
      	* testsuite/gas/s12z/jsr.s: New file.
      	* testsuite/gas/s12z/ld-imm-page2.d: New file.
      	* testsuite/gas/s12z/ld-imm-page2.s: New file.
      	* testsuite/gas/s12z/ld-imm.d: New file.
      	* testsuite/gas/s12z/ld-imm.s: New file.
      	* testsuite/gas/s12z/ld-immu18.d: New file.
      	* testsuite/gas/s12z/ld-immu18.s: New file.
      	* testsuite/gas/s12z/ld-large-direct.d: New file.
      	* testsuite/gas/s12z/ld-large-direct.s: New file.
      	* testsuite/gas/s12z/ld-opr.d: New file.
      	* testsuite/gas/s12z/ld-opr.s: New file.
      	* testsuite/gas/s12z/ld-s-opr.d: New file.
      	* testsuite/gas/s12z/ld-s-opr.s: New file.
      	* testsuite/gas/s12z/ld-small-direct.d: New file.
      	* testsuite/gas/s12z/ld-small-direct.s: New file.
      	* testsuite/gas/s12z/lea-immu18.d: New file.
      	* testsuite/gas/s12z/lea-immu18.s: New file.
      	* testsuite/gas/s12z/lea.d: New file.
      	* testsuite/gas/s12z/lea.s: New file.
      	* testsuite/gas/s12z/mac.d: New file.
      	* testsuite/gas/s12z/mac.s: New file.
      	* testsuite/gas/s12z/min-max.d: New file.
      	* testsuite/gas/s12z/min-max.s: New file.
      	* testsuite/gas/s12z/mod.d: New file.
      	* testsuite/gas/s12z/mod.s: New file.
      	* testsuite/gas/s12z/mov.d: New file.
      	* testsuite/gas/s12z/mov.s: New file.
      	* testsuite/gas/s12z/mul-imm.d: New file.
      	* testsuite/gas/s12z/mul-imm.s: New file.
      	* testsuite/gas/s12z/mul-opr-opr.d: New file.
      	* testsuite/gas/s12z/mul-opr-opr.s: New file.
      	* testsuite/gas/s12z/mul-opr.d: New file.
      	* testsuite/gas/s12z/mul-opr.s: New file.
      	* testsuite/gas/s12z/mul-reg.d: New file.
      	* testsuite/gas/s12z/mul-reg.s: New file.
      	* testsuite/gas/s12z/mul.d: New file.
      	* testsuite/gas/s12z/mul.s: New file.
      	* testsuite/gas/s12z/neg-opr.d: New file.
      	* testsuite/gas/s12z/neg-opr.s: New file.
      	* testsuite/gas/s12z/not-so-simple-shifts.d: New file.
      	* testsuite/gas/s12z/not-so-simple-shifts.s: New file.
      	* testsuite/gas/s12z/opr-18u.d: New file.
      	* testsuite/gas/s12z/opr-18u.s: New file.
      	* testsuite/gas/s12z/opr-expr.d: New file.
      	* testsuite/gas/s12z/opr-expr.s: New file.
      	* testsuite/gas/s12z/opr-ext-18.d: New file.
      	* testsuite/gas/s12z/opr-ext-18.s: New file.
      	* testsuite/gas/s12z/opr-idx-24-reg.d: New file.
      	* testsuite/gas/s12z/opr-idx-24-reg.s: New file.
      	* testsuite/gas/s12z/opr-idx3-reg.d: New file.
      	* testsuite/gas/s12z/opr-idx3-reg.s: New file.
      	* testsuite/gas/s12z/opr-idx3-xysp-24.d: New file.
      	* testsuite/gas/s12z/opr-idx3-xysp-24.s: New file.
      	* testsuite/gas/s12z/opr-indirect-expr.d: New file.
      	* testsuite/gas/s12z/opr-indirect-expr.s: New file.
      	* testsuite/gas/s12z/opr-symbol.d: New file.
      	* testsuite/gas/s12z/opr-symbol.s: New file.
      	* testsuite/gas/s12z/or-imm.d: New file.
      	* testsuite/gas/s12z/or-imm.s: New file.
      	* testsuite/gas/s12z/or-opr.d: New file.
      	* testsuite/gas/s12z/or-opr.s: New file.
      	* testsuite/gas/s12z/p2-mul.d: New file.
      	* testsuite/gas/s12z/p2-mul.s: New file.
      	* testsuite/gas/s12z/page2-inh.d: New file.
      	* testsuite/gas/s12z/page2-inh.s: New file.
      	* testsuite/gas/s12z/psh-pul.d: New file.
      	* testsuite/gas/s12z/psh-pul.s: New file.
      	* testsuite/gas/s12z/qmul.d: New file.
      	* testsuite/gas/s12z/qmul.s: New file.
      	* testsuite/gas/s12z/rotate.d: New file.
      	* testsuite/gas/s12z/rotate.s: New file.
      	* testsuite/gas/s12z/s12z.exp: New file.
      	* testsuite/gas/s12z/sat.d: New file.
      	* testsuite/gas/s12z/sat.s: New file.
      	* testsuite/gas/s12z/sbc-imm.d: New file.
      	* testsuite/gas/s12z/sbc-imm.s: New file.
      	* testsuite/gas/s12z/sbc-opr.d: New file.
      	* testsuite/gas/s12z/sbc-opr.s: New file.
      	* testsuite/gas/s12z/shift.d: New file.
      	* testsuite/gas/s12z/shift.s: New file.
      	* testsuite/gas/s12z/simple-shift.d: New file.
      	* testsuite/gas/s12z/simple-shift.s: New file.
      	* testsuite/gas/s12z/single-ops.d: New file.
      	* testsuite/gas/s12z/single-ops.s: New file.
      	* testsuite/gas/s12z/specd6.d: New file.
      	* testsuite/gas/s12z/specd6.s: New file.
      	* testsuite/gas/s12z/st-large-direct.d: New file.
      	* testsuite/gas/s12z/st-large-direct.s: New file.
      	* testsuite/gas/s12z/st-opr.d: New file.
      	* testsuite/gas/s12z/st-opr.s: New file.
      	* testsuite/gas/s12z/st-s-opr.d: New file.
      	* testsuite/gas/s12z/st-s-opr.s: New file.
      	* testsuite/gas/s12z/st-small-direct.d: New file.
      	* testsuite/gas/s12z/st-small-direct.s: New file.
      	* testsuite/gas/s12z/st-xy.d: New file.
      	* testsuite/gas/s12z/st-xy.s: New file.
      	* testsuite/gas/s12z/sub-imm.d: New file.
      	* testsuite/gas/s12z/sub-imm.s: New file.
      	* testsuite/gas/s12z/sub-opr.d: New file.
      	* testsuite/gas/s12z/sub-opr.s: New file.
      	* testsuite/gas/s12z/tfr.d: New file.
      	* testsuite/gas/s12z/tfr.s: New file.
      	* testsuite/gas/s12z/trap.d: New file.
      	* testsuite/gas/s12z/trap.s: New file.
      
      binutils* readelf.c: Add support for s12z architecture.
      	* testsuite/lib/binutils-common.exp (is_elf_format): Excluse s12z
      	targets.
      7b4ae824
    • H.J. Lu's avatar
      x86: Don't set eh->local_ref to 1 for linker defined symbols · 011b32fd
      H.J. Lu authored
      Since symbols created by HIDDEN and PROVIDE_HIDDEN assignments in
      linker script may be marked as defined, but not hidden, we can't
      set eh->local_ref to 1 in _bfd_x86_elf_link_symbol_references_local.
      
      Also R_386_GOT32X should be handled as just like R_386_GOT32 when
      relocating a section.  The input R_386_GOT32X relocations, which
      can be relaxed, should have been converted to R_386_PC32, R_386_32
      or R_386_GOTOFF.
      
      bfd/
      
      	PR ld/23189
      	* elf32-i386.c (elf_i386_relocate_section): Handle R_386_GOT32X
      	like R_386_GOT32.
      	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
      	set eh->local_ref to 1 for linker defined symbols.
      
      ld/
      
      	PR ld/23189
      	* testsuite/ld-i386/i386.exp: Run pr23189.
      	* testsuite/ld-x86-64/x86-64.exp: Likewise.
      	* testsuite/ld-i386/pr23189.d: New file.
      	* testsuite/ld-i386/pr23189.s: Likewise.
      	* testsuite/ld-i386/pr23189.t: Likewise.
      	* testsuite/ld-x86-64/pr23189.d: Likewise.
      	* testsuite/ld-x86-64/pr23189.s: Likewise.
      	* testsuite/ld-x86-64/pr23189.t: Likewise.
      011b32fd
    • Alan Modra's avatar
      PR23199, Invalid SHT_GROUP entry leads to group confusion · 4bba0fb1
      Alan Modra authored
      This patch prevents elf_next_in_group list pointer confusion when
      SHT_GROUP sections specify other SHT_GROUP sections in their list of
      group sections.
      
      	PR 23199
      	* elf.c (setup_group): Formatting.  Check that SHT_GROUP entries
      	don't point at other SHT_GROUP sections.  Set shdr corresponding
      	to invalid entry, to NULL rather than section 0.  Identify
      	SHT_GROUP section index when reporting an error.  Cope with NULL
      	shdr pointer.
      4bba0fb1
    • Alan Modra's avatar
      ATTRIBUTE_HIDDEN for libbfd.h · 8722de9c
      Alan Modra authored
      	* libbfd-in.h (ATTRIBUTE_HIDDEN): Define and use throughout.
      	* configure.ac (HAVE_HIDDEN): Check compiler support for hidden
      	visibility.
      	* libbfd.h: Regenerate.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      8722de9c
    • Alan Modra's avatar
      libbfd.h and libcoff.h include guards · 0b439543
      Alan Modra authored
      	* libbfd-in.h: Add include guard.
      	* libcoff-in.h: Likewise.
      	* doc/Makefile.am (libbfd.h, libcoff.h): Append another #endif.
      	* doc/Makefile.in: Regenerate.
      	* libbfd.h: Regenerate.
      	* libcoff.h: Regenerate.
      0b439543
    • Alan Modra's avatar
      opcodes sources should not include libbfd.h · 29e0f0a1
      Alan Modra authored
      	* nfp-dis.c: Don't #include libbfd.h.
      	(init_nfp3200_priv): Use bfd_get_section_contents.
      	(nit_nfp6000_mecsr_sec): Likewise.
      29e0f0a1
    • GDB Administrator's avatar
      Automatic date update in version.in · 838c49a4
      GDB Administrator authored
      838c49a4
  6. 17 May, 2018 7 commits
    • Keith Seitz's avatar
      Don't elide all inlined frames · ddfe970e
      Keith Seitz authored
      This patch essentially causes GDB to treat inlined frames like "normal"
      frames from the user's perspective.  This means, for example, that when a
      user sets a breakpoint in an inlined function, GDB will now actually stop
      "in" that function.
      
      Using the test case from breakpoints/17534,
      
      3	static inline void NVIC_EnableIRQ(int IRQn)
      4	{
      5	  volatile int y;
      6	  y = IRQn;
      7	}
      8
      9	__attribute__( ( always_inline ) ) static inline void __WFI(void)
      10	{
      11	    __asm volatile ("nop");
      12	}
      13
      14	int main(void) {
      15
      16	    x= 42;
      17
      18	    if (x)
      19	      NVIC_EnableIRQ(16);
      20	    else
      21	      NVIC_EnableIRQ(18);
      (gdb) b NVIC_EnableIRQ
      Breakpoint 1 at 0x4003e4: NVIC_EnableIRQ. (2 locations)
      (gdb) r
      Starting program: 17534
      
      Breakpoint 1, main () at 17534.c:19
      19	      NVIC_EnableIRQ(16);
      
      Because skip_inline_frames currently skips every inlined frame, GDB "stops"
      in the caller.  This patch adds a new parameter to skip_inline_frames
      that allows us to pass in a bpstat stop chain.  The breakpoint locations
      on the stop chain can be used to determine if we've stopped inside an inline
      function (due to a user breakpoint).  If we have, we do not elide the frame.
      
      With this patch, GDB now reports that the inferior has stopped inside the
      inlined function:
      
      (gdb) r
      Starting program: 17534
      
      Breakpoint 1, NVIC_EnableIRQ (IRQn=16) at 17534.c:6
      6	  y = IRQn;
      
      Many thanks to Jan and Pedro for guidance on this.
      
      gdb/ChangeLog:
      
      	* breakpoint.c (build_bpstat_chain): New function, moved from
      	bpstat_stop_status.
      	(bpstat_stop_status): Add optional parameter, `stop_chain'.
      	If no stop chain is passed, call build_bpstat_chain to build it.
      	* breakpoint.h (build_bpstat_chain): Declare.
      	(bpstat_stop_status): Move documentation here from breakpoint.c.
      	* infrun.c (handle_signal_stop): Before eliding inlined frames,
      	build the stop chain and pass it to skip_inline_frames.
      	Pass this stop chain to bpstat_stop_status.
      	* inline-frame.c: Include breakpoint.h.
      	(stopped_by_user_bp_inline_frame): New function.
      	(skip_inline_frames): Add parameter `stop_chain'.
      	Move documention to inline-frame.h.
      	If non-NULL, use stopped_by_user_bp_inline_frame to determine
      	whether the frame should be elided.
      	* inline-frame.h (skip_inline_frames): Add parameter `stop_chain'.
      	Add moved documentation and update for new parameter.
      
      gdb/testsuite/ChangeLog:
      
      	* gdb.ada/bp_inlined_func.exp: Update inlined frame locations
      	in expected breakpoint stop locations.
      	* gdb.dwarf2/implptr.exp (implptr_test_baz): Use up/down to
      	move to proper scope to test variable values.
      	* gdb.opt/inline-break.c (inline_func1, not_inline_func1)
      	(inline_func2, not_inline_func2, inline_func3, not_inline_func3):
      	New functions.
      	(main): Call not_inline_func3.
      	* gdb.opt/inline-break.exp: Start inferior and set breakpoints at
      	inline_func1, inline_func2, and inline_func3.  Test that when each
      	breakpoint is hit, GDB properly reports both the stop location
      	and the backtrace. Repeat tests for temporary breakpoints.
      ddfe970e
    • Simon Marchi's avatar
      Make format_pieces recognize the \e escape sequence · b17992c1
      Simon Marchi authored
      I noticed that the printf command did not recognize the \e escape
      sequence, used amongst other things to use colors:
      
        (gdb) printf "This is \e[32mgreen\e[m!\n"
        Unrecognized escape character \e in format string.
      
      This patch makes format_pieces recognize it, which makes that command
      print the expected result in glorious color.
      
      I wrote a really simple unit test for format_pieces.
      format_pieces::operator[] is unused so I removed it.  I added
      format_piece::operator==, which is needed to compare vectors of
      format_piece.
      
      gdb/ChangeLog:
      
      	PR cli/14975
      	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
      	unittests/format_pieces-selftests.c.
      	* common/format.h (format_piece) <operator==>: New.
      	(format_pieces) <operator[]>: Remove.
      	* common/format.c (format_pieces::format_pieces): Handle \e.
      	* unittests/format_pieces-selftests.c: New.
      b17992c1
    • Tom Tromey's avatar
      Fix for dwz-related crash · 58f0c718
      Tom Tromey authored
      PR symtab/23010 reports a crash that occurs when using -readnow
      on a dwz-generated debuginfo file.
      
      The crash occurs because the DWARF has a partial CU with no language
      set, and then a full CU that references this partial CU using
      DW_AT_abstract_origin.
      
      In this case, the partial CU is read by dw2_expand_all_symtabs using
      language_minimal; but then this conflicts with the creation of the
      block's symbol table in the C++ CU.
      
      This patch fixes the problem by arranging for partial CUs not to be
      read by -readnow.  I tend to think that it doesn't make sense to read
      a partial CU in isolation -- they should only be read when imported
      into some other CU.
      
      In conjunction with some other patches I am going to post, this also
      fixes the Rust -readnow crash that Jan reported.
      
      There are two problems with this patch:
      
      1. It is difficult to reason about.  There are many cases where I've
         patched the code to call init_cutu_and_read_dies with the flag set
         to "please do read partial units" -- but I find it difficult to be
         sure that this is always correct.
      
      2. It is still missing a standalone test case.  This seemed hard.
      
      2018-05-17  Tom Tromey  <tom@tromey.com>
      
      	PR symtab/23010:
      	* dwarf2read.c (load_cu, dw2_do_instantiate_symtab)
      	(dw2_instantiate_symtab): Add skip_partial parameter.
      	(dw2_find_last_source_symtab, dw2_map_expand_apply)
      	(dw2_lookup_symbol, dw2_expand_symtabs_for_function)
      	(dw2_expand_all_symtabs, dw2_expand_symtabs_with_fullname)
      	(dw2_expand_symtabs_matching_one)
      	(dw2_find_pc_sect_compunit_symtab)
      	(dw2_debug_names_lookup_symbol)
      	(dw2_debug_names_expand_symtabs_for_function): Update.
      	(init_cutu_and_read_dies): Add skip_partial parameter.
      	(process_psymtab_comp_unit, build_type_psymtabs_1)
      	(process_skeletonless_type_unit, load_partial_comp_unit)
      	(psymtab_to_symtab_1): Update.
      	(load_full_comp_unit): Add skip_partial parameter.
      	(process_imported_unit_die, dwarf2_read_addr_index)
      	(follow_die_offset, dwarf2_fetch_die_loc_sect_off)
      	(dwarf2_fetch_constant_bytes, dwarf2_fetch_die_type_sect_off)
      	(read_signatured_type): Update.
      58f0c718
    • Nick Clifton's avatar
      Updated simplified Chinese translation for the opcodes directory. · 809276d2
      Nick Clifton authored
      opcodes	* po/zh_CN.po: Updated simplified Chinese translation.
      809276d2
    • Simon Marchi's avatar
      value.c: Remove unused variables · 3e618834
      Simon Marchi authored
      Obvious patch to remove unused local variables (found by adding
      -Wunused).  I didn't touch this one in value_fetch_lazy, because
      check_typedef could have a desired side-effect.
      
        3743  struct type *type = check_typedef (value_type (val));
      
      gdb/ChangeLog:
      
      	* value.c (release_value): Remove unused variable.
      	(record_latest_value): Likewise.
      	(access_value_history): Likewise.
      	(preserve_values): Likewise.
      3e618834
    • Tom Tromey's avatar
      Initialize py_type_printers in ext_lang_type_printers · fe10fe31
      Tom Tromey authored
      When running gdb in the build directory without passing
      --data-directory, I noticed I could provoke a crash by:
      
          $ ./gdb -nx ./gdb
          (gdb) ptype/o struct dwarf2_per_objfile
      
      ... and then trying to "q" out at the pagination prompt.
      
      valgrind complained about an uninitialized use of py_type_printers.
      Initializing this member fixes the bug.
      
      I believe this bug can occur even when the gdb Python libraries are
      available, for example if get_type_recognizers fails.
      
      Tested by hand on x86-64 Fedora 26.  No test case because it seemed
      difficult to guarantee failures.
      
      gdb/ChangeLog
      2018-05-17  Tom Tromey  <tom@tromey.com>
      
      	* extension.h (struct ext_lang_type_printers) <py_type_printers>:
      	Initialize.
      fe10fe31
    • GDB Administrator's avatar
      Automatic date update in version.in · 1a87f0ee
      GDB Administrator authored
      1a87f0ee
  7. 16 May, 2018 7 commits
    • Maciej W. Rozycki's avatar
      PR gdb/22286: linux-nat-trad: Support arbitrary register widths · 1d761124
      Maciej W. Rozycki authored
      Update `fetch_register' and `store_register' code to support arbitrary
      register widths rather than only ones that are a multiply of the size of
      the `ptrace' data type used with PTRACE_PEEKUSR and PTRACE_POKEUSR
      requests to access registers.  Remove associated assertions, correcting
      an issue with accessing the DSPControl (`$dspctl') register on n64 MIPS
      native targets:
      
      (gdb) print /x $dspctl
      .../gdb/linux-nat-trad.c:50: internal-error: void linux_nat_trad_target::fetch_register(regcache*, int): Assertion `(size % sizeof (PTRACE_TYPE_RET)) == 0' failed.
      A problem internal to GDB has been detected,
      further debugging may prove unreliable.
      Quit this debugging session? (y or n) n
      
      This is a bug, please report it.  For instructions, see:
      <http://www.gnu.org/software/gdb/bugs/>.
      
      .../gdb/linux-nat-trad.c:50: internal-error: void linux_nat_trad_target::fetch_register(regcache*, int): Assertion `(size % sizeof (PTRACE_TYPE_RET)) == 0' failed.
      A problem internal to GDB has been detected,
      further debugging may prove unreliable.
      Create a core file of GDB? (y or n) n
      Command aborted.
      (gdb)
      
      All registers are now reported correctly and their architectural
      hardware widths respected:
      
      (gdb) print /x $dspctl
      $1 = 0x55aa33cc
      (gdb) info registers
                        zero               at               v0               v1
       R0   0000000000000000 0000000000000001 000000fff7ffeb20 0000000000000000
                          a0               a1               a2               a3
       R4   0000000000000001 000000ffffffeaf8 000000ffffffeb08 0000000000000000
                          a4               a5               a6               a7
       R8   000000fff7ee3800 000000fff7ede8f0 000000ffffffeaf0 2f2f2f2f2f2f2f2f
                          t0               t1               t2               t3
       R12  0000000000000437 0000000000000002 000000fff7ffd000 0000000120000ad0
                          s0               s1               s2               s3
       R16  000000fff7ee2068 0000000120000e60 0000000000000000 0000000000000000
                          s4               s5               s6               s7
       R20  0000000000521ec8 0000000000522608 0000000000000000 0000000000000000
                          t8               t9               k0               k1
       R24  0000000000000000 0000000120000d9c 0000000000000000 0000000000000000
                          gp               sp               s8               ra
       R28  0000000120019030 000000ffffffe990 000000ffffffe990 000000fff7d5b88c
                      status               lo               hi         badvaddr
            0000000000109cf3 0000000000005ea5 0000000000000211 000000fff7fc6fe0
                       cause               pc
            0000000000800024 0000000120000dbc
                        fcsr              fir              hi1              lo1
                    00000000         00f30000 0000000000000000 0101010101010101
                         hi2              lo2              hi3              lo3
            0202020202020202 0303030303030303 0404040404040404 0505050505050505
                      dspctl          restart
                    55aa33cc 0000000000000000
      (gdb)
      
      NB due to the lack of access to 64-bit DSP hardware all DSP register
      values in the dumps are artificial and have been created with a debug
      change applied to the kernel handler of the `ptrace' syscall.
      
      The use of `store_unsigned_integer' and `extract_unsigned_integer'
      unconditionally in all cases rather than when actual data occupies a
      part of the data quantity exchanged with `ptrace' makes code perhaps
      marginally slower, however I think avoiding it is not worth code
      obfuscation it would cause.  If this turns out unfounded, then there
      should be no problem with optimizing this code later.
      
      	gdb/
      	PR gdb/22286
      	* linux-nat-trad.c (linux_nat_trad_target::fetch_register):
      	Also handle registers whose width is not a multiple of
      	PTRACE_TYPE_RET.
      	(linux_nat_trad_target::store_register): Likewise.
      1d761124
    • Maciej W. Rozycki's avatar
      NDS32/GAS: Correct an `expr' global shadowing error for pre-4.8 GCC · 49d519ec
      Maciej W. Rozycki authored
      Remove `-Wshadow' compilation errors:
      
      cc1: warnings being treated as errors
      .../gas/config/tc-nds32.c: In function 'md_assemble':
      .../gas/config/tc-nds32.c:5212: error: declaration of 'expr' shadows a global declaration
      .../gas/expr.h:180: error: shadowed declaration is here
      make[4]: *** [tc-nds32.o] Error 1
      
      which for versions of GCC before 4.8 prevent support for NDS32 targets
      from being built.  See also GCC PR c/53066.
      
      	gas/
      	* tc-nds32.c (md_assemble): Rename `expr' local variable to
      	`insn_expr'.
      49d519ec
    • Maciej W. Rozycki's avatar
      NDS32/BFD: Fix build error in `nds32_convert_32_to_16' · 1624c9ca
      Maciej W. Rozycki authored
      Fix:
      
      cc1: warnings being treated as errors
      .../bfd/elf32-nds32.c: In function 'nds32_convert_32_to_16':
      .../bfd/elf32-nds32.c:6816: error: 'insn_type' may be used uninitialized in this function
      make[4]: *** [elf32-nds32.lo] Error 1
      
      seen with GCC 4.1.2 and 4.4.7.
      
      	bfd/
      	* elf32-nds32.c (nds32_convert_32_to_16): Preset `insn_type'.
      1624c9ca
    • Tom Tromey's avatar
      Make "cbfd" a gdb_bfd_ref_ptr · 06333fea
      Tom Tromey authored
      This changes program_space::cbfd to be a gdb_bfd_ref_ptr.  This makes
      it somewhat less error-prone to use, because now it manages the
      reference counting automatically.
      
      Tested by the buildbot.
      
      2018-05-16  Tom Tromey  <tom@tromey.com>
      
      	* gdbcore.h (core_bfd): Redefine.
      	* corelow.c (core_target::close): Update.
      	(core_target_open): Update.
      	* progspace.h (struct program_space) <cbfd>: Now a
      	gdb_bfd_ref_ptr.
      06333fea
    • Tom Tromey's avatar
      Use a distinguishing name for minidebug objfile · 921222e2
      Tom Tromey authored
      One part of PR cli/19551 is that the mini debug info objfile reuses the
      name of the main objfile from which it comes.  This can be seen because
      gdb claims to be reading symbols from the same file two times, like:
      
      Reading symbols from /bin/gdb...Reading symbols from /bin/gdb...(no debugging symbols found)...done.
      
      I think this would be less confusing if the minidebug objfile were given
      a different name.  That is what this patch implements.  It also arranges
      for the minidebug objfile to be marked OBJF_NOT_FILENAME.
      
      After this patch the output looks like:
      
      Reading symbols from /bin/gdb...Reading symbols from .gnu_debugdata for /usr/libexec/gdb...(no debugging symbols found)...done.
      
      Tested by the buildbot.
      
      gdb/ChangeLog
      2018-05-16  Tom Tromey  <tom@tromey.com>
      
      	PR cli/19551:
      	* symfile-add-flags.h (enum symfile_add_flags)
      	<SYMFILE_NOT_FILENAME>: New constant.
      	* symfile.c (read_symbols): Use SYMFILE_NOT_FILENAME.  Get
      	objfile name from BFD.
      	(symbol_file_add_with_addrs): Check SYMFILE_NOT_FILENAME.
      	* minidebug.c (find_separate_debug_file_in_section): Put
      	".gnu_debugdata" into BFD's file name.
      921222e2
    • Simon Marchi's avatar
      regcache.c: Remove unused typedefs · 3acb7083
      Simon Marchi authored
      gdb/ChangeLog:
      
      	* regcache.c (regcache_read_ftype, regcache_write_ftype):
      	Remove.
      3acb7083
    • Alan Modra's avatar
      PR22458, failure to choose a matching ELF target · 7cf7fcc8
      Alan Modra authored
      https://sourceware.org/ml/binutils/2013-05/msg00271.html was supposed
      to banish "file format is ambiguous" errors for ELF.  It didn't,
      because the code supposedly detecting formats that implement
      match_priority didn't work.  That was due to not placing all matching
      targets into the vector of matching targets.  ELF objects should all
      match the generic ELF target (priority 2), plus one or more machine
      specific targets (priority 1), and perhaps a single machine specific
      target with OS/ABI set (priority 0, best match).  So the armel object
      in the testcase actually matches elf32-littlearm,
      elf32-littlearm-symbian, and elf32-littlearm-vxworks (all priority 1),
      and elf32-little (priority 2).  As the PR reported, elf32-little
      wasn't seen as matching.  Fixing that part of the problem wasn't too
      difficult but matching the generic ELF target as well as the ARM ELF
      targets resulted in ARM testsuite failures.
      
      These proved to be the annoying reordering of stubs that occurs from
      time to time due to the stub names containing the section id.
      Matching another target causes more sections to be created in
      elf_object_p.  If section ids change, stub names change, which results
      in different hashing and can therefore result in different hash table
      traversal and stub creation order.  That particular problem is fixed
      by resetting section_id to the initial state before attempting each
      target match, and taking a snapshot of its value after a successful
      match.
      
      	PR 22458
      	* format.c (struct bfd_preserve): Add section_id.
      	(bfd_preserve_save, bfd_preserve_restore): Save and restore
      	_bfd_section_id.
      	(bfd_reinit): Set _bfd_section_id.
      	(bfd_check_format_matches): Put all matches of any priority into
      	matching_vector.  Save initial section id and start each attempted
      	match at that section id.
      	* libbfd-in.h (_bfd_section_id): Declare.
      	* section.c (_bfd_section_id): Rename from section_id and make
      	global.  Adjust uses.
      	(bfd_get_next_section_id): Delete.
      	* elf64-ppc.c (ppc64_elf_setup_section_lists): Replace use of
      	bfd_get_section_id with _bfd_section_id.
      	* libbfd.h: Regenerate.
      	* bfd-in2.h: Regenerate.
      7cf7fcc8