1. Mar 02, 2020
  2. Mar 01, 2020
  3. Feb 29, 2020
    • GDB Administrator's avatar
      Automatic date update in version.in · 7076a660
      GDB Administrator authored
      7076a660
    • Simon Marchi's avatar
      Update libinproctrace.so path in lib/trace-support.exp · f5e46084
      Simon Marchi authored
      Following the move to gdbserver to the top-level, the path to
      libinproctrace.so in testsuite/lib/trace-support.exp is no longer valid.
      This can be observed by running:
      
          $ make check TESTS="gdb.trace/ftrace.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
          ...
          ERROR: error copying "/home/smarchi/build/binutils-gdb/gdb/testsuite/../gdbserver/libinproctrace.so": no such file or directory
      
      Adjust the path to libinproctrace.so by adding a "..".  With this patch,
      the test mentioned above runs fine.
      
      gdb/testsuite/ChangeLog:
      
      	* lib/trace-support.exp (get_in_proc_agent): Adjust path to
      	libinproctrace.so.
      f5e46084
    • Sergio Durigan Junior's avatar
      Fix comment for 'gdb_dlopen' · d7592e97
      Sergio Durigan Junior authored
      The 'gdb_dlopen' function doesn't return NULL if the shlib load
      fails; it actually throws an error.  This patch updates the comment
      to reflect this.
      
      gdbsupport/ChangeLog:
      2020-02-28  Sergio Durigan Junior  <sergiodj@redhat.com>
      
      	* gdb-dlfcn.h (gdb_dlopen): Update comment.
      d7592e97
  4. Feb 28, 2020
    • Luis Machado's avatar
      Fix SVE-related failure in gdb.arch/aarch64-fp.exp · f7a7000d
      Luis Machado authored
      The gdb.arch/aarch64-fp.exp test assumes it is dealing with a regular SIMD
      target that exposes the V registers as raw registers.  SVE-enabled targets
      turn the V registers into pseudo-registers.
      
      That is all fine, but the testcase uses the "info registers" command, which
      prints pseudo-register's contents twice. One for the hex format and another
      for the natural format of the type.
      
      (gdb) info registers v0
      v0             {d = {f = {0x0, 0x0}, u = {0x1716151413121110, 0x1f1e1d1c1b1a1918}, s = {0x1716151413121110, 0x1f1e1d1c1b1a1918}}, s = {f = {0x0, 0x0, 0x0, 0x0}, u = {0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c}, s = {0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c}}, h = {f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u = {0x1110, 0x1312, 0x1514, 0x1716, 0x1918, 0x1b1a, 0x1d1c, 0x1f1e}, s = {0x1110, 0x1312, 0x1514, 0x1716, 0x1918, 0x1b1a, 0x1d1c, 0x1f1e}}, b = {u = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f}, s = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f}}, q = {u = {0x1f1e1d1c1b1a19181716151413121110}, s = {0x1f1e1d1c1b1a19181716151413121110}}} {d = {f = {1.846323925681849e-197, 8.5677456166123577e-159}, u = {1663540288323457296, 2242261671028070680}, s = {1663540288323457296, 2242261671028070680}}, s = {f = {1.84362032e-27, 4.84942184e-25, 1.27466897e-22, 3.34818801e-20}, u = {319951120, 387323156, 454695192, 522067228}, s = {319951120, 387323156, 454695192, 522067228}}, h = {f = {0.00061798, 0.00086308, 0.0012398, 0.00173, 0.0024872, 0.0034676, 0.0049896, 0.0069504}, u = {4368, 4882, 5396, 5910, 6424, 6938, 7452, 7966}, s = {4368, 4882, 5396, 5910, 6424, 6938, 7452, 7966}}, b = {u = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}, s = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}}, q = {u = {41362427191743139026751447860679676176}, s = {41362427191743139026751447860679676176}}}
      
      (gdb) p/x $v0
      $1 = {d = {f = {0x0, 0x0}, u = {0x1716151413121110, 0x1f1e1d1c1b1a1918}, s = {0x1716151413121110, 0x1f1e1d1c1b1a1918}}, s = {f = {0x0, 0x0, 0x0, 0x0}, u = {0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c}, s = {0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c}}, h = {f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u = {0x1110, 0x1312, 0x1514, 0x1716, 0x1918, 0x1b1a, 0x1d1c, 0x1f1e}, s = {0x1110, 0x1312, 0x1514, 0x1716, 0x1918, 0x1b1a, 0x1d1c, 0x1f1e}}, b = {u = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f}, s = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f}}, q = {u = {0x1f1e1d1c1b1a19181716151413121110}, s = {0x1f1e1d1c1b1a19181716151413121110}}}
      
      Since the testcase is not expecting that, we run into a couple failures:
      
      FAIL: gdb.arch/aarch64-fp.exp: check register v0 value
      FAIL: gdb.arch/aarch64-fp.exp: check register v1 value
      
      The following patch switches to using "p/x" for printing register values, which
      prints the values once with the hex format, instead of twice.
      
      gdb/testsuite/ChangeLog
      
      2020-02-28  Luis Machado  <luis.machado@linaro.org>
      
      	* gdb.arch/aarch64-fp.exp: Switch from "info registers" command
      	to "p/x".
      f7a7000d
    • Luis Machado's avatar
      Fix gdb.arch/aarch64-dbreg-contents.exp build failures · 718e0816
      Luis Machado authored
      I ran into the following failures when running tests under QEMU:
      
      --
      
      gdb compile failed, binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c: In function 'set_watchpoint':
      binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:41:29: error: storage size of 'dreg_state' isn't known
         struct user_hwdebug_state dreg_state;
                                   ^~~~~~~~~~
      In file included from /usr/include/aarch64-linux-gnu/bits/types/struct_iovec.h:23:0,
                       from /usr/include/aarch64-linux-gnu/sys/uio.h:23,
                       from binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:17:
      binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:69:18: error: invalid use of undefined type 'struct user_hwdebug_state'
         iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs)
                        ^
      binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:74:5: warning: implicit declaration of function 'error'; did you mean 'errno'? [-Wimplicit-function-declaration]
           error (1, errno, "PTRACE_SETREGSET: NT_ARM_HW_WATCH");
           ^~~~~
           errno
      binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c: In function 'main':
      binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:87:3: warning: implicit declaration of function 'atexit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
         atexit (cleanup);
         ^~~~~~
         _Exit
      binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:89:11: warning: implicit declaration of function 'fork' [-Wimplicit-function-declaration]
         child = fork ();
      
                 ^~~~
      
      --
      
      The following patch fixes those by adding the necessary include files.
      
      With that said, the test doesn't pass at present. I'll have to investigate it
      a bit more.
      
      gdb/testsuite/ChangeLog:
      
      2020-02-28  Luis Machado  <luis.machado@linaro.org>
      
      	* gdb.arch/aarch64-dbreg-contents.c: Include stdlib.h, unistd,
      	asm/ptrace.h and error.h.
      718e0816
    • Tom de Vries's avatar
      [gdb] Don't set initial language using previous language · 658dadf0
      Tom de Vries authored
      When language is set to auto, part of loading an executable is to update the
      language accordingly.  This is implemented by set_initial_language.
      
      In case of a c++ executable without DW_AT_main_subprogram,
      set_initial_language finds "main" in the minimal symbols, and does a lookup of
      "main" in the symbol tables to determine the language of the symbol, and uses
      that as initial language.
      
      The symbol lookup is done using lookup_symbol which is a wrapper around
      lookup_symbol_in_language, using the current language.
      
      So, consider two c++ executables a.out and b.out, which we'll load one after
      another.  If we track the resulting lookup_symbol_in_language calls:
      ...
      $ gdb -batch \
          -ex "b lookup_symbol_in_language" \
          -ex r -ex c -ex c \
          --args gdb
      ...
      we find that indeed lookup_symbol_in_language is called once using language_c, and
      once using language_c_plus:
      ...
      (gdb) file a.out
      Reading symbols from a.out...
      
      Breakpoint 1, lookup_symbol_in_language (name=0x5555568c2050 "main", \
        block=0x0, domain=VAR_DOMAIN, lang=language_c, is_a_field_of_this=0x0) \
        at ../../gdb/symtab.c:1905
      1905    {
      (gdb) file b.out
      Load new symbol table from "b.out"? (y or n) y
      Reading symbols from b.out...
      
      Breakpoint 1, lookup_symbol_in_language (name=0x5555568c2030 "main", \
        block=0x0, domain=VAR_DOMAIN, lang=language_cplus, is_a_field_of_this=0x0) \
        at ../../gdb/symtab.c:1905
      1905    {
      (gdb)
      ...
      
      It seems like a bad idea to have the previous language play a role
      in determining the executable language.
      
      Fix this by using lookup_symbol_in_language in set_initial_language with the
      default language c as argument.
      
      Tested on x86_64-linux.
      
      gdb/ChangeLog:
      
      2020-02-28  Tom de Vries  <tdevries@suse.de>
      
      	* symfile.c (set_initial_language): Use default language for lookup.
      658dadf0
    • Simon Marchi's avatar
      Pass correct die_reader_specs in cutu_reader::init_tu_and_read_dwo_dies · 4ebe4877
      Simon Marchi authored
      Running anything with the fission.exp board fails since commit
      c0ab21c2 ("Replace init_cutu_and_read_dies with a class").
      GDB crashes while reading the DWARF info.  cu is NULL in
      read_signatured_type:
      
          Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
          0x000055555780663e in read_signatured_type
          sig_type=0x6210000c3600) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22782
          22782         gdb_assert (cu->die_hash == NULL);
          (top-gdb) bt
          #0  0x000055555780663e in read_signatured_type (sig_type=0x6210000c3600) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22782
          #1  0x00005555578062dd in load_full_type_unit (per_cu=0x6210000c3600) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22758
          #2  0x00005555577c5fb7 in queue_and_load_dwo_tu (slot=0x60600007fc00, info=0x6210000c34e0) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:12674
          #3  0x0000555559934232 in htab_traverse_noresize (htab=0x60b000063670, callback=0x5555577c5e61 <queue_and_load_dwo_tu(void**, void*)>, info=0x6210000c34e0)
              at /home/simark/src/binutils-gdb/libiberty/hashtab.c:775
          #4  0x00005555577c6252 in queue_and_load_all_dwo_tus (per_cu=0x6210000c34e0) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:12701
          #5  0x000055555777ebd8 in dw2_do_instantiate_symtab (per_cu=0x6210000c34e0, skip_partial=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:2371
          #6  0x000055555777eea2 in dw2_instantiate_symtab (per_cu=0x6210000c34e0, skip_partial=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:2395
          #7  0x0000555557786ab6 in dw2_lookup_symbol (objfile=0x614000007240, block_index=GLOBAL_BLOCK, name=0x602000025310 "main", domain=VAR_DOMAIN)
              at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3539
      
      After creating the reader object, the reader.cu field should not be
      NULL.  By checking the commit previous to the faulty one mentioned
      above, I noticed that the cu field is normally set by
      init_cu_die_reader, called from read_cutu_die_from_dwo, itself called
      from cutu_reader::init_tu_and_read_dwo_dies, itself called from
      cutu_reader's constructor.
      
      However, cutu_reader::init_tu_and_read_dwo_dies calls
      read_cutu_die_from_dwo, passing a pointer to a local `die_reader_specs`
      variable.  So it's the `cu` field of that object that gets set.
      cutu_reader itself is a `die_reader_specs` (it inherits from it), and
      the intention was most likely to pass `this` to read_cutu_die_from_dwo.
      This way, the fields of the cutu_reader object, which
      read_signatured_type will use, are set.
      
      With this, I am able to use:
      
        make check RUNTESTFLAGS='--target_board=fission'
      
      and it looks much better.  There are still some failures to be
      investigated, but that's the usual state of the testsuite.
      
      gdb/ChangeLog:
      
      	* dwarf2/read.c (cutu_reader::init_tu_and_read_dwo_dies): Remove
      	reader variable, pass `this` to read_cutu_die_from_dwo.
      4ebe4877
    • Tom de Vries's avatar
      [gdb/testsuite] Fix psymtab expansion postponement in c-linkage-name.exp · 13c3a74a
      Tom de Vries authored
      The test-case gdb.base/c-linkage-name.exp starts with the following test:
      ...
      gdb_test "print symada__cS" \
               " = {a = 100829103}" \
               "print symada__cS before partial symtab expansion"
      ...
      
      However, printing the state of the partial symtabs using maint info psymtabs
      shows that in fact the symtab has already been expanded:
      ...
        { psymtab c-linkage-name.c ((struct partial_symtab *) 0x1e27b40)^M
          readin yes^M
      ...
      
      This is due to set_initial_language, which looks up the main symbol, which
      expands the psymtab containing main.
      
      Fix this by moving all but main into a separate source file c-linkage-name-2.c.
      
      Tested on x86_64-linux.
      
      gdb/testsuite/ChangeLog:
      
      2020-02-28  Tom de Vries  <tdevries@suse.de>
      
      	* gdb.base/c-linkage-name.c (main): Call do_something_other_cu.
      	(struct wrapper, do_something, mundane/symada__cS): Move ...
      	* gdb.base/c-linkage-name-2.c: ... here.  New source file.
      	* gdb.base/c-linkage-name.exp: Add verification of psymtab expansion.
      	Update "print symada__cS before partial symtab expansion" regexp.
      	Update breakpoint location.  Flush symbol cache after expansion.
      13c3a74a
    • Luis Machado's avatar
      Harden gdb.arch/aarch64-pauth.exp and fix a failure · 85d2d5bb
      Luis Machado authored
      When running this testcase against a QEMU with PAC support, i noticed we
      were failing to recognize the additional [PAC] that is emitted in the
      backtrace, resulting in this failure:
      
      FAIL: gdb.arch/aarch64-pauth.exp: backtrace
      
      I've made the test use multi_line to make the pattern more clear.
      
      Tested against aarch64-linux-gnu with and without PAC support.
      
      gdb/testsuite/ChangeLog:
      
      2020-02-28  Luis Machado  <luis.machado@linaro.org>
      
      	* gdb.arch/aarch64-pauth.exp: Recognize optional PAC output.
      85d2d5bb
    • YunQiang Su's avatar
      MIPS/fix_loongson3_llsc: fix when target has multi labels · dec7b24b
      YunQiang Su authored
      When there is multi-labels on the same insn, the current code
      will take care about the last one. it may cause that no sync
      is added at the target.
      
      Here we scan all labels with same value of
         S_GET_VALUE(label_list->label)
      by label_list->next.
      
      2020-02-28  YunQiang Su  <syq@debian.org>
      
          PR gas/25539
          * config/tc-mips.c (fix_loongson3_llsc): Compare label value
          to handle multi-labels.
          (has_label_name): New.
      dec7b24b
    • Alan Modra's avatar
      alpha-vms: memory leak · 182ec670
      Alan Modra authored
      	* vms-lib.c (_bfd_vms_lib_archive_p): Free memory on error paths.
      182ec670
    • Alan Modra's avatar
      alpha-vms: large memory allocation · 1b088c82
      Alan Modra authored
      This patch simplifies reading of image headers.  It's really not worth
      trying to avoid re-reading a 12 byte buffer and then read in
      VMS_BLOCK_SIZE chunks, better just to throw the buffer away and use
      _bfd_malloc_and_read which does checks against file size.
      
      	* vms-alpha.c (alpha_vms_object_p): Use _bfd_malloc_and_read.
      	Remove duplicate undersize check.
      1b088c82
    • Aaron Merey's avatar
      gdb: Check for nullptr when computing srcpath · e5da1139
      Aaron Merey authored
      This fixes a regression caused by commit 0d79cdc4:
      
        $ make check TESTS="gdb.dwarf2/dw2-ranges-base.exp"
        [...]
        ERROR: GDB process no longer exists
      
      This error is caused by an abort during the computation of srcpath
      when SYMTAB_DIRNAME (s) == NULL.
      
      Computing srcpath only when SYMTAB_DIRNAME (s) is not NULL fixes this
      error. Also change the condition for calling debuginfod_source_query
      to include whether srcpath could be computed.
      
      gdb/ChangeLog:
      
      2020-02-27  Aaron Merey  <amerey@redhat.com>
      
              * source.c (open_source_file): Check for nullptr when computing
              srcpath.
      e5da1139
    • GDB Administrator's avatar
      Automatic date update in version.in · a1f2ad11
      GDB Administrator authored
      a1f2ad11
    • Tom Tromey's avatar
      Remove field_info::nfields member · 317f7127
      Tom Tromey authored
      I noticed that there's no real reason to have field_info::nfields in
      the DWARF reader.  It simply mirrors information that is already
      available.  This patch removes it, in favor of a convenience method.
      
      gdb/ChangeLog
      2020-02-27  Tom Tromey  <tromey@adacore.com>
      
      	* dwarf2/read.c (struct field_info) <nfields>: Now a method, not a
      	member.
      	(dwarf2_add_field): Don't update nfields.
      	(dwarf2_attach_fields_to_type, process_structure_scope): Update.
      317f7127
    • Alan Modra's avatar
      mmix-mmo set SEC_DATA for .data section · 5f602802
      Alan Modra authored
      With the bfd_decode_symclass change, ld SIZEOF test fails due to
      data_end being reported as type '?'.
      
      bfd/
      	PR 24511
      	* mmo.c (mmo_scan): Set SEC_DATA for .data.
      ld/
      	PR 24511
      	* testsuite/ld-mmix/b-fixo2.d: Adjust for .data change.
      	* testsuite/ld-mmix/sec-2.d: Likewise.
      	* testsuite/ld-mmix/sec-3.d: Likewise.
      	* testsuite/ld-mmix/sec-4.d: Likewise.
      	* testsuite/ld-mmix/spec802.d: Likewise.
      	* testsuite/ld-mmix/spec803.d: Likewise.
      	* testsuite/ld-mmix/spec804.d: Likewise.
      	* testsuite/ld-mmix/spec805.d: Likewise.
      	* testsuite/ld-mmix/spec806.d: Likewise.
      	* testsuite/ld-mmix/spec807.d: Likewise.
      	* testsuite/ld-mmix/spec808.d: Likewise.
      5f602802
    • Alan Modra's avatar
      .idata symbols should be reported with i or I flag by nm · 49d9fd42
      Alan Modra authored
      	PR 24511
      	* syms.c (stt): Trim off all but 'e', 'i' and 'p' entries.
      	(coff_section_type): Adjust comment.
      	(decode_section_type): Likewise.  Call coff_section_type before
      	decode_section_type.
      	(bfd_decode_symclass): Use 'c' for common sections other than
      	the standard one.
      49d9fd42
    • Andrew Burgess's avatar
      gdb: Use std::abs instead of abs on LONGEST types · 3104d9ee
      Andrew Burgess authored
      Use std::abs so that we get the C++ overloaded version that matches
      the argument type instead of the C abs function which is only for int
      arguments.
      
      There should be no user visible change after this commit.
      
      gdb/ChangeLog:
      
      	* gdbtypes.c (create_array_type_with_stride): Use std::abs not
      	abs.
      3104d9ee
    • Nick Clifton's avatar
      Fix an illegal memory access by readelf when displaying the contents of a corrupt IA64 binary. · 736990c4
      Nick Clifton authored
      	PR 25526
      	* readelf.c (process_ia64_vms_dynamic_relocs): Check to see if
      	get_data is unable to load the string table.
      736990c4
  5. Feb 27, 2020
    • Tom de Vries's avatar
      [gdb/testsuite] Remove unused globals · 3608f86c
      Tom de Vries authored
      Remove unused global variable declarations.
      
      Tested on x86_64-linux.
      
      gdb/testsuite/ChangeLog:
      
      2020-02-27  Tom de Vries  <tdevries@suse.de>
      
      	* config/sid.exp: Remove unused globals.
      	* gdb.base/attach.exp: Same.
      	* gdb.base/catch-load.exp: Same.
      	* gdb.base/dbx.exp: Same.
      	* lib/gdb.exp: Same.
      	* lib/mi-support.exp: Same.
      	* lib/prompt.exp: Same.
      3608f86c
    • Tom de Vries's avatar
      [gdb/testsuite] Fix spawn in tuiterm.exp · c8d4f6df
      Tom de Vries authored
      When running gdb.stabs/weird.exp by itself it passes, but if we run a gdb.tui
      test before it, we get:
      ...
      $ make check RUNTESTFLAGS="gdb.stabs/weird.exp gdb.tui/basic.exp"
      Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.tui/basic.exp ...
      Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.stabs/weird.exp ...
      ERROR: Couldn't make test case. -1 {spawn failed}
      ...
      
      In more detail, using -v:
      ...
      Executing on build: sed  -f aout.sed weird.def weird.s (timeout = 300)
      builtin_spawn [open ...]^M
      pid is 19060 19061 -19060 -19061
      spawn -open file10 failed, 1 can't read "spawn_out(slave,name)": \
        no such variable, can't read "spawn_out(slave,name)": no such variable
          while executing
      "set gdb_spawn_name $spawn_out(slave,name)"
          (procedure "spawn" line 5)
          invoked from within
      "spawn -ignore SIGHUP -leaveopen file10"
          invoked from within
      "catch "spawn -ignore SIGHUP -leaveopen $id" result2"
      ERROR: Couldn't make test case. -1 {spawn failed}
      ...
      
      When running the gdb.tui test, spawn gets renamed to a local version from
      lib/tuiterm.exp.  The local version calls expect's spawn, and then makes the
      local spawn_out(slave,name) variable accessible in the global variable
      gdb_spawn_name.
      
      However, the weird.exp test-case uses remote_exec build, which ends up using
      local_exec, which given that there's input/output redirection uses open:
      ...
          set result [catch {open "| ${commandline} $inp |& tee $outpf" RDONLY} id]
      ...
      followed by spawn using the -leaveopen option:
      ...
          set result [catch "spawn -ignore SIGHUP -leaveopen $id" result2]
      ...
      which apparently has the effect that spawn_out(slave,name) is not set.
      
      Fix this in the lib/tuiterm.exp local spawn proc by detecting the case that
      spawn_out(slave,name) is not set, and handling it accordingly.
      
      Tested gdb.stabs/weird.exp and gdb.tui/*.exp on x86_64-linux.
      
      gdb/testsuite/ChangeLog:
      
      2020-02-27  Tom de Vries  <tdevries@suse.de>
      
      	* lib/tuiterm.exp (spawn): Handle case that spawn_out(slave,name) is
      	not set.
      c8d4f6df
    • Alan Modra's avatar
      _bfd_xcoff_read_ar_hdr tidy · 05f52dc2
      Alan Modra authored
      	* coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Put all data in one
      	malloc'd block.
      05f52dc2
    • Alan Modra's avatar
      bfd_stat_arch_elt buffer overflow · ff69a894
      Alan Modra authored
      If you manage to put an xcoff object file into a non-xcoff archive
      (created by first putting a non-xcoff object file into it), and have
      xcoff support compiled into libbfd, then objdump -x on the archive
      can segfault.  The problem is that _bfd_xcoff_stat_arch_elt expects
      abfd->arelt_data->arch_header to be one of the xcoff variants, but
      arelt_data is generated depending on the archive format, *not* the
      element format.
      
      	* bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
      	if file is an archive element.
      	* bfd-in2.h: Regenerate.
      ff69a894
    • GDB Administrator's avatar
      Automatic date update in version.in · d0adf545
      GDB Administrator authored
      d0adf545
    • Tom Tromey's avatar
      Specialize partial_symtab for DWARF include files · b83470bf
      Tom Tromey authored
      Include files are represented by a partial symtab, but don't expand to
      anything.  From dwarf2_psymtab::expand_psymtab:
      
        if (per_cu == NULL)
          {
            /* It's an include file, no symbols to read for it.
               Everything is in the parent symtab.  */
            readin = true;
            return;
          }
      
      This patch introduces a new specialization of partial_symtab to handle
      this case.  In addition to being slightly smaller, I believe an
      include file is the only situation where a DWARF psymtab can result in
      a null compunit_symtab.  This adds an assert to that effect as well.
      This change will simplify one of the psymtab sharing patches.
      
      gdb/ChangeLog
      2020-02-26  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2/read.c (struct dwarf2_include_psymtab): New.
      	(dwarf2_create_include_psymtab): Use dwarf2_include_psymtab.
      	(dwarf2_psymtab::expand_psymtab, dwarf2_psymtab::readin_p)
      	(dwarf2_psymtab::get_compunit_symtab): Remove null checks for
      	per_cu_data.
      b83470bf
    • Tom Tromey's avatar
      Remove casts from dwarf2/index-write.c · edfe0a0c
      Tom Tromey authored
      dwarf2/index-write.c casts pointers to "dwarf2_psymtab *", but as far
      as I can tell, it does not actually use any DWARF-specific fields of
      the psymtab.  So, this patch changes this code to use partial_symtab
      instead.  This removes nearly every cast, leaving just the unavoidable
      one from addrmap iteration.
      
      gdb/ChangeLog
      2020-02-26  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2/index-write.c (psym_index_map): Change type.
      	(add_address_entry_worker, write_one_signatured_type)
      	(recursively_count_psymbols, recursively_write_psymbols)
      	(class debug_names, psyms_seen_size, write_gdbindex)
      	(write_debug_names): Use partial_symtab, not dwarf2_psymtab.
      edfe0a0c
    • Aaron Merey's avatar
      Add debuginfod support to GDB · 0d79cdc4
      Aaron Merey authored
      debuginfod is a lightweight web service that indexes ELF/DWARF debugging
      resources by build-id and serves them over HTTP.
      
      This patch enables GDB to query debuginfod servers for separate debug
      files and source code when it is otherwise not able to find them.
      
      GDB can be built with debuginfod using the --with-debuginfod configure
      option.
      
      This requires that libdebuginfod be installed and found at configure time.
      
      debuginfod is packaged with elfutils, starting with version 0.178.
      
      For more information see https://sourceware.org/elfutils/.
      
      Tested on x86_64 Fedora 31.
      
      gdb/ChangeLog:
      2020-02-26  Aaron Merey  <amerey@redhat.com>
      
              * Makefile.in: Handle optional debuginfod support.
              * NEWS: Update.
              * README: Add --with-debuginfod summary.
              * config.in: Regenerate.
              * configure: Regenerate.
              * configure.ac: Handle optional debuginfod support.
              * debuginfod-support.c: debuginfod helper functions.
              * debuginfod-support.h: Ditto.
              * doc/gdb.texinfo: Add --with-debuginfod to configure options
              summary.
              * dwarf2/read.c (dwarf2_get_dwz_file): Query debuginfod servers
              when a dwz file cannot be found.
              * elfread.c (elf_symfile_read): Query debuginfod servers when a
              debuginfo file cannot be found.
              * source.c (open_source_file): Query debuginfod servers when a
              source file cannot be found.
              * top.c (print_gdb_configuration): Include
              --{with,without}-debuginfod in the output.
      
      gdb/testsuite/ChangeLog:
      2020-02-26  Aaron Merey  <amerey@redhat.com>
      
              * gdb.debuginfod: New directory for debuginfod tests.
              * gdb.debuginfod/main.c: New test file.
              * gdb.debuginfod/fetch_src_and_symbols.exp: New tests.
      0d79cdc4
    • Jérémie Galarneau's avatar
      gdb: print thread names in thread apply command output · b65ce565
      Jérémie Galarneau authored
      This makes the thread apply command print the thread's name.  The use
      of target_pid_to_str is replaced by thread_target_id_str, which
      provides the same output as "info threads".
      
      Before:
      (gdb) thread apply 2 bt
      
      Thread 2 (Thread 0x7fd245602700 (LWP 3837)):
      [...]
      
      After:
      (gdb) thread apply 2 bt
      
      Thread 2 (Thread 0x7fd245602700 (LWP 3837) "HT cleanup"):
      [...]
      
      The thread's description header is pre-computed before running the
      command since the command may change the selected inferior. This is
      not permitted by thread_target_id_str as target_thread_name asserts
      that `info->inf == current_inferior ()`.
      
      This situation arises in the `gdb.threads/threadapply.exp` test which
      kills and removes the inferior as part of a "thread apply" command.
      
      gdb/ChangeLog:
      
              * thread.c (thr_try_catch_cmd): Print thread name.
      b65ce565
  6. Feb 26, 2020
    • Simon Marchi's avatar
      Move more declarations from dwarf2/loc.h to dwarf2/read.h · d4c9a4f8
      Simon Marchi authored
      All these functions have their implementations in dwarf2/read.c, so move
      their declarations to dwarf2/read.h.  Move the doc to the header, at the
      same time.
      
      gdb/ChangeLog:
      
      	* dwarf2/loc.h (dwarf2_fetch_die_loc_sect_off,
      	dwarf2_fetch_die_loc_cu_off, dwarf2_fetch_constant_bytes,
      	dwarf2_fetch_die_type_sect_off): Move to...
      	* dwarf2/read.h (dwarf2_fetch_die_loc_sect_off,
      	dwarf2_fetch_die_loc_cu_off, dwarf2_fetch_constant_bytes,
      	dwarf2_fetch_die_type_sect_off): ... here.
      	* dwarf2/read.c (dwarf2_fetch_die_loc_sect_off,
      	dwarf2_fetch_die_loc_cu_off, dwarf2_fetch_constant_bytes,
      	dwarf2_fetch_die_type_sect_off): Move doc to header file.
      d4c9a4f8
    • Matthew Malcomson's avatar
      [binutils][arm] Arm CDE CX*A instructions allow condition code · cceb53b8
      Matthew Malcomson authored
      The implementation of the Arm CDE CX*A instructions doesn't allow a
      condition code on the instructions but does allow the instruction in an
      ITBlock.
      
      The specification has been recently updated, though this is yet to be
      published.
      
      The instructions now should allow a suffix, and should behave in the
      standard way around ITBlocks.
      
      This patch removes the custom pred_instruction_type and handling for
      these instructions, and uses the standard INSIDE_IT_INSN predication
      type to describe the new instructions.
      
      gas/ChangeLog:
      
      2020-02-26  Matthew Malcomson  <matthew.malcomson@arm.com>
      
      	* config/tc-arm.c (enum pred_instruction_type): Remove
      	NEUTRAL_IT_NO_VPT_INSN predication type.
      	(cxn_handle_predication): Modify to require condition suffixes.
      	(handle_pred_state): Remove NEUTRAL_IT_NO_VPT_INSN cases.
      	* testsuite/gas/arm/cde-scalar.s: Update test.
      	* testsuite/gas/arm/cde-warnings.l: Update test.
      	* testsuite/gas/arm/cde-warnings.s: Update test.
      cceb53b8
    • Tom de Vries's avatar
      [gdb] Don't set initial language if set manually · 0dce4280
      Tom de Vries authored
      Initially, gdb sets the language to auto/c:
      ...
      $ gdb -q
      (gdb) show language
      The current source language is "auto; currently c".
      ...
      
      And after loading a c++ executable, that changes to auto/c++:
      ...
      (gdb) file a.out
      Reading symbols from a.out...
      (gdb) show language
      The current source language is "auto; currently c++".
      ...
      
      Now consider setting the language manually to c:
      ...
      $ gdb -q
      (gdb) show language
      The current source language is "auto; currently c".
      (gdb) set language c
      (gdb) show language
      The current source language is "c".
      ...
      The resulting language is manual/c.
      
      Surprisingly, a subsequent load of the c++ executable:
      ...
      (gdb) file a.out
      Reading symbols from a.out...
      (gdb) show language
      The current source language is "c++".
      ...
      gets us language manual/c++.
      
      Loading the file should get us either:
      - auto/c++, or
      - manual/c.
      That is, either the manual setting should be reset by loading, or the manual
      setting should persist.
      
      Fix this in the manual/c fashion. [ Though we could make some gdb setting to
      choose one or the other. ]
      
      Build and reg-tested on x86_64-linux.
      
      [ Note: In PR23710 comment 1 a cc1 binary is attached for which gdb is slow when
      loading and settting a breakpoint on do_rpo_vn:
      ...
      $ time.sh gdb cc1 -batch -ex "b do_rpo_vn"
      Breakpoint 1 at 0xd40e30: do_rpo_vn. (2 locations)
      maxmem: 1463496
      real: 8.88
      user: 8.59
      system: 0.35
      ...
      
      This fix enables a speedup by manually setting the language before
      loading, reducing executing time with ~17%, due to not having to load the full
      symtab containing main:
      ...
      $ time.sh gdb -iex "set language c++" cc1 -batch -ex "b do_rpo_vn"
      Breakpoint 1 at 0xd40e30: do_rpo_vn. (2 locations)
      maxmem: 1067308
      real: 7.36
      user: 7.14
      system: 0.28
      ... ]
      
      gdb/ChangeLog:
      
      2020-02-26  Tom de Vries  <tdevries@suse.de>
      
      	PR gdb/25603
      	* symfile.c (set_initial_language): Exit-early if
      	language_mode == language_mode_manual.
      
      gdb/testsuite/ChangeLog:
      
      2020-02-26  Tom de Vries  <tdevries@suse.de>
      
      	PR gdb/25603
      	* gdb.base/persistent-lang.cc: New test.
      	* gdb.base/persistent-lang.exp: New file.
      0dce4280
    • H.J. Lu's avatar
      ld: Add PR ld/25593 tests · 3312f67c
      H.J. Lu authored
      	PR ld/25593
      	* testsuite/ld-plugin/lto.exp: Run PR ld/25593 tests.
      	* testsuite/ld-plugin/pr25593.d: New file.
      	* testsuite/ld-plugin/pr25593a-1.c: Likewise.
      	* testsuite/ld-plugin/pr25593a-2.c: Likewise.
      	* testsuite/ld-plugin/pr25593b.c: Likewise.
      	* testsuite/ld-plugin/pr25593c.c: Likewise.
      	* testsuite/ld-plugin/pr25593d.c: Likewise.
      	* testsuite/ld-plugin/pr25593e.c: Likewise.
      3312f67c
    • Alan Modra's avatar
      Archive sanity checks · 02f7e7ee
      Alan Modra authored
      Adds some sanity checking to size values read from file.
      
      	* archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and
      	bfd_set_error on failing test.  Don't bother changing bfd_error on
      	file read error.  Check symdef_count is multiple of BSD_SYMDEF_SIZE.
      	Check sym name is within string buffer.  Use size_t for some vars.
      	(do_slurp_coff_armap): Use size_t for some variables, fix size of
      	int_buf.  Don't change bfd_error on file read error.  Use
      	_bfd_mul_overflow when calculating carsym buffer size.  Reorder
      	calculations to catch overflows before they occur.  malloc and
      	free raw armap rather than using bfd_alloc.  Read raw armap before
      	allocating carsym+strings buffer.
      	(_bfd_slurp_extended_name_table): Localize variables.  Check
      	name size against file size.
      02f7e7ee
    • Alan Modra's avatar
      Re: vms buffer overflows and large memory allocation · cc4c4f40
      Alan Modra authored
      git commit c893ce36 changed buffer management, in the process
      introducing a bug on an error return path.
      
      	* vms-lib.c (vms_lib_read_index): Release correct buffer.
      cc4c4f40
    • Simon Marchi's avatar
      Move dwarf2_read_addr_index declaration to dwarf2/read.h · 450a1bfc
      Simon Marchi authored
      The implementation is in dwarf2/read.c, so the declaration belongs in
      dwarf2/read.h.  Also, move the documentation there.
      
      gdb/ChangeLog:
      
      	* dwarf2/loc.h (dwarf2_read_addr_index): Move...
      	* dwarf2/read.h (dwarf2_read_addr_index): ... here.
      	* dwarf2/read.c (dwarf2_read_addr_index): Move doc to header.
      450a1bfc
    • Alan Modra's avatar
      rx: memory allocation without checking for NULL return · e0b317de
      Alan Modra authored
      	* elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
      	malloc.  Check for NULL return from bfd_malloc.
      	(rx_table_find, rx_table_map): Likewise.
      	(rx_set_section_contents): Check bfd_alloc return.
      	(rx_dump_symtab): Don't alloc internal_syms or external_syms.
      e0b317de
    • Alan Modra's avatar
      gas gettext warning · da3ec71f
      Alan Modra authored
      gettext("") returns the header entry with meta information, not the
      empty string.
      
      	* config/tc-arm.c (reg_expected_msgs[REG_TYPE_RNB]): Don't use
      	N_() on empty string.
      da3ec71f
    • Alan Modra's avatar
      gas strncpy warning · 42135cad
      Alan Modra authored
      Avoid a warning that the buffer may not be zero terminated.
      
      	* read.c (read_a_source_file): Call strncpy with length one
      	less than size of original_case_string.
      42135cad