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.
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.
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.
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.
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.
GDB Administrator [Thu, 12 Sep 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
GDB Administrator [Wed, 11 Sep 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
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.
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.
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.
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.
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.
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".
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.
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.
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".
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.
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.
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.
GDB Administrator [Tue, 10 Sep 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
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.
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.
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.
Phil Blundell [Mon, 9 Sep 2019 09:27:03 +0000 (10:27 +0100)]
Add markers for 2.33 branch to NEWS and ChangeLog files.
GDB Administrator [Mon, 9 Sep 2019 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
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.
GDB Administrator [Sun, 8 Sep 2019 00:01:06 +0000 (00:01 +0000)]
Automatic date update in version.in
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.
GDB Administrator [Sat, 7 Sep 2019 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
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.
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.
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.
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.
GDB Administrator [Fri, 6 Sep 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
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.
Tom de Vries [Thu, 5 Sep 2019 12:33:10 +0000 (14:33 +0200)]
[gdb/testsuite] Restore breakpoint command in ui-redirect.exp
In gdb.base/ui-redirect.exp, the "save breakpoint" command is used to write
the current breakpoints to a file, but the actual output is not verified.
Consequently, the test has regressed in that the "print 1" command associated
with a breakpoint on main is removed by a subsequent runto_main, which first
deletes all breakpoints:
...
(gdb) break main
Breakpoint 1 at 0x4004d7: file start.c, line 34.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
> PASS: gdb.base/ui-redirect.exp: commands
print 1
> PASS: gdb.base/ui-redirect.exp: print 1
end
(gdb) PASS: gdb.base/ui-redirect.exp: end
delete breakpoints
Delete all breakpoints? (y or n) y
...
and consequently the "save breakpoint" output is missing the breakpoint
command for main:
...
break main
- commands
- print 1
- end
break foo
break bar
...
Fix this by replacing "gdb_breakpoint main" with runto_main, and verifying the
"save breakpoints" output.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-05 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (cmp_file_string): New proc.
* gdb.base/ui-redirect.exp: Replace "gdb_breakpoint main" with
runto_main. Verify save breakpoints output.
Alan Modra [Thu, 5 Sep 2019 06:20:35 +0000 (15:50 +0930)]
PowerPC warning on symbol+offset@got
* config/tc-ppc.c (ppc_elf_suffix): Display the relocation
operator on GOT reloc warnings/errors.
Alan Modra [Thu, 5 Sep 2019 00:36:42 +0000 (10:06 +0930)]
PowerPC64 GOT_PCREL relocs
PC-relative relocs typically use the addend in adjusting what they are
relative to. For example:
bcl 20,31,1f
1: mflr 12
addi 12,12,xxx-1b
generates "R_PPC64_REL16 xxx+0x4" for the addi (when little-endian).
The addend reflects the fact that you want the offset relative to the
previous insn not the current one in this case.
So the question is, will we ever want to do something like that for an
instruction using R_PPC64_GOT_PCREL34? I thought so at the time I
first implemented support in ld but at the time I think the hardware
was possibly going to support pcrel+offset+reg addressing. In which
case you might want something like:
load_big_offset_into_r2
pld 3,sym-big_offset@got@pcrel(2)
which would be a way of supporting more than 8G offsets from code to
the GOT. We could do the same with
load_big_offset_into_r2
pla 9,sym-big_offset@got@pcrel
ldx 3,9,2
However, this is really a poor version of TOC-pointer relative code.
So let's go with an addend on R_PPC64_GOT_PCREL34 meaning that
sym+addend should be put in a GOT entry, and the relocation calculate
the pc-relative offset to that GOT entry.
Note that this is an extension to the ABI, which says (by the
expression given for GOT relocs) that non-zero addends on GOT and PLT
relocs are ignored. This is true for all GOT/PLT relocs, not just the
pcrel ones.
* elf64-ppc.c (ppc64_elf_check_relocs): Interpret an addend in
GOT_PCREL and PLT_PCREL relocs as affecting the value stored
in the GOT/PLT entry rather than affecting the offset to that
GOI/PLT entry.
(ppc64_elf_edit_toc, ppc64_elf_relocate_section): Likewise.
Alan Modra [Wed, 4 Sep 2019 06:00:37 +0000 (15:30 +0930)]
R_PPC64_PCREL_OPT
The loads and stores handled in the second instruction of a sequence
marked by R_PPC64_PCREL_OPT may be a prefix instruction. For example:
pld ra,symbol@got@pcrel
0:
pld rt,off(ra)
.reloc 0b-8,R_PPC64_PCREL_OPT,(.-8)-(0b-8)
can be optimised to
pld rt,symbol+off@pcrel
pnop
* elf64-ppc.c (xlate_pcrel_opt): Handle prefix loads and stores
in second instruction.
(ppc64_elf_relocate_section): Likewise.
Alan Modra [Mon, 2 Sep 2019 06:43:05 +0000 (16:13 +0930)]
PR24955, libbfd terminating program on out of memory
This patch fixes the worst of the cases where libbfd might terminate
a program due to calling xstrdup or xmalloc. I've also fixed some
error paths that didn't clean up properly.
PR 24955
* libbfd-in.h (bfd_strdup): New inline function.
* archive.c (_bfd_get_elt_at_filepos): Use bfd_strdup. Close
bfd on error.
* elfcode.h (_bfd_elf_bfd_from_remote_memory): Use bfd_strdup.
* opncls.c (bfd_fopen): Use bfd_strdup. Close fd and stream
on error.
(bfd_openstreamr): Use bfd_strdup.
(bfd_openr_iovec, bfd_openw, bfd_create): Likewise.
* plugin.c (try_load_plugin): Use bfd_malloc.
* libbfd.h: Regenerate.
GDB Administrator [Thu, 5 Sep 2019 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Sat, 31 Aug 2019 15:25:54 +0000 (17:25 +0200)]
Avoid expect's buffer overflow in info-var.exp test.
Once the executable is started, info variables can show thousands
of variables belonging to glibc (see below).
This long list of variables then causes the test to fail, due
to expect's buffer overflow:
Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ...
ERROR: internal buffer is full.
ERROR: internal buffer is full.
ERROR: internal buffer is full.
Fix this by testing 'info variables' without running the executable.
gdb ./info-var
...
Reading symbols from ./info-var...
(gdb) |info variables|wc
27 54 971
(gdb) start
Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23.
Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var
Temporary breakpoint 1, main ()
at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23
23 return global_var + get_offset() + f1_var;
(gdb) |info variables|wc
4334 14581 130738
(gdb)
gdb/testsuite/ChangeLog
2019-09-04 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/info-var.exp: Test info variables without running
to main, to avoid expect's buffer overflow.
GDB Administrator [Wed, 4 Sep 2019 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Tue, 3 Sep 2019 14:54:57 +0000 (15:54 +0100)]
gdb: Handle missing domain types in: maintenance print psymbols
Some domain_enum values were not handled in print_partial_symbols
which means that 'maintenance print psymbols' would print '<invalid
domain>' when it shouldn't have.
gdb/ChangeLog:
* psymtab.c (print_partial_symbols): Handle missing domain_enum
values MODULE_DOMAIN and COMMON_BLOCK_DOMAIN.
Tom Tromey [Mon, 13 May 2019 19:21:48 +0000 (13:21 -0600)]
Handle biased types
In Ada, the programmer can request that a range type with a non-zero
base be stored in the minimal number of bits required for the range.
This is done by biasing the values; so, for example, a range of -7..-4
may be stored as two bits with a bias of -7.
This patch implements this for gdb. It is done by adding a bias to
struct range_bounds and then adjusting a few spots to handle this.
The test case is written to use -fgnat-encodings=minimal, but a future
compiler patch will change the compiler to emit DW_AT_GNU_bias with
-fgnat-encodings=gdb. It seemed good to get the gdb patch in first.
Tested on x86-64 Fedora 29; plus a variety of targets using AdaCore's
internal test suite.
gdb/ChangeLog
2019-09-03 Tom Tromey <tromey@adacore.com>
* ada-valprint.c (ada_val_print_num): Don't recurse for range
types.
(has_negatives): Unbias a range type bound.
* dwarf2read.c (read_subrange_type): Handle DW_AT_GNU_bias.
* gdbtypes.c (operator==): Handle new field.
(create_range_type): Add "bias" parameter.
(create_static_range_type, resolve_dynamic_range): Update.
* gdbtypes.h (struct range_bounds) <bias>: New member.
(create_range_type): Add bias parameter.
* printcmd.c (print_scalar_formatted): Unbias range types.
* value.c (unpack_long): Unbias range types.
(pack_long): Bias range types.
gdb/testsuite/ChangeLog
2019-09-03 Tom Tromey <tromey@adacore.com>
* gdb.ada/bias.exp: New file.
* gdb.ada/bias/bias.adb: New file.
* gdb.ada/print_chars.exp: Add regression test.
* gdb.ada/print_chars/foo.adb (My_Character): New type.
(MC): New variable.
Nick Clifton [Tue, 3 Sep 2019 14:37:12 +0000 (15:37 +0100)]
Fix buffer underrun bug in the TI C30 disassembler.
PR 24961
* tic30-dis.c (get_indirect_operand): Check for bufcnt being
greater than zero before indexing via (bufcnt -1).
Nick Clifton [Tue, 3 Sep 2019 08:53:25 +0000 (09:53 +0100)]
Fix a potential buffer overrun in the MMIX disassembler when processing a corrupt input file.
PR 24958
* mmix-dis.c (MAX_REG_NAME_LEN): Define.
(MAX_SPEC_REG_NAME_LEN): Define.
(struct mmix_dis_info): Use defined constants for array lengths.
(get_reg_name): New function.
(get_sprec_reg_name): New function.
(print_insn_mmix): Use new functions.
GDB Administrator [Tue, 3 Sep 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Hayward [Wed, 21 Aug 2019 14:36:37 +0000 (15:36 +0100)]
Check arguments for all probes before using them
There is a long standing bug in the Arm toolchain where invalid
stap probes get created due to the probes referring to symbols which
have been resolved away.
More details are here:
https://bugzilla.redhat.com/show_bug.cgi?id=
1196181
When these invalid probes are present, GDB will create the breakpoints
and then fail to stop. The errors are only spotted the first time
GDB stops, which is too late.
The solution is to ensure the arguments for all the probes are
resolved before using them.
This fixes >100 timeouts when running break-interp.exp when using
bad probes.
gdb/ChangeLog:
* solib-svr4.c (svr4_find_and_create_probe_breakpoints): Check all
probe arguments.
Alan Hayward [Wed, 21 Aug 2019 14:24:02 +0000 (15:24 +0100)]
Use gdbarch for probe::get_argument_count
The probe function get_argument_count does not need a frame, only
the current gdbarch. Switch the code to pass gdbarch instead.
No functional changes.
gdb/ChangeLog:
* break-catch-throw.c (fetch_probe_arguments): Use gdbarch.
* dtrace-probe.c (dtrace_probe::get_argument_count): Likewise.
* probe.c (probe_safe_evaluate_at_pc) (compute_probe_arg)
(compile_probe_arg): Likewise.
* probe.h (get_argument_count): Likewise.
* solib-svr4.c (solib_event_probe_action): Likewise.
* stap-probe.c (stap_probe::get_argument_count): Likewise.
Alan Hayward [Wed, 21 Aug 2019 14:05:40 +0000 (15:05 +0100)]
Refactor svr4_create_solib_event_breakpoints
Move the bulk of svr4_create_solib_event_breakpoints into a new
function to simplify the logic. No functional changes.
gdb/ChangeLog:
* solib-svr4.c (svr4_find_and_create_probe_breakpoints): Move
code to here...
(svr4_create_solib_event_breakpoints): ...from here.
Alan Modra [Mon, 2 Sep 2019 07:18:44 +0000 (16:48 +0930)]
Re: Memory leak in dwarf2.c
PR 11983
* dwarf2.c (read_alt_indirect_string): Free debug_filename
on success. Tidy.
(read_alt_indirect_ref): Likewise.
Alan Modra [Mon, 2 Sep 2019 00:24:55 +0000 (09:54 +0930)]
Memory leak in dwarf2.c
This fixes a small leak of debug_filename. bfd_openr copies the file
name since git commit
1be5090bca.
PR 11983
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename
on success. Tidy.
GDB Administrator [Mon, 2 Sep 2019 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sun, 1 Sep 2019 04:22:36 +0000 (21:22 -0700)]
RISC-V: Fix linker problems with tls copy relocs.
The linker doesn't allocate memory space for sections that are only SEC_ALLOC
and SEC_THREAD_LOCAL. See the IS_TBSS test in ld/ldlang.c. So we need to
pretend that .tdata.dyn sections have contents to get the right result. It
will be marked this way anyways if there is a .tdata section to merge with.
bfd/
PR 23825
* elfnn-riscv.c (riscv_elf_create_dynamic_sections): Add SEC_LOAD,
SEC_DATA, and SEC_HAS_CONTENTS to .tdata.dyn section.
GDB Administrator [Sun, 1 Sep 2019 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 31 Aug 2019 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Fri, 30 Aug 2019 22:14:36 +0000 (15:14 -0700)]
RISC-V: Force linker error exit after unresolvable reloc.
This was noticed while trying to test the compiler -msave-restore support.
Putting non-pic code in a shared library gives a linker error, but doesn't
stop the build.
rohan:2030$ cat libtmp.c
extern int sub2 (int);
int sub (int i) { return sub2 (i + 10); }
rohan:2031$ cat libtmp2.c
extern int sub (int);
int sub2 (int i) { return sub (i + 10); }
rohan:2032$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp.so libtmp.c
rohan:2033$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp2.so libtmp2.c libtmp.so
/home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-linux-gnu/8.3.0/../../../../riscv64-unknown-linux-gnu/bin/ld: /tmp/cctrsIBe.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub'
rohan:2034$ echo $?
0
rohan:2035$ ls -lt libtmp2.so
-rwxr-xr-x 1 jimw jimw 6912 Aug 30 14:32 libtmp2.so
rohan:2036$
The patch fixes this by forcing a linker error. I now get this.
ohan:2059$ sh tmp.script
/home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: libtmp2.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub'
/home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: final link failed: bad value
rohan:2060$ echo $?
1
rohan:2061$ ls -lt libtmp2.so
ls: cannot access 'libtmp2.so': No such file or directory
bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): For unresolvable reloc
error, call bfd_set_error, set ret to FALSE, and goto out label.
Sergio Durigan Junior [Thu, 29 Aug 2019 20:11:45 +0000 (16:11 -0400)]
Remove "\nError: " suffix from nat/fork-inferior.c:trace_start_error warning message
Rationale: https://sourceware.org/ml/gdb-patches/2019-08/msg00651.html
This very simple patch removes the "\nError: " suffix from the warning
message printed by nat/fork-inferior.c:trace_start_error. This proved
to just pollute the screen, causing things like:
Starting program: /usr/bin/true
warning: Could not trace the inferior process.
Error:
warning: ptrace: Permission denied
This "Error: " string is not useful at all, and can confuse things,
therefore let's just remove it and simplify the resulting messages:
Starting program: /usr/bin/true
warning: Could not trace the inferior process.
warning: ptrace: Permission denied
gdb/ChangeLog:
2019-08-30 Sergio Durigan Junior <sergiodj@redhat.com>
* nat/fork-inferior.c (trace_start_error): Remove "\nError: "
suffix from warning message.
Tom Tromey [Thu, 18 Jul 2019 20:38:39 +0000 (14:38 -0600)]
Remove tui_win_info::refresh_all
The TUI has two duplicate "re-render this window" methods, "rerender"
and "refresh_all". They differ only slightly in semantics, so I
wanted to see if they could be unified.
After looking into this, I decided that refresh_all was not needed.
There are 4 calls to tui_refresh_all_win (the only caller of this
method):
1. tui_enable. This sets the layout, which renders the windows.
2. tui_cont_sig. Here, I think it's sufficient to simply redraw the
current window contents from the curses backing store, because gdb
state didn't change while it was suspended
3. tui_dispatch_ctrl_char. This is the C-l handler, and here it's
explicitly enough to just refresh the screen (as above).
4. tui_refresh_all_command. This is the command equivalent of C-l.
So, this patch removes this method entirely and simplifies
tui_refresh_all_win.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_base)
<refresh_all>: Don't declare.
* tui/tui-winsource.c (tui_source_window_base::refresh_all):
Remove.
* tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or
tui_show_locator_content.
* tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't
declare.
* tui/tui-regs.c (tui_data_window::refresh_all): Remove.
* tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't
declare.
Tom Tromey [Thu, 18 Jul 2019 20:34:39 +0000 (14:34 -0600)]
Don't call wrefresh from tui_cont_sig
tui_cont_sig does not need to call wrefresh, because this is already
done by tui_refresh_all_win.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-io.c (tui_cont_sig): Don't call wrefresh.
Tom Tromey [Thu, 18 Jul 2019 20:12:31 +0000 (14:12 -0600)]
Minor rearrangement of tui-stack.c
This move _initialize_tui_stack to the end of tui-stack.c, per the gdb
style; and then removes two unnecessary forward declarations.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (_initialize_tui_stack): Move later.
Remove unnecessary forward declarations.
Tom Tromey [Thu, 18 Jul 2019 20:08:53 +0000 (14:08 -0600)]
Make tui_locator_window::set_locator_fullname re-render
This changes tui_locator_window::set_locator_fullname to re-render the
locator window, so that the callers don't need to do this.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (tui_locator_window::set_locator_fullname): Call
rerender.
(tui_update_locator_fullname, tui_show_frame_info): Don't call
tui_show_locator_content.
Tom Tromey [Thu, 18 Jul 2019 20:04:14 +0000 (14:04 -0600)]
Swap tui_show_locator_content and tui_locator_window::rerender
This swaps the bodies ot tui_show_locator_content and
tui_locator_window::rerender, so that the latter does the work, and
the former is now just an exported convenience wrapper.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (tui_show_locator_content): Move lower. Rewrite.
(tui_locator_window::rerender): Rewrite using body of previous
tui_show_locator_content.
Tom Tromey [Thu, 18 Jul 2019 20:01:56 +0000 (14:01 -0600)]
Turn two locator functions into methods
This changes tui_set_locator_fullname and tui_set_locator_info to be
methods on tui_locator_window. This enables some subsequent
cleannups.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.h (struct tui_locator_window) <set_locator_info,
set_locator_fullname>: New methods.
* tui/tui-stack.c (tui_locator_window::set_locator_fullname):
Rename from tui_set_locator_fullname.
(tui_locator_window::set_locator_info): Rename from
tui_set_locator_info. Return bool.
(tui_update_locator_fullname, tui_show_frame_info): Update.
Tom Tromey [Thu, 18 Jul 2019 19:46:23 +0000 (13:46 -0600)]
Don't call tui_refresh_all from show_layout
show_layout calls tui_refresh_all in one case. However, it doesn't
need to any more, because the resize method on each window will also
update the contents.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (show_layout): Don't call tui_refresh_all.
Tom Tromey [Wed, 17 Jul 2019 22:11:40 +0000 (16:11 -0600)]
Don't call touchwin in tui_gen_win_info::refresh_window
The call to touchwin in tui_gen_win_info::refresh_window was an
artifact of some earlier refactorings. Testing shows it isn't needed
any more -- I believe it was only ever needed for the data item window
display problem; but that's been solved more locally.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Don't
call touchwin.
Tom Tromey [Mon, 15 Jul 2019 21:59:53 +0000 (15:59 -0600)]
Remove NULL checks from box_win
box_win can't be called with a NULL window, or with an invisible
window. So, the NULL checks in that function can be removed.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (box_win): Assume win_info and
win_info->handle cannot be NULL.
Tom Tromey [Mon, 15 Jul 2019 21:28:56 +0000 (15:28 -0600)]
Simplify register display
This patch starts with the observation that the code in
tui_data_window::display_registers_from can all be replaced with a
call to resize. To make this work propertly, it also changes
tui_display_register to be the "rerender" method on
tui_data_item_window.
The refresh_window method is needed due to the use of nested windows
here. The ncurses man page makes it sound like this is not very well
supported; and experience bears this out: negelecting the touchwin
call in this path will cause the register window to blank when
switching focus.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_item_window) <rerender,
refresh_window>: Declare.
* tui/tui-regs.c (tui_data_window::display_registers_from): Call
resize.
(tui_data_item_window::rerender): Rename from
tui_display_register.
(tui_data_item_window::refresh_window): New method.
* tui/tui-layout.c (tui_gen_win_info::resize): Do nothing on
no-op.
Tom Tromey [Mon, 15 Jul 2019 01:45:55 +0000 (19:45 -0600)]
Private data members in tui_data_window
This changes tui_data_window so that the data members are private.
This required the addition of a simple accessor method in one case.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <regs_content,
regs_column_count, current_group>: Move later. Now private.
<get_current_group>: New method.
* tui/tui-regs.c (tui_reg_command): Update.
* tui/tui-layout.c (tui_set_layout): Update.
Tom Tromey [Sun, 14 Jul 2019 15:11:46 +0000 (09:11 -0600)]
Remove some calls in tui_data_window
This patch removes a call to erase_data_content in refresh_all and
then removes some other calls that are more clearly unnecessary once
one follows calls from that point.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::display_registers_from_line)
(tui_data_window::rerender): Don't call
check_and_display_highlight_if_needed.
(tui_data_window::refresh_all): Remove call to
erase_data_content.
Tom Tromey [Sun, 14 Jul 2019 15:07:10 +0000 (09:07 -0600)]
Remove some checks of .empty()
A few methods in tui_data_window check whether the contents are empty;
but all the callers already check this, so these calls can be removed.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::last_regs_line_no)
(tui_data_window::display_registers_from)
(tui_data_window::display_reg_element_at_line)
(tui_data_window::display_registers_from_line): Remove checks of
"empty".
Tom Tromey [Sun, 14 Jul 2019 14:27:34 +0000 (08:27 -0600)]
Remove tui_data_window::display_all_data
tui_data_window::rerender clears the data item windows, and then calls
display_all_data. However, that method only does anything if the
contents are not empty. So, display_all_data can be renamed and the
wrapper removed.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <display_all_data>:
Don't declare.
* tui/tui-regs.c (tui_data_window::show_registers): Call
rerender.
(tui_data_window::rerender): Rename from display_all_data.
(tui_data_window::rerender): Remove old implementation.
Tom Tromey [Sun, 14 Jul 2019 14:21:16 +0000 (08:21 -0600)]
Remove NO_DATA_STRING
NO_DATA_STRING shouldn't be used. It's referenced in a single spot,
in tui_data_window::display_all_data. This patch removes the use and
replaces it with the more correct text. A later patch (though not in
this series) will remove this call entirely, when it's more obviously
correct to do so.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::display_all_data): Change
text.
* tui/tui-data.h (NO_DATA_STRING): Remove define.
H.J. Lu [Fri, 30 Aug 2019 14:46:15 +0000 (07:46 -0700)]
Copy BFD_COMPRESS/BFD_DECOMPRESS/BFD_COMPRESS_GABI for thin archive
We need to copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI flags
for thin archive.
PR ld/24951
* archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS,
BFD_DECOMPRESS and BFD_COMPRESS_GABI flags for thin archive.
Srinath Parvathaneni [Fri, 30 Aug 2019 09:44:18 +0000 (10:44 +0100)]
[PATCH][ARM][GAS]: Assembler support to interpret MVE VMOV instruction correctly.
This patch make changes to the assembler to encode MVE VMOV instruction "a" same as "b".
a: VMOV<c><q> <Dd>, <Dm>
b: VMOV<c><q>.F64 <Dd>, <Dm>
gas/ChangeLog:
2019-08-30 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* config/tc-arm.c (do_neon_mov): Modify "if" statement.
* testsuite/gas/arm/mve-vmov-bad-3.d: New test.
* testsuite/gas/arm/mve-vmov-bad-3.l: Likewise.
* testsuite/gas/arm/mve-vmov-bad-3.s: Likewise.
Claudiu Zissulescu [Fri, 30 Aug 2019 08:31:19 +0000 (11:31 +0300)]
[ARC] [COMMITTED] Fix FASTMATH field.
Move FASTMATH to the right enum.
2019-08-30 Claudiu Zissulescu <claziss@gmail.com>
* opcode/arc.h (FASTMATH): Move it from insn_class_t to
insn_subclass_t enum.
GDB Administrator [Fri, 30 Aug 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Sandra Loosemore [Thu, 29 Aug 2019 21:48:05 +0000 (14:48 -0700)]
Run argv0-symlink.exp only on native target and local host.
This testcase was originally for PR gdb/15415, a problem with the
"run" command expanding symlinks in the name of the program being run.
It does not correctly distinguish between files on build, host, and
target, and it is not clear if it would be testing anything useful in
configurations where "run" is not being used.
2019-08-29 Sandra Loosemore <sandra@codesourcery.com>
* gdb.base/argv0-symlink.exp: Run only on native target
and local host.
Bernhard Wodok [Tue, 27 Aug 2019 15:40:31 +0000 (11:40 -0400)]
Fix PR win32/24284: tcp_auto_retry doesn't work in MinGW
This was reported by Bernhard Wodok, along with a patch to fix the
issue. I adjusted the patch a bit, and I'm submitting the patch on
his behalf.
According to Bernhard, the issue can be reproduced by doing:
1. start gdb
2. enter 'target remote :2345'
3. observe that it throws a "connection refused" error immediately
instead of waiting and throwing a timeout error
I.e., I believe it can be reproduced by our current tests, which is
why I'm not proposing any extra tests here (well, I don't use nor have
any Windows system to test this, so...).
The problem happens because, on ser-tcp:wait_for_connect, we call
'gdb_select' passing 0 as its first argument, which, when using MinGW,
ends up using the 'gdb_select' version from mingw-hdep.c, and when the
first argument is 0 this means that WaitForMultipleObjects will be
called with 0 as its first argument as well. According to the MS API
docs, this is forbidden:
https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects
The proposed fix is simple: we just call Sleep when N == 0 (and when
TIMEOUT is non-NULL), and return 0. It makes sense to me.
Both Bernhard and Paul Carroll confirmed that the fix works. I'm
Cc'ing Bernhard in case you have any questions about the patch.
OK?
gdb/ChangeLog:
2019-08-29 Bernhard Wodok <barto@gmx.net>
Sergio Durigan Junior <sergiodj@redhat.com>
PR win32/24284
* mingw-hdep.c (gdb_select): Handle case when 'n' is zero.
Tom de Vries [Thu, 29 Aug 2019 12:43:11 +0000 (14:43 +0200)]
[gdb/testsuite] Fix gdb.fortran/info-types.exp regexp
The gdb.fortran/info-types.exp test-case passes with gcc 7 (though not on
openSUSE, due to the extra debug info) and fails with gcc 4.8 and gcc 8.
Fix the gdb_test regexp to fix all those cases.
gdb/testsuite/ChangeLog:
2019-08-29 Tom de Vries <tdevries@suse.de>
* gdb.fortran/info-types.exp: Fix gdb_test regexp to allow more
diverse debug info.
* lib/fortran.exp (fortran_int8): New proc, based on fortran_int4.
Alan Modra [Thu, 29 Aug 2019 09:05:54 +0000 (18:35 +0930)]
PR24697, R_PPC_EMB_SDA21 cannot be used when making a shared object
This removes a restriction on various R_PPC_EMB relocations that has
been present for ppc32 since 1996-04-26 git commit
e25a798839. As far
as I know, only those relocs that would require addressing via r2 for
.sdata2/.sbss2 access are disallowed in shared libraries.
PR 24697
* elf32-ppc.c (ppc_elf_check_relocs): Call bad_shared_reloc
when !bfd_link_executable for R_PPC_EMB_SDA2I16 and
R_PPC_EMB_SDA2REL. Don't call bad_shared_reloc for any other
reloc.
Alan Modra [Thu, 29 Aug 2019 02:00:11 +0000 (11:30 +0930)]
PowerPC64 xlate_pcrel_opt
We can easily support an offset on the second instruction of a
sequence marked with R_PPC64_PCREL_OPT. For example,
pla ra,symbol@pcrel
ld rt,off(ra)
can be optimised to
pld rt,symbol+off@pcrel
nop
* elf64-ppc.c (xlate_pcrel_opt): Add poff parameter. Allow offset
on second insn, return it in poff.
(ppc64_elf_relocate_section): Add offset to paddi addend for
PCREL_OPT.
Jim Wilson [Thu, 29 Aug 2019 00:47:01 +0000 (17:47 -0700)]
RISC-V: Fix a gp relaxation reloc overflow error.
This was broken when I changed how we compute the value for the gp register.
It used to be computed inside the sdata section. Now it is computed at the
end which makes it an abs section symbol. There is code that tries to use
the alignment of the section that the gp value is in, but this does not work
if it is in the abs section, as the abs section has alignment of 1 byte.
There are people using alternative linker scripts that still define it in the
sdata section, so the code is still useful. Thus adding a check to disable
this when gp is in the abs section.
bfd/
* elfnn-riscv.c (_bfd_riscv_relax_lui): Add check to exclude abs
section when setting max_alignment. Update comment.
(_bfd_riscv_relax_pc): Likewise.
GDB Administrator [Thu, 29 Aug 2019 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 28 Aug 2019 23:34:08 +0000 (09:04 +0930)]
Tidy check_uvalue
I don't see a need to calculate "ptr = start + uvalue" then compare
"ptr" with "start" and "end". Given "start <= end" on entry, the
"uvalue" comparison with "max_uvalue" ought to be sufficient to ensure
"start + uvalue" is bounded by "start" and "end" regardless of the
size of pointers and the unsigned dwarf_vma integer type.
* dwarf.c (check_uvalue): Remove unnecessary pointer checks.
Alan Modra [Wed, 28 Aug 2019 07:04:34 +0000 (16:34 +0930)]
PR24891, objdump memory leaks when parsing malformed archive
BFD was leaking memory in bfd_check_format_matches. As part of
deciding the proper format of an archive, BFD looks at the format of
the first file stored. That file's bfd was left open for reasons
given in a comment removed in git commit
0e71e4955cd1 that said:
/* We ought to close `first' here, but we can't, because
we have no way to remove it from the archive cache.
It's close to impossible to figure out when we can
release bfd_ardata. FIXME. */
Well, things have changed since that comment was true and we now can
remove files from the archive cache. Closing the first file is good
and cures some of the leaks. Other leaks are caused by
bfd_check_format_matches throwing away bfd tdata before trying a new
match. That lost the element cache set up when format checking the
first element in the archive. The easiest and cleanest fix is to
simply disable the caching when checking the first element.
PR 24891
* bfd.c (struct bfd): Add no_element_cache.
* archive.c (_bfd_get_elt_at_filepos): Don't add element to
archive cache when no_element_cache.
(bfd_generic_archive_p): Set no_element_cache when opening first
element to check format. Close first element too.
(do_slurp_bsd_armap): Don't zero ardata->cache here.
* bfd-in2.h: Regenerate.
Tom de Vries [Wed, 28 Aug 2019 17:13:29 +0000 (19:13 +0200)]
[gdb/testsuite] Fix info-var.exp for debug info from other files
On openSUSE Leap 15.1, I get:
...
FAIL: gdb.base/info-var.exp: info variables
FAIL: gdb.base/info-var.exp: info variables -n
...
because the info variables command prints info also for init.c:
...
File init.c:^M
24: const int _IO_stdin_used;^M
...
while the regexps in the test-case only expect info for info-var-f1.c and
info-var-f2.c.
Fix this by extending the regexps.
Tested on x86_64-linux, both openSUSE Leap 15.1 and Fedora 30.
gdb/testsuite/ChangeLog:
2019-08-28 Tom de Vries <tdevries@suse.de>
* gdb.base/info-var.exp: Allow info variables to print info for files
other than info-var-f1.c and info-var-f2.c.