]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 years agogdb, gdbserver, gdbsupport: fix leading space vs tabs issues users/simark/fix-leading-whitespace
Simon Marchi [Mon, 26 Oct 2020 15:39:39 +0000 (11:39 -0400)] 
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues

Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c).  I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it?  What if the lines around it are also
wrong, do I fix them too?  I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.

So I propose to fix as much as possible once and for all (hopefully).

One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines.  My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for.  So you
already need a somewhat efficient way to do this.

Using some interactive tool, rather than plain git-blame, makes this
trivial.  For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too.  My point is that it won't
really make archeology more difficult.

The other typical counter argument is that it will cause conflicts with
existing patches.  That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve.  I have also tried "git
rebase --ignore-whitespace", it seems to work well.  Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).

gdb/ChangeLog:

* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.

gdbserver/ChangeLog:

* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.

gdbsupport/ChangeLog:

* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.

Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695

3 years ago[gdb/testsuite] Prevent pagination in GDB_INTERNALFLAGS
Tom de Vries [Mon, 26 Oct 2020 15:05:15 +0000 (16:05 +0100)] 
[gdb/testsuite] Prevent pagination in GDB_INTERNALFLAGS

When running test-case gdb.base/corefile.exp with target board readnow, we run
into:
...
Reading symbols from outputs/gdb.base/corefile/corefile...^M
Expanding full symbols from outputs/gdb.base/corefile/corefile...^M
[New LWP 2293]^M
Core was generated by `outputs/gdb.base/corefile/co'.^M
Program terminated with signal SIGABRT, Aborted.^M
--Type <RET> for more, q to quit, c to continue without paging--\
  FAIL: gdb.base/corefile.exp: (timeout) starting with -core
...

In commit bd447abb24 "Make gdb.base/corefile.exp work on terminals with few
rows", pagination (in the same test-case) is prevented using:
...
set stty_init "rows 25 cols 80"
...
but this doesn't work in our case because using -readnow adds an extra line
"Expanding full symbols".

The test passes when increasing rows to 26.  However, increasing the rows by
some n only fixes the problem for n lines, and things will break again if
somehow we end up with n + 1 lines.

Instead, fix this by setting heigth and width in INTERNAL_GDBFLAGS.  This
solution was not chosen in commit bd447abb24 because it doesn't handle
pagination due to the introduction text.  But it does handle the pagination
due to the extra "Expanding full symbols", and any other line printed during
and after file loading.

Tested on x86_64-linux, with and without readnow.

With -readnow, fixes timeout FAILs in gdb.base/corefile.exp and
gdb.base/reread-readsym.exp.

gdb/testsuite/ChangeLog:

2020-10-26  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (INTERNAL_GDBFLAGS): Set heigth and width.

3 years agogas: Clear all auto-assigned file slots
H.J. Lu [Mon, 26 Oct 2020 13:16:08 +0000 (06:16 -0700)] 
gas: Clear all auto-assigned file slots

Since a file slot is auto-assigned for the #APP marker appeared before
the first .file <NUMBER> directive has been seen, clear all auto-assigned
file slots when seeing the first .file <NUMBER> directive.

PR gas/26778
* * dwarf2dbg.c (num_of_auto_assigned): New.
(allocate_filenum): Increment num_of_auto_assigned.
(dwarf2_directive_filename): Clear the slots auto-assigned
before the first .file <NUMBER> directive was seen.
* testsuite/gas/i386/dwarf4-line-1.d: New file.
* testsuite/gas/i386/dwarf4-line-1.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf4-line-1.

3 years agoInvoke the linker's error handling script with the keyword "undefined-symbol" when...
Nick Clifton [Mon, 26 Oct 2020 12:39:50 +0000 (12:39 +0000)] 
Invoke the linker's error handling script with the keyword "undefined-symbol" when using it to help with undefined symbol errors.

PR 26626
* ldmain.c (undefined_symbol): Use the keyword undefined-symbol
when invoking the error handling script for undefined symbols.
* ld.texi: Update documentation.

3 years ago[gdb/testsuite] Add missing ranges base in dw2-objfile-overlap-*.S
Tom de Vries [Mon, 26 Oct 2020 10:08:38 +0000 (11:08 +0100)] 
[gdb/testsuite] Add missing ranges base in dw2-objfile-overlap-*.S

When doing a gdb testsuite run with this trigger patch:
...
@@ -14454,6 +14454,7 @@ dwarf2_ranges_process

       if (!base.has_value ())
        {
+         gdb_assert (false);
          /* We have no valid base address for the ranges
             data.  */
          complaint (_("Invalid .debug_ranges data (no base address)"));
...
we run into the assert with test-case gdb.dwarf2/dw2-objfile-overlap.exp.

Fix this by adding the missing .debug_ranges base in
gdb.dwarf2/dw2-objfile-overlap-*.S.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-26  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/dw2-objfile-overlap-inner.S: Specify default base address
for CU.
* gdb.dwarf2/dw2-objfile-overlap-outer.S: Same.

3 years agoUpdate gas/ChangeLog of last commit
Lifang Xia [Mon, 26 Oct 2020 10:02:33 +0000 (18:02 +0800)] 
Update gas/ChangeLog of last commit

gas/
* ChangeLog: Update ChangLog of 2e58f3923ef

3 years agoC-SKY: Fix the literal dump of big vector constant.
Cooper Qu [Mon, 19 Oct 2020 07:45:36 +0000 (15:45 +0800)] 
C-SKY: Fix the literal dump of big vector constant.

gas/
* config/tc-csky.c (dump_literals): Fix the literal dump of big
vector constant.

3 years agoCSKY: Change default linker script for elf toolchain.
Cooper Qu [Mon, 12 Oct 2020 14:31:29 +0000 (22:31 +0800)] 
CSKY: Change default linker script for elf toolchain.

ld/
* emulparams/cskyelf.sh (TEXT_START_ADDR): Change to 0x60000000.
(DATA_ADDR) : Define.
(OTHER_SYMBOLS) : Define.
(OTHER_BSS_SYMBOLS) : Set symbol __sbss__.
(OTHER_BSS_END_SYMBOLS) : Set symbol __ebss__.
* ld/emulparams/cskyelf_linux.sh : Don't include cskyelf.sh.
* testsuite/ld-csky/data.d : Fix '/s*' to match spaces.
* testsuite/ld-csky/hilo16.d : Likewise.

Change-Id: Ia29b32eab4157ae5be0fc0b6125fb5b7d9dac939

3 years agoCSKY: Change plsl.u16 to plsl.16.
Cooper Qu [Mon, 12 Oct 2020 14:31:14 +0000 (22:31 +0800)] 
CSKY: Change plsl.u16 to plsl.16.

gas/
* testsuite/gas/csky/enhance_dsp.s : Change plsl.u16 to plsl.16.
* testsuite/gas/csky/enhance_dsp.d : Change plsl.u16 to plsl.16.

opcodes/
* csky-opc.h (csky_v2_opcodes): Change plsl.u16 to plsl.16.

Change-Id: Ifb43573192e215527355f6541365b9f6a8ec80a4

3 years agoCSKY: Add version flag in eflag and fix bug in disassembling register.
Cooper Qu [Mon, 12 Oct 2020 14:30:18 +0000 (22:30 +0800)] 
CSKY: Add version flag in eflag and fix bug in disassembling register.

gas/
* config/tc-csky.c (md_begin): Add version flag in eflag.

include/
* opcode/csky.h (CSKY_VERSION_V1): Define, currently used.
(CSKY_VERSION_V2): Define.
(CSKY_VERSION_V3): Define.

Change-Id: Iafe3a9ce6fe544880a225b9fae439275a828bb34

3 years agoCSKY: Fix and add some instructions for VDSPV1.
Cooper Qu [Mon, 12 Oct 2020 14:29:09 +0000 (22:29 +0800)] 
CSKY: Fix and add some instructions for VDSPV1.

gas/
* config/tc-csky.c (get_operand_value): Add handler for
OPRND_TYPE_IMM5b_VSH and OPRND_TYPE_VREG_WITH_INDEX.
* testsuite/gas/csky/csky_vdsp.d : Fix the disassembling
for vector register.

opcodes/
* csky-dis.c (csky_output_operand): Add handler for
OPRND_TYPE_IMM5b_VSH and OPRND_TYPE_VREG_WITH_INDEX.
* csky-opc.h (OPRND_TYPE_VREG_WITH_INDEX): New enum.
(OPRND_TYPE_IMM5b_VSH): New enum.
(csky_v2_opcodes): Fix and add some instructions for VDSPV1.

Change-Id: Ia5675d7b716fe5c331e6121ad8f83061ef6454bb

3 years agoChange avxvnni disassembler output from {vex3} to {vex}
Cui,Lili [Mon, 26 Oct 2020 01:35:26 +0000 (09:35 +0800)] 
Change avxvnni disassembler output from {vex3} to {vex}

gas/

* testsuite/gas/i386/avx-vnni.d: Change psuedo prefix from
{vex3} to {vex}
* testsuite/gas/i386/x86-64-avx-vnni.d: Likewise.

opcodes/

* i386-dis.c: Change "XV" to print "{vex}" pseudo prefix.

3 years agogdb: move ptrace.m4 to gdbsupport
Simon Marchi [Mon, 26 Oct 2020 01:08:49 +0000 (21:08 -0400)] 
gdb: move ptrace.m4 to gdbsupport

ptrace.m4, providing the GDB_AC_PTRACE autoconf macro, is used by gdb,
gdbserver and gdbsupport.  I think it would make sense to move it to
gdbsupport.

gdb/ChangeLog:

* acinclude.m4: Update ptrace.m4 path.
* ptrace.m4: Moved to gdbsupport.

gdbserver/ChangeLog:

* acinclude.m4: Update ptrace.m4 path.

gdbsupport/ChangeLog:

* Makefile.in: Re-generate.
* acinclude.m4: Update ptrace.m4 path.
* ptrace.m4: Move here.

Change-Id: I849c149fd5dd8c3b2b0af38654fb353e3727871b

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Oct 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: use inferior parameter in add_vsyscall_page
Simon Marchi [Sun, 25 Oct 2020 03:00:10 +0000 (23:00 -0400)] 
gdb: use inferior parameter in add_vsyscall_page

Use the new inferior parameter instead of target_gdbarch.  There are
still hidden references to the current context behind core_bfd and
exec_bfd, but this seemed better than nothing.

gdb/ChangeLog:

* symfile-mem.c (add_vsyscall_page): Use inferior parameter
instead of target_gdbarch.

Change-Id: Iaf5ace555ee8e46cbef5190aca1f6fe639f06677

3 years agogdb: make jit.c use the inferior_created inferior parameter
Simon Marchi [Sun, 25 Oct 2020 02:59:51 +0000 (22:59 -0400)] 
gdb: make jit.c use the inferior_created inferior parameter

Use the inferior parameter now available in jit_inferior_created_hook.
It is passed down to jit_inferior_init, which uses it as much as
possible instead of the current inferior or current program space.

gdb/ChangeLog:

* jit.c (jit_reader_load_command): Pass current inferior.
(jit_inferior_init): Change parameter type to inferior, use it.
(jit_inferior_created): Remove.
(jit_inferior_created_hook): Pass inferior parameter down.
(_initialize_jit): Use jit_inferior_created_hook instead of
jit_inferior_created.
* jit.h (jit_inferior_created_hook): Add inferior parameter.
* infrun.c (follow_exec): Pass inferior to
jit_inferior_created_hook.

Change-Id: If3a2114a933370dd313d5abd623136d273cdb8fa

3 years agogdb: pass inferior to check_pid_namespace_match
Simon Marchi [Sun, 25 Oct 2020 02:59:29 +0000 (22:59 -0400)] 
gdb: pass inferior to check_pid_namespace_match

Pass the inferior argument available in thread_db_inferior_created, and
use it to do most things requiring the inferior.
check_pid_namespace_match is not completely decoupled from the current
inferior yet, there are hidden references behind target_can_run, for
example.  But I think this is still a good step forward.

gdb/ChangeLog:

* linux-thread-db.c (check_pid_namespace_match): Add inferior
parameter and use it.
(thread_db_inferior_created): Pass inferior argument.

Change-Id: Ib768b14fc61dcf115fe13f776691f2c2f36e0679

3 years agogdb: add inferior parameter to inferior_created observable
Simon Marchi [Sun, 25 Oct 2020 02:59:04 +0000 (22:59 -0400)] 
gdb: add inferior parameter to inferior_created observable

I think it would make sense for the inferior_created observable to say
which inferior is being dealt with, rather than relying on it being the
current inferior.

This patch adds an inferior parameter to inferior_created, but does not
change the callbacks to use it.

gdb/ChangeLog:

* aix-thread.c (aix_thread_inferior_created): Add inferior
parameter.
* bsd-uthread.c (bsd_uthread_inferior_created): Likewise.
* dummy-frame.c (cleanup_dummy_frames): Likewise.
* jit.c (jit_inferior_created): Likewise.
* linux-thread-db.c (thread_db_inferior_created): Likewise.
* m68k-linux-tdep.c (m68k_linux_inferior_created): Likewise.
* observable.h (inferior_created): Likewise.
* ravenscar-thread.c (ravenscar_inferior_created): Likewise.
* symfile-mem.c (add_vsyscall_page): Likewise.
* infcmd.c (post_create_inferior): Pass inferior argument.

Change-Id: I2543d19ff055a9df6b269929faea10b27d2adc5e

3 years agoasan: alpha-vms: buffer overflow
Alan Modra [Sun, 25 Oct 2020 11:51:45 +0000 (22:21 +1030)] 
asan: alpha-vms: buffer overflow

* vms-misc.c (_bfd_vms_save_counted_string): Count length byte
towards maxlen.

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Oct 2020 00:00:14 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdbserver: re-generate configure
Simon Marchi [Sat, 24 Oct 2020 16:44:18 +0000 (12:44 -0400)] 
gdbserver: re-generate configure

I get this diff when I re-generate the configure script in gdbserver,
probably leftovers from e911c6663bb8 ("Require kinfo_get_file and
kinfo_get_vmmap for FreeBSD hosts").

gdbserver/ChangeLog:

* config.in: Re-generate.
* configure: Re-generate.

Change-Id: Id19a72ea9f3e7c7b4fdb0f319c9c0bbad0e39aeb

3 years agoDocument the GDB 10.1 release in gdb/ChangeLog
Joel Brobecker [Sat, 24 Oct 2020 04:36:42 +0000 (08:36 +0400)] 
Document the GDB 10.1 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 10.1 released.

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Oct 2020 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agold: Set plug_opt only if compiler is available
H.J. Lu [Fri, 23 Oct 2020 18:24:58 +0000 (11:24 -0700)] 
ld: Set plug_opt only if compiler is available

* testsuite/config/default.exp (plug_opt): Set only if compiler
is available.

3 years ago[gdb/testsuite] Don't use default form in Dwarf::_guess_form
Tom de Vries [Fri, 23 Oct 2020 16:49:48 +0000 (18:49 +0200)] 
[gdb/testsuite] Don't use default form in Dwarf::_guess_form

The only possible form for a DW_AT_low_pc attribute is DW_FORM_addr.

When specifying in dwarf assembly a low_pc attribute without explicit form:
...
  {low_pc {main_label - 4}}
...
the resulting attribute uses DW_FORM_string, which is misinterpreted by gdb
when reading it as:
...
        cu->base_address = attr->as_address ();
...

Stop using DW_FORM_string as default form.  Instead, use a default form based
on the attribute name, if possible and unambiguous.  Otherwise, error out.

F.i.:
- for DW_AT_low_pc we use DW_FORM_addr.
- For DW_AT_high_pc, we don't specify a default form because it could be
  either address or constant class.
- For DW_AT_name, we use DW_FORM_string.  While we could encode with
  DW_FORM_strp instead, DW_FORM_string is always ok.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-23  Tom de Vries  <tdevries@suse.de>

* lib/dwarf.exp (Dwarf::_guess_form): Return "" by default instead of
DW_FORM_string.
(Dwarf::_default_form): New proc.
(Dwarf::_handle_DW_TAG): Use _default_form.  Error out if no form was
guessed.

3 years ago[gdb/testsuite] Use $srcfile in DW_AT_name for CU
Tom de Vries [Fri, 23 Oct 2020 12:55:04 +0000 (14:55 +0200)] 
[gdb/testsuite] Use $srcfile in DW_AT_name for CU

In dwarf assembly test-case ada-linkage-name.exp, we have:
...
standard_testfile .c -debug.S
  ...
  cu {} {
    DW_TAG_compile_unit {
      {DW_AT_name     ada-linkage-name.c}
...
Use $srcfile instead of ada-linkage-name.c.

In dwarf assembly test-case atomic-type.exp, we have:
...
standard_testfile .c -dw.S
  ...
  cu {} {
    DW_TAG_compile_unit {
      {DW_AT_name     atomic-type-dw.c}
...
The dwarf generated into atomic-type-dw.S is meant to represent the code in
atomic-type.c, not atomic-type-dw.c, so use $srcfile instead of
atomic-type-dw.c.

Fix these and similar.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-23  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/ada-linkage-name.exp: Use $srcfile for DW_AT_name of CU.
* gdb.dwarf2/atomic-type.exp: Same.
* gdb.dwarf2/bad-regnum.exp: Same.
* gdb.dwarf2/cpp-linkage-name.exp: Same.
* gdb.dwarf2/dw2-align.exp: Same.
* gdb.dwarf2/dw2-bad-elf.exp: Same.
* gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Same.
* gdb.dwarf2/dw2-bad-unresolved.exp: Same.
* gdb.dwarf2/dw2-namespaceless-anonymous.exp: Same.
* gdb.dwarf2/dw2-opt-structptr.exp: Same.
* gdb.dwarf2/dw2-unusual-field-names.exp: Same.
* gdb.dwarf2/enum-type.exp: Same.
* gdb.dwarf2/frame-inlined-in-outer-frame.exp: Same.
* gdb.dwarf2/info-locals-optimized-out.exp: Same.
* gdb.dwarf2/main-subprogram.exp: Same.
* gdb.dwarf2/missing-type-name.exp: Same.
* gdb.dwarf2/nonvar-access.exp: Same.
* gdb.dwarf2/typedef-void-finish.exp: Same.
* gdb.dwarf2/var-access.exp: Same.
* gdb.dwarf2/void-type.exp: Same.

3 years agoada-typeprint.c::ada_print_type: Remove redundant call to ada_check_typedef
Joel Brobecker [Fri, 23 Oct 2020 10:15:15 +0000 (14:15 +0400)] 
ada-typeprint.c::ada_print_type: Remove redundant call to ada_check_typedef

This commit removes a call to ada_check_typedef which has already
been done a few lines earlier in the same function, so the second one
is superfluous.

gdb/ChangeLog:

        * ada-typeprint.c (ada_print_type): Remove superfluous second call
        to ada_check_typedef.

3 years agogdb: move f_language class into a header file
Andrew Burgess [Wed, 16 Sep 2020 15:27:30 +0000 (16:27 +0100)] 
gdb: move f_language class into a header file

Moves the f_language class from f-lang.c into f-lang.h.  The benefit
of this is that functions declared in other f-*.c files can become
member functions without having to go through a level of indirection.

Some additional support functions have now become private member
functions of the f_language class, these are mostly functions that
then called some other function that was itself a member of the
language_defn class hierarchy.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* f-exp.y (f_parse): Rename to...
(f_language::parser): ...this.
* f-lang.c (f_get_encoding): Rename to...
(f_language::get_encoding): ...this.
(f_op_print_tab): Rename to...
(f_language::op_print_tab): ...this.
(exp_descriptor_f): Rename to...
(f_language::exp_descriptor_tab): ...this.
(class f_language): Moved to f-lang.h.
(f_language::language_arch_info): New function, moved out of class
declaration.
(f_language::search_name_hash): Likewise.
(f_language::lookup_symbol_nonlocal): Likewise.
(f_language::get_symbol_name_matcher_inner): Likewise.
* f-lang.h: Add 'valprint.h' include.
(class f_language): Moved here from f-lang.c.
* f-typeprint.c (f_type_print_args): Delete commented out
declaration.
(f_print_typedef): Rename to...
(f_language::print_typedef): ...this.
(f_print_type): Rename to...
(f_language::print_type): ...this.
(f_type_print_varspec_prefix): Delete declaration and rename to...
(f_language::f_type_print_varspec_prefix): ...this.
(f_type_print_varspec_suffix): Delete declaration and rename to...
(f_language::f_type_print_varspec_suffix): ...this.
(f_type_print_base): Delete declaration and rename to...
(f_language::f_type_print_base): ...this.
* f-valprint.c (f_value_print_inner): Rename to...
(f_language::value_print_inner): ...this.
* parse.c: Delete 'f-lang.h' include.

3 years agogdb: Improve documentation comment on language_defn::print_type
Andrew Burgess [Mon, 21 Sep 2020 11:10:04 +0000 (12:10 +0100)] 
gdb: Improve documentation comment on language_defn::print_type

Improves the comment at the declaration of language_defn::print_type.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* language.h (language_defn::print_type): Add variable names in
declaration, and update header comment.

3 years agogdb: Rename language_defn::demangle
Andrew Burgess [Sat, 19 Sep 2020 19:38:11 +0000 (20:38 +0100)] 
gdb: Rename language_defn::demangle

GDB already has a global symbol `demangle` (a boolean), having a
language method called `demangle` is not a good idea as we often want
to reference `demangle` the control variable inside `demangle` the
member function.

This commit renames `demangle` the member function to
`demangle_symbol`.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language::demangle): Rename to...
(ada_language::demangle_symbol): ...this.
* c-lang.c (cplus_language::demangle): Rename to...
(cplus_language::demangle_symbol): ...this.
* d-lang.c (d_language::demangle): Rename to...
(d_language::demangle_symbol): ...this.
* f-lang.c (f_language::demangle): Rename to...
(f_language::demangle_symbol): ...this.
* go-lang.c (go_language::demangle): Rename to...
(go_language::demangle_symbol): ...this.
* language.c (language_demangle): Update call to demangle_symbol.
(auto_or_unknown_language::demangle): Rename to...
(auto_or_unknown_language::demangle_symbol): ...this.
* language.h (language_defn::demangle): Rename to...
(language_defn::demangle_symbol): ...this.
* objc-lang.c (objc_language::demangle): Rename to...
(objc_language::demangle_symbol): ...this.
* rust-lang.c (rust_language::demangle): Rename to...
(rust_language::demangle_symbol): ...this.

3 years agogdb: remove LA_ITERATE_OVER_SYMBOLS macro
Andrew Burgess [Fri, 14 Aug 2020 14:07:52 +0000 (15:07 +0100)] 
gdb: remove LA_ITERATE_OVER_SYMBOLS macro

Replace the single use of the LA_ITERATE_OVER_SYMBOLS macro with the
macro's definition, and delete the macro.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* language.h (LA_ITERATE_OVER_SYMBOLS): Delete.
(iterate_over_file_blocks): Replace use of macro with the macros
definition.

3 years agogdb: remove LA_PRINT_ARRAY_INDEX macro
Andrew Burgess [Fri, 14 Aug 2020 14:06:08 +0000 (15:06 +0100)] 
gdb: remove LA_PRINT_ARRAY_INDEX macro

Replace the single use of the LA_PRINT_ARRAY_INDEX macro with the
macro's definition, and delete the macro.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* language.h (LA_PRINT_ARRAY_INDEX): Delete.
* valprint.c (maybe_print_array_index): Replace use of macro with
the macros definition.

3 years agogdb: remove LA_VALUE_PRINT macro
Andrew Burgess [Fri, 14 Aug 2020 14:05:48 +0000 (15:05 +0100)] 
gdb: remove LA_VALUE_PRINT macro

Remove the LA_VALUE_PRINT macro, and replace its uses with direct
calls to the value_print member function on an appropriate language.

In the global 'value_print' function, we call the value_print method
on the current_language, this is a direct inline replacement of the
old LA_VALUE_PRINT macro.

However, in ada-lang.c, and language.c the macro was being used
within the print_array_index member function of a language class.  In
these cases we now call the value_print member function of the current
language class.

In theory, when we are inside (for example) the
ada_language::print_array_index function the current_language should
always be set to Ada, so this change should have no effect.  However,
if we ever could get into ada_language::print_array_index with the
current language set to something else (which I think would have been
a bug) then we would now see a change in behaviour.  I couldn't find
any cases where this happened though.

There should be no user visible changes after this commit, but it is
not impossible in some edge cases.

gdb/ChangeLog:

* ada-lang.c (ada_language::print_array_index): Call value_print
directly.
* language.c (language_defn::print_array_index): Likewise.
* language.h (LA_VALUE_PRINT): Delete.
* valprint.c (value_print): Call value_print on the
current_language directly.

3 years agogdb: remove LA_PRINT_TYPEDEF macro
Andrew Burgess [Fri, 14 Aug 2020 13:52:26 +0000 (14:52 +0100)] 
gdb: remove LA_PRINT_TYPEDEF macro

Remove the LA_PRINT_TYPEDEF macro, replace the single use with the
macros definition.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* language.h (LA_PRINT_TYPEDEF): Delete.
* typeprint.c (typedef_print): Call print_typedef directly on the
current_language object.

3 years agogdb: move Modula2 language class into a header file
Andrew Burgess [Fri, 14 Aug 2020 13:50:48 +0000 (14:50 +0100)] 
gdb: move Modula2 language class into a header file

Move the m2_language class from m2-lang.c into m2-lang.h.  The benefit
of this move is that we can remove trampoline functions.  Currently
the language implementation is split of different m2-* files with
m2-lang.h including declaration for all the language implementation
functions.

Currently the m2_language class in m2-lang.c has member functions that
then call the global functions declared in m2-lang.h.

After this change the m2_language class is declared in m2-lang.h, and
the member functions are the implementations defined in all the m2-*
files.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* m2-exp.y (m2_parse): Rename to...
(m2_language::parser): ...this.  Update function signature.
* m2-lang.c (m2_printchar): Renamed to m2_language::printchar.
(m2_op_print): Rename to...
(m2_language::op_print_tab): ...this, and make const.
(exp_descriptor_modula2): Rename to...
(m2_language::exp_descriptor_modula2): ...this.
(class m2_language): Move to m2-lang.h.
(m2_language::language_arch_info): New function, moved out of
class declaration.
(m2_language::printchar): New function, body from m2_printchar.
(m2_language::printstr): New function, moved out of class
declaration.
(m2_language::emitchar): Likewise.
* m2-lang.h (m2_parse): Delete declaration.
(m2_print_typedef): Delete declaration.
(m2_value_print_inner): Delete declaration.
(class m2_language): Class declaration moved from m2-lang.c,
larger functions are left in m2-lang.c.
* m2-typeprint.c (m2_print_typedef): Rename to...
(m2_language::print_typedef): ...this, and update function
signature.
* m2-valprint.c (m2_value_print_inner): Rename to...
(m2_language::value_print_inner): ...this, replace use of
LA_PRINT_STRING with a direct call to printstr member function,
and update recursive call.

3 years agogdb: Merge auto and unknown language implementations
Andrew Burgess [Thu, 6 Aug 2020 10:14:37 +0000 (11:14 +0100)] 
gdb: Merge auto and unknown language implementations

The auto_language and unknown_language classes are basically the same
except for the language names and store_sym_names_in_linkage_form_p
which the unknown_language overrides to return true, while
auto_language returns the default false.

This commit creates a new parent class from which both of these
languages can inherit.  The two base classes are now greatly reduced.

Some of the static helper functions which previously were called from
both of these languages are now only called from one place, and so
I've inlined them into the new class.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* language.c (default_is_string_type_p): Delete, implementation
moved into auto_or_unknown_language::is_string_type_p.
(unk_op_print_tab): Moved into
auto_or_unknown_language::opcode_print_table.
(unknown_language_arch_info): Delete, implementation moved into
auto_or_unknown_language::language_arch_info.
(class auto_or_unknown_language): New class, member functions
copied from unknown_language class, with some updates.
(class unknown_language): Most member functions moved into
auto_or_unknown_language class.  Inherit from
auto_or_unknown_language class.
(class auto_language): Inherit from auto_or_unknown_language.
Delete most member functions.

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 23 Oct 2020 00:00:19 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoRemove gdb_assert for TYPE_CODE_METHOD in stabs reader
Hannes Domani [Tue, 6 Oct 2020 15:20:20 +0000 (17:20 +0200)] 
Remove gdb_assert for TYPE_CODE_METHOD in stabs reader

It's possible to come across TYPE_CODE_UNDEF at this point in
read_member_functions, which according to a comment in read_type
is used for forward references.

gdb/ChangeLog:

2020-10-22  Hannes Domani  <ssbssa@yahoo.de>

* stabsread.c (read_member_functions): Remove gdb_assert.

3 years agoDon't create _Complex type name if there is no target type name
Hannes Domani [Tue, 6 Oct 2020 15:08:42 +0000 (17:08 +0200)] 
Don't create _Complex type name if there is no target type name

This causes gdb to crash in strlen.

Happens if init_complex_type is called for a type created by
dbx_init_float_type in stabsread.c.

gdb/ChangeLog:

2020-10-22  Hannes Domani  <ssbssa@yahoo.de>

* gdbtypes.c (init_complex_type): Check target type name.

3 years agogdb: remove unused macros from target-debug.h
Simon Marchi [Thu, 22 Oct 2020 17:28:12 +0000 (13:28 -0400)] 
gdb: remove unused macros from target-debug.h

I noticed some clearly stale entries in target-debug.h (which contained
references to VEC).  I commented everything in target-debug.h and then
uncommented things until it built again, it pointed out a few unused
macros.  Remove them.

gdb/ChangeLog:

* target-debug.h (target_debug_print_struct_target_ops_p):
Remove.
(target_debug_print_async_callback_ftype_p): Remove.
(target_debug_print_struct_trace_state_variable_p): Remove.
(target_debug_print_struct_traceframe_info_p): Remove.
(target_debug_print_VEC__btrace_block_s__pp): Remove.
(target_debug_print_enum_btrace_format): Remove.
(target_debug_print_enum_info_proc_what): Remove.
(target_debug_print_thread_info_pp): Remove.

Change-Id: I7943d21ac6e78751fd7c65a45b345018623ac2f2

3 years agogdb: make target_ops::make_corefile_notes return a unique ptr
Simon Marchi [Thu, 22 Oct 2020 16:58:11 +0000 (12:58 -0400)] 
gdb: make target_ops::make_corefile_notes return a unique ptr

Since we converted gdbarch_make_corefile_notes to returning a
gdb::unique_xmalloc_ptr, I figured it would make sense to converted
target_ops::make_corefile_notes as well.

The only implementation of that is in procfs.c, and it should ideally be
re-written as a gdbarch method (see comment in write_gcore_file_1), but
in the mean time I guess it doesn't hurt to throw some unique pointer at
it.

I tested that it builds on Solaris 11 (gcc compile farm machine gcc211),
but I am not able to test it, because I can't get GDB to start a
process (I'll look at that separately).

gdb/ChangeLog:

* target.h (struct target_ops) <make_corefile_notes>:
Change return type to unique pointer.
* target.c (dummy_make_corefile_notes): Likewise.
* exec.c (struct exec_target) <make_corefile_notes>:
Likewise.
(exec_target::make_corefile_notes): Likewise.
* procfs.c (class procfs_target) <make_corefile_notes>:
Likewise.
(procfs_do_thread_registers): Adjust to unique pointer.
(struct procfs_corefile_thread_data): Add constructor.
<note_data>: Change type to unique pointer.
(procfs_corefile_thread_callback): Adjust to unique pointer.
(procfs_target::make_corefile_notes): Change return type to
unique pointer.
* target-delegates.c: Re-generate.
* gcore.c (write_gcore_file_1): Adjust.
* target-debug.h (target_debug_print_gdb_unique_xmalloc_ptr_char):
New.

Change-Id: I768fb17ac0f7adc67d2fe95e952c784fe0ac37ab

3 years ago[gdb/symtab] Make find_block_in_blockvector more robust
Tom de Vries [Thu, 22 Oct 2020 15:23:25 +0000 (17:23 +0200)] 
[gdb/symtab] Make find_block_in_blockvector more robust

While working on PR25858 I noticed that the following trigger patch:
...
@@ -2918,6 +2918,7 @@ find_pc_sect_compunit_symtab
          const struct blockvector *bv;

          bv = COMPUNIT_BLOCKVECTOR (cust);
+         (volatile int)blockvector_contains_pc (bv, pc);
          b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);

          if (BLOCK_START (b) <= pc
...
triggers this assert, which checks that the returned block indeed
contains pc:
...
@@ -170,7 +170,10 @@ find_block_in_blockvector

     {
       b = BLOCKVECTOR_BLOCK (bl, bot);
       if (BLOCK_END (b) > pc)
-       return b;
+       {
+         gdb_assert (BLOCK_START (b) <= pc);
+         return b;
+       }
       bot--;
     }

...
when running test-case gdb.ada/bp_c_mixed_case.exp.

It's possible that the trigger patch breaks an undocumented invariant:  I've
tried a build and test run without the trigger patch and did not manage to
trigger the assert.

For robustness-sake, fix the assert by bailing out if 'BLOCK_START (b) <= pc'
doesn't hold.

Tested on x86_64-linux.

gdb/ChangeLog:

2020-10-22  Tom de Vries  <tdevries@suse.de>

* block.c (find_block_in_blockvector): Make sure the returned block
contains pc.

3 years agogdb/dwarf: fix reading subprogram with DW_AT_specification (PR gdb/26693)
Simon Marchi [Thu, 22 Oct 2020 14:27:39 +0000 (10:27 -0400)] 
gdb/dwarf: fix reading subprogram with DW_AT_specification (PR gdb/26693)

Fix a regression introduced by commit 7188ed02d2a7 ("Replace
dwarf2_per_cu_data::cu backlink with per-objfile map").

This patch targets both master and gdb-10-branch, since this is a
regression from GDB 9.

Analysis
--------

The DWARF generated by the included test case looks like:

    0x0000000b: DW_TAG_compile_unit
                  DW_AT_language [DW_FORM_sdata]    (4)

    0x0000000d:   DW_TAG_base_type
                    DW_AT_name [DW_FORM_string]     ("int")
                    DW_AT_byte_size [DW_FORM_data1] (0x04)
                    DW_AT_encoding [DW_FORM_sdata]  (5)

    0x00000014:   DW_TAG_subprogram
                    DW_AT_name [DW_FORM_string]     ("apply")

    0x0000001b:   DW_TAG_subprogram
                    DW_AT_specification [DW_FORM_ref4]      (0x00000014 "apply")
                    DW_AT_low_pc [DW_FORM_addr]     (0x0000000000001234)
                    DW_AT_high_pc [DW_FORM_data8]   (0x0000000000000020)

    0x00000030:     DW_TAG_template_type_parameter
                      DW_AT_name [DW_FORM_string]   ("T")
                      DW_AT_type [DW_FORM_ref4]     (0x0000000d "int")

    0x00000037:     NULL

    0x00000038:   NULL

Simply loading the file in GDB makes it crash:

    $ ./gdb -nx --data-directory=data-directory testsuite/outputs/gdb.dwarf2/pr26693/pr26693
    [1]    15188 abort (core dumped)  ./gdb -nx --data-directory=data-directory

The crash happens here, where htab (a dwarf2_cu::die_hash field) is
unexpectedly NULL while generating partial symbols:

    #0  0x000055555fa28188 in htab_find_with_hash (htab=0x0, element=0x7fffffffbfa0, hash=27) at /home/simark/src/binutils-gdb/libiberty/hashtab.c:591
    #1  0x000055555cb4eb2e in follow_die_offset (sect_off=(unknown: 27), offset_in_dwz=0, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22951
    #2  0x000055555cb4edfb in follow_die_ref (src_die=0x0, attr=0x7fffffffc130, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22968
    #3  0x000055555caa48c5 in partial_die_full_name (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8441
    #4  0x000055555caa4d79 in add_partial_symbol (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8469
    #5  0x000055555caa7d8c in add_partial_subprogram (pdi=0x621000157e70, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8737
    #6  0x000055555caa265c in scan_partial_symbols (first_die=0x621000157e00, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8230
    #7  0x000055555ca98e3f in process_psymtab_comp_unit_reader (reader=0x7fffffffc6b0, info_ptr=0x60600009650d "\003int", comp_unit_die=0x621000157d10, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7614
    #8  0x000055555ca9aa2c in process_psymtab_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, want_partial_unit=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7712
    #9  0x000055555caa051a in dwarf2_build_psymtabs_hard (per_objfile=0x613000009f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8073

The special thing about this DWARF is that the subprogram at 0x1b is a
template specialization described with DW_AT_specification, and has no
DW_AT_name in itself.  To compute the name of this subprogram,
partial_die_full_name needs to load the full DIE for this partial DIE.
The name is generated from the templated function name and the actual
tempalate parameter values of the specialization.

To load the full DIE, partial_die_full_name creates a dummy DWARF
attribute of form DW_FORM_ref_addr that points to our subprogram's DIE,
and calls follow_die_ref on it.  This eventually causes
load_full_comp_unit to be called for the exact same CU we are currently
making partial symbols for:

    #0  load_full_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, skip_partial=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:9238
    #1  0x000055555cb4e943 in follow_die_offset (sect_off=(unknown: 27), offset_in_dwz=0, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22942
    #2  0x000055555cb4edfb in follow_die_ref (src_die=0x0, attr=0x7fffffffc130, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22968
    #3  0x000055555caa48c5 in partial_die_full_name (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8441
    #4  0x000055555caa4d79 in add_partial_symbol (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8469
    #5  0x000055555caa7d8c in add_partial_subprogram (pdi=0x621000157e70, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8737
    #6  0x000055555caa265c in scan_partial_symbols (first_die=0x621000157e00, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8230
    #7  0x000055555ca98e3f in process_psymtab_comp_unit_reader (reader=0x7fffffffc6b0, info_ptr=0x60600009650d "\003int", comp_unit_die=0x621000157d10, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7614
    #8  0x000055555ca9aa2c in process_psymtab_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, want_partial_unit=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7712
    #9  0x000055555caa051a in dwarf2_build_psymtabs_hard (per_objfile=0x613000009f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8073

load_full_comp_unit creates a cutu_reader for the CU.  Since a dwarf2_cu
object already exists for the CU, load_full_comp_unit is expected to
find it and pass it to cutu_reader, so that cutu_reader doesn't create
a new dwarf2_cu for the CU.

And this is the difference between before and after the regression.
Before commit 7188ed02d2a7, the dwarf2_per_cu_data -> dwarf2_cu link was
a simple pointer in dwarf2_per_cu_data.  This pointer was set up when
starting the read the partial symbols.  So it was already available at
that point where load_full_comp_unit gets called.  Post-7188ed02d2a7,
this link is per-objfile, kept in the dwarf2_per_objfile::m_dwarf2_cus
hash map.  The entry is only put in the hash map once the partial
symbols have been successfully read, when cutu_reader::keep is called.
Therefore, it is _not_ set at the point load_full_comp_unit is called.

As a consequence, a new dwarf2_cu object gets created and initialized by
load_full_comp_unit (including initializing that dwarf2_cu::die_hash
field).  Meanwhile, the dwarf2_cu object created and used by the callers
up the stack does not get initialized for full symbol reading, and the
dwarf2_cu::die_hash field stays unexpectedly NULL.

Solution
--------

Since the caller of load_full_comp_unit knows about the existing
dwarf2_cu object for the CU we are reading (the one load_full_comp_unit
is expected to find), we can simply make it pass it down, instead of
having load_full_comp_unit look up the per-objfile map.

load_full_comp_unit therefore gets a new `existing_cu` parameter.  All
other callers get updated to pass `per_objfile->get_cu (per_cu)`, so the
behavior shouldn't change for them, compared to the current HEAD.

A test is added, which is the bare minimum to reproduce the issue.

Notes
-----

The original problem was reproduced by downloading

    https://github.com/oneapi-src/oneTBB/releases/download/v2020.3/tbb-2020.3-lin.tgz

and loading libtbb.so in GDB.  This code was compiled with the Intel
C/C++ compiler.  I was not able to reproduce the issue using GCC, I
think because GCC puts a DW_AT_name in the specialized subprogram, so
there's no need for partial_die_full_name to load the full DIE of the
subprogram, and the faulty code doesn't execute.

gdb/ChangeLog:

PR gdb/26693
* dwarf2/read.c (load_full_comp_unit): Add existing_cu
parameter.
(load_cu): Pass existing CU.
(process_imported_unit_die): Likewise.
(follow_die_offset): Likewise.

gdb/testsuite/ChangeLog:

PR gdb/26693
* gdb.dwarf2/template-specification-full-name.exp: New test.

Change-Id: I57c8042f96c45f15797a3848e4d384181c56bb44

3 years agoFix gdb.base/msym*.exp failures
Luis Machado [Wed, 14 Oct 2020 22:44:03 +0000 (19:44 -0300)] 
Fix gdb.base/msym*.exp failures

AArch64 generates functions without a prologue for these two testcases,
therefore we shouldn't expect the function location to be displayed with
an offset.

gdb/testsuite/ChangeLog:

2020-10-22  Luis Machado  <luis.machado@linaro.org>

* gdb.base/msym-bp-shl.exp (test_break): Adjust pattern to not
expected an offset from the function.
* gdb.base/msym-bp.exp (test): Likewise.

3 years ago[PATCH][GAS][AArch64] Define BRBE system registers
Przemyslaw Wirkus [Thu, 22 Oct 2020 14:17:35 +0000 (15:17 +0100)] 
[PATCH][GAS][AArch64] Define BRBE system registers

This patch introduces BRBE (Branch Record Buffer Extension) system
registers.

Note: as this is register only extension we do not want to hide these
registers behind -march flag going forward (they should be enabled by
default).

gas/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

* NEWS: Docs update.
* testsuite/gas/aarch64/brbe-invalid.d: New test.
* testsuite/gas/aarch64/brbe-invalid.l: New test.
* testsuite/gas/aarch64/brbe-invalid.s: New test.
* testsuite/gas/aarch64/brbe.d: New test.
* testsuite/gas/aarch64/brbe.s: New test.

opcodes/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

* aarch64-opc.c: Add BRBE system registers.

3 years agoaarch64: Define CSRE system registers
Przemyslaw Wirkus [Thu, 22 Oct 2020 14:17:10 +0000 (15:17 +0100)] 
aarch64: Define CSRE system registers

This patch introduces CSRE (Call Stack Recorder Extension) system
registers.

Note: as this is register only extension we do not want to hide these
registers behind -march flag going forward (they should be enabled by
default).

CSRE feature adds CSR PDEC (Decrements Call stack pointer by the size
of a Call stack record) instruction. This instruction will be added in
a following, separate patch. This change only adds CSRE system
registers.

gas/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

* NEWS: Docs update.
* testsuite/gas/aarch64/csre-invalid.d: New test.
* testsuite/gas/aarch64/csre-invalid.l: New test.
* testsuite/gas/aarch64/csre-invalid.s: New test.
* testsuite/gas/aarch64/csre.d: New test.
* testsuite/gas/aarch64/csre.s: New test.

opcodes/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

* aarch64-opc.c: New CSRE system registers defined.

3 years agogold: Skip bootstrap-test/bootstrap-test-r for LTO build
H.J. Lu [Thu, 22 Oct 2020 13:11:34 +0000 (06:11 -0700)] 
gold: Skip bootstrap-test/bootstrap-test-r for LTO build

Skip bootstrap-test and bootstrap-test-r for LTO build due to different
build IDs.

* Makefile.am (bootstrap-test): Skip for LTO build.
(bootstrap-test-r): Likewise.

3 years agold: Skip bootstrap tests for -fprofile-generate=
H.J. Lu [Thu, 22 Oct 2020 13:10:08 +0000 (06:10 -0700)] 
ld: Skip bootstrap tests for -fprofile-generate=

Make plug_opt available to all linker tests.  Skip bootstrap tests when
linker is compiled with -fprofile-generate=.

* testsuite/ld-plugin/lto.exp (plug_opt): Moved to ...
* testsuite/config/default.exp (plug_opt): Here.  New.
* testsuite/ld-bootstrap/bootstrap.exp: Skip when linker is
compiled with -fprofile-generate=.

3 years agoFix gdb.base/corefile2.exp regression when running Docker/AUFS
Luis Machado [Wed, 14 Oct 2020 22:11:09 +0000 (19:11 -0300)] 
Fix gdb.base/corefile2.exp regression when running Docker/AUFS

The following failures started showing up after commit
bb2a67773c - "Use a std::vector in target_section_table":

FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[0]@4
FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[pagesize-4]@4
FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[-3]@6
FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_rw[pagesize-3]@6
FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[pagesize-3]@6

I tracked it down to a problem in core_target::xfer_partial, at this point:

if (!m_core_file_mappings.empty ())
  xfer_status = xfer_memory_via_mappings (readbuf, writebuf, offset,
  len, xfered_len);
else
  xfer_status = this->beneath ()->xfer_partial (object, annex, readbuf,
writebuf, offset, len,
xfered_len);

It seems commit bb2a67773c uncovered a latent bug when handling a particular
case where things are running within a Docker container using the AUFS storage
driver.

When building the file mappings for a core file, we call
gdbarch_read_core_file_mappings, which in turn passes a couple lambda
callbacks. One pre-loop and one in-loop.

The catch is that commit bb2a67773c reworked the pre-loop lambda and
made it do nothing. Before that commit, we always allocated
m_core_file_mappings in that lambda.

Now, when calling the in-loop lambda, we don't touch m_core_file_mappings
because the bfd is nullptr (given Docker leaks the host system path, and that
file doesn't exist within the container itself).

So, instead, we add an entry to the m_core_unavailable_mappings vector.

When we reach core_target::xfer_partial, we're only checking for an empty
m_core_file_mappings. Given it is now empty, we take the path of reading
the contents from the file, not the core file. This reads back unexpected
results.

The following patch fixes this by also checking for
m_core_unavailable_mappings, given core_target::xfer_memory_via_mappings
already handles the Docker/AUFS situation.

gdb/ChangeLog:

2020-10-22  Luis Machado  <luis.machado@linaro.org>

* corelow.c (core_target::xfer_partial): Also check for an empty
m_core_unavailable_mappings vector.

3 years agold: Pass -fno-lto to non LTO tests
H.J. Lu [Thu, 22 Oct 2020 13:04:21 +0000 (06:04 -0700)] 
ld: Pass -fno-lto to non LTO tests

* testsuite/config/default.exp (NOLTO_CFLAGS): New.
* ld/testsuite/ld-elfcomm/elfcomm.exp: Add $NOLTO_CFLAGS to CC.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-plugin/plugin.exp: Likewise.
* testsuite/ld-scripts/crossref.exp: Likewise.
* testsuite/ld-selective/selective.exp: Likewise.
* testsuite/ld-undefined/undefined.exp: Likewise.
* testsuite/ld-srec/srec.exp: Add $NOLTO_CFLAGS to CC.  Override
CXXFLAGS.
* testsuite/lib/ld-lib.exp (run_ld_link_tests): Prepend -fno-lto
to cflags.

3 years agosim: move ChangeLog entries into the correct files
Andrew Burgess [Thu, 22 Oct 2020 12:37:56 +0000 (13:37 +0100)] 
sim: move ChangeLog entries into the correct files

Moves some ChangeLog entries under sim/ into the correct files.

3 years agoarm: Fix the wrong error message string for mve vldr/vstr (PR26763).
Srinath Parvathaneni [Thu, 22 Oct 2020 12:24:34 +0000 (13:24 +0100)] 
arm: Fix the wrong error message string for mve vldr/vstr (PR26763).

For mve vldr/vstr instructions assembler is throwing wrong error message.
Instead of 'Error: syntax error' assembler fails with 'Error: lo register required'.
This patch fixes the issue.

eg:
$ cat x.s
.syntax unified
.thumb

vldrb.s16 q0, r0

Before this patch:
$ arm-none-eabi-as x.s -march=armv8.1-m.main+mve -mfloat-abi=hard
x.s: Assembler messages:
x.s:4: Error: lo register required -- `vldrb.s16 q0,r0'

