deliverable/binutils-gdb.git
4 years agox86-64: fix handling of PUSH/POP of segment register
Jan Beulich [Fri, 20 Sep 2019 08:18:15 +0000 (10:18 +0200)] 
x86-64: fix handling of PUSH/POP of segment register

Commit 21df382b91 ("x86: fold SReg{2,3}") went too far: Folding 64-bit
PUSH/POP templates into non-64-bit ones isn't correct, due to the
different operand widths, and hence suffixes permitted. Restore the
separate templates.

Add tests of PUSH/POP with q suffix and %fs/%gs operands to the
testsuite. While doing so also add PUSHF/POPF ones _without_ suffix.

4 years ago[GOLD] Fix spurious "plugin needed to handle lto object" warnings
Alan Modra [Fri, 20 Sep 2019 05:22:54 +0000 (14:52 +0930)] 
[GOLD] Fix spurious "plugin needed to handle lto object" warnings

lto_slim_object_ was unitialized.  I also thought it worth adding
a sanity check on the .gnu.lto_.lto.* section size, and made some
other tidies.

PR 24768
* layout.cc (Layout::Layout): Init lto_slim_object_.
* object.cc (Sized_relobj_file::do_layout): Wrap overlong line.
Don't use C cast.  Validate section size.  Don't copy contents.

4 years agoPowerPC64, error on unsupported dynamic relocation
Alan Modra [Fri, 20 Sep 2019 02:51:50 +0000 (12:21 +0930)] 
PowerPC64, error on unsupported dynamic relocation

This patch corrects the set of dynamic relocations recognised by gold
as supported by glibc, and teaches ld.bfd to report an error similar
to the gold error.  Note that ld --noinhibit-exec can be used to
produce an output, supporting older ld with newer glibc if the set of
supported glibc dynamic relocations changes.

bfd/
* elf64-ppc.c (ppc64_glibc_dynamic_reloc): New function.
(ppc64_elf_relocate_section): Error if emitting unsupported
dynamic relocations.
gold/
* powerpc.cc (Target_powerpc::Scan::check_non_pic): Move REL24
to 32-bit supported.

4 years agoMove declaration of overload_resolution to value.h
Christian Biesinger [Thu, 19 Sep 2019 04:40:15 +0000 (13:40 +0900)] 
Move declaration of overload_resolution to value.h

The variable is defined in valops.c and has an extern decl in
eval.c; move it to the header file.

gdb/ChangeLog:

2019-09-19  Christian Biesinger  <cbiesinger@google.com>

* eval.c: Move declaration of overload_resolution to...
* value.h: ...here.

4 years agoMove arm_apcs_32 extern declaration to header
Christian Biesinger [Thu, 19 Sep 2019 04:33:35 +0000 (13:33 +0900)] 
Move arm_apcs_32 extern declaration to header

Instead of having several extern declarations for arm_apcs_32
in a few .c files, declare it in arm-tdep.h. This file is already
included from these .c files.

gdb/ChangeLog:

2019-09-19  Christian Biesinger  <cbiesinger@google.com>

* arm-linux-nat.c: Remove extern declaration for arm_apcs_32.
* arm-linux-tdep.c: Likewise.
* arm-nbsd-nat.c: Likewise.
* arm-tdep.h: Declare arm_apcs_32.

4 years agoDeclare dwarf_always_disassemble in dwarf2read.h
Christian Biesinger [Thu, 19 Sep 2019 04:26:55 +0000 (13:26 +0900)] 
Declare dwarf_always_disassemble in dwarf2read.h

And remove the declaration from dwarf2loc.c, for better typesafety.

gdb/ChangeLog:

2019-09-19  Christian Biesinger  <cbiesinger@google.com>

* dwarf2loc.c: Remove extern declaration of dwarf_always_disassemble.
* dwarf2read.h: Declare dwarf_always_disassemble.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Sep 2019 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb/testsuite] Don't use FOOBAR pattern in gdb_test
Tom de Vries [Thu, 19 Sep 2019 17:54:15 +0000 (19:54 +0200)] 
[gdb/testsuite] Don't use FOOBAR pattern in gdb_test

If gdb_test is used with fewer than five arguments, then the question_string
defaults to "^FOOBAR$":
...
    if [llength $args]==5 {
       set question_string [lindex $args 3]
       set response_string [lindex $args 4]
    } else {
       set question_string "^FOOBAR$"
    }
...

This can however match "FOOBAR", so perhaps "\$FOOBAR^" would have been a
better choice.

Eliminate the FOOBAR pattern from gdb_test by instead of defining a default
regexp, conditionally appending the regexp matching to a user_code variable.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (gdb_test): Eliminate "^FOOBAR$" pattern.

4 years ago[gdb] Catch exception when constructing the highlighter
Tom de Vries [Thu, 19 Sep 2019 17:49:39 +0000 (19:49 +0200)] 
[gdb] Catch exception when constructing the highlighter

Currently in source_cache::ensure we catch the exception that triggers when
highlighter->highlight is called:
...
         try
           {
             std::istringstream input (contents);
             std::ostringstream output;
             highlighter->highlight (input, output, lang_name, fullname);
...
and the file used earlier in the construction of the highlighter:
...
             highlighter = new srchilite::SourceHighlight ("esc.outlang");
...
is missing.

The fact that this exception triggers when highlighter->highlight is called is
an implementation artefact of libsource-highlight.so though, and this could be
different for older or newer versions.

Make things more robust by also catching exceptions thrown during construction
of the highlighter.  This makes the handling on master equivalent with what
has been committed for 8.3.1.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

PR gdb/25009
* source-cache.c (source_cache::ensure): Catch exception thrown during
construction of the highlighter.

4 years ago[gas][news] NEWS (2.33) note new SVE2 and TME instructions for AArch64
Matthew Malcomson [Thu, 19 Sep 2019 13:34:14 +0000 (14:34 +0100)] 
[gas][news] NEWS (2.33) note new SVE2 and TME instructions for AArch64

These NEWS entries had been missed when the instructions were added.

gas/ChangeLog:

2019-09-19  Matthew Malcomson  <matthew.malcomson@arm.com>

* NEWS: Add SVE2 and TME entries.

4 years agoAArch64: Fix objdump tests
Tamar Christina [Thu, 19 Sep 2019 12:15:02 +0000 (13:15 +0100)] 
AArch64: Fix objdump tests

The newly added objdump -S tests check for source line mapping of a static
variable.  But the test doesn't dump any data sections so this should never
pass.

This changes the test to dump all sections so the source mapping can be found.

binutils/ChangeLog:

* testsuite/binutils-all/objdump.exp (objdump -S): Update testcases.

4 years agobfd_section_* macros
Alan Modra [Mon, 16 Sep 2019 10:55:17 +0000 (20:25 +0930)] 
bfd_section_* macros

This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions.  The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections.  Those sections shouldn't be modified
anyway.

The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma.  I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section.  This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.

bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Sep 2019 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb/testsuite] Fix gdb_target_cmd
Tom de Vries [Wed, 18 Sep 2019 23:14:19 +0000 (01:14 +0200)] 
[gdb/testsuite] Fix gdb_target_cmd

In commit 81dc3ab594 "[gdb/testsuite] Handle unreachable network in
server-connect.exp" a regression was introduced in gdb_target_cmd, causing
ERRORs like this:
...
ERROR: tcl error sourcing src/gdb/testsuite/gdb.server/abspath.exp.
ERROR: wrong # args: should be "gdb_target_cmd {$args}"
    while executing
"gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport"
...

Fix the argument passing in gdb_target_cmd.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

* lib/gdbserver-support.exp (gdb_target_cmd): Fix argument passing.

4 years ago[gdb/testsuite] Handle unreachable network in server-connect.exp
Tom de Vries [Wed, 18 Sep 2019 22:23:54 +0000 (00:23 +0200)] 
[gdb/testsuite] Handle unreachable network in server-connect.exp

When running gdb.server/server-connect.exp I run into:
...
FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
FAIL: gdb.server/server-connect.exp: tcp6-with-brackets: connect to gdbserver \
  using tcp6:[::1]
FAIL: gdb.server/server-connect.exp: udp6: connect to gdbserver using udp6:::1
FAIL: gdb.server/server-connect.exp: udp6-with-brackets: connect to gdbserver \
  using udp6:[::1]
...

