1. Dec 20, 2020
    • Tom de Vries's avatar
      [gdb/testsuite] Add save_target_board_info · c541fa7c
      Tom de Vries authored
      Add a proc save_target_board_info, similar to save_vars, such that we can do:
      ...
      save_target_board_info { multilib_flags } {
          global board
          set board [target_info name]
          unset_board_info multilib_flags
          set_board_info multilib_flags "$override_multilib_flags"
          ...
      }
      ...
      and use it in gdb_compile_shlib.
      
      Tested on x86_64-linux.
      
      gdb/testsuite/ChangeLog:
      
      2020-12-20  Tom de Vries  <tdevries@suse.de>
      
      	* lib/gdb.exp (save_target_board_info): New proc.
      	(gdb_compile_shlib): Use save_target_board_info.
      c541fa7c
    • GDB Administrator's avatar
      Automatic date update in version.in · 3dc9a557
      GDB Administrator authored
      3dc9a557
    • H.J. Lu's avatar
      gold: Move sym declaration just before use · 97aac4ec
      H.J. Lu authored
      Move sym declaration just before use to avoid -Wmaybe-uninitialized
      warning from GCC 11.
      
      	PR gold/27097
      	* incremental.cc (Sized_relobj_incr::do_add_symbols): Move sym
      	declaration just before use.
      	(Sized_incr_dynobj::do_add_symbols): Likewise.
      	* plugin.cc (Sized_pluginobj::do_add_symbols): Likewise.
      97aac4ec
  2. Dec 19, 2020
    • Tom de Vries's avatar
      [gdb/testsuite] Introduce supports_scalar_storage_order_attribute · 60108e47
      Tom de Vries authored
      Introduce support test procs:
      - supports_scalar_storage_order_attribute, and
      - supports_gnuc
      and use them in test-case gdb.base/endianity.exp.
      
      Tested on x86_64-linux with gcc-7.5.0, gcc-4.8.5, and clang 10.0.1.
      
      gdb/testsuite/ChangeLog:
      
      2020-12-19  Tom de Vries  <tdevries@suse.de>
      
      	* lib/gdb.exp (supports_scalar_storage_order_attribute)
      	(supports_gnuc): New proc.
      	* gdb.base/endianity.exp: Define TEST_SSO.  Eliminate
      	test_compiler_info calls.  Add unsupported message.
      	* gdb.base/endianity.c: Use TEST_SSO.
      60108e47
    • Hannes Domani's avatar
      Don't compare types of enum fields · fa639f55
      Hannes Domani authored
      Comparing types of enum fields results in a crash, because they don't
      have a type.
      
      It can be reproduced by comparing the types of 2 instances of the same
      enum type in different objects:
      
      enum.h:
      
          enum e
          {
            zero,
            one,
          };
      
      enum-1.c:
      
          #include <enum.h>
          int func();
          enum e e1;
          int main()
          {
            return e1 + func();
          }
      
      enum-2.c:
      
          #include <enum.h>
          enum e e2;
          int func()
          {
            return e2;
          }
      
      $ gcc -g -oenum enum-1.c enum-2.c
      $ gdb -q enum.exe
      Reading symbols from enum.exe...
      (gdb) py print(gdb.parse_and_eval("e1").type==gdb.parse_and_eval("e2").type)
      
      Thread 1 received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 6184.0x1cc4]
      check_typedef (type=0x0) at C:/src/repos/binutils-gdb.git/gdb/gdbtypes.c:2745
      2745      while (type->code () == TYPE_CODE_TYPEDEF)
      
      gdb/ChangeLog:
      
      2020-12-19  Hannes Domani  <ssbssa@yahoo.de>
      
      	PR exp/27070
      	* gdbtypes.c (check_types_equal): Don't compare types of enum fields.
      
      gdb/testsuite/ChangeLog:
      
      2020-12-19  Hannes Domani  <ssbssa@yahoo.de>
      
      	PR exp/27070
      	* gdb.python/compare-enum-type-a.c: New test.
      	* gdb.python/compare-enum-type-b.c: New test.
      	* gdb.python/compare-enum-type.exp: New file.
      	* gdb.python/compare-enum-type.h: New test.
      fa639f55
    • Bernd Edlinger's avatar
      Warn about static libs vs. source-highlight only when necessary · 0455b7d3
      Bernd Edlinger authored
      Avoid the error message when source-highlight is actually available.
      
      2020-12-19  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
      	* configure.ac: Move the static libs vs. source-highlight
      	error message to a better place.
      	* configure: Regenerate.
      0455b7d3
    • GDB Administrator's avatar
      Automatic date update in version.in · a24e0498
      GDB Administrator authored
      a24e0498
    • Hannes Domani's avatar
      Fix name of main_type field type in pretty printer · e51765f9
      Hannes Domani authored
      It was renamed from type to m_type.
      
      gdb/ChangeLog:
      
      2020-12-18  Hannes Domani  <ssbssa@yahoo.de>
      
      	* gdb-gdb.py.in: Fix main_type field name.
      e51765f9
    • Hannes Domani's avatar
      Remove erroneous 'a' in gdb.register_window_type documentation · e8460459
      Hannes Domani authored
      gdb/doc/ChangeLog:
      
      2020-12-18  Hannes Domani  <ssbssa@yahoo.de>
      
      	* python.texi (TUI Windows In Python): Remove erroneous 'a'.
      e8460459
    • Hannes Domani's avatar
      Add address keyword to Value.format_string · 4aea001f
      Hannes Domani authored
      This makes it possible to disable the address in the result string:
      
      const char *str = "alpha";
      
      (gdb) py print(gdb.parse_and_eval("str").format_string())
      0x404000 "alpha"
      (gdb) py print(gdb.parse_and_eval("str").format_string(address=False))
      "alpha"
      
      gdb/ChangeLog:
      
      2020-12-18  Hannes Domani  <ssbssa@yahoo.de>
      
      	* python/py-value.c (valpy_format_string): Implement address keyword.
      
      gdb/doc/ChangeLog:
      
      2020-12-18  Hannes Domani  <ssbssa@yahoo.de>
      
      	* python.texi (Values From Inferior): Document the address keyword.
      
      gdb/testsuite/ChangeLog:
      
      2020-12-18  Hannes Domani  <ssbssa@yahoo.de>
      
      	* gdb.python/py-format-string.exp: Add tests for address keyword.
      4aea001f
    • Hannes Domani's avatar
      Fix accessing a method's fields from Python · b3f9469b
      Hannes Domani authored
      Considering this example:
      
      struct C
      {
        int func() { return 1; }
      } c;
      int main()
      {
        return c.func();
      }
      
      Accessing the fields of C::func, when requesting the function by its
      type, works:
      
      (gdb) py print(gdb.parse_and_eval('C::func').type.fields()[0].type)
      C * const
      
      But when trying to do the same via a class instance, it fails:
      
      (gdb) py print(gdb.parse_and_eval('c')['func'].type.fields()[0].type)
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
      TypeError: Type is not a structure, union, enum, or function type.
      Error while executing Python code.
      
      The difference is that in the former the function type is TYPE_CODE_FUNC:
      
      (gdb) py print(gdb.parse_and_eval('C::func').type.code == gdb.TYPE_CODE_FUNC)
      True
      
      And in the latter the function type is TYPE_CODE_METHOD:
      
      (gdb) py print(gdb.parse_and_eval('c')['func'].type.code == gdb.TYPE_CODE_METHOD)
      True
      
      So this adds the functionality for TYPE_CODE_METHOD as well.
      
      gdb/ChangeLog:
      
      2020-12-18  Hannes Domani  <ssbssa@yahoo.de>
      
      	* python/py-type.c (typy_get_composite): Add TYPE_CODE_METHOD.
      
      gdb/testsuite/ChangeLog:
      
      2020-12-18  Hannes Domani  <ssbssa@yahoo.de>
      
      	* gdb.python/py-type.exp: Add tests for TYPE_CODE_METHOD.
      b3f9469b
    • Jameson Nash's avatar
      gdb: define COFF file offsets with file_ptr · a9e48095
      Jameson Nash authored
      The arguments to these functions are file_ptr, so these declarations
      were accidentally implicitly down-casting them to signed int. This
      allows for reading files between 2 and 4 GB in size in my testing (I
      don't have a larger dll currently to test). These may not be natively
      supported by Windows, but can appear when using split-dwarf information.
      
      This solves a "can't get string table" error resulting from attempting
      to pass a negative offset to bfd_seek. I encountered this occuring while
      trying to use a debug file for libLLVM.dll, but searching online reveals
      at least one other person may have run into a similar problem with
      Firefox?
      
          https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/CA+cU71k2bU0azQxjy4-77ynQj1O+TKmgtaTKe59n7Bjub1y7Tg@mail.gmail.com/
      
      With this patch, the debug file appears to load successfully and I can
      see debug information in gdb for the library.
      
      gdb/ChangeLog:
      
      	* coffread.c (linetab_offset): Change type to file_ptr.
      	(linetab_size): Likewise.
      	(enter_linenos): Change parameter type to file_ptr.
      	(init_lineno): Likewise.
      	(init_stringtab): Likewise.
      	(coff_symtab_read): Likewise.
      	(coff_symfile_read): Change variable types to file_ptr.
      
      Change-Id: I6ae3bf31efc51c826734ade6731ea6b1c32129f3
      a9e48095
    • Tom Tromey's avatar
      Run fixed_points.exp with -fgnat-encodings=minimal · 86ef42bd
      Tom Tromey authored
      This changes the test case gdb.ada/fixed_points.exp to also be run
      with -fgnat-encodings=minimal.  This change pointed out that the test
      case had a few incorrect expected outputs; these are fixed as well.
      
      Note that the Overprecise_Object test only uses the non-legacy output
      with GCC trunk.
      
      gdb/testsuite/ChangeLog
      2020-12-18  Tom Tromey  <tromey@adacore.com>
      
      	* gdb.ada/fixed_points.exp: Also run with
      	-fgnat-encodings=minimal.  Update expected output.
      86ef42bd
  3. Dec 18, 2020
    • H.J. Lu's avatar
      ld: Build and install only unversioned libdep · eba7b68c
      H.J. Lu authored
      Build only unversioned libdep and remove the installed libdep.la since
      only a single libdep.so is needed.
      
      	PR ld/27082
      	* Makefile.am
      	(libdep_la_LDFLAGS): Add -module -avoid-version.
      	(libdep_la_LINK): New.
      	(install-data-local): Depend on $(install-bfdpluginLTLIBRARIES)
      	and remove libdep.la.
      eba7b68c
    • H.J. Lu's avatar
      elf: Copy elf_gnu_osabi_retain only for relocatable link · 04f89674
      H.J. Lu authored
      Copy elf_gnu_osabi_retain from input only for relocatable link since
      SHF_GNU_RETAIN has no impact on non-relocatable outputs.
      
      bfd/
      
      	PR ld/27091
      	* elflink.c (elf_link_input_bfd): Copy elf_gnu_osabi_retain
      	from input only for relocatable link.
      
      ld/
      
      	PR ld/27091
      	* testsuite/ld-elf/retain7.s: New file.
      	* testsuite/ld-elf/retain7a.d: Likewise.
      	* testsuite/ld-elf/retain7b.d: Likewise.
      04f89674
    • Alan Modra's avatar
      Assorted tidies · 3fafa2e2
      Alan Modra authored
      bfd/
      	* elf32-microblaze.c (dbg): Delete unused variable.
      	* elf32-nds32.c (relax_group_section_id_list): Make static.
      	* som.c (reloc_queue): Make static.
      	* xtensa-isa.c (xtisa_errno, xtisa_error_msg): Make static.
      include/
      	* xtensa-isa-internal.h (xtisa_errno, xtisa_error_msg): Delete.
      3fafa2e2
    • Alan Modra's avatar
      Remove some static buffers · 7fbd5f4e
      Alan Modra authored
      Fixes possible overflow of a static buffer for powerpc with translated
      messages, and on v850 when symbol names are large.
      
      	* archive.c (_bfd_ar_spacepad, _bfd_ar_sizepad): Use auto buf.
      	* coff-mcore.c (coff_mcore_relocate_section): Likewise.
      	* elf32-ppc.c (ppc_elf_unhandled_reloc): Use asprintf in place
      	of fixed size and possibly too small buf for translated message.
      	* elf64-ppc.c (ppc64_elf_unhandled_reloc): Likewise.
      	* elf32-v850.c (v850_elf_check_relocs): Likewise.
      	* ecoff.c (ecoff_type_to_string): Pass in return string buff rather
      	than using static buffer2.  Delete dead code.  Remove unnecessary
      	parentheses.
      	(_bfd_ecoff_print_symbol): Pass auto buff to ecoff_type_to_string.
      	* elf32-rx.c (describe_flags): Pass in return string buf rather
      	than using static buf.
      	(rx_elf_merge_private_bfd_data): Pass buf to describe_flags.
      	(rx_elf_print_private_bfd_data): Likewise.
      	* mach-o.c (cpusubtype): Pass in return string buffer rather than
      	using static buffer.
      	(bfd_mach_o_bfd_print_private_bfd_data): Pass buff to cpusubtype.
      	* opncls.c (separate_debug_file_exists): Make buffer an auto var.
      	(bfd_fill_in_gnu_debuglink_section): Likewise.
      	* peXXigen.c (rsrc_resource_name): Pass in return string buffer
      	rather than using static buffer.
      	(rsrc_sort_entries): Pass buff to rsrc_resource_name.
      	* vms-alpha.c (_bfd_vms_write_emh): Pass tbuf to get_vms_time_string.
      	* vms-misc.c (get_vms_time_string): Pass in return string tbuf
      	rather than using static tbuf.
      	* vms.h (get_vms_time_string): Update prototype.
      7fbd5f4e
    • Alan Modra's avatar
      Constify more arrays · bd38246a
      Alan Modra authored
      bfd/
      	* coff-z80.c (bfd_howto_type): Make typedef const.
      	* elf32-z80.c (bfd_howto_type): Likewise.
      	* elf32-m32c.c (EncodingTable): Likewise.
      	* elf32-csky.c (csky_arch_for_merge): Likewise.
      	(csky_archs): Use typedef.
      	* elf32-m68hc11.c (m68hc11_direct_relax_table): Make const.
      	(find_relaxable_insn, m68hc11_elf_relax_section): Adjust to suit.
      	* elf32-ppc.c (ppc_alt_plt): Make const.
      	* elf32-rl78.c (relax_addr16): Likewise.
      	* targets.c (_bfd_associated_vector): Likewise.
      	(bfd_target_vector, bfd_associated_vector): Likewise.
      	* libbfd-in.h (bfd_target_vector, bfd_associated_vector): Likewise.
      	* libbfd.h: Regenerate.
      include/
      	* opcode/arc-attrs.h (CONFLICT_LIST): Make const.
      bd38246a
    • Alan Modra's avatar
      Statically initialise target common sections · 7f3a18cf
      Alan Modra authored
      This tidies initialisation of target common sections, doing so using a
      static initialiser rather than via code and deleting unnecessary
      symbol_ptr_ptr variables (the one in asection is used instead).
      
      The patch also initialises ecoff.c:bfd_debug_section using
      BFD_FAKE_SECTION.  That does change bfd_debug_section slightly,
      output_section was NULL now bfd_debug_section, and symbol_ptr_ptr
      was NULL now &bfd_debug_section.symbol, but I believe those changes
      are safe.
      
      bfd/
      	* ecoff.c (bfd_debug_section): Init using BFD_FAKE_SECTION.
      	(ecoff_scom_section, ecoff_scom_symbol): Statically init using
      	BFD_FAKE_SECTION and GLOBAL_SYM_INIT.  Delete initialisation code.
      	(ecoff_scom_symbol_ptr): Delete.
      	* elf32-m32r.c (m32r_elf_scom_section, m32r_elf_scom_symbol),
      	(m32r_elf_scom_symbol_ptr),
      	* elf32-score.c (score_elf_scom_section, score_elf_scom_symbol),
      	(score_elf_scom_symbol_ptr),
      	* elf32-score7.c (score_elf_scom_section, score_elf_scom_symbol),
      	(score_elf_scom_sy...
      7f3a18cf
    • GDB Administrator's avatar
      Automatic date update in version.in · 3ece0b95
      GDB Administrator authored
      3ece0b95
    • Tom Tromey's avatar
      Remove a use of n_spaces · 844a6538
      Tom Tromey authored
      While removing printfi_filtered, I found a spot that used n_spaces
      where the now-ordinary "%*s" approach would do.  This patch makes this
      change.
      
      Tested on x86-64 Fedora 32.
      
      gdb/ChangeLog
      2020-12-17  Tom Tromey  <tromey@adacore.com>
      
      	* printcmd.c (print_variable_and_value): Don't use n_spaces.
      844a6538
    • Tom Tromey's avatar
      Remove printfi_filtered and fprintfi_filtered · 32f47895
      Tom Tromey authored
      After seeing Simon's patch, I thought maybe it was finally time to
      remove printfi_filtered and fprintfi_filtered, in favor of using the
      "%*s" approach to indenting.
      
      In this patch I took the straightforward approach of always adding a
      leading "%*s", even when the format already started with "%s", to
      avoid the trickier form of:
      
          printf ("%*s", -indent, string)
      
      Regression tested on x86-64 Fedora 32.
      Let me know what you think.
      
      gdb/ChangeLog
      2020-12-17  Tom Tromey  <tromey@adacore.com>
      
      	* gdbtypes.c (print_args, dump_fn_fieldlists, print_cplus_stuff)
      	(print_gnat_stuff, print_fixed_point_type_info)
      	(recursive_dump_type): Update.
      	* go32-nat.c (go32_sysinfo, display_descriptor): Update.
      	* c-typeprint.c (c_type_print_base_struct_union)
      	(c_type_print_base_1): Update.
      	* rust-lang.c (rust_internal_print_type): Update.
      	* f-typeprint.c (f_language::f_type_print_base): Update.
      	* utils.h (fprintfi_filtered, printfi_filtered): Remove.
      	* m2-typeprint.c (m2_record_fields): Update.
      	* p-typeprint.c (pascal_type_print_base): Update.
      	* compile/compile-loc2c.c (push, pushf, unary, binary)
      	(do_compile_dwarf_expr_to_c): Update.
      	* utils.c (fprintfi_filtered, printfi_filtered): Remove.
      32f47895
  4. Dec 17, 2020
    • Simon Marchi's avatar
      gdb/doc: fix "show check range" command name · 85be4f5a
      Simon Marchi authored
      gdb/doc/ChangeLog:
      
      	PR gdb/27088
      	* gdb.texinfo (Range Checking): Fix "show check range" command
      	name.
      
      Change-Id: I0248ef76d205ac49ed71b813aafe3e630c2ffc2e
      85be4f5a
    • Tom Tromey's avatar
      Change parameters to language_defn::post_parser · c5c41205
      Tom Tromey authored
      In the expression rewrite, Ada type resolution will be done at parse
      time rather than in a post-parse pass.  At this point,
      language_defn::post_parser will be removed.  However, for this to
      work, the information available to post_parser must be made available
      during the actual parse.
      
      This patch refactors this code slightly to make this possible.  In
      particular, "void_context_p" is passed to the parser_state
      constructor, and the parser state is then passed to the post_parser
      method.
      
      gdb/ChangeLog
      2020-12-16  Tom Tromey  <tom@tromey.com>
      
      	* rust-exp.y (rust_lex_tests): Update.
      	* parser-defs.h (parser_state): Add void_p parameter.
      	<void_context_p>: New member.
      	* parse.c (parse_exp_in_context): Update.
      	* language.h (language_defn::post_parser): Remove void_context_p,
      	completing, tracker parameters.  Add parser state.
      	* ada-lang.c (ada_language::post_parser): Update.
      c5c41205
    • GDB Administrator's avatar
      Automatic date update in version.in · f81baa08
      GDB Administrator authored
      f81baa08
    • Tom Tromey's avatar
      Change void_context_p to bool · 35c1ab60
      Tom Tromey authored
      This patch changes void_context_p to bool, as a prerequisite to the
      change to post_parser that I submitted here:
      
      https://sourceware.org/pipermail/gdb-patches/2020-December/174080.html
      
      Tested by rebuilding.
      
      Note that nothing in-tree passes true here.  I don't know why this is,
      but there is a use of this internally in AdaCore's tree.  I will try
      to submit that patch, if it is needed.  (And if not, I will come back
      around and remove this.)
      
      gdb/ChangeLog
      2020-12-16  Tom Tromey  <tom@tromey.com>
      
      	* parse.c (parse_exp_1, parse_expression_for_completion): Update.
      	(parse_exp_in_context): Change void_context_p to bool.
      	* language.h (struct language_defn) <post_parser>: Change
      	void_context_p to bool.
      	* ada-lang.c (class ada_language) <post_parser>: Update.
      35c1ab60
    • Simon Marchi's avatar
      gdb/testsuite: make some tests in gdb.base enable non-stop using GDBFLAGS · 93df4a1d
      Simon Marchi authored
      For the same reason as explained in commit 7cb2893d ("gdb/testsuite:
      gdb.mi/mi-nonstop-exit.exp: enable non-stop using GDBFLAGS").
      
      Note that the use of
      
          set GDBFLAGS "$GDBFLAGS ..."
      
      instead of
      
          append GDBFLAGS "..."
      
      is intentional.  "append" is silent when appending to a non-existent
      variable.  So if this code if moved to a proc (as is the case already
      for step-sw-breakpoint-adjust-pc.exp) and we forget to add "global
      GDBFLAGS", the flag won't be added to the global GDBFLAGS, and we won't
      actually enable non-stop, and it might go unnoticed.  Using the "set"
      version will turn into an error if we forget the "global".
      
      This makes these test work correctly with native-extended-gdbserver.
      Some of them were silently failing because we runto_main is silent when
      it fails.
      
      gdb/testsuite/ChangeLog:
      
      	* gdb.base/async-shell.exp: Enable non-stop through GDBFLAGS.
      	* gdb.base/continue-all-already-running.exp: Likewise.
      	* gdb.base/moribund-step.exp: Likewise.
      	* gdb.base/step-sw-breakpoint-adjust-pc.exp: Likewise.
      
      Change-Id: I19ef05d07a0ec4a9c9476af2ba6e1ea1159ee437
      93df4a1d
    • H.J. Lu's avatar
      ld: Skip libdep plugin if not all plugin hooks are available · bcac599f
      H.J. Lu authored
      Skip plugin if not all required plugin hooks are available.
      
      2020-12-16  Howard Chu <hyc@symas.com>
      	    H.J. Lu  <hongjiu.lu@intel.com>
      
      	PR ld/27081
      	* libdep_plugin.c (onload): Skip if not all required plugin hooks
      	are available.
      	* testsuite/config/default.exp (dep_plug_opt): New.
      	* testsuite/ld-elf/elf.exp: Pass $dep_plug_opt to nm.
      	* testsuite/ld-elf/pr26391.fd: New file.
      bcac599f
    • Tom de Vries's avatar
      [gdb/testsuite] Fix prompt regexp in batch-preserve-term-settings.exp · 592995fa
      Tom de Vries authored
      On openSUSE Leap 15.2, when running test-case
      gdb.base/batch-preserve-term-settings.exp I get:
      ...
      spawn /bin/sh^M
      PS1="gdb-subshell$ "^M
      sh-4.4$ PS1="gdb-subshell$ "^M
      gdb-subshell$ PASS: gdb.base/batch-preserve-term-settings.exp: batch run: \
        spawn shell
      ...
      but on Ubuntu 18.04.5, I get instead:
      ...
      spawn /bin/sh^M
      PS1="gdb-subshell$ "^M
      $ gdb-subshell$ FAIL: gdb.base/batch-preserve-term-settings.exp: batch run: \
        spawn shell (timeout)
      ...
      
      Fix this by making the regexp recognize the second pattern as well.
      
      Tested on x86_64-linux.
      
      gdb/testsuite/ChangeLog:
      
      2020-12-16  Tom de Vries  <tdevries@suse.de>
      
      	* gdb.base/batch-preserve-term-settings.exp:
      592995fa
    • Martin Liska's avatar
      [gdb] Print progress for debuginfod · d6f26c9d
      Martin Liska authored
      Prints progress like:
      
      Downloading 4.89 MB separate debug info for /usr/lib64/libgcrypt.so.20.
      Downloading 1.10 MB separate debug info for /usr/lib64/liblzma.so.5.
      Downloading 1.31 MB separate debug info for /usr/lib64/liblz4.so.1.
      Downloading 0.96 MB separate debug info for /usr/lib64/libsmime3.so.
      [###                                                                    ]
      
      Tested on x86_64-linux.
      
      ChangeLog:
      
      2020-12-16  Martin Liska  <mliska@suse.cz>
      	    Tom de Vries  <tdevries@suse.de>
      
      	* gdb/debuginfod-support.c (struct user_data): Remove has_printed
      	field.  Add meter field.
      	(progressfn): Print progress using meter.
      d6f26c9d
    • Tom Tromey's avatar
      [gdb/cli] Add a progress meter · 2f228731
      Tom Tromey authored
      Add a progress meter.  It's not used anywhere yet.
      
      gdb/ChangeLog:
      
      2020-12-16  Tom Tromey  <tom@tromey.com>
      	    Tom Tromey  <tromey@redhat.com>
      	    Tom de Vries  <tdevries@suse.de>
      
      	* utils.h (get_chars_per_line): Declare.
      	* utils.c (get_chars_per_line): New function.
      	(fputs_maybe_filtered): Handle '\r'.
      	* ui-out.h (ui_out::progress_meter): New class.
      	(ui_out::progress, ui_out::do_progress_start)
      	(ui_out::do_progress_notify, ui_out::do_progress_end): New
      	methods.
      	* ui-out.c (do_progress_end)
      	(make_cleanup_ui_out_progress_begin_end, ui_out_progress): New
      	functions.
      	* mi/mi-out.h (mi_ui_out::do_progress_start)
      	(mi_ui_out::do_progress_notify, mi_ui_out::do_progress_end): New
      	methods.
      	* cli-out.h (struct cli_ui_out) <do_progress_start,
      	do_progress_notify, do_progress_end>: New methods.
      	<enum meter_stat, struct cli_progress_info>: New.
      	<m_meters>: New member.
      	* cli-out.c (cli_ui_out::do_progress_start)
      	(cli_ui_out::do_progress_notify, cli_ui_out::do_progress_end): New
      	methods.
      2f228731
    • Tom de Vries's avatar
      [gdb/testsuite] Fix shlib compilation with target board unix/-pie/-fPIE · 1e61189d
      Tom de Vries authored
      When running test-case gdb.base/info-shared.exp with target board
      unix/-pie/-fPIE, we run into:
      ...
      spawn -ignore SIGHUP gcc -fno-stack-protector \
        outputs/gdb.base/info-shared/info-shared-solib1.c.o \
        -fdiagnostics-color=never -fPIC -shared -Wl,-soname,info-shared-solib1.so \
        -lm -fPIE -pie -o outputs/gdb.base/info-shared/info-shared-solib1.so^M
      ld: Scrt1.o: in function `_start':^M
      start.S:104: undefined reference to `main'^M
      collect2: error: ld returned 1 exit status^M
      compiler exited with status 1
      ...
      
      The intention of the -pie/-fPIE flags is to build and test PIE executables on
      platforms where that is not the default.  However, the flags clash with the
      flags required to build shared libraries.
      
      Fix this by filtering out PIE-related flags out of the multilib_flags settings
      in compile_shared_lib.
      
      Tested on x86_64-linux.
      
      gdb/testsuite/ChangeLog:
      
      2020-12-16  Tom de Vries  <tdevries@suse.de>
      
      	* lib/gdb.exp (gdb_compile_shlib_1): Factor out of ...
      	(gdb_compile_shlib): ... here.  Filter out PIE-related flags.
      1e61189d
  5. Dec 16, 2020
    • Luis Machado's avatar
      Record FPSR for SIMD/FP data instructions · bfbe4b84
      Luis Machado authored
      I noticed this failure in gdb.reverse/reverse-insn.exp:
      
      FAIL: gdb.reverse/insn-reverse.exp: adv_simd_vect_shift: compare registers on insn 0:fcvtzs     s0, s0, #1
      
      Turns out we're not recording changes to the FPSR.  The SIMD/FP data
      instructions may set bits in the FPSR, so it needs to be recorded for
      proper reverse operations.
      
      gdb/ChangeLog:
      
      2020-12-16  Luis Machado  <luis.machado@linaro.org>
      
      	* aarch64-tdep.c (aarch64_record_data_proc_simd_fp): Record FPSR.
      bfbe4b84
    • Luis Machado's avatar
      Fix TBI handling for watchpoints · 19007d95
      Luis Machado authored
      When inserting hw watchpoints, we take care of masking off the top byte
      of the address (and sign-extending it if needed).  This guarantees we won't
      pass tagged addresses to the kernel via ptrace.
      
      However, from the kernel documentation on tagged pointers...
      
      "Non-zero tags are not preserved when delivering signals. This means that
      signal handlers in applications making use of tags cannot rely on the tag
      information for user virtual addresses being maintained for fields inside
      siginfo_t.
      
      One exception to this rule is for signals raised in response to watchpoint
      debug exceptions, where the tag information will be preserved."
      
      So the stopped data address after a hw watchpoint hit can be potentially
      tagged, and we don't handle this in GDB at the moment.  This results in
      GDB missing a hw watchpoint hit and attempting to step over an unsteppable
      hw watchpoint, causing it to spin endlessly.
      
      The following patch fixes this by adjusting the stopped data address and adds
      some tests...
      19007d95
    • Alan Modra's avatar
      constify elfNN_bed · c410035d
      Alan Modra authored
      elfNN_bed was made writable as an expedient means of communicating
      ld -z max-page-size and ld -z common-page-size values to BFD linker
      code, and even for objcopy to communicate segment alignment between
      copy_private_bfd_data, rewrite_elf_program_header and
      assign_file_positions_for_load_sections.  Some time later elfNN_bed
      elf_osabi was written by gas.  It turns out none of these
      modifications to elfNN_bed was necessary, so make it const again.
      
      include/
      	* bfdlink.h (struct bfd_link_info): Add maxpagesize and
      	commonpagesize.
      bfd/
      	* elfxx-target.h (elfNN_bed): Constify.
      	* bfd.c (bfd_elf_set_pagesize): Delete.
      	(bfd_emul_set_maxpagesize, bfd_emul_set_commonpagesize): Delete.
      	* elf.c (get_program_header_size): Get commonpagesize from
      	link info.
      	(_bfd_elf_map_sections_to_segments): Get maxpagesize from link info.
      	(assign_file_positions_for_load_sections): Likewise.
      	(assign_file_positions_for_non_load_sections): Likewise.
      	(rewrite_elf_program_header): Add maxpagesize param.  Set map_p_align.
      	(copy_private_bfd_data): Don't call bfd_elf_set_maxpagesize.
      	Instead pass maxpagesize to rewrite_elf_program_header.
      	* elf32-nds32.c (relax_range_measurement): Add link_info param.
      	Get maxpagesize from link_info.  Adjust caller.
      	* bfd-in2.h: Regenerate.
      gas/
      	* config/obj-elf.c (obj_elf_section): Don't set elf_osabi here.
      	(obj_elf_type): Likewise.
      ld/
      	* ld.h (ld_config_type): Delete maxpagesize and commonpagesize.
      	* emultempl/elf.em: Use link_info rather than config
      	for maxpagesize and commonpagesize.
      	* emultempl/ppc32elf.em: Likewise.
      	* ldexp.c (fold_binary, fold_name): Likewise.
      	* ldemul.c (after_parse_default): Likewise.
      	(set_output_arch_default): Don't call bfd_emul_set_maxpagesize
      	or bfd_emul_set_commonpagesize.
      c410035d
    • Alan Modra's avatar
      elflink.c constify · 3f75e1d6
      Alan Modra authored
      	* elflink.c (elf_flags_to_names): Constify.
      3f75e1d6
    • Alan Modra's avatar
      XCOFF constify · 342371d5
      Alan Modra authored
      There are occasions where it is reasonable to use a macro defining
      function parameters, but this isn't one of them.  Use typedefs
      instead, which also simplifies declaring a const array of function
      pointers.
      
      	* libxcoff.h (struct xcoff_backend_data_rec): Constify
      	_xcoff_glink_code.
      	(XCOFF_RELOC_FUNCTION_ARGS, XCOFF_COMPLAIN_FUNCTION_ARGS): Delete.
      	(xcoff_reloc_function, xcoff_complain_function): New typedef.
      	(xcoff_calculate_relocation, xcoff_complain_overflow),
      	(xcoff_reloc_type_noop, xcoff_reloc_type_fail),
      	(xcoff_reloc_type_pos, xcoff_reloc_type_neg),
      	(xcoff_reloc_type_rel, xcoff_reloc_type_toc),
      	(xcoff_reloc_type_ba, xcoff_reloc_type_crel): Update declaration.
      	* coff-rs6000.c (xcoff_reloc_type_br): Declare using typedef.
      	(xcoff_complain_overflow_dont_func): Likewise.
      	(xcoff_complain_overflow_bitfield_func): Likewise.
      	(xcoff_complain_overflow_signed_func): Likewise.
      	(xcoff_complain_overflow_unsigned_func): Likewise.
      	(xcoff_calculate_relocation, xcoff_complain_overflow): Constify.
      	(xcoff_glink_code): Constify.
      	* coff64-rs6000.c (xcoff64_reloc_type_br): Declare using typedef.
      	(xcoff64_calculate_relocation, xcoff64_glink_code): Constify.
      342371d5
    • Alan Modra's avatar
      xtensa constify · 61d2295d
      Alan Modra authored
      Move lots of read-only arrays to .rodata.
      
      include/
      	* xtensa-isa-internal.h (xtensa_format_internal),
      	(xtensa_slot_internal, xtensa_operand_internal),
      	(xtensa_arg_internal, xtensa_iclass_internal),
      	(xtensa_opcode_internal, xtensa_regfile_internal),
      	(xtensa_interface_internal, xtensa_funcUnit_internal),
      	(xtensa_state_internal, xtensa_sysreg_internal): Constify.
      bfd/
      	* elf32-xtensa.c (narrowable, widenable): Constify.
      	* xtensa-modules.c: Constify many arrays.
      61d2295d
    • Alan Modra's avatar
      ppc64 constify · 8cb1c2c8
      Alan Modra authored
      Nothing to see here.
      
      	* elf64-ppc.c (synthetic_opd): Constify.
      8cb1c2c8
    • Alan Modra's avatar
      arc constify · 14aa7c52
      Alan Modra authored
      Move a read-only array to .rodata.
      
      	* arc-plt.h (plt_versions): Constify.
      	* elf32-arc.c (arc_get_plt_version): Constify return pointer,
      	adjust uses throughout.
      14aa7c52