After this patch:
$ arm-none-eabi-as x.s -march=armv8.1-m.main+mve -mfloat-abi=hard
x.s: Assembler messages:
x.s:4: Error: syntax error -- `vldrb.s16 q0,r0'

gas/ChangeLog:

2020-10-21  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/26763
* config/tc-arm.c (parse_address_main): Add new MVE addressing mode
check.
* testsuite/gas/arm/mve-vldr-vstr-bad.d: New test.
* testsuite/gas/arm/mve-vldr-vstr-bad.l: Likewise.
* testsuite/gas/arm/mve-vldr-vstr-bad.s: Likewise.

3 years agoopcodes/po/es.po: Remove the duplicated entry
H.J. Lu [Thu, 22 Oct 2020 12:21:35 +0000 (05:21 -0700)] 
opcodes/po/es.po: Remove the duplicated entry

Remove the duplicated entry in opcodes/po/es.po:

binutils-gdb/opcodes/po/es.po:749: duplicate message definition...
binutils-gdb/opcodes/po/es.po:742: ...this is the location of the first definition

* po/es.po: Remove the duplicated entry.

3 years agobinutils: Report error message on error
H.J. Lu [Thu, 22 Oct 2020 11:48:11 +0000 (04:48 -0700)] 
binutils: Report error message on error

* testsuite/binutils-all/objcopy.exp (objcopy_test): Report
error message on error.

3 years agoFix printf formatting errors where "0x" is used as a prefix for a decimal number.
Dr. David Alan Gilbert [Thu, 22 Oct 2020 11:00:10 +0000 (12:00 +0100)] 
Fix printf formatting errors where "0x" is used as a prefix for a decimal number.

bfd * po/es.po: Fix printf format

binutils * windmc.c: Fix printf format

gas * config/tc-arc.c: Fix printf format

opcodes * po/es.po: Fix printf format

sim * arm/armos.c: Fix printf format
* ppc/emul_netbsd.c: Fix printf format
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

3 years agogdb/fortran: add support for parsing array strides in expressions
Andrew Burgess [Thu, 8 Oct 2020 15:34:58 +0000 (16:34 +0100)] 
gdb/fortran: add support for parsing array strides in expressions

With this commit GDB now understands the syntax of Fortran array
strides, a user can type an expression including an array stride, but
they will only get an error informing them that array strides are not
supported.

This alone is an improvement on what we had before in GDB, better to
give the user a helpful message that a particular feature is not
supported than to just claim a syntax error.

Before:

  (gdb) p array (1:10:2, 2:10:2)
  A syntax error in expression, near `:2, 2:10:2)'.

