1. 28 Jun, 2020 4 commits
  2. 27 Jun, 2020 4 commits
    • Simon Marchi's avatar
      gdbsupport: add format attribute to print_xml_feature::add_line · 6db3031e
      Simon Marchi authored
      Fixes this clang error:
      
            CXX      tdesc.o
          /home/smarchi/src/binutils-gdb/gdbsupport/tdesc.cc:444:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
            string_vappendf (tmp, fmt, ap);
                                  ^~~
      
      There is already a but about GCC not emitting this warning:
      
          https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82206
      
      gdbsupport/ChangeLog:
      
      	* tdesc.h (class print_xml_feature) <add_line>: Add
      	ATTRIBUTE_PRINTF.
      
      Change-Id: I7014075e83717f6d7e19d044a3675ff9981ebe17
      6db3031e
    • Pedro Alves's avatar
      Make {get,set}_inferior_io_terminal inferior methods · 05779d57
      Pedro Alves authored
      This converts the get_inferior_io_terminal and
      set_inferior_io_terminal free functions to inferior methods.
      
      Since the related commands are called "tty", "{set,show}
      inferior-tty", and MI's "-inferior-tty-{set,show}", to make the
      connection between the commands and the code more obvious, the methods
      are named set_tty/tty instead of set_io_terminal/io_terminal.
      
      gdb/ChangeLog:
      
      	* fork-child.c (prefork_hook): Adjust.
      	* infcmd.c (set_inferior_io_terminal, get_inferior_io_terminal):
      	Delete.
      	(set_inferior_tty_command, show_inferior_tty_command): Adjust.
      	* inferior.c (inferior::set_tty, inferior::tty): New methods.
      	* inferior.h (set_inferior_io_terminal, get_inferior_io_terminal):
      	Remove declarations.
      	(struct inferior) <set_tty, tty>: New methods.
      	(struct inferior) <terminal>: Rename to ...
      	(struct inferior) <m_terminal>: ... this and make private.
      	* main.c (captured_main_1): Adjust.
      	* mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): Adjust.
      	(mi_cmd_inferior_tty_show): Adjust.
      	* nto-procfs.c (nto_procfs_target::create_inferior): Adjust.
      	* windows-nat.c (windows_nat_target::create_inferior): Adjust.
      05779d57
    • Alan Modra's avatar
      asan: readelf: use after free in process_archive · cfc16775
      Alan Modra authored
      This tidies up in cases where fuzzed thin archives hit the error return
      path in setup_nested_archive.
      
      	* elfcomm.c (setup_nested_archive): Set nested_arch->file to NULL
      	after freeing.
      	(release_archive): Set fields of arch to NULL after freeing.
      cfc16775
    • GDB Administrator's avatar
      Automatic date update in version.in · aa57a9d3
      GDB Administrator authored
      aa57a9d3
  3. 26 Jun, 2020 25 commits
    • Philippe Waroquiers's avatar
      Make test names unique in python.exp and guile.exp · c0b3b3bd
      Philippe Waroquiers authored
      Version 2, handles the comments of Simon and Pedro.
      
      Note that gdb_test_multiline and gdb_py_test_multiple are using
      the "input line" as the test name, and so when there is a duplicated
      input line (such as a line containing "end"), we have duplicated test
      names => as gdb_test_multiline and gdb_py_test_multiple are identical,
      as indicated in FIXME, move this to gdb.exp, and make the test name unique
      by adding the inputnr to the pass message for each input.
      
      2020-06-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
      
      	* lib/gdb.exp (gdb_test_multiline): New, moved from gdb-guile.exp,
      	have a input seq nr in each pass message.
              * lib/gdb-guile.exp (gdb_test_multiline): Move to gdb.exp.
      	* lib/gdb-python.exp (gdb_py_test_multiple): Remove.
      	* gdb.python/python.exp: Make test names unique,
      	use gdb_test_multiline instead of gdb_py_test_multiple,
      	use $gdb_test_name.
      	* gdb.guile/guile.exp: Make test names unique, use $gdb_test_name
      c0b3b3bd
    • H.J. Lu's avatar
      x86: Process ImmExt without operands · b6cd5d10
      H.J. Lu authored
      To support Intel AMX instructions with 8-bit immediate opcode extension,
      but without operands:
      
      tilerelease, 0, 0x49, 0xc0, 1, CpuAMX_TILE|Cpu64, Vex|VexOpcode=1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|ImmExt, { 0 }
      
      process ImmExt without operands.
      
      	* config/tc-i386.c (md_assemble): Process ImmExt without
      	operands.
      b6cd5d10
    • H.J. Lu's avatar
      i386-opc.tbl: Add a blank line · e978ad62
      H.J. Lu authored
      	* i386-opc.tbl: Add a blank line.
      e978ad62
    • H.J. Lu's avatar
      x86: Correct VexSIB128 to VecSIB128 · 79b32e73
      H.J. Lu authored
      79b32e73
    • H.J. Lu's avatar
      x86: Rename VecSIB to SIB for Intel AMX · 63112cd6
      H.J. Lu authored
      Rename VecSIB to SIB to support Intel Advanced Matrix Extensions which
      introduces instructions with a mandatory SIB byte which isn't a vector
      SIB (VSIB).
      
      gas/
      
      	* config/tc-i386.c (check_VecOperands): Replace vecsib with sib.
      	Replace VecSIB128, VecSIB256 and VecSIB512 with VECSIB128,
      	VECSIB256 and VECSIB512, respectively.
      	(build_modrm_byte): Replace vecsib with sib.
      
      opcodes/
      
      	* i386-gen.c (opcode_modifiers): Replace VecSIB with SIB.
      	(VecSIB128): Renamed to ...
      	(VECSIB128): This.
      	(VecSIB256): Renamed to ...
      	(VECSIB256): This.
      	(VecSIB512): Renamed to ...
      	(VECSIB512): This.
      	(VecSIB): Renamed to ...
      	(SIB): This.
      	(i386_opcode_modifier): Replace vecsib with sib.
      	* i386-opc.tbl (VexSIB128): New.
      	(VecSIB256): Likewise.
      	(VecSIB512): Likewise.
      	Replace VecSIB=1, VecSIB=2 and VecSIB=3 with VexSIB128, VecSIB256
      	and VecSIB512, respectively.
      63112cd6
    • Nick Alcock's avatar
      libctf: support platforms with separate libintl · 8e6635bd
      Nick Alcock authored
      We were not using the right configure machinery to spot libintl on
      platforms where it was required, leading to the spurious failure of
      various configure tests (e.g. for things like ELF support in BFD).
      
      libctf/
      	* aclocal.m4: Add config/gettext-sister.m4: Shuffle into
      	alphabetical order.
      	* configure.ac: Add ZW_GNU_GETTEXT_SISTER_DIR.
      	* config.h.in: Regenerated.
      	* Makefile.in: Likewise.
      	* configure: Likewise.
      8e6635bd
    • Nick Alcock's avatar
      libctf: add some missing #includes. · c1401ecc
      Nick Alcock authored
      Causes warnings on (at least) recent FreeBSD.
      
      libctf/
      	* ctf-create.c: Include <unistd.h>.
      	* ctf-open-bfd.c: Likewise.
      c1401ecc
    • Nick Alcock's avatar
      libctf, elfcpp, gold: do not assume that <byteswap.h> contains bswap_* · e755667f
      Nick Alcock authored
      At least one C library (uclibc-ng) defines some of these only when
      the compiler is GCC.  We might as well test for all three cases and
      handle any of them being missing.
      
      Very similar code exists in libctf and split between elfcpp and gold:
      fix both.
      
      (Also sync up elfcpp with a change made to libctf swap.h a few months
      ago: since there is no out-of-line definition of the bswap replacements,
      they should be declared static inline, not just inline, to prevent the
      linker generating out-of-line references to them.)
      
      	PR libctf/25120
      libctf/
      	* configure.ac: Check for bswap_16, bswap_32, and bswap_64 decls.
      	* swap.h (bswap_16): Do not assume that presence of <byteswap.h>
      	means this is declared.
      	(bswap_32): Likewise.
      	(bswap_64): Likewise.
      	(bswap_identity_64): Remove, unused.
      	* configure: Regenerated.
      	* config.h.in: Likewise.
      gold/
      	* configure.ac: Check for bswap_16, bswap_32, and bswap_64 decls.
      	* configure: Regenerated.
      	* config.h.in: Likewise.
      elfcpp/
      	* elfcpp_swap.h (bswap_16): Do not assume that presence of
      	<byteswap.h> means this is declared.  Make static inline, matching
      	recent change to libctf, since there is no non-inline definition
      	of these functions.
      	(bswap_32): Likewise.
      	(bswap_64): Likewise.
      e755667f
    • Nick Alcock's avatar
      libctf: work with compilers not supporting GNU C attributes · 86670658
      Nick Alcock authored
      The obvious fallback __attribute__ stanza was missing.
      
      Thanks to Harald van Dijk.
      
      	PR 25120
      libctf/
      	* ctf-impl.h (_libctf_printflike_): Add non-GNU-C fallback.
      	(_libctf_unlikely_): Likewise.
      	(_libctf_unused): Likewise.
      	(_libctf_malloc_): Likewise.
      86670658
    • Nick Alcock's avatar
      libctf: avoid nonportable __thread in CTF archive handling · 2e428e74
      Nick Alcock authored
      This keeps archive searching threadsafe using the new bsearch_r that was
      just added to libiberty.
      
      	PR25120
      libctf/
      	* ctf-archive.c (search_nametbl): No longer global: declare...
      	(ctf_arc_open_by_name_internal): ... here. Use bsearch_r.
      	(search_modent_by_name): Take and use ARG for the nametbl.
      2e428e74
    • Nick Alcock's avatar
      libctf, binutils: support CTF archives like objdump · 2f6ecaed
      Nick Alcock authored
      objdump and readelf have one major CTF-related behavioural difference:
      objdump can read .ctf sections that contain CTF archives and extract and
      dump their members, while readelf cannot.  Since the linker often emits
      CTF archives, this means that readelf intermittently and (from the
      user's perspective) randomly fails to read CTF in files that ld emits,
      with a confusing error message wrongly claiming that the CTF content is
      corrupt.  This is purely because the archive-opening code in libctf was
      needlessly tangled up with the BFD code, so readelf couldn't use it.
      
      Here, we disentangle it, moving ctf_new_archive_internal from
      ctf-open-bfd.c into ctf-archive.c and merging it with the helper
      function in ctf-archive.c it was already using.  We add a new public API
      function ctf_arc_bufopen, that looks very like ctf_bufopen but returns
      an archive given suitable section data rather than a ctf_file_t: the
      archive is a ctf_archive_t, so it can be called on raw CTF dictionaries
      (with no archive present) and will return a single-member synthetic
      "archive".
      
      There is a tiny lifetime tweak here: before now, the archive code could
      assume that the symbol section in the ctf_archive_internal wrapper
      structure was always owned by BFD if it was present and should always be
      freed: now, the caller can pass one in via ctf_arc_bufopen, wihch has
      the usual lifetime rules for such sections (caller frees): so we add an
      extra field to track whether this is an internal call from ctf-open-bfd,
      in which case we still free the symbol section.
      
      include/
      	* ctf-api.h (ctf_arc_bufopen): New.
      libctf/
      	* ctf-impl.h (ctf_new_archive_internal): Declare.
      	(ctf_arc_bufopen): Remove.
      	(ctf_archive_internal) <ctfi_free_symsect>: New.
      	* ctf-archive.c (ctf_arc_close): Use it.
      	(ctf_arc_bufopen): Fuse into...
      	(ctf_new_archive_internal): ... this, moved across from...
      	* ctf-open-bfd.c: ... here.
      	(ctf_bfdopen_ctfsect): Use ctf_arc_bufopen.
      	* libctf.ver: Add it.
      binutils/
      	* readelf.c (dump_section_as_ctf): Support .ctf archives using
      	ctf_arc_bufopen.  Automatically load the .ctf member of such
      	archives as the parent of all other members, unless specifically
      	overridden via --ctf-parent.  Split out dumping code into...
      	(dump_ctf_archive_member): ... here, as in objdump, and call
      	it once per archive member.
      	(dump_ctf_indent_lines): Code style fix.
      2f6ecaed
    • Nick Alcock's avatar
      libctf: create: forwards are always in the namespace of their referent · 8ffcdf18
      Nick Alcock authored
      The C namespace a forward is located in is always the same as the
      namespace of the corresponding complete type: 'struct foo' is in the
      struct namespace and does not collide with, say, 'union foo'.
      
      libctf allowed for this in many places, but inconsistently: in
      particular, forward *addition* never allowed for this, and was interning
      forwards in the default namespace, which is always wrong, since you can
      only forward structs, unions and enums, all of which are in their own
      namespaces in C.
      
      Forward removal needs corresponding adjustment to remove the names form
      the right namespace, as does ctf_rollback.
      
      libctf/
      	* ctf-create.c (ctf_add_forward): Intern in the right namespace.
      	(ctf_dtd_delete): Remove correspondingly.
      	(ctf_rollback): Likewise.
      8ffcdf18
    • Nick Alcock's avatar
      libctf: create: ctf_add_type should hand back already-added non-SoUs · d04a47ac
      Nick Alcock authored
      When we add a type from a dictionary and then try to add it again, we
      should hand it back unchanged unless it is a structure, union or enum
      with a different number of members.  That's what the comment says we do.
      
      Instead, we hand it back unchanged *only* if it is a structure, union or
      enum with the same number of members: non-structs, unions and enums are
      unconditionally added.  This causes extreme type bloating and (in
      conjunction with the bug fixed by the next commit) can easily lead to
      the same type being mistakenly added to a dictionary more than once
      (which, for forwards, was not banned and led to dictionary corruption).
      
      libctf/
      	* ctf-create.c (ctf_add_type_internal): Hand back existing types
      	unchanged.
      d04a47ac
    • Nick Alcock's avatar
      libctf: create: don't add forwards if the type added already exists · 6bbf9da8
      Nick Alcock authored
      This is what ctf_add_forward is documented to do, but it's not what it
      actually does: the code is quite happy to add forwards that duplicate
      existing structs, etc.
      
      This is obviously wrong and breaks both the nondeduplicating linker
      and the upcoming deduplicator, as well as allowing ordinary callers of
      ctf_add_type to corrupt the dictionary by just adding the same root-
      visible forward more than once.
      
      libctf/
      	* ctf-create.c (ctf_add_forward): Don't add forwards to
      	types that already exist.
      6bbf9da8
    • Nick Alcock's avatar
      libctf: create: non-root-visible types should not appear in name tables · fe4c2d55
      Nick Alcock authored
      We were accidentally interning newly-added and newly-opened
      non-root-visible types into name tables, and removing names from name
      tables when such types were removed.  This is very wrong: the whole
      point of non-root-visible types is they do not go in name tables and
      cannot be looked up by name.  This bug made non-root-visible types
      basically identical to root-visible types, right back to the earliest
      days of libctf in the Solaris era.
      
      libctf/
      	* ctf-open.c (init_types): Only intern root-visible types.
      	* ctf-create.c (ctf_dtd_insert): Likewise.
      	(ctf_dtd_delete): Only remove root-visible types.
      	(ctf_rollback): Likewise.
      	(ctf_add_generic): Adjust.
      	(ctf_add_struct_sized): Adjust comment.
      	(ctf_add_union_sized): Likewise.
      	(ctf_add_enum): Likewise.
      	* ctf-impl.h (ctf_dtd_insert): Adjust prototype.
      fe4c2d55
    • Nick Alcock's avatar
      binutils, ld: work with --disable-libctf · 094e34f2
      Nick Alcock authored
      This unfortunately means conditionalizing out all the libctf code, but
      the result is not too unbearably ugly, if a bit repetitive.  I have
      stubbed out code in the !ENABLE_LIBCTF path to avoid extra redundant
      ifdefs where it seems that might be helpful.  (The stubs are not too
      disruptive, but I've tried to keep them on one line where possible to
      avoid filling up the screen with stubs that nobody would care about.
      If this is too much of a coding style violation I can change it.)
      
      Changes since v2: use GCC_ENABLE rather than repeating all the
                        AC_ARG_ENABLE stuff over and over again.
      
      ld/
      	* configure.ac [--enable-libctf]: New, default yes.
      	Set ENABLE_LIBCTF accordingly.
      	* Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      	* Makefile.in: Regenerate.
      	* aclocal.m4: Regenerate.
      	* ldlang.c (ctf_output): Conditionalize on ENABLE_LIBCTF.
      	(ldlang_open_ctf): Likewise.
      	(lang_merge_ctf): Likewise.
      	(ldlang_ctf_apply_strsym): Likewise.
      	(lang_write_ctf): Likewise.
      	(ldlang_write_ctf_late): Likewise.
      	(ldlang_open_ctf) [!ENABLE_LIBCTF]: Warn about the presence of CTF
      	sections.
      	(lang_merge_ctf) [!ENABLE_LIBCTF]: New stub.
      	(ldlang_ctf_apply_strsym) [!ENABLE_LIBCTF]: Likewise.
      	(lang_write_ctf) [!ENABLE_LIBCTF]: Likewise.
      	(ldlang_write_ctf_late) [!ENABLE_LIBCTF]: Likewise.
      	* ldelfgen.c (ldelf_emit_ctf_early): Conditionalize on
      	ENABLE_LIBCTF.
      	(struct ctf_strsym_iter_cb_arg): Likewise.
      	(ldelf_ctf_strtab_iter_cb): Likewise.
      	(ldelf_ctf_symbols_iter_cb): Likewise.
      	(ldelf_examine_strtab_for_ctf): Likewise.
      	(ldelf_emit_ctf_early) [!ENABLE_LIBCTF]: New stub.
      	(ldelf_examine_strtab_for_ctf) [!ENABLE_LIBCTF]: New stub.
      
      binutils/
      	* configure.ac [--enable-libctf]: New, default yes.
      	Set ENABLE_LIBCTF accordingly.
      	* Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF and LIBCTF_NOBFD.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      	* Makefile.in: Regenerate.
      	* aclocal.m4: Regenerate.
      	* objdump.c (usage): Conditionalize portions on ENABLE_LIBCTF.
      	(option_values): Likewise.
      	(long_options): Likewise.
      	(main): Likewise.
      	(dump_ctf_indent_lines): Conditionalize out when !ENABLE_LIBCTF.
      	(make_ctfsect): Likewise.
      	(dump_ctf_archive_member): Likewise.
      	(dump_ctf) [ENABLE_LIBCTF]: Likewise.
      	(dump_ctf) [!ENABLE_LIBCTF]: New empty stub.
      	* readelf.c (options): Conditionalize portions on ENABLE_LIBCTF.
      	(usage): Likewise.
      	(process_section_contents): Likewise.
      	(shdr_to_ctf_sect): Conditionalize out when !ENABLE_LIBCTF.
      	(dump_ctf_indent_lines): Likewise.
      	(dump_section_as_ctf) [ENABLE_LIBCTF]: Likewise.
      094e34f2
    • Nick Alcock's avatar
      Fix --enable-libctf and --disable-static · 1776e3e5
      Nick Alcock authored
      This fixes test runs and compilation when --disable-libctf,
      --disable-static, or --enable-shared are passed.
      
      Changes since v2: Use GCC_ENABLE and fix indentation.  Fix prototype
      using 'void'.  Use 'unsupported' and gdb_caching_proc.
      
      Changes since v3: Adapt to upstream changes providing skip_ctf_tests.
      
      Changes since v4: Adapt to upstream changes in the seven months (!)
      since I last looked at this.
      
      gdb/ChangeLog
      	* configure.ac: Add --enable-libctf: handle --disable-static
      	properly.
      	* acinclude.m4: sinclude ../config/enable.m4.
      	* Makefile.in (aclocal_m4_deps): Adjust accordingly.
      	(LIBCTF): Substitute in.
      	(CTF_DEPS): New, likewise.
      	(CLIBS): libctf needs symbols from libbfd: move earlier.
      	(CDEPS): Use CTF_DEPS, not LIBCTF, now LIBCTF can include rpath
      	flags.
      	* ctfread.c: Surround in ENABLE_LIBCTF.
      	(elfctf_build_psymtabs) [!ENABLE_LIBCTF]: New stub.
      	* configure: Regenerate.
      	* config.in: Likewise.
      
      gdb/testsuite/ChangeLog
      	* configure.ac: Add --enable-libctf.
      	* aclocal.m4: sinclude ../config/enable.m4.
      	* Makefile.in (site.exp): Add enable_libctf to site.exp.
      	* lib/gdb.exp (skip_ctf_tests): Use it.
      	* gdb.base/ctf-constvars.exp: Error message tweak.
      	* gdb.base/ctf-ptype.exp: Likewise.
      	* configure: Regenerate.
      1776e3e5
    • Jan Beulich's avatar
      x86: make I disassembler macro available for new use · d1c36125
      Jan Beulich authored
      The {Q|Q} construct on lgdt/lidt and the slightly different {Q|IQ}
      struck me as odd when encountering. Realizing they both have the same
      effect, let's free up the I macro by using the former form of construct
      where needed (there aren't that many uses overall).
      
      With there now being several multi-character macros also re-do "alt"
      handling slightly: Terminate it when finding the closing brace, rather
      than after the next single character. Also set the flag only when
      actually in Intel syntax mode.
      d1c36125
    • Jan Beulich's avatar
      ld/x86: actually invoke k1om tests · 198e1db7
      Jan Beulich authored
      Unlike claimed by the ChangeLog entries added by 7a9068fe ("Add
      initial Intel K1OM support") these tests did never get enabled.
      198e1db7
    • Jan Beulich's avatar
      x86: fix processing of -M disassembler option · 2a1bb84c
      Jan Beulich authored
      Multiple -M options can be specified in any order. Therefore stright
      assignment to fields affected needs to be avoided, such that earlier
      options' effects won't be discarded. This was in particular a problem
      for -Msuffix followed by certain of the other sub-options.
      
      While updating documentation, take the liberty and also drop the
      redundant mentioning of being able to comma-separate multiple options.
      2a1bb84c
    • Gary Benson's avatar
      Fix -Wstring-compare testcase build failure · f53b3eeb
      Gary Benson authored
      Clang fails to compile the file gdb/testsuite/gdb.cp/try_catch.cc
      with the following error:
        warning: result of comparison against a string literal is
        unspecified (use strncmp instead) [-Wstring-compare]
      
      This commit fixes the error, replacing the pointer comparison with
      a call to strcmp.  This commit also adds a final check: the test
      program is run to the final return statement, and the value of
      "test" is checked to ensure it is still "true" at that point.
      
      gdb/testsuite/ChangeLog:
      
      	* gdb.cp/try_catch.cc: Include string.h.
      	(main): Replace comparison against string literal with
      	strcmp, avoiding build failure with -Wstring-compare.
      	Add "marker test-complete".
      	* gdb.cp/try_catch.exp: Run the test to the above marker,
      	then verify that the value of "test" is still true.
      f53b3eeb
    • Eli Zaretskii's avatar
      Improve documentation of which shell is used by GDB's shell commands · edf92af0
      Eli Zaretskii authored
      gdb/doc/ChangeLog:
      
      2020-06-26  Eli Zaretskii  <eliz@gnu.org>
      
      	* gdb.texinfo (Shell Commands): More accurate description of use
      	of $SHELL.  Reported by Sandra Loosemore <sandra@codesourcery.com>.
      edf92af0
    • Pat Bernardi's avatar
      m68k: tag floating-point ABI used · 85f7484a
      Pat Bernardi authored
      This patch adds GNU attribute support to m68k and utilises it to tag the
      floating-point calling convention used (hard-float or soft-float). It enables
      the linker to ensure linked objects use a consistent floating-point ABI and
      allows tools like GDB to infer the ABI used from the ELF file. It is based on
      similar work done for PowerPC.
      
      bfd/
      	* elf32-m68k.c (m68k_elf_merge_obj_attributes): New function.
      	(elf32_m68k_merge_private_bfd_data): Merge GNU attributes.
      binutils/
      	* readelf.c (display_m68k_gnu_attribute): New function.
      	(process_arch_specific): Call display_m68k_gnu_attribute for EM_68K.
      gas/
      	* config/tc-m68k.c (m68k_elf_gnu_attribute): New function.
      	(md_pseudo_table): Handle "gnu_attribute".
      	* doc/as.texi: Document GNU attribute for M68K.
      include/
      	* elf/m68k.h: Add enum for GNU object attribute with floating point
      	tag name and values.
      ld/
      	* testsuite/ld-m68k/attr-gnu-4-0.s: New file.
      	* testsuite/ld-m68k/attr-gnu-4-1.s: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-2.s: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-00.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-01.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-02.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-10.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-11.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-12.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-20.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-21.d: Likewise.
      	* testsuite/ld-m68k/attr-gnu-4-22.d: Likewise.
      	* testsuite/ld-m68k/m68k.exp: Run the new tests.
      85f7484a
    • Alan Modra's avatar
      RISCV changes broke 32-bit --enable-targets=all · ba9b3ef5
      Alan Modra authored
      By the look of it, git commit 39ff0b81 broke 32-bit host
      --enable-targets=all binutils builds.
      
      /usr/local/bin/ld: ../opcodes/.libs/libopcodes.a(riscv-dis.o): in function `parse_riscv_dis_option':
      /home/alan/src/binutils-gdb/opcodes/riscv-dis.c:102: undefined reference to `riscv_get_priv_spec_class'
      collect2: error: ld returned 1 exit status
      Makefile:925: recipe for target 'objdump' failed
      
      The problem is that elfxx-riscv.c is not built for a 32-bit host
      without --enable-64-bit-bfd or unless RISCV is given specifically as a
      target.  No such trimming of 64-bit only targets is done in opcodes.
      
      One solution is to move these support functions to cpu-riscv.c, which
      runs into "error: implicit declaration of function ‘xmalloc’".  Now,
      xmalloc is not supposed to be used in libbfd or libopcodes - it's rude
      to crash out of an application that calls libbfd or libopcodes
      functions without giving it a chance to deal with out-of-memory
      itself.  So I removed the xmalloc and instead used a fixed size
      buffer.  If you are worried about adding 36 bytes for the buffer to
      the riscv_get_priv_spec_class_from_numbers stack frame size, then you
      have no idea of the likely xmalloc + malloc stack frame size!  Trying
      to reduce memory usage is commendable, but in this instance
      riscv_estimate_digit and malloc for a temp buffer uses a lot more
      memory than a fixed max-size buffer.
      
      	* elfxx-riscv.c (struct priv_spec_t, priv_specs),
      	(riscv_get_priv_spec_class, riscv_get_priv_spec_class_from_numbers),
      	(riscv_get_priv_spec_name): Move to..
      	* cpu-riscv.c: ..here.
      	(riscv_get_priv_spec_class_from_numbers): Don't xmalloc temp buffer.
      	Use %u to print unsigned numbers.
      ba9b3ef5
    • GDB Administrator's avatar
      Automatic date update in version.in · 30610e15
      GDB Administrator authored
      30610e15
  4. 25 Jun, 2020 7 commits
    • Simon Marchi's avatar
      gdb: use make_unique_xstrdup in set_inferior_io_terminal · 58373b80
      Simon Marchi authored
      gdb/ChangeLog:
      
      	* infcmd.c (set_inferior_io_terminal): Use make_unique_xstrdup.
      
      Change-Id: I38b6e753f58947531fe4a293d574bc27ec128f47
      58373b80
    • Simon Marchi's avatar
      gdb: make inferior::terminal a unique ptr · 277474ee
      Simon Marchi authored
      This changes the inferior::terminal field to be a unique pointer, so its
      deallocation is automatically managed.
      
      gdb/ChangeLog:
      
      	* inferior.h (struct inferior) <terminal>: Change type to
      	gdb::unique_xmalloc_ptr<char>.
      	* inferior.c (inferior::~inferior): Don't free inf->terminal.
      	* infcmd.c (set_inferior_io_terminal): Don't free terminal
      	field, adjust to unique pointer.
      	(get_inferior_io_terminal): Adjust to unique pointer.
      
      Change-Id: Iedb6459b4f9eeae812b0cb9d514b5707d5107cdb
      277474ee
    • David Faust's avatar
      cpu: fix offset16 type, update c-calls in bpf.cpu · d73be611
      David Faust authored
      Correct the type of the offset16 field to HI, and simplify memory
      accesses which use it. Also update c-calls in semantics for a
      few instructions.
      
      cpu/ChangeLog:
      
      2020-06-25 David Faust  <david.faust@oracle.com>
      
      	* bpf.cpu (f-offset16): Change type from INT to HI.
      	(dxli): Simplify memory access.
      	(dxsi): Likewise.
      	(define-endian-insn): Update c-call in semantics.
      	(dlabs) Likewise.
      	(dlind) Likewise.
      d73be611
    • Andrew Burgess's avatar
      gdb/riscv: Loop over all registers for 'info all-registers' · 6d74da72
      Andrew Burgess authored
      Currently the 'info all-registers' command only loops over those
      registers that are known to GDB.  Any registers that are unknown, that
      is, are mentioned in the target description, but are not something GDB
      otherwise knows, will not be displayed.
      
      This feels wrong, so this commit fixes this mistake.  The output of
      'info all-registers' now matches 'info registers all'.
      
      gdb/ChangeLog:
      
      	* riscv-tdep.c (riscv_print_registers_info): Loop over all
      	registers, not just the known core set of registers.
      
      gdb/testsuite/ChangeLog:
      
      	* gdb.arch/riscv-tdesc-regs.exp: New test cases.
      6d74da72
    • Andrew Burgess's avatar
      gdb/riscv: Record information about unknown tdesc registers · 2e52d038
      Andrew Burgess authored
      Making use of the previous commit, record information about unknown
      registers in the target description, and use this to resolve two
      issues.
      
      1. Some targets (QEMU) are reporting three register fflags, frm, and
         fcsr, twice, once in the FPU feature, and once in the CSR feature.
         GDB does create two registers with identical names, but this
         is (sort of) fine, we only ever use the first one, and as both
         registers access the same target state things basically work OK.
         The only real problem is that the register names show up twice in
         'info registers all' output.
      
         In this commit we spot the duplicates of these registers and then
         return NULL when asked for the name of these registers.  This
         causes GDB to hide these registers from the user, fixing this
         problem.
      
      2. Some targets (QEMU) advertise CSRs that GDB then can't read.  The
         problem is these targets also say these CSRs are part of the
         save/restore register groups.
      
         This means that before an inferior call GDB tries to save all of
         these CSRs, and a failure to read one causes the inferior call to
         be abandoned.
      
         We already work around this issue to some degree, known CSRs are
         removed from the save/restore groups, despite what the target might
         say.  However, any unknown CSRs are (currently) not removed in this
         way.
      
         After this commit we keep a log of the register numbers for all
         unknown CSRs, then when asked about the register groups, we
         override the group information for unknown CSRs, removing them from
         the save and restore groups.
      
      gdb/ChangeLog:
      
      	* riscv-tdep.c (riscv_register_name): Return NULL for duplicate
      	fflags, frm, and fcsr registers.
      	(riscv_register_reggroup_p): Remove unknown CSRs from save and
      	restore groups.
      	(riscv_tdesc_unknown_reg): New function.
      	(riscv_gdbarch_init): Pass riscv_tdesc_unknown_reg to
      	tdesc_use_registers.
      	* riscv-tdep.h (struct gdbarch_tdep): Add
      	unknown_csrs_first_regnum, unknown_csrs_count,
      	duplicate_fflags_regnum, duplicate_frm_regnum, and
      	duplicate_fcsr_regnum fields.
      
      gdb/testsuite/ChangeLog:
      
      	* gdb.arch/riscv-tdesc-regs.exp: Extend test case.
      2e52d038
    • Andrew Burgess's avatar
      gdb: Extend target description processing of unknown registers · be64fd07
      Andrew Burgess authored
      This commit adds a new step to the processing of a target description
      done in tdesc_use_registers, this new step is about how unknown
      registers are processed.
      
      Currently an architecture looks through the target description and
      calls tdesc_numbered_register for each register is was expecting (or
      hoping) to find.  This builds up a map from GDB's register numbers to
      the tdesc_reg object.  Later the architecture calls
      tdesc_use_registers.
      
      In tdesc_use_registers we build a hash with keys being all the
      tdesc_reg object pointers, from this hash we remove all of the
      tdesc_reg objects that were assigned register numbers using
      tdesc_numbered_register.
      
      Finally we walk through all of the tdesc_reg objects, and if it was
      not already assigned a number we assign that register the next
      available number.
      
      The problem with this is that the architecture has no visibility of
      which unknown registers exist, and which tdesc_feature the register
      came from, in some cases this might be important.
      
      For example, on RISC-V GDB overrides the use of
      tdesc_register_reggroup_p, with riscv_register_reggroup_p to modify
      some of the register group choices.  In this function GDB wants to
      treat all registers from a particular feature in a certain way.  This
      is fine for registers that GDB knows might be in that feature, but for
      unknown registers the RISC-V parts of GDB have no easy way to figure
      out which unknown registers exist, and what numbers they were
      assigned.
      
      We could figure this information out by probing the register
      structures after calling tdesc_use_registers, but this would be
      horrible, much better to have tdesc_use_registers tell the
      architecture about unknown registers.
      
      This is what this commit does.  A new phase of tdesc_use_registers,
      just before the unknown registers are assigned a number, we loop over
      each tdesc_reg object, if it has not been assigned a number then we
      figure out what number would be assigned and then call back into the
      architecture passing the tdesc_feature, register name, and the
      proposed register number.
      
      The architecture is free to return the proposed register number, or it
      can return a different number (which has a result identical to having
      called tdesc_numbered_register).  Alternatively the architecture can
      return -1 to indicate the register should be numbered later.
      
      After calling the callback for every tdesc_reg object any registers
      still don't have a number assigned (because the architecture returned
      -1), then a new register number is assigned, which might be different
      from the proposed number that was suggested earlier.
      
      This commit adds the general target-description parts of this
      mechanism.  No targets are currently using this code.  The RISC-V
      target will make use of this in the next commit.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* target-descriptions.c (tdesc_use_registers): Add new parameter a
      	callback, use the callback (when not null) to help number unknown
      	registers.
      	* target-descriptions.h (tdesc_unknown_register_ftype): New typedef.
      	(tdesc_use_registers): Add extra parameter to declaration.
      be64fd07
    • Andrew Burgess's avatar
      gdb/riscv: Improve support for matching against target descriptions · 3b9fce96
      Andrew Burgess authored
      For the RISC-V target it is desirable if the three floating pointer
      status CSRs fflags, frm, and fcsr can be placed into either the FPU
      feature or the CSR feature.  This allows different targets to build
      the features in a way that better reflects their target.
      
      The change to support this within GDB is fairly simple, so this is
      done in this commit, and some tests added to check this new
      functionality.
      
      gdb/ChangeLog:
      
      	* riscv-tdep.c (value_of_riscv_user_reg): Moved to here from later
      	in the file.
      	(class riscv_pending_register_alias): Likewise.
      	(riscv_register_feature::register_info): Change 'required_p' field
      	to 'required', and change its type.  Add 'check' member function.
      	(riscv_register_feature::register_info::check): Define new member
      	function.
      	(riscv_xreg_feature): Change initialisation of 'required' field.
      	(riscv_freg_feature): Likewise.
      	(riscv_virtual_feature): Likewise.
      	(riscv_csr_feature): Likewise.
      	(riscv_check_tdesc_feature): Take extra parameter, the csr
      	tdesc_feature, rewrite the function to use the new
      	riscv_register_feature::register_info::check function.
      	(riscv_gdbarch_init): Pass the csr tdesc_feature where needed.
      
      gdb/testsuite/ChangeLog:
      
      	* gdb.arch/riscv-tdesc-loading-01.xml: New file.
      	* gdb.arch/riscv-tdesc-loading-02.xml: New file.
      	* gdb.arch/riscv-tdesc-loading-03.xml: New file.
      	* gdb.arch/riscv-tdesc-loading-04.xml: New file.
      	* gdb.arch/riscv-tdesc-loading.exp: New file.
      3b9fce96