1. Jan 12, 2022
    • Tiezhu Yang's avatar
      gdb: testsuite: fix wrong comment in gdb.base/charset.c · 295114a6
      Tiezhu Yang authored
      
      
      In gdb/testsuite/gdb.base/charset.c, use "IBM1047" instead of "EBCDIC"
      to fix the wrong comment.
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      295114a6
    • Tiezhu Yang's avatar
      gdb: testsuite: fix failed testcases in gdb.base/charset.exp · ff656e2e
      Tiezhu Yang authored
      
      
      In gdb/testsuite/gdb.base/charset.c, the last argument is greater than 127
      when call fill_run() in EBCDIC-US and IBM1047, but the type of string[] is
      char, this will change the value due to sign extension.
      
      For example, ebcdic_us_string[7] will be -63 instead of the original 193 in
      EBCDIC-US.
      
      Make the type of string[] as unsigned char to fix the following six failed
      testcases:
      
        $ grep FAIL gdb/testsuite/gdb.sum
        FAIL: gdb.base/charset.exp: check value of parsed character literal in EBCDIC-US
        FAIL: gdb.base/charset.exp: check value of parsed string literal in EBCDIC-US
        FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in EBCDIC-US
        FAIL: gdb.base/charset.exp: check value of parsed character literal in IBM1047
        FAIL: gdb.base/charset.exp: check value of parsed string literal in IBM1047
        FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in IBM1047
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      ff656e2e
    • GDB Administrator's avatar
      Automatic date update in version.in · e66b7536
      GDB Administrator authored
      e66b7536
    • Fangrui Song's avatar
      ar: Add --thin for creating thin archives · d1b69c50
      Fangrui Song authored
      In many ar implementations (FreeBSD, elfutils, etc), -T has the X/Open
      System Interface specified semantics. Therefore -T for thin archives is
      not recommended for portability. -T is deprecated without diagnostics.
      
          PR binutils/28759
          * ar.c (long_options): Add --thin.
          (usage) Add --thin. Deprecate -T without diagnostics.
          * doc/binutils.texi: Add doc.
          * NEWS: Mention --thin.
          * binutils/testsuite/binutils-all/ar.exp: Add tests.
      d1b69c50
  2. Jan 11, 2022
    • Martin Storsj's avatar
      Fix multiple problems with DLL generation. · c4a8df19
      Martin Storsj authored
      ld	* pe-dll.c (make_head): Prefix the symbol name with the dll name.
      	(make_tail, make_one, make_singleton_name_thunk): Likewise.
      	(make_import_fixup_entry, make_runtime_pseudo_reloc): Likewise.
      	(pe_create_runtime_relocator_reference): Likewise.
      	(pe_dll_generate_implib): Set dll_symname_len.
      	(pe_process_import_defs): Likewise.
      
      binutils
      	* dlltool.c (main): If a prefix has not been provided, attempt to
      	use a deterministic one based upon the dll name.
      c4a8df19
    • Jan Beulich's avatar
      gas/doc: mention quoted symbol names · d02f2788
      Jan Beulich authored
      d02f2788
    • Andrew Burgess's avatar
      gdbsupport: regenerate Makefile.in · 9ed5be56
      Andrew Burgess authored
      I had cause to regenerate gdbsupport/Makefile.in, and noticed some
      unexpected changes in the copyright header dates.
      
      I suspect that this was caused by the end of year date range update
      process.
      
      The Makefile.in contains two date ranges.  The first range appears to
      be the date range for the version of automake being used, that is the
      range runs up to 2017 only, when automake 1.15.1 was released.
      
      The second date range in Makefile.in represents the date range for the
      generated file, and so, now runs up to 2022.
      
      Anyway, this is the result of running autoreconf (using automake
      1.15.1) in the gdbsupport directory.
      9ed5be56
    • GDB Administrator's avatar
      Automatic date update in version.in · 892c10d3
      GDB Administrator authored
      892c10d3
  3. Jan 10, 2022
    • Clément Chigot's avatar
      XCOFF: add support for TLS relocations on hidden symbols · 3c503824
      Clément Chigot authored
      This patch adds support for TLS relocation targeting C_HIDEXT symbols.
      In gas, TLS relocations, except R_TLSM and R_TLMSL, must keep the value
      of their target symbol.
      In ld, it simply ensures that internal TLS symbols are added to the
      linker hash table for xcoff_reloc_type_tls.
      
      It also improves the tests made by both.
      
      bfd/ChangeLog:
      
      	* coff-rs6000.c (xcoff_howto_table): Fix name of R_TLSML.
      	(xcoff_reloc_type_tls): Replace the error when h is NULL by
      	an assert.
      	(xcoff_complain_overflow_unsigned_func): Adjust comments.
      	* coff64-rs6000.c (xcoff64_howto_table): Fix name of R_TLSML.
      	* xcofflink.c (xcoff_link_add_symbols_to_hash_table): New
      	function.
      	(xcoff_link_add_symbols): Add C_HIDEXT TLS symbols to the linker
      	hash table.
      
      gas/ChangeLog:
      
      	* config/tc-ppc.c (md_apply_fix): Enable support for TLS
      	relocation over internal symbols.
      	* testsuite/gas/ppc/aix.exp: Replace xcoff-tlms by xcoff-tls.
      	* testsuite/gas/ppc/xcoff-tlsm-32.d: Removed.
      	* testsuite/gas/ppc/xcoff-tlsm-64.d: Removed.
      	* testsuite/gas/ppc/xcoff-tlsm.s: Removed.
      	* testsuite/gas/ppc/xcoff-tls-32.d: New test.
      	* testsuite/gas/ppc/xcoff-tls-64.d: New test.
      	* testsuite/gas/ppc/xcoff-tls.s: New test.
      
      ld/ChangeLog:
      
      	* testsuite/ld-powerpc/aix52.exp: Improve aix-tls-reloc test.
      	* testsuite/ld-powerpc/aix-tls-reloc.s: Likewise.
      	* testsuite/ld-powerpc/aix-tls-reloc-32.d: Removed.
      	* testsuite/ld-powerpc/aix-tls-reloc-64.d: Removed.
      	* testsuite/ld-powerpc/aix-tls-reloc-32.dd: New test.
      	* testsuite/ld-powerpc/aix-tls-reloc-32.dt: New test.
      	* testsuite/ld-powerpc/aix-tls-reloc-64.dd: New test.
      	* testsuite/ld-powerpc/aix-tls-reloc-64.dt: New test.
      3c503824
    • Tiezhu Yang's avatar
      gdb: add Tiezhu Yang to MAINTAINERS · 4cfa9e3f
      Tiezhu Yang authored
      
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      4cfa9e3f
    • Tom Tromey's avatar
      Reduce use of unfiltered output in Darwin code · a42a7433
      Tom Tromey authored
      The Darwin code uses unfiltered output liberally.  This patch changes
      this code to send some output to gdb_stdlog (in some cases via the use
      of debug_prefixed_printf_cond_nofunc), or to gdb_stderr, or to simply
      switch to filtered output.
      
      Note that I didn't switch inferior_debug to use
      debug_prefixed_printf_cond_nofunc, because that would affect the
      output by removing the information about the inferior.  I wasn't sure
      if this was important or not, so I left it in.
      
      v2 of this patch uses warning rather than prints to gdb_stderr, and
      removes some trailing whitespace.
      
      I can't compile this patch, so it's "best effort".
      
      a42a7433
    • GDB Administrator's avatar
      Automatic date update in version.in · 4bb12b29
      GDB Administrator authored
      4bb12b29
  4. Jan 09, 2022
    • GDB Administrator's avatar
      Automatic date update in version.in · 9ef77629
      GDB Administrator authored
      9ef77629
    • Andrew Burgess's avatar
      gdb/hurd: handle inferiors exiting · 038d8b46
      Andrew Burgess authored
      While testing on GNU/Hurd (i386) I noticed that GDB crashes when an
      inferior exits, with this error:
      
        inferior.c:293: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed.
      
      The problem appears to be in gnu_nat_target::wait.
      
      We always set inferior_ptid to null_ptid before calling target_wait,
      this has been the case since the multi-target changes were made to GDB
      in commit:
      
        commit 5b6d1e4f
        Date:   Fri Jan 10 20:06:08 2020 +0000
      
            Multi-target support
      
      With follow up changes in commit:
      
        commit 24ed6739
        Date:   Thu Jan 30 14:35:40 2020 +0000
      
            gdb/remote: Restore support for 'S' stop reply packet
      
      Unfortunately, the GNU/Hurd target is still relying on the value of
      inferior_ptid in the case where an inferior exits - we return the
      value of inferior_ptid as the pid of the process that exited.  This
      was fine in the single target world, where inferior_ptid identified
      the one running inferior, but this is no longer good enough.
      
      Instead, we should return a ptid containing the pid of the process
      that exited, as obtained from the wait event, and this is what this
      commit does.
      
      I've not run the full testsuite on GNU/Hurd as there appear to be lots
      of other issues with this target that makes running the full testsuite
      very painful, but I think this looks like a small easy improvement.
      038d8b46
    • Tom Tromey's avatar
      Add explicit check for nullptr to target_announce_attach · 249f1cf8
      Tom Tromey authored
      Lancelot pointed out that target_announce_attach was missing an
      explicit check against nullptr.  This patch adds it.
      249f1cf8
  5. Jan 08, 2022
    • Hannes Domani's avatar
      Add _sigsys info to siginfo struct · 24fe764c
      Hannes Domani authored
      This patch adds information about _sigsys structure from newer
      kernels, so that $_siginfo decoding can show information about
      _sigsys, making it easier for developers to debug seccomp failures.
      Requested in PR gdb/24283.
      
      Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24283
      24fe764c
    • Tiezhu Yang's avatar
      gdb: testsuite: show print array-indexes after set in arrayidx.exp · bc2e7c7d
      Tiezhu Yang authored
      
      
      Add "show print array-indexes" testcases after set print array-indexes
      to off or on.
      
      Without this patch:
      
          PASS: gdb.base/arrayidx.exp: set print array-indexes to off
          PASS: gdb.base/arrayidx.exp: print array with array-indexes off
          PASS: gdb.base/arrayidx.exp: set print array-indexes to on
          PASS: gdb.base/arrayidx.exp: print array with array-indexes on
      
      With this patch:
      
          PASS: gdb.base/arrayidx.exp: set print array-indexes to off
          PASS: gdb.base/arrayidx.exp: show print array-indexes is off
          PASS: gdb.base/arrayidx.exp: print array with array-indexes off
          PASS: gdb.base/arrayidx.exp: set print array-indexes to on
          PASS: gdb.base/arrayidx.exp: show print array-indexes is on
          PASS: gdb.base/arrayidx.exp: print array with array-indexes on
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      bc2e7c7d
    • H.J. Lu's avatar
      ld: Extract _bfd_elf_link_iterate_on_relocs · 3747999c
      H.J. Lu authored
      DT_RELR encodes consecutive R_*_RELATIVE relocations in GOT (the global
      offset table) and data sections in a compact format:
      
      https://groups.google.com/g/generic-abi/c/bX460iggiKg
      
      On some targets, R_*_RELATIVE relocations are counted and the GOT offsets
      are allocated when setting the dynamic section sizes after seeing all
      relocations.  R_*_RELATIVE relocations are generated while relocating
      sections after section layout has been finalized.
      
      To prepare for DT_RELR implementation on these targets, extract
      _bfd_elf_link_iterate_on_relocs from _bfd_elf_link_check_relocs so
      that a backend can scan relocations in elf_backend_always_size_sections
      
      For x86 targets, the old check_relocs is renamed to scan_relocs and a
      new check_relocs is added to chek input sections and create dynamic
      relocation sections so that they will be mapped to output sections.
      scan_relocs is now called from elf_backend_always_size_sections.
      
      Since relocations are scanned after __start, __stop, .startof. and
      .sizeof. symbols have been finalized on x86, __[start|stop]_SECNAME for
      --gc-sections -z start-stop-gc are now zero when all SECNAME sections
      been garbage collected.  This is no need for elf_x86_start_stop_gc_p.
      
      bfd/
      
      	* elf-bfd.h (_bfd_elf_link_iterate_on_relocs): New.
      	* elf32-i386.c (elf_i386_convert_load_reloc): Don't call
      	elf_x86_start_stop_gc_p.
      	(elf_i386_check_relocs): Renamed to ...
      	(elf_i386_scan_relocs): This.  Don't call
      	_bfd_elf_make_dynamic_reloc_section.
      	(elf_i386_always_size_sections): New.
      	(elf_backend_check_relocs): Removed.
      	(elf_backend_always_size_sections): New.
      	* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Don't call
      	elf_x86_start_stop_gc_p.
      	(elf_x86_64_check_relocs): Renamed to ...
      	(elf_x86_64_scan_relocs): This.  Don't call
      	_bfd_elf_make_dynamic_reloc_section.
      	(elf_x86_64_always_size_sections): New.
      	(elf_backend_check_relocs): Removed.
      	(elf_backend_always_size_sections): New.
      	* elflink.c (elf_link_check_or_scan_relocs):
      	New.  Extracted from _bfd_elf_link_check_relocs.
      	(_bfd_elf_link_check_relocs): Call elf_link_check_or_scan_relocs.
      	* elfxx-x86.c (_bfd_x86_elf_check_relocs): New.
      	* elfxx-x86.h (X86_64_NEED_DYNAMIC_RELOC_TYPE_P): New.
      	(I386_NEED_DYNAMIC_RELOC_TYPE_P): Likewise.
      	(X86_NEED_DYNAMIC_RELOC_TYPE_P): Likewise.
      	(_bfd_x86_elf_check_relocs): Likewise.
      	(elf_backend_check_relocs): Likewise.
      	(elf_backend_always_size_sections): Removed.
      	(elf_x86_start_stop_gc_p): Likewise.
      
      ld/
      
      	* testsuite/ld-i386/pr27491-1a.d: Updated.
      	* testsuite/ld-x86-64/pr27491-1a.d: Likewise.
      3747999c
    • GDB Administrator's avatar
      Automatic date update in version.in · ce230579
      GDB Administrator authored
      ce230579
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp · 202fb840
      Lancelot SIX authored
      When I run the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
          DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
          DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main
      
      Fix by grouping the various phases in with_test_prefix blocks.  Since
      the tests now have a prefix, remove the manually written prefixes in
      testnames.
      
      Also change some messages with the pattern "(timeout) $testname" into
      "$estname (timeout)" since tools will handle this as $testname[1] (which
      is what we want in this particular scenario).
      
      Tested on x86_64-linux.
      
      [1] https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages
      202fb840
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex · 4df98d9d
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.threads/staticthreads.exp ...
          DUPLICATE: gdb.threads/staticthreads.exp: couldn't compile staticthreads.c: unrecognized error
      
      Fix by using foreach_with_prefix instead of foreach when preparing the
      test case.
      
      Testeed on x86_64-linux both in a setup where the test fails to prepare
      and in a setup where the test fails to setup.
      4df98d9d
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp · 0b6180fe
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
          DUPLICATE: gdb.mi/mi-language.exp: set lang ada
      
      This is due to an erroneous explicit test name.  This explicit test name
      also happens to be useless (at least it would have been if it was
      correct) since it only repeats the command, so just remove the explicit
      test name and let the command be used as default test name.  Also remove
      explicit test name at another location in the file since it also just
      repeat the command.
      
      Tested on x86_64-linux.
      0b6180fe
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp · dd1655df
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
          DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
          DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main
      
      This test runs the same sequence of operations twice.  Refactor the code
      by running both of those sequences within a foreach_with_prefix block to
      ensure that the commands have unique test names.
      
      Tested on x86_64-linux.
      dd1655df
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp · 94e3acde
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.mi/mi-nonstop.exp ...
          DUPLICATE: gdb.mi/mi-nonstop.exp: check varobj, w1, 1
          DUPLICATE: gdb.mi/mi-nonstop.exp: stacktrace of stopped thread
      
      Fix by adjusting the problematic test names.
      
      Tested on x86_64-linux.
      94e3acde
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp · b4130189
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.mi/mi-nsthrexec.exp ...
          DUPLICATE: gdb.mi/mi-nsthrexec.exp: breakpoint at main
      
      Fix by adjusting the duplicated test name.
      
      Tested on x86_64-linux.
      b4130189
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/watchpoints.exp · b64f5c88
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running ../gdb/testsuite/gdb.base/watchpoints.exp ...
          DUPLICATE: gdb.base/watchpoints.exp: watchpoint hit, first time
      
      Fix by adjusting the test names where appropriate.
      
      Tested on x86_64-linux.
      b64f5c88
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/nested-subp2.exp · c6336a6d
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/nested-subp2.exp ...
          DUPLICATE: gdb.base/nested-subp2.exp: continue to the STOP marker
          DUPLICATE: gdb.base/nested-subp2.exp: print c
          DUPLICATE: gdb.base/nested-subp2.exp: print count
      
      Fix by using with_test_prefix to differentiate the test that are
      performed at different points during the execution of the debuggee.
      
      Tested on x86_64-linux.
      c6336a6d
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/call-signal-resume.exp · 8cc261b7
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/call-signal-resume.exp ...
          DUPLICATE: gdb.base/call-signal-resume.exp: dummy stack frame number
          DUPLICATE: gdb.base/call-signal-resume.exp: set confirm off
          DUPLICATE: gdb.base/call-signal-resume.exp: return
      
      This is due to the fact that a pattern was probably copy/pasted to
      re-use the logic while not adjusting the test names to avoid the
      duplication.
      
      Fix by removing the redundant tests ('set confirm off' only needs to be
      used once) and adjusting the test names where appropriate.
      
      Tested on x86_64-linux.
      8cc261b7
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/pointers.exp · 148ac50e
      Lancelot SIX authored
      
      
      When I run the testsuite, I have :
      
          Running .../gdb/testsuite/gdb.base/pointers.exp ...
          DUPLICATE: gdb.base/pointers.exp: pointer assignment
      
      Fix by placing the sections with duplication in with_test_prefix blocks.
      This removes the duplication and gives a better organization the file.
      
      Tested on x86_64-linux.
      Co-Authored-By: default avatarPedro Alves <pedro@palves.net>
      148ac50e
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/unload.exp · bfc9663f
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/unload.exp ...
          DUPLICATE: gdb.base/unload.exp: continuing to unloaded libfile
      
      Fix by adjusting the test name.
      
      Tested on x86_64-linux.
      bfc9663f
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/define-prefix.exp · bcce3429
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/define-prefix.exp ...
          DUPLICATE: gdb.base/define-prefix.exp: define user command: ghi-prefix-cmd
      
      Fix by adjusting test names.
      
      Tested on x86_64-linux.
      bcce3429
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/funcargs.exp · 2dc33008
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/funcargs.exp ...
          DUPLICATE: gdb.base/funcargs.exp: run to call2a
      
      Fix by using proc_with_prefix instead on plain proc to create logical
      function blocks.
      
      Tested on x86_64-linux.
      2dc33008
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/shlib-call.exp · 5bdd79df
      Lancelot SIX authored
      When I run the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/shlib-call.exp ...
          DUPLICATE: gdb.base/shlib-call.exp: print g
          DUPLICATE: gdb.base/shlib-call.exp: set print sevenbit-strings
          DUPLICATE: gdb.base/shlib-call.exp: set print address off
          DUPLICATE: gdb.base/shlib-call.exp: set width 0
          DUPLICATE: gdb.base/shlib-call.exp: continue until exit
      
      Fix by adjusting the test names when required, and by removing
      un-necessary commands.
      
      While at it, do some cleanup:
      - Replace an explicit GDB restart sequence with a call to clean_restart.
      - Remove trailing whitespaces.
      - Use $gdb_test_name in gdb_test_multiple.
      
      Tested on x86_64-linux.
      5bdd79df
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/set-cfd.exp · d95edb60
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/set-cwd.exp ...
          DUPLICATE: gdb.base/set-cwd.exp: test_cwd_reset: continue to breakpoint: break-here
      
      Fix by moving the tests after the 'runto_main' within the same
      with_test_prefix scope.
      
      While at it, I fix some indentation issues.
      
      Tested on x86_64-linux.
      d95edb60
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/exprs.exp · 1868c0cb
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/exprs.exp ...
          DUPLICATE: gdb.base/exprs.exp: \$[0-9]* = red (setup)
      
      Fix by using with_test_prefix where appropriate.
      
      Tested on x86_64-linux.
      1868c0cb
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/readline.exp · e88e1678
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/readline.exp ...
          DUPLICATE: gdb.base/readline.exp: Simple operate-and-get-next - final prompt
      
      Fix by adjusting the prefix given to the second 'simple' call to
      operate_and_get_next.
      
      Tested on x86_64-linux.
      e88e1678
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/pretty-array.exp · 22dafa45
      Lancelot SIX authored
      When I run the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/pretty-array.exp ...
          DUPLICATE: gdb.base/pretty-array.exp: print nums
          DUPLICATE: gdb.base/pretty-array.exp: print nums
      
      Fix by giving a name to the test cases.
      
      Tested on x86_64-linux.
      22dafa45
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/ui-redirect.exp · fdc3b978
      Lancelot SIX authored
      When running the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/ui-redirect.exp ...
          DUPLICATE: gdb.base/ui-redirect.exp: redirect while already logging: set logging redirect off
      
      Fix by moving the first 'set logging redirect off' to the end of the
      previous [with_test_prefix] test block. The statement's purpose is to
      clean the on flag set in this previous block, so moving it there makes
      sense and does not change the sequence of commands in the test file.
      
      Tested on x86_64-linux.
      fdc3b978
    • Lancelot SIX's avatar
      gdb: completion-support.exp: improve leading whitespace support · 86a83999
      Lancelot SIX authored
      There is a expect support library in the source tree designed to help
      developers test the auto-completion capabilities of GDB.
      
      One of the functions is test_gdb_complete_unique_re.  It is used
      (usually indirectly via test_gdb_complete_unique) to test that a given
      input line is completed as a given output line.  The test checks for two
      ways to do the completion: using tab-completion, or using the
      'complete' command.  To do this, calls to two dedicated functions are
      performed.  If we omit few details, we can consider that a call to
      
          test_gdb_complete_unique $input $expected
      
      is equivalent to the two following calls:
      
          test_gdb_complete_tab_unique $input $expected
          test_gdb_complete_cmd_unique $input $expected
      
      When using the tab-completion, everything works as expected, but some
      care must be taken when using the 'complete' command if the given input
      has leading whitespaces.  In such situation, the output of the
      'complete' command will drop the leading whitespaces.
      
      The current approach is that in such situation, the input and expected
      outputs are right trimmed (i.e. all leading whitespaces are removed)
      when performing the command completion check.
      
      This means that the following call:
      
          test_gdb_complete_unique "   $input" "   $expected"
      
      is almost equivalent to (again, omitting few details and arguments):
      
          test_gdb_complete_tab_unique "   $input" "   $expected"
          test_gdb_complete_cmd_unique "$input" "$expected"
      
      This approach comes with a problem that we encounter when running the
      tests in complete-empty.exp.  When doing so, we have:
      
          Running .../gdb/testsuite/gdb.base/complete-empty.exp ...
          DUPLICATE: gdb.base/complete-empty.exp: empty-input-line: cmd complete ""
      
      This is because the test file does something like:
      
          test_gdb_complete_unique "" "!" " " 1
          test_gdb_complete_unique "   " "   !" " " 1¬
      
      which, if we do the substitution introduced above is equivalent to:
      
          test_gdb_complete_tab_unique "" "!"
          test_gdb_complete_cmd_unique "" "!"
          test_gdb_complete_tab_unique "   " "   !"
          test_gdb_complete_cmd_unique "" "!"
      
      We see that the lines 2 and 4 are now the same, and for this reason the
      testing framework complains about DUPLICATE test names.
      
      To fix that, this commit proposes that instead of left trimming both
      input and expected outputs, only the expected output is trimmed.
      
      Care must be taken in the case the completion gives more possibilities
      than allowed by the max-completions setting.  In this case, the input
      will be repeated in the output in its left trimmed version.  This commit
      also ensures that this is taken care of.
      
      With this commit, the gdb.base/complete-empty.exp still passes all its
      tests but does not report the DUPLICATE anymore.
      
      Tested on x86_64-linux.
      86a83999
    • Lancelot SIX's avatar
      gdb/testsuite: Remove duplicates from gdb.base/subst.exp · 0d3ca327
      Lancelot SIX authored
      When I run the testsuite, I have:
      
          Running .../gdb/testsuite/gdb.base/subst.ex ...
          DUPLICATE: gdb.base/subst.exp: unset substitute-path from, no rule entered yet
      
      Fix by adjusting the problematic test name.
      
      Tested on x86_64-linux.
      0d3ca327