Now:

  (gdb) p array (1:10:2, 2:10:2)
  Fortran array strides are not currently supported

Later commits will allow GDB to handle array strides correctly.

gdb/ChangeLog:

* expprint.c (dump_subexp_body_standard): Print RANGE_HAS_STRIDE.
* expression.h (enum range_type): Add RANGE_HAS_STRIDE.
* f-exp.y (arglist): Allow for a series of subranges.
(subrange): Add cases for subranges with strides.
* f-lang.c (value_f90_subarray): Catch use of array strides and
throw an error.
* parse.c (operator_length_standard): Handle RANGE_HAS_STRIDE.

gdb/testsuite/ChangeLog:

* gdb.fortran/array-slices.exp: Add a new test.

3 years agogdb: rename 'enum range_type' to 'enum range_flag'
Andrew Burgess [Fri, 25 Sep 2020 23:09:25 +0000 (00:09 +0100)] 
gdb: rename 'enum range_type' to 'enum range_flag'

To avoid confusion with other parts of GDB relating to types and
ranges, rename this enum to make it clearer that it is a set of
individual flags rather than an enumeration of different types of
range.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* expprint.c (print_subexp_standard): Change enum range_type to
range_flag and rename variables to match.
(dump_subexp_body_standard): Likewise.
* expression.h (enum range_type): Rename to...
(enum range_flag): ...this.
(range_types): Rename to...
(range_flags): ...this.
* f-lang.c (value_f90_subarray): Change enum range_type to
range_flag and rename variables to match.
* parse.c (operator_length_standard): Likewise.
* rust-exp.y (rust_parser::convert_ast_to_expression): Change enum
range_type to range_flag.
* rust-lang.c (rust_evaluate_funcall): Likewise.
(rust_range): Likewise.
(rust_compute_range): Likewise.
(rust_subscript): Likewise.