The FAIL is caused by the fact that the ipv6 loopback address is not available:
...
PASS: gdb.server/server-connect.exp: tcp6: start gdbserver
target remote tcp6:::1:2347^M
A program is being debugged already.  Kill it? (y or n) y^M
tcp6:::1:2347: Network is unreachable.^M
(gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
...
This should be marked UNSUPPORTED rather than FAIL.

Furthermore, the test-case takes about 4 minutes, because the 'Network is
unreachable' response is not explicitly handled in gdb_target_cmd, so instead
it runs into the timeout case.

Fix this by handling the 'Network is unreachable' response as UNSUPPORTED.
This reduces testing time from 4 minutes to about 2 seconds.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

* lib/gdbserver-support.exp (gdb_target_cmd_ext): Return 2 (meaning
UNSUPPORTED) for 'Network is unreachable' message.  Factor out of ...
(gdb_target_cmd): ... here.
* gdb.server/server-connect.exp: Use gdb_target_cmd_ext, handle return
value 2.

4 years agoUpdate ChangeLog entry of commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0...
Joel Brobecker [Wed, 18 Sep 2019 21:42:24 +0000 (14:42 -0700)] 
Update ChangeLog entry of commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0...

... to include PR breakpoints/24541 (for documentation purposes).

For the reader's convenience, the commit in question was the following:

    commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0
    Author: Sergio Durigan Junior <sergiodj@redhat.com>
    Date:   Thu May 16 16:23:24 2019 -0400
    Subject: Make stap-probe.c:stap_parse_register_operand's "regname"
       an std::string

4 years agoGive a name to the TUI SingleKey keymap
Tom Tromey [Tue, 10 Sep 2019 23:25:35 +0000 (17:25 -0600)] 
Give a name to the TUI SingleKey keymap

Readline 8.0 has a feature that lets an application name a keymap.
This in turn makes it simpler for users to bind keys in keymaps in
their .inputrc.

This patch gives a name to the TUI SingleKey keymap, so that
additional bindings can be made there.  For example:

    $if gdb
    set keymap SingleKey
    "X": "echo hello\\n\n"
    $endif

The call to rl_initialize, in tui_initialize_readline, had to be
removed so that .inputrc was not read too early.  Note that Readline
explicitly documents that this call is not needed.

gdb/ChangeLog
2019-09-18  Tom Tromey  <tom@tromey.com>

* NEWS: Add entry.
* tui/tui.c (tui_initialize_readline): Set name of keymap.  Do not
call rl_initialize.
(tui_enable): Do not call rl_initialize.

gdb/doc/ChangeLog
2019-09-18  Tom Tromey  <tom@tromey.com>

* gdb.texinfo (Editing): Document readline application name.
(TUI Single Key Mode): Document TUI SingleKey keymap name.

4 years agogdb: Fix native build on Linux/Alpha.
Christian Groessler [Wed, 11 Sep 2019 22:19:45 +0000 (22:19 +0000)] 
gdb: Fix native build on Linux/Alpha.

Fixes:

  CXX    alpha-linux-nat.o
alpha-linux-nat.c: In member function 'virtual CORE_ADDR alpha_linux_nat_target::register_u_offset(gdbarch*, int, int)':
alpha-linux-nat.c:93:16: error: 'gdbarch_pc_regnum' was not declared in this scope
   if (regno == gdbarch_pc_regnum (gdbarch))
                ^~~~~~~~~~~~~~~~~
alpha-linux-nat.c:93:16: note: suggested alternative: 'gdbarch_info'
   if (regno == gdbarch_pc_regnum (gdbarch))
                ^~~~~~~~~~~~~~~~~
                gdbarch_info
alpha-linux-nat.c:97:15: error: 'gdbarch_fp0_regnum' was not declared in this scope
   if (regno < gdbarch_fp0_regnum (gdbarch))
               ^~~~~~~~~~~~~~~~~~
alpha-linux-nat.c:97:15: note: suggested alternative: 'gdbarch_info'
   if (regno < gdbarch_fp0_regnum (gdbarch))
               ^~~~~~~~~~~~~~~~~~
               gdbarch_info
make[2]: *** [Makefile:1638: alpha-linux-nat.o] Error 1
make[2]: Leaving directory '/home/chris/tmp/binutils-gdb/gdb'

2019-09-12  Christian Groessler  <chris@groessler.org>

       * alpha-linux-nat.c: Include gdbarch.h.

4 years agogdb: remove local extern declaration of cli_styling
Simon Marchi [Wed, 18 Sep 2019 17:33:33 +0000 (13:33 -0400)] 
gdb: remove local extern declaration of cli_styling

Following the int -> bool conversion of boolean options (commit
491144b5e21b ("Change boolean options to bool instead of int")), I see
this ASAN error:

  ==357543==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55555b25d440 at pc 0x5555583ce9e1 bp 0x7fffffffd390 sp 0x7fffffffd380
  READ of size 4 at 0x55555b25d440 thread T0
      #0 0x5555583ce9e0 in term_cli_styling /home/simark/src/binutils-gdb/gdb/ui-file.c:111
      #1 0x5555583cf8b0 in stdio_file::can_emit_style_escape() /home/simark/src/binutils-gdb/gdb/ui-file.c:308
      #2 0x5555584450d2 in set_output_style /home/simark/src/binutils-gdb/gdb/utils.c:1442
      #3 0x5555584491af in fprintf_styled(ui_file*, ui_file_style const&, char const*, ...) /home/simark/src/binutils-gdb/gdb/utils.c:2143
      #4 0x5555582fa13c in print_gdb_version(ui_file*, bool) /home/simark/src/binutils-gdb/gdb/top.c:1339
      #5 0x555557b723ab in captured_main_1 /home/simark/src/binutils-gdb/gdb/main.c:981
      #6 0x555557b7353b in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1172
      #7 0x555557b735d0 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1197
      #8 0x55555700a53d in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
      #9 0x7ffff64c9ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
      #10 0x55555700a30d in _start (/home/simark/build/binutils-gdb/gdb/gdb+0x1ab630d)

  0x55555b25d441 is located 0 bytes to the right of global variable 'cli_styling' defined in '/home/simark/src/binutils-gdb/gdb/cli/cli-style.c:31:6' (0x55555b25d440) of size 1

The reason of this is that we have this declaration of cli_styling in cli/cli-style.h:

  extern bool cli_styling;

but ui-file.c uses its  own local declaration:

  extern int cli_styling;

Because of that, the code in ui-file.c thinks the variable is 4 bytes
long, when it is actually 1 byte long, so the generated code reads past
the variable.

Fix it by removing the declaration and making ui-file.c include
cli/cli-style.h.

gdb/ChangeLog:

* ui-file.c: Include cli/cli-style.h.
(term_cli_styling): Remove cli_styling declaration.

4 years agogdb/testsuite: Avoid directory names in test names
Andrew Burgess [Wed, 18 Sep 2019 16:27:11 +0000 (12:27 -0400)] 
gdb/testsuite: Avoid directory names in test names

Give a test an actual name in order to avoid having a directory name
in the .sum file.

gdb/testsuite/ChangeLog:

* gdb.base/source-dir.exp: Avoid having directory names in test
names.

4 years agobfd_asymbol_* macros
Alan Modra [Wed, 18 Sep 2019 06:55:19 +0000 (16:25 +0930)] 
bfd_asymbol_* macros

The main point of this patch is to give bfd_get_section a better name,
bfd_asymbol_section.

bfd/
* bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.
(bfd_get_output_section): Delete.
(bfd_asymbol_base): Delete.
(bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy.
(bfd_set_asymbol_name): New macro.
* bfd-in2.h: Regenerate.
* aout-cris.c: Update throughout to use bfd_asymbol_section.
* aoutx.h: Likewise.
* cofflink.c: Likewise.
* dwarf2.c: Likewise.
* ecoff.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-mips.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elfn32-mips.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfxx-mips.c: Likewise.
* linker.c: Likewise.
* pdp11.c: Likewise.
* elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section.
binutils/
* nm.c: Update bfd_get_section to bfd_asymbol_section throughout.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* rdcoff.c: Likewise.
* objcopy.c (create_new_symbol): Use bfd_set_asymbol_name.
(filter_symbols): Likewise.
gas/
* symbols.c (S_IS_LOCAL): Update bfd_get_section to
bfd_asymbol_section.
gdb/
* arm-tdep.c (arm_record_special_symbol): Update bfd_get_section
to bfd_asymbol_section.
ld/
* ldcref.c (check_reloc_refs): Update bfd_get_section to
bfd_asymbol_section.

4 years agobinutils: doc: make `make clean` clean more things
Simon Marchi [Wed, 18 Sep 2019 13:14:59 +0000 (09:14 -0400)] 
binutils: doc: make `make clean` clean more things

There is a bunch of things left over after a `make clean` in the doc
directory.  This patch changes the Makefile so that everything built by
make is cleaned:

- man pages (the man_MANS variable)
- cxxfilt.man
- binutils.info

I am not sure why the last one was in MAINTAINERCLEANFILES.  It's
generated from binutils.texi using makeinfo, and it's not particularly
long to build, so I don't see why it shouldn't be cleaned like the other
files.

Note: with my automake 1,15.1 (built from source), I get a spurious diff
in Makefile.in, where the

  runstatedir = @runstatedir@

line gets removed.  I am not sure why, but I haven't included it.

binutils/ChangeLog:

* doc/Makefile.am (MOSTLYCLEANFILES): Clean all man pages,
cxxfilt.man and binutils.info.
(MAINTAINERCLEANFILES): Remove.
* doc/Makefile.in: Re-generate.

4 years agobinutils: doc: remove binutils_TEXINFOS usages
Simon Marchi [Wed, 18 Sep 2019 13:11:13 +0000 (09:11 -0400)] 
binutils: doc: remove binutils_TEXINFOS usages

This variable doesn't exist (it evaluates to nothing).

It was introduced in

    commit 42ecbf5edab08ee88b37d9fbd8542f5f25ce51ae
    Author: Daniel Jacobowitz <drow@false.org>
    Date:   Sun May 15 18:19:45 2005 +0000

And removed in

    commit c428fa83c21769fafedcebb7b4a381c6ca24f998
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Thu Mar 15 14:17:20 2007 +0000

Note: with my automake 1,15.1 (built from source), I get a spurious diff
in Makefile.in, where the

  runstatedir = @runstatedir@

line gets removed.  I am not sure why, but I haven't included it.

binutils/ChangeLog:

* doc/Makefile.am: Remove references to binutils_TEXINFOS.
* doc/Makefile.in: Re-generate.

4 years agobinutils: doc: remove stale things from Makefile
Simon Marchi [Wed, 18 Sep 2019 13:10:59 +0000 (09:10 -0400)] 
binutils: doc: remove stale things from Makefile

The `install-data-local: install-info` part: the comment refers to when
the Makefile had the cygnus option.  It no longer uses that, so the info
file should get installed without that rule.  I verified that `make
install` still installed $(prefix)/share/info/binutils.info.

The `DISTCLEANFILES` part: the comment talks about Automake 1.9, we are
using 1.15.1, which doesn't appear to have this problem.  binutils.info
is built fine without this snippet.

Note: with my automake 1,15.1 (built from source), I get a spurious diff
in Makefile.in, where the

  runstatedir = @runstatedir@

line gets removed.  I am not sure why, but I haven't included it.

binutils/ChangeLog:

* doc/Makefile.am (install-data-loca): Remove target.
(DISTCLEANFILES): Remove variable.
* doc/Makefile.in: Re-generate.

4 years agoRe-generate many configure and Makefile.in files
Simon Marchi [Wed, 18 Sep 2019 13:07:44 +0000 (09:07 -0400)] 
Re-generate many configure and Makefile.in files

I get some spurious changes when running autoconf/automake for various
projects in the tree.  This is likely because they were generated using
distro-patched tools last time.

I ran `autoreconf -f` in the various automake projects of the
binutils-gdb tree, and this is the result.  The tools I am using have
been compiled from source, from the upstream release.

bfd/ChangeLog:

* Makefile.in: Re-generate.
* configure: Re-generate.
* doc/Makefile.in: Re-generate.

binutils/ChangeLog:

* Makefile.in: Re-generate.
* configure: Re-generate.
* doc/Makefile.in: Re-generate.

gas/ChangeLog:

* Makefile.in: Re-generate.
* configure: Re-generate.
* doc/Makefile.in: Re-generate.

gold/ChangeLog:

* testsuite/Makefile.in: Re-generate.

gprof/ChangeLog:

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

ld/ChangeLog:

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

opcodes/ChangeLog:

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

4 years agoDon't use bfd_get_* macro to set bfd fields
Alan Modra [Wed, 18 Sep 2019 05:37:33 +0000 (15:07 +0930)] 
Don't use bfd_get_* macro to set bfd fields

* aoutx.h (slurp_symbol_table): Don't set symcount using bfd_get
macros.
* pdp11.c (slurp_symbol_table): Likewise.
* som.c (som_slurp_symbol_table): Likewise.
* coff-ppc.c (ppc_bfd_coff_final_link): Likewise.
* coffcode.h (coff_slurp_symbol_table): Likewise.
* cofflink.c (_bfd_coff_final_link): Likewise.
* ecoff.c (ecoff_slurp_symbolic_header): Likewise.
(_bfd_ecoff_slurp_symbolic_info): Likewise.
(_bfd_ecoff_slurp_symbol_table): Likewise.
(_bfd_ecoff_bfd_final_link): Likewise.
* elf.c (_bfd_elf_canonicalize_symtab): Likewise.
* elflink.c (elf_link_output_symstrtab): Likewise.
(bfd_elf_final_link): Likewise.
* peicode.h (pe_ILF_build_a_bfd): Likewise.
* xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise.
* aoutx.h (some_aout_object_p, slurp_symbol_table): Don't set
start_address or symcount using bfd_get macros.
* coffgen.c (coff_real_object_p): Likewise.
* pdp11.c (some_aout_object_p, slurp_symbol_table): Likewise.
* som.c (som_object_setup, som_slurp_symbol_table): Likewise.
* elfcore.h (elf_core_file_p): Don't set start_address using
bfd_get macro.
* elf.c (_bfd_elf_canonicalize_dynamic_symtab): Don't set dynsymcount
using bfd_get macro.
* bfd.c (bfd_set_file_flags): Don't set flags using bfd_get macro.
* linker.c (bfd_generic_link_read_symbols): Don't set outsymbols
or symcount using bfd_get macros.
(_bfd_generic_final_link, generic_add_output_symbol): Likewise.
* syms.c (bfd_set_symtab): Likewise.
* vms-alpha.c (alpha_vms_bfd_final_link): Likewise.
* archive.c (do_slurp_bsd_armap): Don't set has_armap using
bfd_has_map macro.
(do_slurp_coff_armap, bfd_slurp_armap): Likewise.
* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
* coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
* coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
* ecoff.c (_bfd_ecoff_slurp_armap): Likewise.
* som.c (som_slurp_armap): Likewise.

4 years agoConstify bfd_octets_per_byte and related functions
Alan Modra [Tue, 17 Sep 2019 05:54:01 +0000 (15:24 +0930)] 
Constify bfd_octets_per_byte and related functions

* archures.c (bfd_get_arch): Make param const.
(bfd_get_mach, bfd_arch_bits_per_byte): Likewise.
(bfd_arch_bits_per_address, bfd_octets_per_byte): Likewise.
* bfd-in2.h: Regenerate.

4 years agoConstify target name, reloc name, and carsym name
Alan Modra [Wed, 18 Sep 2019 05:34:27 +0000 (15:04 +0930)] 
Constify target name, reloc name, and carsym name

bfd/
* bfd-in.h (carsym.name): Make const.
* reloc.c (struct reloc_howto_struct.name): Likewise.
* targets.c (bfd_target.name): Likewise.!
* bfd.c (bfd_get_sign_extend_vma): Make variable const.
* som.c (som_bfd_fill_in_ar_symbols): Use an intermediary variable
when setting carsym.name.
* bfd-in2.h: Regenerate.
gdb/
* amd64-dicos-tdep.c (amd64_dicos_osabi_sniffer): Constify target.
* i386-cygwin-tdep.c (i386_cygwin_init_abi): Likewise.
* i386-dicos-tdep.c (i386_dicos_osabi_sniffer): Likewise.
ld/
* ldlang.c (stricpy, strcut, name_compare): Constify params.
(get_first_input_target): Make return and "target" const.

4 years agoUse bfd_set_filename more
Alan Modra [Wed, 18 Sep 2019 01:04:46 +0000 (10:34 +0930)] 
Use bfd_set_filename more

Fixes a few leaks in bfd and ld.

bfd/
* mach-o.c (bfd_mach_o_fat_member_init): Likewise.  Replace
xstrdup and xmalloc with bfd_strdup and bfd_malloc.  Return an
error status.  Adjust calls.
* vms-lib.c (_bfd_vms_lib_get_module): Test mhd->id earlier.
Close bfd on failure.  Replace xstrdup/bfd_alloc use with
bfd_malloc.  Use bfd_set_filename.
gdb/
* solib-spu.c (spu_bfd_open): Use bfd_set_filename.
* spu-linux-nat.c (spu_bfd_open): Likewise.
ld/
* emultempl/pe.em (after_open): Use bfd_set_filename.
* emultempl/pep.em (after_open): Use bfd_set_filename.

4 years agoPowerPC64, support medium model access to common symbols
Alan Modra [Wed, 18 Sep 2019 00:57:23 +0000 (10:27 +0930)] 
PowerPC64, support medium model access to common symbols

Some versions of clang apparently generate non-PIC on powerpc64le to
access common symbols.  Since a common symbol and a strong definition
with the same name should resolve to the strong definition we have the
possibility of non-PIC attempting to access shared library variables.
This is really a clanger since powerpc64le is supposed to be PIC by
default, but let's see if ld can cope by generating .dynbss copies.

* elf64-ppc.c (must_be_dyn_reloc): Return 0 for TOC16 relocs.
(ppc64_elf_check_relocs): Support dynamic/copy relocs for TOC16.
(ppc64_elf_adjust_dynamic_symbol): Don't keep dynamic reloc when
needs_copy even if all relocs are in rw sections.
(dec_dynrel_count): Handle TOC16 relocs.
(ppc64_elf_relocate_section): Support dynamic relocs for TOC16.
(ppc64_elf_finish_dynamic_symbol): Adjust to handle needs_copy
semantic change.

4 years agoMake extern declaration of dwarf_always_disassemble correct
Christian Biesinger [Wed, 18 Sep 2019 04:50:42 +0000 (13:50 +0900)] 
Make extern declaration of dwarf_always_disassemble correct

This was an oversight in 491144b5e21bbfd41969c175aebb663976f59058;
dwarf2loc.c has an extern definition for dwarf_always_disassemble
that I missed. This patch updates it from int to bool to match
the definition in dwarf2read.c.

gdb/ChangeLog:

2019-09-18  Christian Biesinger  <cbiesinger@google.com>

* dwarf2loc.c: Change extern declaration of dwarf_always_disassemble
to bool to match definition in dwarf2read.c.

4 years agoRISC-V: Gate opcode tables by enum rather than string.
Jim Wilson [Wed, 18 Sep 2019 00:59:08 +0000 (17:59 -0700)] 
RISC-V: Gate opcode tables by enum rather than string.

Generalize opcode arch dependencies so that we can support the
overlapping B extension Zb* subsets.

2019-09-17  Maxim Blinov  <maxim.blinov@embecosm.com>
gas/
* config/tc-riscv.c (riscv_multi_subset_supports): Handle
insn_class enum rather than subset char string.
(riscv_ip): Update call to riscv_multi_subset_supports.
include/
* opcode/riscv.h (riscv_insn_class): New enum.
* opcode/riscv.h (struct riscv_opcode): Change
subset field to insn_class field.
opcodes/
* riscv-opc.c (riscv_opcodes): Change subset field
to insn_class field for all instructions.
(riscv_insn_types): Likewise.

4 years agoChange boolean options to bool instead of int
Christian Biesinger [Sat, 14 Sep 2019 19:36:58 +0000 (15:36 -0400)] 
Change boolean options to bool instead of int

This is for add_setshow_boolean_cmd as well as the gdb::option interface.

gdb/ChangeLog:

2019-09-17  Christian Biesinger  <cbiesinger@google.com>

* ada-lang.c (ada_ignore_descriptive_types_p): Change to bool.
(print_signatures): Likewise.
(trust_pad_over_xvs): Likewise.
* arch/aarch64-insn.c (aarch64_debug): Likewise.
* arch/aarch64-insn.h (aarch64_debug): Likewise.
* arm-linux-nat.c (arm_apcs_32): Likewise.
* arm-linux-tdep.c (arm_apcs_32): Likewise.
* arm-nbsd-nat.c (arm_apcs_32): Likewise.
* arm-tdep.c (arm_debug): Likewise.
(arm_apcs_32): Likewise.
* auto-load.c (debug_auto_load): Likewise.
(auto_load_gdb_scripts): Likewise.
(global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* auto-load.h (global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* breakpoint.c (disconnected_dprintf): Likewise.
(breakpoint_proceeded): Likewise.
(automatic_hardware_breakpoints): Likewise.
(always_inserted_mode): Likewise.
(target_exact_watchpoints): Likewise.
(_initialize_breakpoint): Update.
* breakpoint.h (target_exact_watchpoints): Change to bool.
* btrace.c (maint_btrace_pt_skip_pad): Likewise.
* cli/cli-cmds.c (trace_commands): Likewise.
* cli/cli-cmds.h (trace_commands): Likewise.
* cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument
to bool*.
* cli/cli-logging.c (logging_overwrite): Change to bool.
(logging_redirect): Likewise.
(debug_redirect): Likewise.
* cli/cli-option.h (option_def) <boolean>: Change return type to bool*.
(struct boolean_option_def) <get_var_address_cb_>: Change return type
to bool.
<boolean_option_def>: Update.
(struct flag_option_def): Change default type of Context to bool
from int.
<flag_option_def>: Change return type of var_address_cb_ to bool*.
* cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*.
(get_setshow_command_value_string): Likewise.
* cli/cli-style.c (cli_styling): Change to bool.
(source_styling): Likewise.
* cli/cli-style.h (source_styling): Likewise.
(cli_styling): Likewise.
* cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change
to bool.
* command.h (var_types): Update comment.
(add_setshow_boolean_cmd): Change int* var argument to bool*.
* compile/compile-cplus-types.c (debug_compile_cplus_types): Change to
bool.
(debug_compile_cplus_scopes): Likewise.
* compile/compile-internal.h (compile_debug): Likewise.
* compile/compile.c (compile_debug): Likewise.
(struct compile_options) <raw>: Likewise.
* cp-support.c (catch_demangler_crashes): Likewise.
* cris-tdep.c (usr_cmd_cris_version_valid): Likewise.
(usr_cmd_cris_dwarf2_cfi): Likewise.
* csky-tdep.c (csky_debug): Likewise.
* darwin-nat.c (enable_mach_exceptions): Likewise.
* dcache.c (dcache_enabled_p): Likewise.
* defs.h (info_verbose): Likewise.
* demangle.c (demangle): Likewise.
(asm_demangle): Likewise.
* dwarf-index-cache.c (debug_index_cache): Likewise.
* dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2read.c (check_physname): Likewise.
(use_deprecated_index_sections): Likewise.
(dwarf_always_disassemble): Likewise.
* eval.c (overload_resolution): Likewise.
* event-top.c (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* event-top.h (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* exec.c (write_files): Likewise.
* fbsd-nat.c (debug_fbsd_lwp): Likewise
(debug_fbsd_nat): Likewise.
* frame.h (struct frame_print_options) <print_raw_frame_arguments>:
Likewise.
(struct set_backtrace_options) <backtrace_past_main>: Likewise.
<backtrace_past_entry> Likewise.
* gdb-demangle.h (demangle): Likewise.
(asm_demangle): Likewise.
* gdb_bfd.c (bfd_sharing): Likewise.
* gdbcore.h (write_files): Likewise.
* gdbsupport/common-debug.c (show_debug_regs): Likewise.
* gdbsupport/common-debug.h (show_debug_regs): Likewise.
* gdbthread.h (print_thread_events): Likewise.
* gdbtypes.c (opaque_type_resolution): Likewise.
(strict_type_checking): Likewise.
* gnu-nat.c (gnu_debug_flag): Likewise.
* guile/scm-auto-load.c (auto_load_guile_scripts): Likewise.
* guile/scm-param.c (pascm_variable): Add boolval.
(add_setshow_generic): Update.
(pascm_param_value): Update.
(pascm_set_param_value_x): Update.
* hppa-tdep.c (hppa_debug): Change to bool..
* infcall.c (may_call_functions_p): Likewise.
(coerce_float_to_double_p): Likewise.
(unwind_on_signal_p): Likewise.
(unwind_on_terminating_exception_p): Likewise.
* infcmd.c (startup_with_shell): Likewise.
* inferior.c (print_inferior_events): Likewise.
* inferior.h (startup_with_shell): Likewise.
(print_inferior_events): Likewise.
* infrun.c (step_stop_if_no_debug): Likewise.
(detach_fork): Likewise.
(debug_displaced): Likewise.
(disable_randomization): Likewise.
(non_stop): Likewise.
(non_stop_1): Likewise.
(observer_mode): Likewise.
(observer_mode_1): Likewise.
(set_observer_mode): Update.
(sched_multi): Change to bool.
* infrun.h (debug_displaced): Likewise.
(sched_multi): Likewise.
(step_stop_if_no_debug): Likewise.
(non_stop): Likewise.
(disable_randomization): Likewise.
* linux-tdep.c (use_coredump_filter): Likewise.
(dump_excluded_mappings): Likewise.
* linux-thread-db.c (auto_load_thread_db): Likewise.
(check_thread_db_on_load): Likewise.
* main.c (captured_main_1): Update.
* maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt,
xx2_opt, boolean_opt>: Change to bool.
* maint-test-settings.c (maintenance_test_settings_boolean): Likewise.
* maint.c (maintenance_profile_p): Likewise.
(per_command_time): Likewise.
(per_command_space): Likewise.
(per_command_symtab): Likewise.
* memattr.c (inaccessible_by_default): Likewise.
* mi/mi-main.c (mi_async): Likewise.
(mi_async_1): Likewise.
* mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise.
* nat/fork-inferior.h (startup_with_shell): Likewise.
* nat/linux-namespaces.c (debug_linux_namespaces): Likewise.
* nat/linux-namespaces.h (debug_linux_namespaces): Likewise.
* nios2-tdep.c (nios2_debug): Likewise.
* or1k-tdep.c (or1k_debug): Likewise.
* parse.c (parser_debug): Likewise.
* parser-defs.h (parser_debug): Likewise.
* printcmd.c (print_symbol_filename): Likewise.
* proc-api.c (procfs_trace): Likewise.
* python/py-auto-load.c (auto_load_python_scripts): Likewise.
* python/py-param.c (union parmpy_variable): Add "bool boolval" field.
(set_parameter_value): Update.
(add_setshow_generic): Update.
* python/py-value.c (copy_py_bool_obj): Change argument from int*
to bool*.
* python/python.c (gdbpy_parameter_value): Cast to bool* instead of
int*.
* ravenscar-thread.c (ravenscar_task_support): Change to bool.
* record-btrace.c (record_btrace_target::store_registers): Update.
* record-full.c (record_full_memory_query): Change to bool.
(record_full_stop_at_limit): Likewise.
* record-full.h (record_full_memory_query): Likewise.
* remote-notif.c (notif_debug): Likewise.
* remote-notif.h (notif_debug): Likewise.
* remote.c (use_range_stepping): Likewise.
(interrupt_on_connect): Likewise.
(remote_break): Likewise.
* ser-tcp.c (tcp_auto_retry): Likewise.
* ser-unix.c (serial_hwflow): Likewise.
* skip.c (debug_skip): Likewise.
* solib-aix.c (solib_aix_debug): Likewise.
* spu-tdep.c (spu_stop_on_load_p): Likewise.
(spu_auto_flush_cache_p): Likewise.
* stack.c (struct backtrace_cmd_options) <full, no_filters, hide>:
Likewise.
(struct info_print_options) <quiet>: Likewise.
* symfile-debug.c (debug_symfile): Likewise.
* symfile.c (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symfile.h (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symtab.c (basenames_may_differ): Likewise.
(struct filename_partial_match_opts) <dirname, basename>: Likewise.
(struct info_print_options) <quiet, exclude_minsyms>: Likewise.
(struct info_types_options) <quiet>: Likewise.
* symtab.h (demangle): Likewise.
(basenames_may_differ): Likewise.
* target-dcache.c (stack_cache_enabled_1): Likewise.
(code_cache_enabled_1): Likewise.
* target.c (trust_readonly): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
(auto_connect_native_target): Likewise.
(target_stop_and_wait): Update.
(target_async_permitted): Change to bool.
(target_async_permitted_1): Likewise.
(may_write_registers_1): Likewise.
(may_write_memory_1): Likewise.
(may_insert_breakpoints_1): Likewise.
(may_insert_tracepoints_1): Likewise.
(may_insert_fast_tracepoints_1): Likewise.
(may_stop_1): Likewise.
* target.h (target_async_permitted): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
* thread.c (struct info_threads_opts) <show_global_ids>: Likewise.
(make_thread_apply_all_options_def_group): Change argument from int*
to bool*.
(thread_apply_all_command): Update.
(print_thread_events): Change to bool.
* top.c (confirm): Likewise.
(command_editing_p): Likewise.
(history_expansion_p): Likewise.
(write_history_p): Likewise.
(info_verbose): Likewise.
* top.h (confirm): Likewise.
(history_expansion_p): Likewise.
* tracepoint.c (disconnected_tracing): Likewise.
(circular_trace_buffer): Likewise.
* typeprint.c (print_methods): Likewise.
(print_typedefs): Likewise.
* utils.c (debug_timestamp): Likewise.
(sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* utils.h (sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* valops.c (overload_resolution): Likewise.
* valprint.h (struct value_print_options) <prettyformat_arrays,
prettyformat_structs, vtblprint, unionprint, addressprint, objectprint,
stop_print_at_null, print_array_indexes, deref_ref, static_field_print,
pascal_static_field_print, raw, summary, symbol_print, finish_print>:
Likewise.
* windows-nat.c (new_console): Likewise.
(cygwin_exceptions): Likewise.
(new_group): Likewise.
(debug_exec): Likewise.
(debug_events): Likewise.
(debug_memory): Likewise.
(debug_exceptions): Likewise.
(useshell): Likewise.
* windows-tdep.c (maint_display_all_tib): Likewise.
* xml-support.c (debug_xml): Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 18 Sep 2019 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb: Look for compilation directory relative to directory search path
Mike Gulick [Thu, 12 Sep 2019 15:16:06 +0000 (11:16 -0400)] 
gdb: Look for compilation directory relative to directory search path

The 'directory' command allows the user to provide a list of filesystem
directories in which to search for source code.  The directories in this
search path are used as the base directory for the source filename from
the debug information (DW_AT_name).  Thus the directory search path
provides alternatives to the existing compilation directory from the
debug information (DW_AT_comp_dir).  Generally speaking, DW_AT_name
stores the filename argument passed to the compiler (including any
directory components), and DW_AT_comp_dir stores the current working
directory from which the compiler was executed.  For example:

    $ cd /path/to/project/subdir1
    $ gcc -c a/test.c -g

The corresponding debug information will look like this:

    DW_AT_name      : a/test.c
    DW_AT_comp_dir  : /path/to/project/subdir1

When compiling with the -fdebug-prefix-map GCC option, the compilation
directory can be arbitrarily rewritten.  In the above example, we may
rewrite the compilation directory as follows:

    $ gcc -c a/test.c -g -fdebug-prefix-map=/path/to/project=

In this case, the corresponding debug information will look like:

    DW_AT_name      : a/test.c
    DW_AT_comp_dir  : /subdir1

This prevents GDB from finding the corresponding source code based on
the debug information alone.  In some cases, a substitute-path command
can be used to re-map a consistent prefix in the rewritten compilation
directory to the real filesystem path.  However, there may not be a
consistent prefix remaining in the debug symbols (for example in a
project that has source code in many subdirectories under the project's
root), thereby requiring multiple substitute-path rules.  In this case,
it is easier to add the missing prefix to the directory search path via
the 'directory' command.

The function find_and_open_source currently searches in:

    SEARCH_PATH/FILENAME

where SEARCH_PATH corresponds to each individual entry in the directory
search path (which is guaranteed to contain the compilation directory
from the debug information, as well as the current working directory).
FILENAME corresponds to the source filename (DW_AT_name), which may have
directory components in it.  In addition, GDB searches in:

    SEARCH_PATH/FILE_BASENAME

where FILE_BASENAME is the basename of the DW_AT_name entry.

This change modifies find_and_open_source to additionally search in:

    SEARCH_PATH/COMP_DIR/FILENAME

where COMP_DIR is the compilation directory from the debug symbols.  In
the example given earlier, running:

    (gdb) directory /path/to/project

will now allow GDB to correctly locate the source code from the debug
information.

gdb/ChangeLog:

* source.c (prepare_path_for_appending): New function.
(openp): Make use of new function.
(find_and_open_source): Search for the compilation directory and
source file as a relative path beneath the directory search path.

gdb/doc/ChangeLog:

* gdb.texinfo (Source Path): Additional text to better describe
how the source path directory list is used when searching for
source files.

gdb/testsuite/ChangeLog:

* gdb.base/source-dir.exp: Add extra test for mapped compilation
directory.

4 years agogdb: Catch exceptions when accessing source cache
Andrew Burgess [Sat, 7 Sep 2019 23:05:22 +0000 (00:05 +0100)] 
gdb: Catch exceptions when accessing source cache

The source_cache::get_line_charpos function can currently throw an
exception if the source file is missing, which doesn't match the
expected behaviour documented in the functions header file.  The
documented behaviour is to return false on failure, and this is how
the function appears to be used throughout GDB.

I spotted this in the 'info source' command, currently for a missing
source file you'll see something like this:

  (gdb) info source
  Current source file is /path/to/src/file.c
  Compilation directory is /path/to/build/
  /path/to/src/file.c: No such file or directory.
  (gdb)

After this patch we see this:

  (gdb) info source
  Current source file is /path/to/src/file.c
  Compilation directory is /path/to/build/
  Source language is c.
  Producer is COMPILER VERSION AND FLAGS.
  Compiled with DWARF 2 debugging format.
  Does not include preprocessor macro info.

We don't currently indicate that the source file can't be found, and
maybe that would be something worth adding in the future.

gdb/ChangeLog:

* source-cache.c (source_cache::get_line_charpos): Catch
exceptions and return false, this matches the behaviour documented
in the header file.

gdb/testsuite/ChangeLog:

* gdb.base/list-missing-source.exp: New file.

4 years ago(Ada) do not print Ada task names in quotes in "info tasks" output
Joel Brobecker [Tue, 17 Sep 2019 18:27:55 +0000 (13:27 -0500)] 
(Ada) do not print Ada task names in quotes in "info tasks" output

A recent change enhanced a couple of notifications about Ada tasks to
include the task's name in addition to the task's number. That change
also modified the output of the "info tasks" when printing the detailed
information of one given task. I believe this change was unintentionally
left over from the initial version after it was decided that quoting
the task's name should not be done. This patch therefore undoes this
part of the patch.

gdb/ChangeLog:

        * ada-tasks.c (info_task): Remove quoting of the task's name.

Tested on x86_64-linux, with both the official testsuite as well as
AdaCore's testsuite.

4 years agoDon't duplicate comment in symfile.c and .h
Christian Biesinger [Tue, 17 Sep 2019 03:07:16 +0000 (22:07 -0500)] 
Don't duplicate comment in symfile.c and .h

This just replaces the comment in the .c file with
"See symfile.h.".

gdb/ChangeLog:

2019-09-16  Christian Biesinger  <cbiesinger@google.com>

* symfile.c (auto_solib_add): Replace comment with a reference
to the header file.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 17 Sep 2019 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoPR25002, ld/ldelf.c missing safe-ctype.h include
Alan Modra [Mon, 16 Sep 2019 14:21:48 +0000 (23:51 +0930)] 
PR25002, ld/ldelf.c missing safe-ctype.h include

PR 25002
* ldelf.c: Include safe-ctype.h.

4 years agoDelete accidentally-checked in editor temporary file.
Phil Blundell [Mon, 16 Sep 2019 10:01:26 +0000 (11:01 +0100)] 
Delete accidentally-checked in editor temporary file.

4 years agoUpdate version to 2.33.50 and regenerate configure scripts.
Phil Blundell [Mon, 16 Sep 2019 10:01:00 +0000 (11:01 +0100)] 
Update version to 2.33.50 and regenerate configure scripts.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 16 Sep 2019 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAdd a NEWS entry that gdb can be compiled with py3 on Windows.
Christian Biesinger [Sat, 14 Sep 2019 20:28:51 +0000 (16:28 -0400)] 
Add a NEWS entry that gdb can be compiled with py3 on Windows.

This was fixed in commit 272044897e178835f596c96740c5a1800ec6f9fb.

2019-09-14  Christian Biesinger  <cbiesinger@google.com>

* NEWS: Mention that gdb can now be compiled with Python 3
on Windows.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 15 Sep 2019 00:00:58 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb/testsuite] Require gnatmake 8 for gdb.ada/rename_subscript_param.exp
Tom de Vries [Sat, 14 Sep 2019 08:35:48 +0000 (10:35 +0200)] 
[gdb/testsuite] Require gnatmake 8 for gdb.ada/rename_subscript_param.exp

When running gdb.ada/rename_subscript_param.exp with gnatmake 7.4.1, we get:
...
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \
  before changing its value
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \
  after changing its value
...

The commit last touching the test-case (afcfda091e) states:
...
    The test still fails with old compilers that do not properly
    generate debug info for this renaming:
...

Fix this by requiring at least gnatmake 8 for the test-case.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-14  Tom de Vries  <tdevries@suse.de>

PR teststuite/24599
* gdb.ada/rename_subscript_param.exp: Require gnatmake 8.
* lib/ada.exp (gnatmake_version_at_least): New proc.

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 14 Sep 2019 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAlways add input_statement to statement_list
Alan Modra [Fri, 13 Sep 2019 01:39:41 +0000 (11:09 +0930)] 
Always add input_statement to statement_list

I think this is safer than leaving an input_statement added during
open_input_bfds off the list.  There are a number of places that
fiddle with various lists and might be confused by an off-list
statement, eg. orphan handling.

* ldlang.c (new_afile): Remove add_to_list parameter.
(lang_add_input_file): Update new_afile calls.
(lookup_name): Splice input_statement added by new_afile into
statement_list after current input_file_chain entry.
(lang_process): Update comment.

4 years agogdb: Force use of float version of log10
Andrew Burgess [Fri, 13 Sep 2019 01:23:37 +0000 (21:23 -0400)] 
gdb: Force use of float version of log10

This commit:

  commit aa17805fb9a3a1983a510ba425b682fba03410c2
  Date:   Sat Aug 31 23:44:40 2019 +0100

      gdb: Have 'maint info sections' print all sections again

introduced a use of log10 that took an int as a parameter.
Unfortunately this was causing a compilation error on Solaris, see:

  https://sourceware.org/ml/gdb-patches/2019-09/msg00230.html
  https://sourceware.org/ml/gdb-patches/2019-09/msg00231.html

because there was only a float, double, or long double version of
log10, and the compiler doesn't know which to choose.

This commit should resolve this issue by casting the argument to
float.

gdb/ChangeLog:

* maint.c (maint_print_section_data::maint_print_section_data):
Force use of 'float log10 (float)' by casting the argument to
float.

4 years agogdb/testsuite: Make use of exec_has_index_section function
Andrew Burgess [Sat, 31 Aug 2019 23:21:40 +0000 (00:21 +0100)] 
gdb/testsuite: Make use of exec_has_index_section function

Make use of exec_has_index_section library function rather than
manually checking in the 'maintenance info sections' output.  Should
make no difference to the test results, just makes the code easier to
read.

gdb/testsuite/ChangeLog:

* gdb.base/maint.exp: Use exec_has_index_section.

4 years agogdb: Have 'maint info sections' print all sections again
Andrew Burgess [Sat, 31 Aug 2019 22:44:40 +0000 (23:44 +0100)] 
gdb: Have 'maint info sections' print all sections again

In this commit:

  commit 6eac171f0624303d944ff1a1ae4d0e3b0a63c800
  Date:   Fri Aug 16 00:25:14 2019 +0200

      [gdb] Make maint info sections print relocated addresses

A couple of things broke with the 'maintenance info sections' command,
here is some before output:

  (gdb) maintenance info sections
  Exec file:
      `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
          file type elf64-x86-64.
   [0]     0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
   [1]     0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
   [2]     0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
   [3]     0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
   [4]     0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
   [5]     0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
   [6]     0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
   [7]     0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
   [8]     0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
   [9]     0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
   [10]     0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
   [11]     0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
   [12]     0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
   [13]     0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
   [14]     0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
   [15]     0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
   [16]     0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
   [17]     0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
   [18]     0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
   [19]     0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
   [20]     0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
   [21]     0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
   [22]     0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
   [23]     0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
   [24]     0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS
   [25]     0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS
   [26]     0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS
   [27]     0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS
   [28]     0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS
   [29]     0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS
  (gdb)

And here is the output after the above commit:

  (gdb) maintenance info sections
  +maintenance info sections
  Exec file:
      `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
          file type elf64-x86-64.
      0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
      0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
      0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
      0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
      0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
      0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
      0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
      0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
      0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
      0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
      0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
      0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
      0x00000000->0x00000000 at 0x00000000: *COM* IS_COMMON
      0x00000000->0x00000000 at 0x00000000: *UND*
      0x00000000->0x00000000 at 0x00000000: *ABS*
      0x00000000->0x00000000 at 0x00000000: *IND*
  (gdb)

We lost the section index numbers, but more importantly, we lost the
information about the .debug* sections.  We also gained entries for
the "fake" sections *COM*, *UND*, *ABS*, and *IND*.

I noticed this when running:

  make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp"

As this test relies on looking in the 'maint info sections' output to
see if we have a .debug_names or .gdb_index section, and these are
debug sections so they no longer show up in the 'main info sections'
output, the gdb.base/maint.exp test fails.

This commit restores the old behaviour while keeping the important
change that the above commit introduced, the addresses printed for
sections are the relocated addresses where appropriate.  The above
commit mentions using this test:

   make check-gdb RUNTESTFLAGS="CFLAGS_FOR_TARGET='-pie' gdb.base/compare-sections.exp"

And this still passes after this commit.

The output for 'maint info sections' now looks like this:

  (gdb) maintenance info sections
  Exec file:
      `/home/andrew/projects/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
          file type elf64-x86-64.
   [0]      0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
   [1]      0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
   [2]      0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
   [3]      0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
   [4]      0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
   [5]      0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
   [6]      0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
   [7]      0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
   [8]      0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
   [9]      0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
   [10]     0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
   [11]     0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
   [12]     0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
   [13]     0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
   [14]     0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
   [15]     0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
   [16]     0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
   [17]     0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
   [18]     0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
   [19]     0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
   [20]     0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
   [21]     0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
   [22]     0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
   [23]     0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
   [24]     0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS
   [25]     0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS
   [26]     0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS
   [27]     0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS
   [28]     0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS
   [29]     0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS
  (gdb)

This is basically as it was before, except that the index numbers are
now padded so the section information all lines up.

When GDB has relocated a section then the relocated addresses will be
printed, otherwise the non-relocated addresses from the bfd will be
printed.

I've added a test to gdb.base/maint.exp to do some basic validation of
the output format.

gdb/ChangeLog:

* maint.c: Add 'cmath' include.
(struct maint_print_section_data): New structure.
(print_section_index): New function.
(print_bfd_section_info): Add header comment, small whitespace
cleanup, and update to call new print_section_index function.
(print_objfile_section_info): Likewise.
(maint_obj_section_from_bfd_section): New function.
(print_bfd_section_info_maybe_relocated): New function.
(maintenance_info_sections): Add header comment, always use
bfd_map_over_sections instead of ALL_OBJFILE_OSECTIONS.

gdb/testsuite/ChangeLog:

* gdb.base/maint.exp: Add test for 'maint info sections'.

4 years agogdb: Don't fault for 'maint print psymbols' when using an index
Andrew Burgess [Sat, 31 Aug 2019 20:46:27 +0000 (21:46 +0100)] 
gdb: Don't fault for 'maint print psymbols' when using an index

I found that these tests:

  make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp"
  make check-gdb RUNTESTFLAGS="--target_board=cc-with-debug-names gdb.base/maint.exp"

were causing GDB to segfault.  It turns out that this test runs this
command:

  maint print psymbols -pc main /path/to/some/file

which tries to lookup the partial_symtab for 'main'.  The problem is
that there is no partial_symtab for 'main' as we are using the
.gdb_index or .debug_names instead of partial_symtabs.

What happens is that maintenance_print_symbols calls
find_pc_sect_psymtab, which looks for the partial_symtab in the
objfile's objfile->partial_symtabs->psymtabs_addrmap.

This is a problem because when we are using the indexes
psymtabs_addrmap is reused to hold things other than partial_symtabs,
this can be seen in dwarf2read.c in create_addrmap_from_index and
create_addrmap_from_aranges.  If we then lookup in psymtabs_addrmap we
end up returning a pointer to something that isn't really a
partial_symtab, after which everything goes wrong.

Initially I simply added a check at the start of find_pc_sect_psymtab
that the objfile had some partial_symtabs, like:

  if (objfile->partial_symtabs->psymtabs == NULL)
    return NULL;

Figuring that if there were no partial_symtabs at all then this
function should always return NULL, however, this caused a failure in
the test gdb.python/py-event.exp which I didn't dig into too deeply,
but seems to be that in this tests there are initially no psymtabs,
but the second part of find_pc_sect_psymtab does manage to read some
in from somewhere, with the check I added the test fails as we
returned NULL here and this caused GDB to load in the full symtabs
earlier than was expected.

Instead I chose to guard only the access to psymtabs_addrmap with a
check that the function has some psymtabs.  This allows my original
tests to pass, and the py-event.exp test to pass too.

Now, a good argument can be made that we simply should never call
find_pc_sect_psymtab on an objfile that is using indexes instead of
partial_symtabs.  I did consider this approach, we could easily add an
assert into find_pc_sect_psymtab that if we find a partial_symtab in
psymtabs_addrmap then the psymtabs pointer must be non-null.  The
responsibility would then be on the user of find_pc_sect_psymtab to
ensure that the objfile being checked is suitable.  In the end I
didn't take this approach as the check in find_pc_sect_psymtab is
cheap and this ensures that any future miss-uses of the function will
not cause problems.

I also extended the comment on psymtabs_addrmap to indicate that it
holds more than just partial_symtabs as this was not at all clear from
the original comment, and caused me some confusion when I was
initially debugging this problem.

gdb/ChangeLog:

* psymtab.c (find_pc_sect_psymtab): Move baseaddr local into more
inner scope, add check that the objfile has psymtabs before
checking psymtabs_addrmap.
* psymtab.h (psymtab_storage) <psymtabs_addrmap>: Extend comment.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Sep 2019 00:00:15 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb/testsuite] Allow some tests in gdb.base/store.exp to be unsupported
Tom de Vries [Thu, 12 Sep 2019 20:36:37 +0000 (22:36 +0200)] 
[gdb/testsuite] Allow some tests in gdb.base/store.exp to be unsupported

The test-case gdb.base/store.exp fails with gcc 7.4.0:
...
nr of unexpected failures        27
...

The first FAIL:
...
110       l = add_float (l, r);
(gdb) PASS: gdb.base/store.exp: continue to wack_float
print l
$21 = <optimized out>
FAIL: gdb.base/store.exp: var float l; print old l, expecting -1
...
relates to this bit in the test-case (compiled at -O0):
...
   106  float
   107  wack_float (register float u, register float v)
   108  {
   109    register float l = u, r = v;
   110    l = add_float (l, r);
   111    return l + r;
   112  }
...
and it expects to be able to read and modify variable l before executing line
110, but it already fails to read the value, because l has no DW_AT_location
attribute in the debug info.

Variable l is declared with the register keyword, and GCC implements the
register keyword at -O0 like so:
...
the compiler allocates distinct stack memory for all variables that do not
have the register storage-class specifier; if register is specified, the
variable may have a shorter lifespan than the code would indicate and may
never be placed in memory.
...

The fact that l has no DW_AT_location attribute, matches with the documented
"variable may have a shorter lifespan that code would indicate", (though it
is the most extreme case of it) so the gcc behaviour is valid.  We can of
course improve gcc to generate better debuginfo (filed gcc PR91611), but
this not a wrong-debug problem.

[ The test-case passes with gcc 4.2.1, but for the failing test discussed
above, it passes simply because it doesn't store l in a register. ]

With the debug info missing for l, reading and setting l is unsupported, so
fix the FAIL by marking the test UNSUPPORTED instead.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-12  Tom de Vries  <tdevries@suse.de>

* gdb.base/store.exp: Allow register variables to be optimized out at
-O0.

4 years agoOutput the Ada task name in more messages.
Philippe Waroquiers [Sat, 8 Jun 2019 17:47:51 +0000 (19:47 +0200)] 
Output the Ada task name in more messages.

With this patch, we e.g. get:
      [Switching to task 2 "task_list(1)"]
      [Current task is 2 "task_list(1)"]
    instead of
      [Switching to task 2]
      [Current task is 2]

The logic to produce the taskno optionally followed
by the task name has been factorized in the task_to_str function.

Task names are output between double quotes in the new messages,
similarly to what GDB does for thread names.
However, no quotes are put around task names in 'info tasks' Name column.
This was discussed with Tom, that preferred no quotes there, while I
was more in favour of visual consistency.
I discussed with a few more users, which led to (exactly) 50% preferring
quotes and 50% preferring no quotes :).
To arrive to the decision to remove the quotes, the following "killing args"
were used:
 * To have quotes or to not have quotes, that is the question; yes
   but not *THE* question :).
 * If there is not a clear majority that prefers quotes, better to
   not disturb the existing user basis for a (somewhat) irrelevant
   aspect.
 * The opinion of the reviewer has more weight.

So, compared to the previous version, this version remotes the quotes
in 'info tasks'.

It improves the alignement of 'info tasks' output.
With this patch, we get:
      (gdb) info task
         ID           TID P-ID Pri State                  Name
      *   1  555555759030       48 Runnable               main_task
          2  555555759e30    1  48 Selective Wait         mit
      (gdb)
   instead of
      (gdb) info task
         ID       TID P-ID Pri State                  Name
      *   1 555555759030       48 Runnable               main_task
          2 555555759e30    1  48 Selective Wait         mit
      (gdb)
(e.g. the first one properly shows parent and priority under the
correct header).

This is version 4 of the 'task name' patch.
Compared to version 3, the changes are:
   output task names between quotes but not in 'info tasks'

gdb/ChangeLog
2019-09-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* NEWS: Announce that Ada task names are now shown at more places,
and between quotes (except in info task output).
* gdb/ada-tasks.c (task_to_str): New function.
(display_current_task_id): Call task_to_str.
(task_command_1): Likewise.
(print_ada_task_info): In non-mi mode, Properly align headers and data
when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR).

gdb/doc/ChangeLog
2019-09-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.texinfo (Ada Tasks): Tell the task name is printed, update
examples.

gdb/testsuite/ChangeLog
2019-09-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.ada/rdv_wait.exp: Update to new task names.
* gdb.base/task_switch_in_core.exp: Likewise.
* gdb.base/info_sources_base.c: Likewise.

4 years agoLOAD in linker map file
Alan Modra [Thu, 12 Sep 2019 08:01:41 +0000 (17:31 +0930)] 
LOAD in linker map file

For some reason, commit 906e58cab5 2008-05-15 excluded input
statements with BFD_LINKER_CREATED BFDs from being printed to map
files.  This isn't ideal since it loses claimed plugin BFDs.

* ldlang.c (print_input_statement): Do not exclude linker created
BFDs.

4 years agoPR24981, Hit assertion failure in ld/ldlang.c:7504
Alan Modra [Thu, 12 Sep 2019 07:55:46 +0000 (17:25 +0930)] 
PR24981, Hit assertion failure in ld/ldlang.c:7504

This fixes a problem with commit 128bf1fe608, a patch I made
2019-08-06.   Apparently it is possible to trigger the assertion I
added during an LTO bootstrap, something I haven't reproduced.
However, I did find a case triggered by an odd linker script feature
that allows a file to be loaded from the script without specifying
that file on the command line.  Regarding input sections:
  "When you use a file name which is not an archive:file specifier
   and does not contain any wild card characters, the linker will
   first see if you also specified the file name on the linker command
   line or in an INPUT command.  If you did not, the linker will
   attempt to open the file as an input file, as though it appeared on
   the command line."

So putting
  .foo : { foo.a(*) }
into a script supposedly extracts foo.a into .foo.  Except it doesn't,
since this feature is meant for object files only.  Well anyway,
assuming --whole-archive was given on the command line, foo.a contains
a -flto object and no other objects involved were -flto then we'll hit
the assert due to files added like foo.a here *not* having their input
statement put on the general statement list.  Why these are not put on
the statement list isn't obvious but it has been that way since commit
193c5f93a17 in 1994.

PR 24981
* ldlang.c (lang_process): Remove assertion.  Comment.

4 years agoFix signals reported for faults on Solaris
Rainer Orth [Thu, 12 Sep 2019 08:40:59 +0000 (10:40 +0200)] 
Fix signals reported for faults on Solaris

It's been a long-standing nuisance that gdb reported unaligned accesses
on Solaris/SPARC as SIGSEGV, contrary to the shells and truss which
correctly report SIGBUS instead.

I could trace this down to the fault handling code in procfs.c
(procfs_target::wait): when pr_why is set to PR_FAULTED, the current
code sets the signal based on the fault number.  For one, the code gets
this wrong for FLTACCESS (the unaligned access case) where it uses
SIGSEGV.  What's worse, it's completely unnecessary to make up the
signal number inside gdb.  Instead, it should just take what procfs
reports to avoid mismatches, which is what this patch does.  I've
completely removed the explicit handling of the various fault codes: for
one, the list has already been incomplete, lacking FLTCPCOVF which
existed since at least Solaris 8.  Besides, there's no reason to error
out on unknown fault codes: either the fault causes a signal which can
then be reported from procfs, or it doesn't (as for FLTPAGE) and no
reporting is necessary.

Tested on sparcv9-sun-solaris2.11 and x86_64-pc-solaris2.11.  Also
spot-checked manually for a couple of cases (unaligned access, division
by 0, NULL pointer dereference).

* procfs.c (procfs_target::wait) <PR_FAULTED>: Get signal from
prstatus.pr_lwp.pr_info instead of making it up.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Sep 2019 00:00:19 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoMake relocate_{path,gdb_directory} return std::string
Christian Biesinger [Mon, 9 Sep 2019 17:55:39 +0000 (12:55 -0500)] 
Make relocate_{path,gdb_directory} return std::string

This simplifies memory management. I've also changed some global variables
to std::string accordingly (which store the result of these functions),
but not all because some are used with add_setshow_optional_filename_cmd
which requires a char*.

gdb/ChangeLog:

2019-09-11  Christian Biesinger  <cbiesinger@google.com>

* auto-load.c (auto_load_expand_dir_vars): Update.
* defs.h (gdb_datadir): Change to std::string.
(python_libdir): Likewise.
(relocate_gdb_directory): Change return type to std::string.
* guile/guile.c (gdbscm_data_directory): Update.
(initialize_scheme_side): Update.
* jit.c (jit_reader_dir): Change to std::string.
(jit_reader_load_command): Update.
* main.c (gdb_datadir): Change to std::string.
(python_libdir): Likewise.
(set_gdb_data_directory): Update.
(relocate_path): Change to return std::string.
(relocate_gdb_directory): Change to return std::string.
(relocate_gdbinit_path_maybe_in_datadir): Update.
(captured_main_1): Update.
* python/python.c (do_start_initialization): Update.
* top.c (show_gdb_datadir): Update.
* xml-syscall.c (xml_init_syscalls_info): Update.
(init_syscalls_info): Update.

4 years agoFactor out the code to do the datadir-relocation for gdbinit
Christian Biesinger [Tue, 20 Aug 2019 21:38:29 +0000 (16:38 -0500)] 
Factor out the code to do the datadir-relocation for gdbinit

This simplifies get_init_files and makes it possible to reuse
this code in an upcoming patch for SYSTEM_GDBINIT_DIR.

gdb/ChangeLog:

2019-09-11  Christian Biesinger  <cbiesinger@google.com>

* main.c (relocate_gdbinit_path_maybe_in_datadir): Factor this code
out of get_init_files.
(get_init_files): Update.

4 years agoRefactor get_init_files to use std::string
Christian Biesinger [Tue, 20 Aug 2019 19:45:51 +0000 (14:45 -0500)] 
Refactor get_init_files to use std::string

To avoid manual memory management.

Tested on buildbot.

gdb/ChangeLog:

2019-09-11  Christian Biesinger  <cbiesinger@google.com>

* main.c (get_init_files): Change to use std::string.
(captured_main_1): Update.
(print_gdb_help): Update.

4 years agoFix float to LONGEST conversion.
Ali Tamur [Wed, 28 Aug 2019 01:58:57 +0000 (18:58 -0700)] 
Fix float to LONGEST conversion.

The code used to have undefined behaviour when template parameter is float and
host_float is NaN, because it attempted to convert NaN value to LONGEST at the
last statement. This frequently caused crashes on tests that checked "info
all-registers" (at least when the code is compiled with clang; I didn't test
with gdb).

gdb/ChangeLog:

*target-float.c (host_float_ops<T>::to_longest): Update
implementation.

4 years agoChange the type of copy_names from int to bool
Christian Biesinger [Tue, 10 Sep 2019 20:37:50 +0000 (15:37 -0500)] 
Change the type of copy_names from int to bool

This parameter is really a boolean, so change the type accordingly
and update the callers.

This is for symbol_set_names, add_psymbol_to_bcache, and
add_psymbol_to_list.

minimal_symbol_reader::record_full was already passing a bool
to symbol_set_names.

gdb/ChangeLog:

2019-09-11  Christian Biesinger  <cbiesinger@google.com>

* dbxread.c (read_dbx_symtab): Update.
* dwarf2read.c (load_partial_dies): Update.
* mdebugread.c (parse_partial_symbols): Update.
(handle_psymbol_enumerators): Update.
* psympriv.h (add_psymbol_to_list): Change type of copy_names to bool.
* psymtab.c (add_psymbol_to_bcache): Likewise.
(add_psymbol_to_list): Likewise.
* symtab.c (symbol_set_names): Likewise.
* symtab.h (symbol_set_names): Likewise.
* xcoffread.c (scan_xcoff_symtab): Update.

4 years agoIntroduce bfd_set_filename
Tom Tromey [Sun, 8 Sep 2019 17:38:24 +0000 (11:38 -0600)] 
Introduce bfd_set_filename

This introduces a new bfd_set_filename function, which is then used in
various spots in gdb.  This allows for the removal of some casts.

bfd/ChangeLog
2019-09-11  Tom Tromey  <tom@tromey.com>

* opncls.c (bfd_set_filename): New function.
* bfd-in2.h: Regenerate.

gdb/ChangeLog
2019-09-11  Tom Tromey  <tom@tromey.com>

* symfile-mem.c (symbol_file_add_from_memory): Use
bfd_set_filename.
* solib-darwin.c (darwin_bfd_open): Use bfd_set_filename.
* solib-aix.c (solib_aix_bfd_open): Use bfd_set_filename.

4 years agoConstify argument to make_tempname and make_tempdir
Tom Tromey [Sun, 8 Sep 2019 15:53:43 +0000 (09:53 -0600)] 
Constify argument to make_tempname and make_tempdir

This constifies the argument to make_tempname and make_tempdir,
removing some casts.

I initially thought that this obsoleted the allocation in
write_archive, but write_archive closes the BFD before using the name,
so this appears not to be the case.

binutils/ChangeLog
2019-09-11  Tom Tromey  <tom@tromey.com>

* objcopy.c (copy_archive): Update.
* bucomm.h (make_tempname, make_tempdir): Make argument const.
* bucomm.c (make_tempname, make_tempdir): Make argument const.

4 years agoRe: Enhance the disassembler
Alan Modra [Wed, 11 Sep 2019 08:03:00 +0000 (17:33 +0930)] 
Re: Enhance the disassembler

PR 24907
* objdump.c (disassemble_bytes): Adjust code to avoid overlong
lines.  Correct max_reloc_offset_into_insn test.

4 years agoRename elf32.em to elf.em
Alan Modra [Tue, 10 Sep 2019 02:57:29 +0000 (12:27 +0930)] 
Rename elf32.em to elf.em

* emultempl/elf32.em: Remove "misnamed" comment.  Rename to..
* emultempl/elf.em: ..this.
* configure.ac (elf_list_options): Adjust TEMPLATE_NAME grep.
* emulparams/aarch64cloudabi.sh (TEMPLATE_NAME): Set to elf.
* emulparams/aarch64elf.sh: Likewise.
* emulparams/aarch64elf32.sh: Likewise.
* emulparams/aarch64fbsd.sh: Likewise.
* emulparams/aarch64linux.sh: Likewise.
* emulparams/aarch64linux32.sh: Likewise.
* emulparams/arcelf.sh: Likewise.
* emulparams/arcelf_prof.sh: Likewise.
* emulparams/arclinux.sh: Likewise.
* emulparams/arclinux_prof.sh: Likewise.
* emulparams/arcv2elf.sh: Likewise.
* emulparams/arcv2elfx.sh: Likewise.
* emulparams/armelf.sh: Likewise.
* emulparams/armelf_fuchsia.sh: Likewise.
* emulparams/armelf_linux.sh: Likewise.
* emulparams/armelf_phoenix.sh: Likewise.
* emulparams/armnto.sh: Likewise.
* emulparams/avr1.sh: Likewise.
* emulparams/avr2.sh: Likewise.
* emulparams/avr25.sh: Likewise.
* emulparams/avr3.sh: Likewise.
* emulparams/avr31.sh: Likewise.
* emulparams/avr35.sh: Likewise.
* emulparams/avr4.sh: Likewise.
* emulparams/avr5.sh: Likewise.
* emulparams/avr51.sh: Likewise.
* emulparams/avr6.sh: Likewise.
* emulparams/avrtiny.sh: Likewise.
* emulparams/avrxmega1.sh: Likewise.
* emulparams/avrxmega2.sh: Likewise.
* emulparams/avrxmega3.sh: Likewise.
* emulparams/avrxmega4.sh: Likewise.
* emulparams/avrxmega5.sh: Likewise.
* emulparams/avrxmega6.sh: Likewise.
* emulparams/avrxmega7.sh: Likewise.
* emulparams/criself.sh: Likewise.
* emulparams/crislinux.sh: Likewise.
* emulparams/cskyelf.sh: Likewise.
* emulparams/d10velf.sh: Likewise.
* emulparams/elf32_sparc.sh: Likewise.
* emulparams/elf32_spu.sh: Likewise.
* emulparams/elf32_tic6x_le.sh: Likewise.
* emulparams/elf32_x86_64.sh: Likewise.
* emulparams/elf32am33lin.sh: Likewise.
* emulparams/elf32bfin.sh: Likewise.
* emulparams/elf32bfinfd.sh: Likewise.
* emulparams/elf32bmip.sh: Likewise.
* emulparams/elf32bmipn32-defs.sh: Likewise.
* emulparams/elf32cr16.sh: Likewise.
* emulparams/elf32cr16c.sh: Likewise.
* emulparams/elf32crx.sh: Likewise.
* emulparams/elf32epiphany.sh: Likewise.
* emulparams/elf32epiphany_4x4.sh: Likewise.
* emulparams/elf32frvfd.sh: Likewise.
* emulparams/elf32ip2k.sh: Likewise.
* emulparams/elf32lm32.sh: Likewise.
* emulparams/elf32lm32fd.sh: Likewise.
* emulparams/elf32lriscv-defs.sh: Likewise.
* emulparams/elf32m32c.sh: Likewise.
* emulparams/elf32mb_linux.sh: Likewise.
* emulparams/elf32mbel_linux.sh: Likewise.
* emulparams/elf32mcore.sh: Likewise.
* emulparams/elf32mep.sh: Likewise.
* emulparams/elf32metag.sh: Likewise.
* emulparams/elf32microblaze.sh: Likewise.
* emulparams/elf32mipswindiss.sh: Likewise.
* emulparams/elf32or1k.sh: Likewise.
* emulparams/elf32ppccommon.sh: Likewise.
* emulparams/elf32rl78.sh: Likewise.
* emulparams/elf32rx.sh: Likewise.
* emulparams/elf32tilegx.sh: Likewise.
* emulparams/elf32tilepro.sh: Likewise.
* emulparams/elf32vax.sh: Likewise.
* emulparams/elf32visium.sh: Likewise.
* emulparams/elf32xc16x.sh: Likewise.
* emulparams/elf32xc16xl.sh: Likewise.
* emulparams/elf32xc16xs.sh: Likewise.
* emulparams/elf32xstormy16.sh: Likewise.
* emulparams/elf32xtensa.sh: Likewise.
* emulparams/elf64_aix.sh: Likewise.
* emulparams/elf64_ia64.sh: Likewise.
* emulparams/elf64_s390.sh: Likewise.
* emulparams/elf64_sparc.sh: Likewise.
* emulparams/elf64alpha.sh: Likewise.
* emulparams/elf64bpf.sh: Likewise.
* emulparams/elf64hppa.sh: Likewise.
* emulparams/elf64mmix.sh: Likewise.
* emulparams/elf64rdos.sh: Likewise.
* emulparams/elf64tilegx.sh: Likewise.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_i386_be.sh: Likewise.
* emulparams/elf_i386_ldso.sh: Likewise.
* emulparams/elf_i386_vxworks.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_k1om.sh: Likewise.
* emulparams/elf_l1om.sh: Likewise.
* emulparams/elf_s390.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/h8300elf.sh: Likewise.
* emulparams/h8300elf_linux.sh: Likewise.
* emulparams/hppa64linux.sh: Likewise.
* emulparams/hppaelf.sh: Likewise.
* emulparams/hppalinux.sh: Likewise.
* emulparams/i386lynx.sh: Likewise.
* emulparams/i386moss.sh: Likewise.
* emulparams/i386nto.sh: Likewise.
* emulparams/m32relf.sh: Likewise.
* emulparams/m32relf_linux.sh: Likewise.
* emulparams/m68hc11elf.sh: Likewise.
* emulparams/m68hc11elfb.sh: Likewise.
* emulparams/m68hc12elf.sh: Likewise.
* emulparams/m68hc12elfb.sh: Likewise.
* emulparams/m68kelf.sh: Likewise.
* emulparams/mn10300.sh: Likewise.
* emulparams/nds32elf.sh: Likewise.
* emulparams/nds32elf16m.sh: Likewise.
* emulparams/nds32elf_linux.sh: Likewise.
* emulparams/nios2elf.sh: Likewise.
* emulparams/nios2linux.sh: Likewise.
* emulparams/pruelf.sh: Likewise.
* emulparams/score3_elf.sh: Likewise.
* emulparams/shelf.sh: Likewise.
* emulparams/shelf_nto.sh: Likewise.
* emulparams/shelf_vxworks.sh: Likewise.
* emulparams/shlelf_linux.sh: Likewise.
* emulparams/shlelf_nto.sh: Likewise.
* emulparams/v850.sh: Likewise.
* emulparams/v850_rh850.sh: Likewise.
* ldelf.c: Update comment.
* ldelf.h: Likewise.
* emultempl/aarch64elf.em: Likewise.
* emultempl/alphaelf.em: Likewise.
* emultempl/arclinux.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/avrelf.em: Likewise.
* emultempl/bfin.em: Likewise.
* emultempl/cr16elf.em: Likewise.
* emultempl/crxelf.em: Likewise.
* emultempl/cskyelf.em: Likewise.
* emultempl/elf-generic.em: Likewise.
* emultempl/elf-x86.em: Likewise.
* emultempl/epiphanyelf_4x4.em: Likewise.
* emultempl/hppaelf.em: Likewise.
* emultempl/ia64elf.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/m68kelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/mmix-elfnmmo.em: Likewise.
* emultempl/mmixelf.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/needrelax.em: Likewise.
* emultempl/nios2elf.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/pruelf.em: Likewise.
* emultempl/rxelf.em: Likewise.
* emultempl/scoreelf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/tic6xdsbt.em: Likewise.
* emultempl/v850elf.em: Likewise.
* emultempl/vms.em: Likewise.
* emultempl/vxworks.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
* scripttempl/arclinux.sc: Likewise.
* scripttempl/armbpabi.sc: Likewise.
* scripttempl/elf.sc: Likewise.
* scripttempl/elf64bpf.sc: Likewise.
* scripttempl/elf64hppa.sc: Likewise.
* scripttempl/elf_chaos.sc: Likewise.
* scripttempl/elfarc.sc: Likewise.
* scripttempl/elfarcv2.sc: Likewise.
* scripttempl/elfd10v.sc: Likewise.
* scripttempl/elfm68hc11.sc: Likewise.
* scripttempl/elfm68hc12.sc: Likewise.
* scripttempl/elfm9s12z.sc: Likewise.
* scripttempl/elfxgate.sc: Likewise.
* scripttempl/elfxtensa.sc: Likewise.
* scripttempl/epiphany_4x4.sc: Likewise.
* scripttempl/iq2000.sc: Likewise.
* scripttempl/mep.sc: Likewise.
* scripttempl/nds32elf.sc: Likewise.
* scripttempl/v850.sc: Likewise.
* scripttempl/v850_rh850.sc: Likewise.
* scripttempl/xstormy16.sc: Likewise.
* testsuite/ld-arm/arm-dyn.ld: Likewise.
* testsuite/ld-arm/arm-lib.ld: Likewise.
* testsuite/ld-arm/arm-no-rel-plt.ld: Likewise.
* testsuite/ld-arm/fdpic-main.ld: Likewise.
* testsuite/ld-arm/fdpic-shared.ld: Likewise.
* testsuite/ld-elf/elf.exp: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elfvsb/elf-offset.ld: Likewise.
* testsuite/ld-mips-elf/mips-dyn.ld: Likewise.
* testsuite/ld-mips-elf/mips-lib.ld: Likewise.
* testsuite/ld-scripts/dynamic-sections.t: Likewise.
* testsuite/ld-shared/elf-offset.ld: Likewise.
* configure: Regenerate.

4 years agoMove elf32.em and elf-generic.em functions
Alan Modra [Mon, 9 Sep 2019 13:37:35 +0000 (23:07 +0930)] 
Move elf32.em and elf-generic.em functions

Many ELF linker targets support multiple "emulations" and thus have
multiple copies of elf32.em being compiled and linked into ld.  This
patch moves much of elf32.em and elf-generic.em into files which will
be compiled just once, resulting in a 20% decrease in ld size for
--enable-targets=all.

* Makefile.am (ALL_EMUL_EXTRA_OFILES): Add ldelf and ldelfgen.
(CFILES, HFILES, EXTRA_ld_new_SOURCES): Likewise.
* configure.tgt: Formatting.
(targ_extra_ofiles): Init to ldelf.o ldelfgen.o, reset to just
ldelfgen.o for generic ELF targets, and empty for non-ELF.
* emultempl/aarch64elf.em (gldaarch64_layout_sections_again): Use
ldelf_map_segments.
(gld${EMULATION_NAME}_after_allocation): Likewise.
(real_func, aarch64_for_each_input_file_wrapper),
(aarch64_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/alphaelf.em (alpha_after_parse): Use ldelf_map_segments.
* emultempl/armelf.em (gldarm_layout_sections_again): Likewise.
(gld${EMULATION_NAME}_after_allocation): Likewise.
(real_func, arm_for_each_input_file_wrapper),
(arm_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/cr16elf.em (cr16elf_after_parse): Use ldelf_map_segments.
* emultempl/crxelf.em (crxelf_after_parse): Likewise.  Delete
declaration.
* emultempl/cskyelf.em (gldcsky_layout_sections_again): Use
ldelf_map_segments.
(gld${EMULATION_NAME}_after_allocation): Likewise.
(real_func, csky_for_each_input_file_wrapper),
(csky_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/genelf.em: Include ldelfgen.h.
(gld${EMULATION_NAME}_before_allocation): Use ldelf_map_segments.
* emultempl/hppaelf.em (hppaelf_after_parse): Likewise.
(hppaelf_layout_sections_again): Likewise.
(gld${EMULATION_NAME}_after_allocation): Likewise.
(real_func, hppa_for_each_input_file_wrapper),
(hppa_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/ia64elf.em (ia64elf_after_parse): Use ldelf_map_segments.
* emultempl/m68hc1xelf.em (real_func),
(m68hc11_for_each_input_file_wrapper),
(m68hc11_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/metagelf.em (metagelf_layout_sections_again): Use
ldelf_map_segments.
(gld${EMULATION_NAME}_after_allocation): Likewise.
(real_func, metag_for_each_input_file_wrapper),
(metag_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/mipself.em (real_func),
(mips_for_each_input_file_wrapper),
(mips_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/mmo.em: Don't include elf-bfd.h, do include ldelfgen.h.
(gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments.
* emultempl/nds32elf.em (nds32_elf_after_parse): Use ldelf_after_parse.
(nds32_elf_after_allocation): Comment fix.
* emultempl/nios2elf.em (nios2elf_layout_sections_again): Use
ldelf_map_segments.
(gld${EMULATION_NAME}_after_allocation): Likewise.
(real_func, nios2_for_each_input_file_wrapper),
(nios2_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
* emultempl/ppc32elf.em (gld${EMULATION_NAME}_load_symbols): Delete
declaration.
(ppc_recognized_file): Call ldelf_load_symbols.
* emultempl/ppc64elf.em (ppc_layout_sections_again): Likewise.
(gld${EMULATION_NAME}_after_allocation): Likewise.
(real_func, ppc_for_each_input_file_wrapper),
(ppc_lang_for_each_input_file): Delete.
(lang_for_each_input_file): Don't define.
(gld${EMULATION_NAME}_load_symbols): Don't declare.
(ppc64_recognized_file): Call ldelf_load_symbols.
* emultempl/riscvelf.em (gld${EMULATION_NAME}_after_allocation):
Use ldelf_map_segments.
* emultempl/spuelf.em (spu_place_special_section): Use
ldelf_place_orphan.
* emultempl/tic6xdsbt.em (gld${EMULATION_NAME}_after_allocation):
Use ldelf_map_segments.
* emultempl/vms.em: Include ldelfgen.h.
(gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments.
* emultempl/elf32.em: Remove unnecessary headers, include ldelf.h
and ldelfgen.h.  Move much of file content to..
* ldelf.c: ..here.  New file.
* ldelf.h: New file.
* emultempl/elf-generic.em: Move gld${EMULATION_NAME}_map_segments..
* ldelfgen.c: ..to here.
* ldelfgen.h: New file.
* ldlang.c (lang_for_each_input_file): Adjust to only call func
on real files.
(lang_for_each_file): Likewise.
* po/SRC-POTFILES.in: Regenerate.
* Makefile.in: Regenerate.

4 years agoTidy ld/ldmisc.c
Alan Modra [Mon, 9 Sep 2019 05:53:27 +0000 (15:23 +0930)] 
Tidy ld/ldmisc.c

The idea here is to not use elf-bfd.h and coff-bfd.h in generic linker
code.

bfd/
* targets.c (struct bfd_target): Add _bfd_group_name.
(BFD_JUMP_TABLE): Likewise.
* coffgen.c (bfd_coff_group_name): New function.
* elf.c (bfd_elf_group_name): New function.
* linker.c (_bfd_nolink_bfd_group_name): New function.
* section.c (bfd_generic_group_name): New function.
* elf-bfd.h (bfd_elf_group_name): Declare.
* libbfd-in.h (_bfd_nolink_bfd_group_name): Declare.
* libcoff-in.h (bfd_coff_group_name): Declare.
* aout-target.h (MY_bfd_group_name): Define.
* aout-tic30.c (MY_bfd_group_name): Define.
* bfd.c (bfd_group_name): Define.
* binary.c (binary_bfd_group_name): Define.
* coff-alpha.c (_bfd_ecoff_bfd_group_name): Define.
* coff-mips.c (_bfd_ecoff_bfd_group_name): Define.
* coff-rs6000.c (_bfd_xcoff_bfd_group_name): Define.
* coffcode.h (coff_bfd_group_name): Define.
* elfxx-target.h (bfd_elfNN_bfd_group_name): Define.
* i386msdos.c (msdos_bfd_group_name): Define.
* ihex.c (ihex_bfd_group_name): Define.
* mach-o-target.c (bfd_mach_o_bfd_group_name): Define.
* mmo.c (mmo_bfd_group_name): Define.
* pef.c (bfd_pef_bfd_group_name): Define.
* plugin.c (bfd_plugin_bfd_group_name): Define.
* ppcboot.c (ppcboot_bfd_group_name): Define.
* som.c (som_bfd_group_name): Define.
* srec.c (srec_bfd_group_name): Define.
* tekhex.c (tekhex_bfd_group_name): Define.
* verilog.c (verilog_bfd_group_name): Define.
* vms-alpha.c (vms_bfd_group_name, alpha_vms_bfd_group_name): Define.
* xsym.c (bfd_sym_bfd_group_name): Define.
* coff64-rs6000.c (rs6000_xcoff64_vec): Init new field.
(rs6000_xcoff64_aix_vec): Likewise.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
ld/
* ldmisc.c: Don't #include elf-bfd.h or coff-bfd.h.
(vfinfo): Use bfd_group_name.

4 years agoTidy ld/plugin.c
Alan Modra [Mon, 9 Sep 2019 04:59:39 +0000 (14:29 +0930)] 
Tidy ld/plugin.c

* plugin.c (asymbol_from_plugin_symbol): Move code handling
ELF common symbols to block handling ELF visibility.  Simplify
visibility setting.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Sep 2019 00:00:19 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoUse the correct alias for the M68K tdiv instruction.
Miod Vallat [Tue, 10 Sep 2019 16:17:01 +0000 (17:17 +0100)] 
Use the correct alias for the M68K tdiv instruction.

PR 24982
* m68k-opc.c: Correct aliases for tdivsl and tdivul.

4 years agoUpdate "save gdb-index" documentation
Tom Tromey [Wed, 31 Jul 2019 20:08:05 +0000 (14:08 -0600)] 
Update "save gdb-index" documentation

This updates the "save gdb-index" documentation to reflect the new
state of Ada support.  It also corrects an existing grammatical error.

gdb/doc/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* gdb.texinfo (Index Files): Update Ada text.

4 years agoAdd Ada support to cc-with-tweaks.exp
Tom Tromey [Tue, 9 Jul 2019 19:51:26 +0000 (13:51 -0600)] 
Add Ada support to cc-with-tweaks.exp

This adds Ada support to the cc-with-tweaks.exp board file, so that we
can test Ada this way.  The cc-with-tweaks.sh script already works
reasonably well as a wrapper for gnatmake.

gdb/testsuite/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* boards/cc-with-tweaks.exp: Set GNATMAKE_FOR_TARGET.

4 years agoAdd Ada support for .debug_names
Tom Tromey [Mon, 8 Jul 2019 12:23:16 +0000 (06:23 -0600)] 
Add Ada support for .debug_names

This patch adds support for Ada to .debug_names.  I opted to leave
.gdb_index alone, because in my view it is a defunct format.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* dwarf-index-write.c (write_psymbols): Extend error message.
(debug_names::insert): Add Ada code.
(debug_names::write_psymbols): Remove Ada check.
(debug_names) <m_string_obstack>: New member.
* dwarf2read.c (gdb_index_symbol_name_matcher): Remove.
(gdb_index_symbol_name_matcher::matches): Remove.
(mapped_index_base::find_name_components_bounds): Add "lang"
parameter.
(mapped_index_base::build_name_components): Also split names
according to Ada syntax.
(dw2_expand_symtabs_matching_symbol): Loop over languages.  Change
type of "match_callback".
(check_match, check_find_bounds_finds)
(dw2_expand_symtabs_matching): Update.
(dw2_debug_names_iterator): Add new constructor.
(dw2_debug_names_map_matching_symbols): New function.
(dw2_debug_names_expand_symtabs_matching): Update.
(dwarf2_debug_names_functions): Use
dw2_debug_names_map_matching_symbols.

4 years agoFix latent bug in .debug_names file-name handling
Tom Tromey [Thu, 18 Jul 2019 18:27:16 +0000 (12:27 -0600)] 
Fix latent bug in .debug_names file-name handling

An internal Ada test case showed that the .debug_names code does not
compute the same list of file names as the partial symbol reader.  In
particular, the partial symbol reader uses the DW_AT_name of the CU:

  /* Allocate a new partial symbol table structure.  */
  filename = dwarf2_string_attr (comp_unit_die, DW_AT_name, cu);
  if (filename == NULL)
    filename = "";

  pst = create_partial_symtab (per_cu, filename);

This patch changes the .debug_names reader to follow.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (dw2_get_file_names_reader): Add the
CU's file name to the results.

gdb/testsuite/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* gdb.ada/dgopt.exp: New file.
* gdb.ada/dgopt/x.adb: New file.

4 years agoChange map_matching_symbols to take a lookup_name_info
Tom Tromey [Fri, 12 Jul 2019 19:34:52 +0000 (13:34 -0600)] 
Change map_matching_symbols to take a lookup_name_info

This patch further simplifies the map_matching_symbols callback, by
having it take a lookup_name_info rather than a plain string.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (add_nonlocal_symbols): Combine calls to
map_matching_symbols.  Update.
* dwarf2read.c (dw2_map_matching_symbols): Update.
* psymtab.c (match_partial_symbol): Change type; update.
(psym_map_matching_symbols): Likewise.
* symfile-debug.c (debug_qf_map_matching_symbols): Change
type; update.
* symfile.h (struct quick_symbol_functions)
<map_matching_symbols>: Change "name" to be a lookup_name_info.
Remove "match".

4 years agoSimplify psym_map_matching_symbols
Tom Tromey [Fri, 12 Jul 2019 17:00:39 +0000 (11:00 -0600)] 
Simplify psym_map_matching_symbols

This introduces a new helper function,
iterate_over_symbols_terminated, and changes psym_map_matching_symbols
to use it.  A subsequent patch will introduce a new user of this
function in the DWARF reader.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* psymtab.c (map_block): Remove.
(psym_map_matching_symbols): Use iterate_over_symbols_terminated.
* symtab.c (iterate_over_symbols_terminated): New function.
* symtab.c (iterate_over_symbols_terminated): Declare.

4 years agoChange iterate_over_symbols to return bool
Tom Tromey [Fri, 12 Jul 2019 16:47:21 +0000 (10:47 -0600)] 
Change iterate_over_symbols to return bool

This changes iterate_over_symbols to return a bool.  This allows it to
be reused in another context in a subsequent patch.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (ada_iterate_over_symbols): Return bool.
* language.h (struct language_defn) <la_iterate_over_symbols>:
Return bool.
* symtab.c (iterate_over_symbols): Return bool.
* symtab.h (iterate_over_symbols): Return bool.

4 years agoChange map_matching_symbols to take a symbol_found_callback_ftype
Tom Tromey [Fri, 12 Jul 2019 16:45:34 +0000 (10:45 -0600)] 
Change map_matching_symbols to take a symbol_found_callback_ftype

This changes map_matching_symbols to take a
symbol_found_callback_ftype, rather than separate callback and data
parameters.  This enables a future patch to clean up some existing
code so that it can more readily be shared.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (aux_add_nonlocal_symbols): Change type.
(add_nonlocal_symbols): Update.
* dwarf2read.c (dw2_map_matching_symbols): Change type.
* psymtab.c (map_block, psym_map_matching_symbols): Change type.
* symfile-debug.c (debug_qf_map_matching_symbols): Change type.
* symfile.h (struct quick_symbol_functions) <map_matching_symbols>:
Change type of "callback".  Remove "data".

4 years agoEnhance the disassembler so that it will reliably determine whether a reloc applies...
Nick Clifton [Tue, 10 Sep 2019 14:20:58 +0000 (15:20 +0100)] 
Enhance the disassembler so that it will reliably determine whether a reloc applies to the middle of the next insn.

PR 24907
binutils* objdump.c (null_print): New function.
(disassemble_bytes): Delete previous_octets local and replace with
a test of the max_reloc_offset_into_insn field of the
bfd_arch_info structure.  If a reloc is a potential match for the
next insn, then perform a dummy disassembly in order to calculate
its real length.

bfd * archures.c (bfd_arch_info_type): Add max_reloc_offset_into_insn
field.
(bfd_default_arch_struct): Initialise the new field.
* bfd-in2.h: Regenerate.
* cpu-aarch64.c: Initialise the new field.
* cpu-alpha.c: Likewise.
* cpu-arc.c: Likewise.
* cpu-arm.c: Likewise.
* cpu-avr.c: Likewise.
* cpu-bfin.c: Likewise.
* cpu-bpf.c: Likewise.
* cpu-cr16.c: Likewise.
* cpu-cr16c.c: Likewise.
* cpu-cris.c: Likewise.
* cpu-crx.c: Likewise.
* cpu-csky.c: Likewise.
* cpu-d10v.c: Likewise.
* cpu-d30v.c: Likewise.
* cpu-dlx.c: Likewise.
* cpu-epiphany.c: Likewise.
* cpu-fr30.c: Likewise.
* cpu-frv.c: Likewise.
* cpu-ft32.c: Likewise.
* cpu-h8300.c: Likewise.
* cpu-hppa.c: Likewise.
* cpu-i386.c: Likewise.
* cpu-ia64.c: Likewise.
* cpu-iamcu.c: Likewise.
* cpu-ip2k.c: Likewise.
* cpu-iq2000.c: Likewise.
* cpu-k1om.c: Likewise.
* cpu-l1om.c: Likewise.
* cpu-lm32.c: Likewise.
* cpu-m10200.c: Likewise.
* cpu-m10300.c: Likewise.
* cpu-m32c.c: Likewise.
* cpu-m32r.c: Likewise.
* cpu-m68hc11.c: Likewise.
* cpu-m68hc12.c: Likewise.
* cpu-m68k.c: Likewise.
* cpu-m9s12x.c: Likewise.
* cpu-m9s12xg.c: Likewise.
* cpu-mcore.c: Likewise.
* cpu-mep.c: Likewise.
* cpu-metag.c: Likewise.
* cpu-microblaze.c: Likewise.
* cpu-mips.c: Likewise.
* cpu-mmix.c: Likewise.
* cpu-moxie.c: Likewise.
* cpu-msp430.c: Likewise.
* cpu-mt.c: Likewise.
* cpu-nds32.c: Likewise.
* cpu-nfp.c: Likewise.
* cpu-nios2.c: Likewise.
* cpu-ns32k.c: Likewise.
* cpu-or1k.c: Likewise.
* cpu-pdp11.c: Likewise.
* cpu-pj.c: Likewise.
* cpu-plugin.c: Likewise.
* cpu-powerpc.c: Likewise.
* cpu-pru.c: Likewise.
* cpu-riscv.c: Likewise.
* cpu-rl78.c: Likewise.
* cpu-rs6000.c: Likewise.
* cpu-rx.c: Likewise.
* cpu-s12z.c: Likewise.
* cpu-s390.c: Likewise.
* cpu-score.c: Likewise.
* cpu-sh.c: Likewise.
* cpu-sparc.c: Likewise.
* cpu-spu.c: Likewise.
* cpu-tic30.c: Likewise.
* cpu-tic4x.c: Likewise.
* cpu-tic54x.c: Likewise.
* cpu-tic6x.c: Likewise.
* cpu-tic80.c: Likewise.
* cpu-tilegx.c: Likewise.
* cpu-tilepro.c: Likewise.
* cpu-v850.c: Likewise.
* cpu-v850_rh850.c: Likewise.
* cpu-vax.c: Likewise.
* cpu-visium.c: Likewise.
* cpu-wasm32.c: Likewise.
* cpu-xc16x.c: Likewise.
* cpu-xgate.c: Likewise.
* cpu-xstormy16.c: Likewise.
* cpu-xtensa.c: Likewise.
* cpu-z80.c: Likewise.
* cpu-z8k.c: Likewise.

gas * testsuite/gas/arm/pr24907.s: New test.
* testsuite/gas/arm/pr24907.d: Expected disassembly.

4 years ago[PATCH][ARM][GAS]: Support to MVE VCTP instruction.
Srinath Parvathaneni [Tue, 10 Sep 2019 10:44:37 +0000 (11:44 +0100)] 
[PATCH][ARM][GAS]: Support to MVE VCTP instruction.

This patch adds support for MVE VCTP instruction in assembler.

gas ChangeLog:

2019-09-10  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

        * config/tc-arm.c (M_MNEM_vctp): Add new Mnemonic.
        (do_mve_vctp): Add function to encode VCTP instruction.
        * testsuite/gas/arm/mve-vctp-bad.d: New test.
        * testsuite/gas/arm/mve-vctp-bad.l: Likewise.
        * testsuite/gas/arm/mve-vctp-bad.s: Likewise.
        * testsuite/gas/arm/mve-vctp.d: Likewise.
        * testsuite/gas/arm/mve-vctp.s: Likewise.

4 years agoDWARF 5 support: Handle dwo_id
Ali Tamur [Tue, 27 Aug 2019 00:53:24 +0000 (17:53 -0700)] 
DWARF 5 support: Handle dwo_id

* DW_UT_skeleton and DW_UT_split_compile compilation units have dwo ids
to match the compilation unit in the skeleton and .dwo files. The dwo_id is
in the header.

Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with
-gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of
tests that fails.

This is part of an effort to support DWARF 5 in gdb.

gdb/ChangeLog:

        * dwarf2read.c (comp_unit_head): Update comment.
        (dwarf2_dwo_name): New function declaration.
        (dwarf_unit_type_name): New function declaration.
        (read_comp_unit_head): Add support for new compilation units,
        DW_UT_partial, DW_UT_skeleton, DW_UT_split_compile, DW_UT_split_type.
        Particularly, DW_UT_skeleton and DW_UT_split_compile have dwo_id
        (currently named as "signature") in their header. Also clarify error
        messages.
        (lookup_dwo_id): New function. Returns the dwo id of the given
        compile unit.
        (lookup_dwo_unit): Use the new lookup_dwo_id function.
        (init_cutu_and_read_dies): Use the new dwarf2_dwo_name and lookup_dwo_id
        functions.
        (create_dwo_cu_reader): Use the added lookup_dwo_id function.
        (dwarf2_dwo_name): Get the dwo name if present.
        (dwarf_unit_type_name): Convert DW_UT_* types to string for diagnostic
        purposes.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Sep 2019 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoUse ui_out for "info win"
Tom Tromey [Thu, 18 Jul 2019 20:53:42 +0000 (14:53 -0600)] 
Use ui_out for "info win"

This changes the "info win" command to use ui-out.  This yields
somewhat nicer table output.

gdb/ChangeLog
2019-09-09  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_all_windows_info): Use ui_out.

4 years agoFix leak detected in python.c initialization code.
Philippe Waroquiers [Sat, 7 Sep 2019 18:54:44 +0000 (20:54 +0200)] 
Fix leak detected in python.c initialization code.

Valgrind reports the below leak.
Make the variable progname_copy static, so that Valgrind continues
to find a pointer to the memory given to Python.
Note that the comment in do_start_initialization and the Python documentation
indicates that the progname given to Py_SetProgramName cannot be freed.
However, in Python 3.7.4, Py_SetProgramName does:
void
Py_SetProgramName(const wchar_t *program_name)
{
    ...
    PyMem_RawFree(_Py_path_config.program_name);
    _Py_path_config.program_name = _PyMem_RawWcsdup(program_name);

So, it looks like 3.7.4 Python duplicates its argument, which explains
the leak found by Valgrind.
It looks better to respect the doc and not have GDB freeing the string
given to Py_SetProgramName, and avoid the leak error by declaring
the progname_copy static.
This will work with Python versions that really use this string without
duplicating it, and avoids a leak report for Python version that duplicates
it.

==4023== 200 bytes in 1 blocks are definitely lost in loss record 4,545 of 7,116^M
==4023==    at 0x4C29F33: malloc (vg_replace_malloc.c:307)^M
==4023==    by 0x446D27: xmalloc (alloc.c:60)^M
==4023==    by 0x657C77: do_start_initialization (python.c:1610)^M
==4023==    by 0x657C77: _initialize_python() (python.c:1823)^M
==4023==    by 0x75FE24: initialize_all_files() (init.c:231)^M
==4023==    by 0x708A94: gdb_init(char*) (top.c:2242)^M
==4023==    by 0x5E7460: captured_main_1 (main.c:857)^M
==4023==    by 0x5E7460: captured_main (main.c:1161)^M
==4023==    by 0x5E7460: gdb_main(captured_main_args*) (main.c:1186)^M
==4023==    by 0x4122D4: main (gdb.c:32)^M

gdb/ChangeLog
2019-09-09  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* python/python.c (do_start_initialization): Make progname_copy static,
to avoid a leak report.

4 years agoi386: Adjust for new output format from readelf
H.J. Lu [Mon, 9 Sep 2019 16:21:36 +0000 (09:21 -0700)] 
i386: Adjust for new output format from readelf

PR binutils/24887
* testsuite/ld-i386/property-1.r: Adjust for new output format
from readelf.
* testsuite/ld-i386/property-1a.r: Likewise.
* testsuite/ld-i386/property-2.r: Likewise.
* testsuite/ld-i386/property-2a.r: Likewise.
* testsuite/ld-i386/property-3.r: Likewise.
* testsuite/ld-i386/property-3a.r: Likewise.
* testsuite/ld-i386/property-4.r: Likewise.
* testsuite/ld-i386/property-4a.r: Likewise.
* testsuite/ld-i386/property-5.r: Likewise.
* testsuite/ld-i386/property-5a.r: Likewise.
* testsuite/ld-i386/property-6.r: Likewise.
* testsuite/ld-i386/property-7.r: Likewise.
* testsuite/ld-i386/property-7a.r: Likewise.
* testsuite/ld-i386/property-1.r: Likewise.
* testsuite/ld-i386/property-1a.r: Likewise.
* testsuite/ld-i386/property-2.r: Likewise.
* testsuite/ld-i386/property-2a.r: Likewise.
* testsuite/ld-i386/property-3.r: Likewise.
* testsuite/ld-i386/property-3a.r: Likewise.
* testsuite/ld-i386/property-4.r: Likewise.
* testsuite/ld-i386/property-4a.r: Likewise.
* testsuite/ld-i386/property-5.r: Likewise.
* testsuite/ld-i386/property-5a.r: Likewise.
* testsuite/ld-i386/property-6.r: Likewise.
* testsuite/ld-i386/property-7.r: Likewise.
* testsuite/ld-i386/property-7a.r: Likewise.

4 years agoAdd markers for 2.33 branch to NEWS and ChangeLog files.
Phil Blundell [Mon, 9 Sep 2019 09:27:03 +0000 (10:27 +0100)] 
Add markers for 2.33 branch to NEWS and ChangeLog files.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Sep 2019 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoTruncate long TUI window titles
Tom Tromey [Thu, 18 Jul 2019 21:07:01 +0000 (15:07 -0600)] 
Truncate long TUI window titles

If a TUI window has a long title, it can overflow the title line.
This changes the TUI to use just the tail part of the title in this
case.

gdb/ChangeLog
2019-09-08  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (box_win): Truncate long window titles.

gdb/testsuite/ChangeLog
2019-09-08  Tom Tromey  <tom@tromey.com>

* gdb.tui/resize.exp: Remove setup_xfail.
* gdb.tui/regs.exp: Remove setup_xfail.
* gdb.tui/basic.exp: Remove setup_xfail.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Sep 2019 00:01:06 +0000 (00:01 +0000)] 
Automatic date update in version.in

4 years agoChange lookup_symbol's block_index parameter type to block_enum
Simon Marchi [Sat, 7 Sep 2019 16:03:56 +0000 (12:03 -0400)] 
Change lookup_symbol's block_index parameter type to block_enum

The only two values valid to pass to the block_index parameter of
quick_symbol_functions::lookup_symbol are GLOBAL_BLOCK and STATIC_BLOCK,
part of enum block_enum.  Change the type of that parameter to
block_enum.

Change also the block_index field of dw2_symtab_iterator in the same
way..  This makes it consistent with dw2_debug_names_iterator, which
already uses block_enum for its block_index field.

This is a follow-up to this thread:

https://sourceware.org/ml/gdb-patches/2019-08/msg00097.html

gdb/ChangeLog:

* dwarf2read.c (struct dw2_symtab_iterator) <block_index>:
Change type to gdb::optional<block_enum>.
(dw2_symtab_iter_init): Change block_index parameter type
to gdb::optional<block_enum>.
(dw2_lookup_symbol): Change block_index parameter
type to block_enum.c
(dw2_debug_names_lookup_symbol): Likewise.
* psymtab.c (psym_lookup_symbol): Likewise.
* symfile-debug.c (debug_qf_lookup_symbol): Likewise.
* symfile.h (struct quick_symbol_functions) <lookup_symbol>:
Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Sep 2019 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoun-XFAIL under Clang tests using labels
David Blaikie [Thu, 5 Sep 2019 22:01:25 +0000 (15:01 -0700)] 
un-XFAIL under Clang tests using labels

gdb/testsuite/
* gdb.base/label.exp: un-XFAIL label related tests under Clang.
* gdb.cp/cplabel.exp: Ditto.
* gdb.linespec/ls-errs.exp: Ditto.

4 years agoChange int to bool for the relocate_* functions
Christian Biesinger [Fri, 6 Sep 2019 19:19:40 +0000 (14:19 -0500)] 
Change int to bool for the relocate_* functions

These parameters are only used as bools. This also
renames "flag" to "relocatable" to make it clearer
what it does.

gdb/ChangeLog:

2019-09-06  Christian Biesinger  <cbiesinger@google.com>

* defs.h (relocate_gdb_directory): Change int to bool in
signature and rename flag to relocatable.
* main.c (relocate_path): Likewise.
(relocate_gdb_directory): Likewise.

4 years agobeos.em qsort predicate tidy
Alan Modra [Fri, 6 Sep 2019 02:53:41 +0000 (12:23 +0930)] 
beos.em qsort predicate tidy

lang_input_section_type** is better than lang_statement_union_type**
here since that is in fact the type passed to the qsort predicate,
and I think it's worth factoring out the common indirections.

* emultempl/beos.em (sort_by_file_name): Use appropriate
intermediary variables.
(sort_by_section_name): Likewise.

4 years agobfd_get_filename
Alan Modra [Fri, 6 Sep 2019 02:37:05 +0000 (12:07 +0930)] 
bfd_get_filename

This macro says:
/* Cast from const char * to char * so that caller can assign to
   a char * without a warning.  */

I reckon that isn't such a good idea since it can result in char*
variables where const char* is appropriate.  Not very many places
need the char* cast.

bfd/
* aout-target.h (object_p): Formatting.
* bfd-in.h (bfd_get_filename): Don't cast to char*.
* corefile.c (generic_core_file_matches_executable_p): Constify
variables and remove cast.
* bfd-in2.h: Regenerate.
binutils/
* nm.c (print_object_filename_bsd, print_object_filename_sysv),
(print_object_filename_posix, print_archive_filename_bsd),
(print_archive_filename_sysv, print_archive_filename_posix),
(print_archive_member_bsd, print_archive_member_sysv),
(print_archive_member_posix): Constify parameter.
(struct output_fns <print_object_filename, print_archive_filename>),
(<print_archive_member>): Likewise.
* objcopy.c (copy_archive): Add cast for make_tempdir.
ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify
variable.
* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
gdb/
* coffread.c (coff_symfile_read): Constify filename variable.
* dbxread.c (dbx_symfile_init, coffstab_build_psymtabs),
(elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise.
* gdb_bfd.c (gdb_bfd_close_or_warn): Likewise.
* solib.c (reload_shared_libraries_1): Likewise.
* symfile.c (reread_symbols): Likewise.
* solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename.
* solib-darwin.c (darwin_bfd_open): Likewise.
* symfile-mem.c (symbol_file_add_from_memory): Likewise.
sim/cris/
* sim-if.c (sim_open): Constify filename variable.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 6 Sep 2019 00:00:19 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoFix PR ld/24574
Eric Botcazou [Thu, 5 Sep 2019 16:23:37 +0000 (18:23 +0200)] 
Fix PR ld/24574

This restores a line that has been dropped when the auto-import feature
of the PE-COFF linker was overhauled about one year.  It is necessary
for GDB to properly resolve extern symbol in DLLs.

ld/ChangeLog
* pe-dll.c (pe_find_data_imports): Replace again the original name
of the undefined symbol with the __imp_ prefixed one after it is
resolved.

This page took 0.063341 seconds and 4 git commands to generate.