3 years agogdb: Convert enum range_type to a bit field enum
Andrew Burgess [Tue, 5 May 2020 15:03:53 +0000 (16:03 +0100)] 
gdb: Convert enum range_type to a bit field enum

The expression range_type enum represents the following ideas:

  - Lower bound is set to default,
  - Upper bound is set to default,
  - Upper bound is exclusive.

There are currently 6 entries in the enum to represent the combination
of all those ideas.

In a future commit I'd like to add stride information to the range,
this could in theory appear with any of the existing enum entries, so
this would take us to 12 enum entries.

This feels like its getting a little out of hand, so in this commit I
switch the range_type enum over to being a flags style enum.  There's
one entry to represent no flags being set, then 3 flags to represent
the 3 ideas above.  Adding stride information will require adding only
one more enum flag.

I've then gone through and updated the code to handle this change.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* expprint.c (print_subexp_standard): Update to reflect changes to
enum range_type.
(dump_subexp_body_standard): Likewise.
* expression.h (enum range_type): Convert to a bit field enum, and
make the enum unsigned.
* f-exp.y (subrange): Update to reflect changes to enum
range_type.
* f-lang.c (value_f90_subarray): Likewise.
* parse.c (operator_length_standard): Likewise.
* rust-exp.y (rust_parser::convert_ast_to_expression): Likewise.
* rust-lang.c (rust_range): Likewise.
(rust_compute_range): Likewise.
(rust_subscript): Likewise.

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Oct 2020 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: fix two comments in infrun
Simon Marchi [Wed, 21 Oct 2020 19:55:58 +0000 (15:55 -0400)] 
gdb: fix two comments in infrun

These comments are stale, they refer to non-existent parameters.  Fix
that.

gdb/ChangeLog:

* infrun.c (displaced_step_in_progress_thread): Fix comment.
(displaced_step_in_progress): Fix comment.

Change-Id: I7a39f1338fbfbf73153b49cbca0345d495d12762

3 years agoRemove libctf/mkerrors.sed
Tom Tromey [Wed, 21 Oct 2020 14:54:17 +0000 (08:54 -0600)] 
Remove libctf/mkerrors.sed

This patch removes libctf/mkerrors.sed, replacing it with a macro in
ctf-api.h.  This simplifies the build and avoids possible unportable
code in the sed script.

2020-10-21  Tom Tromey  <tromey@adacore.com>

* ctf-api.h (_CTF_ERRORS): New macro.

libctf/ChangeLog
2020-10-21  Tom Tromey  <tromey@adacore.com>

* mkerrors.sed: Remove.
* ctf-error.c (_CTF_FIRST): New define.
(_CTF_ITEM): Define this, not _CTF_STR.
(_ctf_errlist, _ctf_erridx): Use _CTF_ERRORS.
(ERRSTRFIELD): Rewrite.
(ERRSTRFIELD1): Remove.
* Makefile.in: Rebuild.
* Makefile.am (BUILT_SOURCES): Remove.
(ctf-error.h): Remove.

3 years agoaarch64: Add testcase for HCR_EL2 system register
Przemyslaw Wirkus [Wed, 21 Oct 2020 17:28:27 +0000 (18:28 +0100)] 
aarch64: Add testcase for HCR_EL2 system register

HCR_EL2 is a 64-bit Hypervisor Configuration Register.

gas/ChangeLog:

2020-10-16  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

* testsuite/gas/aarch64/sysreg-6.d: New test.
* testsuite/gas/aarch64/sysreg-6.s: New test.

3 years agoWork around problem in DWARF decoding library which can result in attempts to read...
Nick Clifton [Wed, 21 Oct 2020 16:42:42 +0000 (17:42 +0100)] 
Work around problem in DWARF decoding library which can result in attempts to read arbitrary bytes as if they were an LEB128 encoded value.

* dwarf.c (skip_attr_bytes): Accept DWARF versions higher than 4
when processing the DW_FORM_ref_addr form.
Skip bytes in DW_FORM_block and DW_FORM_exprloc forms.
Handle DW_FORM_indirect.
(get_type_signedness): Allow a limited amount of recursion.
Do not attempt to decode types that use the DW_FORM_ref_addr form.
(read_and_display_attr_value):  Do not attempt to decode types
that use the DW_FORM_ref_addr form.

3 years agogdb: make gdbarch_make_corefile_notes return a unique ptr
Simon Marchi [Wed, 21 Oct 2020 14:43:48 +0000 (10:43 -0400)] 
gdb: make gdbarch_make_corefile_notes return a unique ptr

This patch starts by making the gdbarch_make_corefile_notes function
return a gdb::unique_xmalloc_ptr<char> and takes care of the fallouts,
mostly in linux-tdep.c and fbsd-tdep.c.

The difficulty in these files is that they use the BFD API for writing
core files, where you pass in a pointer to a malloc-ed buffer (or NULL
in the beginning), it re-allocs it if needed, and returns you the
possibly updated pointer.  I therefore used this pattern everywhere:

  note_data.reset (elfcore_write_note (obfd, note_data.release (), ...)

This hands over the ownership of note_data to the BFD function for the
duration of the call, and then puts its back in note_data right after
the call.

gdb/ChangeLog:

* gdbarch.sh (make_corefile_notes): Return unique pointer.
* gdbarch.c: Re-generate.
* gdbarch.h: Re-generate.
* gcore.c (write_gcore_file_1): Adjust.
* fbsd-tdep.c (struct fbsd_collect_regset_section_cb_data): Add
constructor.
<note_data>: Change type to unique pointer.
<abort_iteration>: Change type to bool.
(fbsd_collect_regset_section_cb): Adjust to unique pointer.
(fbsd_collect_thread_registers): Return void, adjust.
(struct fbsd_corefile_thread_data): Add construtor.
<note_data>: Change type to unique pointer.
(fbsd_corefile_thread): Adjust.
(fbsd_make_corefile_notes): Return unique pointer, adjust.
* linux-tdep.c (linux_make_mappings_corefile_notes): Change type
to unique pointer, adjust.
(struct linux_collect_regset_section_cb_data): Add constructor.
<note_data>: Change type to unique pointer.
<abort_iteration>: Change type to bool.
(linux_collect_thread_registers): Return void, adjust.
(struct linux_corefile_thread_data): Add constructor.
<note_data>: Change type to unique pointer.
(linux_corefile_thread): Adjust.
(linux_make_corefile_notes): Return unique pointer, adjust.

Change-Id: I1e03476bb47b87c6acb3e12204d193f38cc4e02b

3 years agogdbserver: fix overlap in sprintf argument and buffer
Simon Marchi [Wed, 21 Oct 2020 14:41:12 +0000 (10:41 -0400)] 
gdbserver: fix overlap in sprintf argument and buffer

While trying to build on Cygwin (gcc 10.2.0), I got:

      CXX    server.o
    /home/Baube/src/binutils-gdb/gdbserver/server.cc: In function 'void handle_general_set(char*)':
    /home/Baube/src/binutils-gdb/gdbserver/server.cc:832:12: error: 'sprintf' argument 3 overlaps destination object 'own_buf' [-Werror=restrict]
      832 |    sprintf (own_buf, "E.Unknown thread-events mode requested: %s\n",
          |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      833 |      mode);
          |      ~~~~~
    /home/Baube/src/binutils-gdb/gdbserver/server.cc:553:27: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
      553 | handle_general_set (char *own_buf)
          |                     ~~~~~~^~~~~~~

There is indeed a problem: mode points somewhere into own_buf.  And by
the time mode gets formatted as a %s, whatever it points to has been
overwritten.  I hacked gdbserver to coerce it into that error path, and
this is the resulting message:

    (gdb) p own_buf
    $1 = 0x629000000200 "E.Unknown thread-events mode requested: ad-events mode requested: 00;10:9020fdf7ff7f0000;thread:p49388.49388;core:e;\n"

Fix it by formatting the error string in an std::string first.

gdbserver/ChangeLog:

* server.cc (handle_general_set): Don't use sprintf with
argument overlapping buffer.

Change-Id: I4fdf05c0117f63739413dd67ddae7bd6ee414824

3 years agoFix gdb.mi/mi-fullname-deleted.exp with Clang
Gary Benson [Wed, 21 Oct 2020 08:54:31 +0000 (09:54 +0100)] 
Fix gdb.mi/mi-fullname-deleted.exp with Clang

gdb.mi/mi-fullname-deleted.exp attempts to generate an executable
with a doubled slash in the source filename recorded in its debug
info.  This attempt fails when compiling using Clang, causing the
substituted filename test to fail.  This commit fixes this issue.
It also expands the comments in the file, to clarify what the test
is attempting to do, and to document where it doesn't succeed.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-fullname-deleted.exp: Fix substituted
fullname test with Clang.  Also expand comments generally.

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Oct 2020 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: make gdbarch_displaced_step_hw_singlestep return bool
Simon Marchi [Tue, 20 Oct 2020 21:39:47 +0000 (17:39 -0400)] 
gdb: make gdbarch_displaced_step_hw_singlestep return bool

Replace the int-used-as-a-bool with a bool.

gdb/ChangeLog:

* gdbarch.sh (displaced_step_hw_singlestep): Return bool.
* gdbarch.c: Re-generate.
* gdbarch.h: Re-generate.
* aarch64-tdep.c (aarch64_displaced_step_hw_singlestep): Return
bool.
* aarch64-tdep.h (aarch64_displaced_step_hw_singlestep):
Likewise.
* arch-utils.h (default_displaced_step_hw_singlestep): Likewise.
* arch-utils.c (default_displaced_step_hw_singlestep): Likewise.
* rs6000-tdep.c (ppc_displaced_step_hw_singlestep): Likewise.
* s390-tdep.c (s390_displaced_step_hw_singlestep): Likewise.

Change-Id: I76a78366dc5c0afb03f8f4bddf9f4e8d68fe3114

3 years agogdb: make gdbarch predicates return bool
Simon Marchi [Tue, 20 Oct 2020 21:34:30 +0000 (17:34 -0400)] 
gdb: make gdbarch predicates return bool

gdbarch predicates (functions suffixed _p to check whether a gdbarch
implements a given method) currently return int.  Make them return bool.
There is no expected behavior change.

gdb/ChangeLog:

* gdbarch.sh: Make generated predicates return bool.
* gdbarch.c: Re-generate.
* gdbarch.h: Re-generate.

Change-Id: Ie7ebc1acae62df83da9085ba69327fca551c5a30

3 years agoRemove varobj_item typedef
Tom Tromey [Tue, 20 Oct 2020 21:28:22 +0000 (15:28 -0600)] 
Remove varobj_item typedef

While working on some minor varobj cleanups, I noticed this obvious
one: the varobj_item typedef isn't redundant in C++, and so can be
removed.

gdb/ChangeLog
2020-10-20  Tom Tromey  <tom@tromey.com>

* varobj-iter.h (struct varobj_item): Remove typedef.

3 years agoAdd AMD znver3 processor support
Ganesh Gopalasubramanian [Tue, 20 Oct 2020 18:26:58 +0000 (23:56 +0530)] 
Add AMD znver3 processor support

gas/

* config/tc-i386.c (cpu_arch): Add CPU_ZNVER3_FLAGS flags.
(i386_align_code): Add PROCESSOR_ZNVER cases.
* doc/c-i386.texi: Add znver3, snp, invlpgb and tlbsync.
* gas/i386/i386.exp: Add new znver3 test cases.
* gas/i386/arch-14-znver3.d: New.
* gas/i386/arch-14.d: New.
* gas/i386/arch-14.s: New.
* gas/i386/invlpgb.d: New.
* gas/i386/invlpgb64.d: New.
* gas/i386/invlpgb.s: New.
* gas/i386/snp.d: New.
* gas/i386/snp64.d: New.
* gas/i386/snp.s: New.
* gas/i386/tlbsync.d: New.
* gas/i386/tlbsync.s: New.
* gas/i386/x86-64-arch-4-znver3.d: New.
* gas/i386/x86-64-arch-4.d: New.
* gas/i386/x86-64-arch-4.s: New.

opcodes/

* i386-dis.c (rm_table): Add tlbsync, snp, invlpgb.
* i386-gen.c (cpu_flag_init): Add new CPU_INVLPGB_FLAGS,
CPU_TLBSYNC_FLAGS, and CPU_SNP_FLAGS.
Add CPU_ZNVER3_FLAGS.
(cpu_flags): Add CpuINVLPGB, CpuTLBSYNC, CpuSNP.
* i386-opc.h: Add CpuINVLPGB, CpuTLBSYNC, CpuSNP.
* i386-opc.tbl: Add invlpgb, tlbsync, psmash, pvalidate,
rmpupdate, rmpadjust.
* i386-init.h: Re-generated.
* i386-tbl.h: Re-generated.

3 years agogdb: change some int to bool in infrun.c
Simon Marchi [Tue, 20 Oct 2020 20:31:57 +0000 (16:31 -0400)] 
gdb: change some int to bool in infrun.c

Change these int-used-as-a-bool to bool.  I searched for "static int" in
that file and changed what I found.

gdb/ChangeLog:

* infrun.c (currently_stepping): Change int to bool
(maybe_software_singlestep): Likewise.
(show_stop_on_solib_events): Likewise.
(stepping_past_nonsteppable_watchpoint): Likewise.
(displaced_step_in_progress_any_inferior): Likewise.
(displaced_step_in_progress_thread): Likewise.
(keep_going_stepped_thread): Likewise.
(thread_still_needs_step_over): Likewise.
(start_step_over): Likewise.
(do_target_resume): Likewise.
(resume_1): Likewise.
(clear_proceed_status): Likewise.
(thread_still_needs_step_over_bp): Likewise.
(proceed): Likewise.
(switch_back_to_stepped_thread): Likewise.
(adjust_pc_after_break): Likewise.
(stepped_in_from): Likewise.
(handle_stop_requested): Likewise.
(handle_syscall_event): Likewise.
(handle_no_resumed): Likewise.
(handle_inferior_event): Likewise.
(finish_step_over): Likewise.
(handle_signal_stop): Likewise.
(process_event_stop_test): Likewise.

Change-Id: I897527c4a3da5e647f9d97f7d4477649985b8b77

3 years agogdb: fix comment of get_displaced_stepping_state
Simon Marchi [Tue, 20 Oct 2020 20:10:42 +0000 (16:10 -0400)] 
gdb: fix comment of get_displaced_stepping_state

The comment mentions PID instead of INF, fix that.

gdb/ChangeLog:

* infrun.c (get_displaced_stepping_state): Fix comment.

Change-Id: Id9554807c50792db1fcdb7c14590397d1fa6f8f7

3 years agoFix undefined behavior in gdbserver
Tom Tromey [Tue, 20 Oct 2020 16:28:58 +0000 (10:28 -0600)] 
Fix undefined behavior in gdbserver

PR gdb/26742 points out some undefined behavior in gdbserver.  The bug
is that remove_thread does:

  free_one_thread (thread);
  if (current_thread == thread)
    current_thread = NULL;

However, the equality check is undefined, because "thread" has already
been freed.

This patch fixes the bug by moving the check earlier.

Tested on x86-64 Fedora 32.

2020-10-20  Tom Tromey  <tromey@adacore.com>

PR gdb/26742:
* inferiors.cc (remove_thread): Clear current_thread before
freeing the thread.

3 years agoFix help string of alias command
Andreas Schwab [Mon, 19 Oct 2020 18:55:06 +0000 (20:55 +0200)] 
Fix help string of alias command

* cli/cli-cmds.c (_initialize_cli_cmds): Fix alias command help.

3 years ago[gdb/testsuite] Remove superfluous marker in pr13961.S
Tom de Vries [Tue, 20 Oct 2020 08:20:25 +0000 (10:20 +0200)] 
[gdb/testsuite] Remove superfluous marker in pr13961.S

When looking at readelf output for test-case gdb.dwarf2/pr13961.exp, we have:
...
$ readelf -wi ./outputs/gdb.dwarf2/pr13961/pr13961
   ...
 <0><14c>: Abbrev Number: 0
readelf: Warning: Bogus end-of-siblings marker detected at offset 14c in \
  .debug_info section
...

Fix this by removing the superfluous end-of-siblings marker.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-20  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/pr13961.S: Remove superfluous end-of-siblings marker.

3 years ago[gdb/testsuite] Use main.c in gdb.dwarf2
Tom de Vries [Tue, 20 Oct 2020 08:20:25 +0000 (10:20 +0200)] 
[gdb/testsuite] Use main.c in gdb.dwarf2

Eliminate copies of main.c in gdb.dwarf2.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-20  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/arr-stride.c: Remove.
* gdb.dwarf2/arr-stride.exp: Use main.c.
* gdb.dwarf2/arr-subrange.c: Remove.
* gdb.dwarf2/arr-subrange.exp: Use main.c.
* gdb.dwarf2/bad-regnum.c: Remove.
* gdb.dwarf2/bad-regnum.exp: Use main.c.
* gdb.dwarf2/corrupt.c: Remove.
* gdb.dwarf2/corrupt.exp: Use main.c.
* gdb.dwarf2/dw2-bad-elf.c: Remove.
* gdb.dwarf2/dw2-bad-elf.exp: Use main.c.
* gdb.dwarf2/dw2-icycle.c: Remove.
* gdb.dwarf2/dw2-icycle.exp: Use main.c.
* gdb.dwarf2/formdata16.c: Remove.
* gdb.dwarf2/formdata16.exp: Use main.c.
* gdb.dwarf2/implptrconst.c: Remove.
* gdb.dwarf2/implptrconst.exp: Use main.c.
* gdb.dwarf2/info-locals-optimized-out.c: Remove.
* gdb.dwarf2/info-locals-optimized-out.exp: Use main.c.
* gdb.dwarf2/opaque-type-lookup.c: Remove.
* gdb.dwarf2/opaque-type-lookup.exp: Use main.c.

3 years ago[gdb/testsuite] Clean up redundant info in gdb.dwarf2
Tom de Vries [Tue, 20 Oct 2020 08:20:24 +0000 (10:20 +0200)] 
[gdb/testsuite] Clean up redundant info in gdb.dwarf2

In gdb.dwarf2/ada-valprint-error.exp we find:
...
    untested ${testfile}.exp
...
such that we have:
...
UNTESTED: gdb.dwarf2/ada-valprint-error.exp: ada-valprint-error.exp
...

Fix this and a likewise unsupported message in
gdb.dwarf2/dw2-dir-file-name.exp.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-20  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/ada-valprint-error.exp: Remove redundant mention of .exp
file.
* gdb.dwarf2/dw2-dir-file-name.exp: Same.

3 years ago[gdb/testsuite] Use $gdb_test_file_name in gdb.dwarf2
Tom de Vries [Tue, 20 Oct 2020 08:20:24 +0000 (10:20 +0200)] 
[gdb/testsuite] Use $gdb_test_file_name in gdb.dwarf2

In f.i. gdb.dwarf2/dw2-line-number-zero.exp we find:
...
    verbose "Skipping dw2-line-number-zero test."
...

Make the skip messages use the gdb_test_file_name variable, to reduce the
amount of changes that needs to be made when coping a test-case.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-20  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/dw2-error.exp: Use $gdb_test_file_name.
* gdb.dwarf2/dw2-line-number-zero.exp: Same.
* gdb.dwarf2/dw2-main-no-line-number.exp: Same.
* gdb.dwarf2/dw2-ranges-base.exp: Same.
* gdb.dwarf2/dw2-ranges.exp: Same.
* gdb.dwarf2/dw2-vendor-extended-opcode.exp: Same.
* gdb.dwarf2/var-access.exp: Same.

3 years agoreadelf.c display_lto_symtab offset outside bounds of constant string
Alan Modra [Tue, 20 Oct 2020 04:29:40 +0000 (14:59 +1030)] 
readelf.c display_lto_symtab offset outside bounds of constant string

Using gcc-10 or current mainline gcc, binutils configured with
--disable-nls results in:

readelf.c: In function 'display_lto_symtab':
readelf.c:12283:26: error: offset '17' outside bounds of constant string [-Werror=array-bounds]
12283 |   SECTION_NAME (section) + strlen (".gnu.lto_.symtab.")) > 0
      |                          ^

Which is actually a bogus warning in this case because we've already
checked the name string for validity, so SECTION_NAME won't ever be
"<none>", "<no-strings>" or "<corrupt>".  This patch fixes the problem
by making SECTION_NAME simply return the string from the string table.
Other places also shouldn't be trying to match any of the error
strings against a section name, so fix them too.

* readelf.c: Delete whitespace at end of line throughout.
(SECTION_NAME, SECTION_NAME_VALID): New.
(SECTION_NAME_PRINT): Rename from SECTION_NAME.  Formatting.
(printable_section_name, dump_relocations): Use SECTION_NAME_PRINT.
(process_section_headers, process_section_groups): Likewise.
(shdr_to_ctf_sect): Likewise.
(find_section, find_section_in_set): Use SECTION_NAME_VALID.
(ia64_process_unwind, hppa_process_unwind): Likewise.
(display_debug_section, initialise_dumps_byname): Likewise.
(process_lto_symbol_tables): Likewise.  Check trailing period of
lto symbol table names.
(display_lto_symtab): Use sizeof instead of strlen.

3 years agobinutils: Add myself as RISC-V co-maintainer.
Nelson Chu [Tue, 20 Oct 2020 04:34:36 +0000 (12:34 +0800)] 
binutils: Add myself as RISC-V co-maintainer.

binutils/
* MAINTAINERS (RISC-V): Add myself as RISC-V co-maintainer.

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Oct 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoDon't erase TUI source window when switching focus
Tom Tromey [Mon, 19 Oct 2020 13:45:05 +0000 (07:45 -0600)] 
Don't erase TUI source window when switching focus

PR tui/26719 points out that switching the focus can erase the TUI
source window.  This is a regression introduced by the patch to switch
the source window to using a pad.

This patch fixes the bug by arranging to call prefresh whenever the
window is refreshed.

2020-10-19  Tom Tromey  <tromey@adacore.com>

PR tui/26719
* tui/tui-winsource.h (struct tui_source_window_base)
<refresh_window>: Rename from refresh_pad.
* tui/tui-winsource.c (tui_source_window_base::refresh_window):
Rename from refresh_pad.
(tui_source_window_base::show_source_content)
(tui_source_window_base::do_scroll_horizontal): Update.

gdb/testsuite/ChangeLog
2020-10-19  Tom Tromey  <tromey@adacore.com>

PR tui/26719
* gdb.tui/list.exp: Check source window contents after focus
change.

3 years agogdb/thread: fine-tune 'info threads' help text
Tankut Baris Aktemur [Mon, 19 Oct 2020 15:23:26 +0000 (17:23 +0200)] 
gdb/thread: fine-tune 'info threads' help text

The help text of 'info threads' is below:

  (gdb) help info threads
  Display currently known threads.
  Usage: info threads [OPTION]... [ID]...

  Options:
    -gid
      Show global thread IDs.If ID is given, it is a space-separated list of IDs of threads to display.
  Otherwise, all threads are displayed.
  (gdb)

I think the "If ID is given ..." info should have come right below
the the usage line.  This patch reorganizes the text so that we get

  (gdb) help info threads
  Display currently known threads.
  Usage: info threads [OPTION]... [ID]...
  If ID is given, it is a space-separated list of IDs of threads to display.
  Otherwise, all threads are displayed.

  Options:
    -gid
      Show global thread IDs.
  (gdb)

gdb/ChangeLog:
2020-10-19  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* thread.c (_initialize_thread): Fine-tune the help text of
'info threads'.

3 years agogdb/frame: remove an unused type alias
Tankut Baris Aktemur [Mon, 19 Oct 2020 15:17:30 +0000 (17:17 +0200)] 
gdb/frame: remove an unused type alias

Tested by rebuilding.

gdb/ChangeLog:
2020-10-19  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* frame.c: Remove the unused 'uinteger_option_def' type alias.

3 years agogdb: get jiter objfile from a bound minsym
Mihails Strasuns [Wed, 14 Oct 2020 08:44:36 +0000 (10:44 +0200)] 
gdb: get jiter objfile from a bound minsym

This fixes a regression introduced by the following commit:

fe053b9e853 gdb/jit: pass the jiter objfile as an argument to jit_event_handler

In the refactoring `handle_jit_event` function was changed to pass a matching
objfile pointer to the `jit_event_handler` explicitly, rather using internal
storage:

```
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5448,8 +5448,9 @@ handle_jit_event (void)

   frame = get_current_frame ();
   gdbarch = get_frame_arch (frame);
+  objfile *jiter = symbol_objfile (get_frame_function (frame));

-  jit_event_handler (gdbarch);
+  jit_event_handler (gdbarch, jiter);
```

This was needed to add support for multiple jiters.  However it has also
introduced a regression, because `get_frame_function (frame)` here may
return `nullptr`, resulting in a crash.

A more resilient way would be to use an approach mirroring
`jit_breakpoint_re_set` - to find a minimal symbol matching the
breakpoint location and use its object file.  We know that this
breakpoint event comes from a breakpoint set by `jit_breakpoint_re_set`,
thus using the reverse approach should be reliable enough.

gdb/Changelog:
2020-10-14  Mihails Strasuns  <mihails.strasuns@intel.com>

* breakpoint.c (handle_jit_event): Add an argument, change how
`jit_event_handler` is called.

3 years agoReadelf: Add --lto-syms option to display LTO symbol tables.
Nick Clifton [Mon, 19 Oct 2020 14:27:58 +0000 (15:27 +0100)] 
Readelf: Add --lto-syms option to display LTO symbol tables.

* readelf.c (do_lto_syms): New local.
(long_option_values): Add OPTION_LTO_SYMS.
(options): Add --lto-syms.
(usage): Mention the new option.
(parse_args): Parse the new option.
(get_lto_kind): New function.
(get_lto_visibility): New function.
(get_lto_sym_type): New function.
(display_lto_symtab): New function - displays the contents of an
LTo symbol table section.
(process_lto_symbol_tables): New functions.  Calls
dipslay_lto_symtab on any LTO symbol table section.
(process_object_file): Call process_lto_symbol_tables.
* doc/binutils.texi: Document the new option.
* NEWS: Mention the new feature.

3 years agoProvide dummy libraries for alpha-vms
Alan Modra [Sun, 18 Oct 2020 22:19:32 +0000 (08:49 +1030)] 
Provide dummy libraries for alpha-vms

alpha-dec-vms always loads a number of libraries, -limagelib,
-lstarlet, and -lsys$public_vectors.  When running the ld testsuite
without a full cross-build environment, those libraries are missing
and cause fails.  This patch provides dummies, and tidies default.exp
a little.

* testsuite/config/default.exp: Provide dummy libraries for
alpha-dec-vms.
(compiler_supports): New proc.  Use it for compiler tests.
* testsuite/lib/ld-lib.exp (default_ld_assemble): Don't die if
subdir not set.
(run_ld_link_tests): Pass LDFLAGS to ld.
* testsuite/ld-checks/checks.exp (section_check): Likewise.
* testsuite/ld-scripts/assert.exp: Likewise.
* testsuite/ld-scripts/extern.exp: Likewise.
* testsuite/ld-scripts/log2.exp: Likewise.
* testsuite/ld-scripts/map-address.exp: Likewise.
* testsuite/ld-scripts/script.exp: Likewise.
* testsuite/ld-scripts/sizeof.exp: Likewise.

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Oct 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Oct 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoHave partial symbol tables own psymbol vectors
Tom Tromey [Sat, 17 Oct 2020 18:34:53 +0000 (12:34 -0600)] 
Have partial symbol tables own psymbol vectors

Currently pointers to all partial symbols are stored in two vectors;
and then indices into these vectors are stored in each partial_symtab.

This patch changes this so that each partial symtab instead has
vectors of symbols.  add_psymbol_to_list can now be changed into a
method on partial_symtab as well.

My main motivation for doing this is that I am looking into calling
sort_pst_symbols in the background.  However, I haven't actually
implemented this yet.  (Also this may make it more feasible to also
sort the static psymbols, though I haven't tried that either.)

Also, though, this lets us remove the "current_global_psymbols"
vector, because now the callers can simply refer directly to the
psymtab that they are modifying (formerly this was implicit).

The main drawback of this patch is that it increases the size of
partial symtab.

gdb/ChangeLog
2020-10-17  Tom Tromey  <tom@tromey.com>

* xcoffread.c (xcoff_end_psymtab): Use partial_symtab::empty.
(scan_xcoff_symtab): Update.
* psymtab.h (class psymtab_storage) <global_psymbols,
static_psymbols, current_global_psymbols,
current_static_psymbols>: Remove.
* psymtab.c (require_partial_symbols, find_pc_sect_psymbol)
(match_partial_symbol, lookup_partial_symbol): Update.
(print_partial_symbols): Change parameters.
(dump_psymtab, recursively_search_psymtabs)
(psym_fill_psymbol_map, psym_find_compunit_symtab_by_address)
(sort_pst_symbols, partial_symtab::partial_symtab): Update.
(concat): Remove.
(end_psymtab_common): Simplify.
(append_psymbol_to_list): Change parameters.
(partial_symtabs::add_psymbol): Rename from add_psymbol_to_list.
(init_psymbol_list): Simplify.
(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
* psympriv.h (struct partial_symtab) <empty>: New method.
<globals_offset, n_global_syms, statics_offset, n_static_syms>:
Remove.
<global_psymbols, static_psymbols>: New members.
<add_psymbol>: New methods.
(add_psymbol_to_list): Don't declare.
(psymbol_placement): Move earlier.
* mdebugread.c (parse_partial_symbols): Update.
(handle_psymbol_enumerators): Change parameters.
(mdebug_expand_psymtab): Update.
* dwarf2/read.c (process_psymtab_comp_unit_reader)
(add_partial_symbol): Update.
* dwarf2/index-write.c (write_psymbols): Change parameters.
(write_one_signatured_type): Update.
(recursively_count_psymbols): Update.
(recursively_write_psymbols): Update.
(class debug_names) <recursively_write_psymbols>: Update.
<write_psymbols>: Change parameters.
<write_one_signatured_type>: Update.
* dbxread.c (read_dbx_symtab): Update.
(dbx_end_psymtab): Use partial_symtab::empty.
* ctfread.c (struct ctf_context) <pst>: New member.
(create_partial_symtab): Set it.
(ctf_psymtab_type_cb, ctf_psymtab_var_cb): Update.
(scan_partial_symbols): Use the psymtab's context.  Update.

3 years agoMake range types inherit signed-ness from base type
Tom Tromey [Sat, 17 Oct 2020 17:41:59 +0000 (11:41 -0600)] 
Make range types inherit signed-ness from base type

I ran across this comment in valprint.c:

      /* FIXME: create_static_range_type does not set the unsigned bit in a
         range type (I think it probably should copy it from the target
         type), so we won't print values which are too large to
         fit in a signed integer correctly.  */

It seems to me that a range type ought to inherit its signed-ness from
the underlying type, so this patch implements this change, and removes
the comment.  (It was also copied into m2-valprint.c.)

I also remove the comment about handling ranges of enums, because I
think that comment is incorrect.

gdb/ChangeLog
2020-10-17  Tom Tromey  <tom@tromey.com>

* valprint.c (generic_value_print): Remove comment.
* m2-valprint.c (m2_value_print_inner): Remove comment.
* gdbtypes.c (create_range_type): Set TYPE_UNSIGNED from base
type.

3 years agogas: Add a -gdwarf-5 debug_line test with .s file
H.J. Lu [Sat, 17 Oct 2020 12:52:13 +0000 (05:52 -0700)] 
gas: Add a -gdwarf-5 debug_line test with .s file

PR gas/25878
PR gas/26740
* testsuite/gas/i386/dwarf5-line-4.d: New file.
* testsuite/gas/i386/dwarf5-line-4.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf5-line-4.

3 years agogas: Replace dwarf5-line-2.S with dwarf5-line-3.S
H.J. Lu [Sat, 17 Oct 2020 12:35:23 +0000 (05:35 -0700)] 
gas: Replace dwarf5-line-2.S with dwarf5-line-3.S

PR gas/25878
PR gas/26740
* testsuite/gas/i386/dwarf5-line-3.s: Replace dwarf5-line-2.S
with dwarf5-line-3.S.
* testsuite/gas/i386/dwarf5-line-3.d: Updated.

3 years agogas: Always use as_where for preprocessed assembly codes
H.J. Lu [Sat, 17 Oct 2020 11:24:22 +0000 (04:24 -0700)] 
gas: Always use as_where for preprocessed assembly codes

Always clear the slot 1 if it was assigned to the input file before the
first .file <NUMBER> directive has been seen.  Always use as_where to
generate the correct debug infor for preprocessed assembly codes.

PR gas/25878
PR gas/26740
* dwarf2dbg.c (allocate_filename_to_slot): Don't reuse the slot 1
here.
(dwarf2_where): Restore as_where.
(dwarf2_directive_filename): Clear the slot 1 if it was assigned
to the input file.
* testsuite/gas/i386/dwarf5-line-2.d: New file.
* testsuite/gas/i386/dwarf5-line-2.s: Likewise.
* testsuite/gas/i386/dwarf5-line-3.d: Likewise.
* testsuite/gas/i386/dwarf5-line-3.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf5-line-2 and
dwarf5-line-3.

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Oct 2020 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years ago[gdb/symtab] Handle setting line bp without debug line info
Tom de Vries [Fri, 16 Oct 2020 22:10:31 +0000 (00:10 +0200)] 
[gdb/symtab] Handle setting line bp without debug line info

When setting a breakpoint on a line in an executable without debug line info,
we run into an abort.

The problem occurs when calling set_default_source_symtab_and_line, which
calls select_source_symtab (0), which is where we try to find the line number
for main:
...
  /* Make the default place to list be the function `main'
     if one exists.  */
  block_symbol bsym = lookup_symbol (main_name (), 0, VAR_DOMAIN, 0);
  if (bsym.symbol != nullptr && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
    {
      symtab_and_line sal = find_function_start_sal (bsym.symbol, true);
      loc->set (sal.symtab, std::max (sal.line - (lines_to_list - 1), 1));
      return;
    }
...

However, due to the missing debug line info, find_function_start_sal returns a
sal with sal.symtab == 0:
...
(gdb) p /x sal
$2 = {pspace = 0x1a4a7f0, symtab = 0x0, symbol = 0x1d9e480, section = 0x1d5b398,
  msymbol = 0x0, line = 0x0, pc = 0x4004ab, end = 0x0, explicit_pc = 0x0,
  explicit_line = 0x0, is_stmt = 0x0, prob = 0x0, objfile = 0x0}
...
which eventually causes an segfault in create_sals_line_offset because
self->default_symtab->filename is accessed while self->default_symtab == NULL.

Fix this by handling sal.symtab == NULL in select_source_symtab.

Tested on x86_64-linux.

gdb/ChangeLog:

2020-10-17  Tom de Vries  <tdevries@suse.de>

PR symtab/26317
* source.c (select_source_symtab): Handling sal.symtab == NULL for
symbol main.

gdb/testsuite/ChangeLog:

2020-10-17  Tom de Vries  <tdevries@suse.de>

PR symtab/26317
* gdb.dwarf2/dw2-main-no-line-number.exp: New file.

3 years ago[gdb/testsuite] Remove hardcoded filenames in gdb.dwarf2/*.exp
Tom de Vries [Fri, 16 Oct 2020 22:10:31 +0000 (00:10 +0200)] 
[gdb/testsuite] Remove hardcoded filenames in gdb.dwarf2/*.exp

There's a common occurance in dwarf assembly test-cases, where a file test.exp
contains:
...
standard_testfile test.c test-dw.S
...

The "test.c" arg can be abbreviated to ".c".

Make standard_testfile treat args with "-" prefix the same as with "." prefix,
such that we can write:
...
standard_testfile .c -dw.S
...
and apply this in gdb.dwarf2/*.exp.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-17  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (standard_testfile): Also treat args starting with '-'
as suffix.
* gdb.dwarf2/atomic.c: Rename to ...
* gdb.dwarf2/atomic-type.c: ... this.
* gdb.dwarf2/dw2-ranges2.c: Rename to ...
* gdb.dwarf2/dw2-ranges-2.c: ... this.
* gdb.dwarf2/dw2-ranges3.c: Rename to ...
* gdb.dwarf2/dw2-ranges-3.c: ... this.
* gdb.dwarf2/fission-mix2.c: Rename to ...
* gdb.dwarf2/fission-mix-2.c: ... this.
* gdb.dwarf2/ada-linkage-name.exp: Use more suffix args for
standard_testfile.
* gdb.dwarf2/ada-valprint-error.exp: Same.
* gdb.dwarf2/arr-stride.exp: Same.
* gdb.dwarf2/arr-subrange.exp: Same.
* gdb.dwarf2/atomic-type.exp: Same.
* gdb.dwarf2/bad-regnum.exp: Same.
* gdb.dwarf2/break-inline-psymtab.exp: Same.
* gdb.dwarf2/clang-debug-names-2.exp: Same.
* gdb.dwarf2/clang-debug-names.exp: Same.
* gdb.dwarf2/comp-unit-lang.exp: Same.
* gdb.dwarf2/corrupt.exp: Same.
* gdb.dwarf2/count.exp: Same.
* gdb.dwarf2/cpp-linkage-name.exp: Same.
* gdb.dwarf2/data-loc.exp: Same.
* gdb.dwarf2/dw2-align.exp: Same.
* gdb.dwarf2/dw2-bad-elf.exp: Same.
* gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Same.
* gdb.dwarf2/dw2-bad-unresolved.exp: Same.
* gdb.dwarf2/dw2-case-insensitive.exp: Same.
* gdb.dwarf2/dw2-cp-infcall-ref-static.exp: Same.
* gdb.dwarf2/dw2-ifort-parameter.exp: Same.
* gdb.dwarf2/dw2-inline-many-frames.exp: Same.
* gdb.dwarf2/dw2-inline-param.exp: Same.
* gdb.dwarf2/dw2-inline-small-func.exp: Same.
* gdb.dwarf2/dw2-inline-stepping.exp: Same.
* gdb.dwarf2/dw2-is-stmt-2.exp: Same.
* gdb.dwarf2/dw2-is-stmt.exp: Same.
* gdb.dwarf2/dw2-line-number-zero.exp: Same.
* gdb.dwarf2/dw2-namespaceless-anonymous.exp: Same.
* gdb.dwarf2/dw2-opt-structptr.exp: Same.
* gdb.dwarf2/dw2-param-error.exp: Same.
* gdb.dwarf2/dw2-ranges-base.exp: Same.
* gdb.dwarf2/dw2-ranges.exp: Same.
* gdb.dwarf2/dw2-unusual-field-names.exp: Same.
* gdb.dwarf2/dw2-vendor-extended-opcode.exp: Same.
* gdb.dwarf2/dw4-sig-types.exp: Same.
* gdb.dwarf2/dynarr-ptr.exp: Same.
* gdb.dwarf2/enum-type.exp: Same.
* gdb.dwarf2/fission-mix.exp: Same.
* gdb.dwarf2/formdata16.exp: Same.
* gdb.dwarf2/implptrconst.exp: Same.
* gdb.dwarf2/implptrpiece.exp: Same.
* gdb.dwarf2/info-locals-optimized-out.exp: Same.
* gdb.dwarf2/main-subprogram.exp: Same.
* gdb.dwarf2/method-ptr.exp: Same.
* gdb.dwarf2/missing-sig-type.exp: Same.
* gdb.dwarf2/nonvar-access.exp: Same.
* gdb.dwarf2/opaque-type-lookup.exp: Same.
* gdb.dwarf2/shortpiece.exp: Same.
* gdb.dwarf2/staticvirtual.exp: Same.
* gdb.dwarf2/subrange.exp: Same.
* gdb.dwarf2/symtab-producer.exp: Same.
* gdb.dwarf2/typedef-void-finish.exp: Same.
* gdb.dwarf2/var-access.exp: Same.
* gdb.dwarf2/variant.exp: Same.
* gdb.dwarf2/void-type.exp: Same.
* gdb.dwarf2/dw2-ranges-psym.exp: Same.  Use main.c instead of
dw2-ranges-main.c.
* gdb.dwarf2/dw2-ranges-main.c: Remove.

3 years agold: Allow symbols from PROVIDE to be use in MEMORY regions
Andrew Burgess [Wed, 7 Oct 2020 13:27:56 +0000 (14:27 +0100)] 
ld: Allow symbols from PROVIDE to be use in MEMORY regions

I wanted to write a linker script like this:

  PROVIDE(mem_origin = 0x1000);
  PROVIDE(mem_length = 0x1000);

  MEMORY
  {
    REGION : ORIGIN = mem_origin, LENGTH = mem_length
  }

  ....

Then when I link using this script I can optionally supply:

  --defsym=mem_origin=..... --defsym=mem_length=....

to override the defaults.

And though passing `--defsym' does work, if I remove the use of
`--defsym' and just rely on the defaults I get an error:

  ld-new: invalid origin for memory region REGION

Interestingly, if I make the above error non-fatal and dump a linker
map file I see that (a) REGION has origin 0x0, and length 0xffff...,
and (b) the symbol from the PROVIDE is provided.

An examination of ldlang.c:lang_process shows us what the issue is,
the origin and length of all memory regions are set as a result of a
single call to lang_do_memory_regions, this call is done after calling
open_input_bfds.

During the open_input_bfds call provide statements can be converted to
provided statements if we know that the assigned symbol is needed, but
for symbols that are only used in the memory regions we are unaware
that we need these symbols.

What I propose in this patch is to make two calls to
lang_do_memory_regions, in the first call we process the expressions
for the origin and length fields of each region, however, errors,
especially undefined symbols, will be ignored.  The origin and length
values are not updated.  However, by evaluating the expressions any
symbols we need will be added to the symbol table.

Now when we call open_input_bfds, when we process the provide
statements, we will see that the assigned symbol is needed add its new
value to the symbol table.

Finally we reach the original call to lang_do_memory_regions, in
this (now second) call we again process the expressions, and this time
update the origin and length values.  Any errors encountered now are
reported to the user.

ld/ChangeLog:

* ldlang.c (lang_process): Add extra call to
lang_do_memory_regions, and pass parameter.
(lang_do_memory_regions): Add parameter, only define origin and
length when requested.  Reindent.
* testsuite/ld-scripts/provide-10.d: New file.
* testsuite/ld-scripts/provide-10.map: New file.
* testsuite/ld-scripts/provide-11.d: New file.
* testsuite/ld-scripts/provide-11.map: New file.
* testsuite/ld-scripts/provide-12.d: New file.
* testsuite/ld-scripts/provide-12.map: New file.
* testsuite/ld-scripts/provide-9.d: New file.
* testsuite/ld-scripts/provide-9.map: New file.
* testsuite/ld-scripts/provide-9.t: New file.

3 years agold: More documentation for --defsym
Andrew Burgess [Tue, 6 Oct 2020 14:30:15 +0000 (15:30 +0100)] 
ld: More documentation for --defsym

The ordering of command line options --defsym and -T is important,
however, the description of --defsym in the manual doesn't mention
this.

This commit adds more text to the description of --defsym to try and
explain this ordering requirement.

ld/ChangeLog:

* ld.texi (Options): Extend the description of --defsym.