Alan Modra [Thu, 27 Feb 2020 03:53:34 +0000 (14:23 +1030)]
.idata symbols should be reported with i or I flag by nm
PR 24511
* syms.c (stt): Trim off all but 'e', 'i' and 'p' entries.
(coff_section_type): Adjust comment.
(decode_section_type): Likewise. Call coff_section_type before
decode_section_type.
(bfd_decode_symclass): Use 'c' for common sections other than
the standard one.
Andrew Burgess [Thu, 27 Feb 2020 16:42:17 +0000 (16:42 +0000)]
gdb: Use std::abs instead of abs on LONGEST types
Use std::abs so that we get the C++ overloaded version that matches
the argument type instead of the C abs function which is only for int
arguments.
There should be no user visible change after this commit.
gdb/ChangeLog:
* gdbtypes.c (create_array_type_with_stride): Use std::abs not
abs.
Nick Clifton [Thu, 27 Feb 2020 16:28:25 +0000 (16:28 +0000)]
Fix an illegal memory access by readelf when displaying the contents of a corrupt IA64 binary.
PR 25526
* readelf.c (process_ia64_vms_dynamic_relocs): Check to see if
get_data is unable to load the string table.
Tom de Vries [Thu, 27 Feb 2020 13:27:09 +0000 (14:27 +0100)]
[gdb/testsuite] Remove unused globals
Remove unused global variable declarations.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-27 Tom de Vries <tdevries@suse.de>
* config/sid.exp: Remove unused globals.
* gdb.base/attach.exp: Same.
* gdb.base/catch-load.exp: Same.
* gdb.base/dbx.exp: Same.
* lib/gdb.exp: Same.
* lib/mi-support.exp: Same.
* lib/prompt.exp: Same.
Tom de Vries [Thu, 27 Feb 2020 09:16:00 +0000 (10:16 +0100)]
[gdb/testsuite] Fix spawn in tuiterm.exp
When running gdb.stabs/weird.exp by itself it passes, but if we run a gdb.tui
test before it, we get:
...
$ make check RUNTESTFLAGS="gdb.stabs/weird.exp gdb.tui/basic.exp"
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.tui/basic.exp ...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.stabs/weird.exp ...
ERROR: Couldn't make test case. -1 {spawn failed}
...
In more detail, using -v:
...
Executing on build: sed -f aout.sed weird.def weird.s (timeout = 300)
builtin_spawn [open ...]^M
pid is 19060 19061 -19060 -19061
spawn -open file10 failed, 1 can't read "spawn_out(slave,name)": \
no such variable, can't read "spawn_out(slave,name)": no such variable
while executing
"set gdb_spawn_name $spawn_out(slave,name)"
(procedure "spawn" line 5)
invoked from within
"spawn -ignore SIGHUP -leaveopen file10"
invoked from within
"catch "spawn -ignore SIGHUP -leaveopen $id" result2"
ERROR: Couldn't make test case. -1 {spawn failed}
...
When running the gdb.tui test, spawn gets renamed to a local version from
lib/tuiterm.exp. The local version calls expect's spawn, and then makes the
local spawn_out(slave,name) variable accessible in the global variable
gdb_spawn_name.
However, the weird.exp test-case uses remote_exec build, which ends up using
local_exec, which given that there's input/output redirection uses open:
...
set result [catch {open "| ${commandline} $inp |& tee $outpf" RDONLY} id]
...
followed by spawn using the -leaveopen option:
...
set result [catch "spawn -ignore SIGHUP -leaveopen $id" result2]
...
which apparently has the effect that spawn_out(slave,name) is not set.
Fix this in the lib/tuiterm.exp local spawn proc by detecting the case that
spawn_out(slave,name) is not set, and handling it accordingly.
Tested gdb.stabs/weird.exp and gdb.tui/*.exp on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-27 Tom de Vries <tdevries@suse.de>
* lib/tuiterm.exp (spawn): Handle case that spawn_out(slave,name) is
not set.
Alan Modra [Thu, 27 Feb 2020 03:41:35 +0000 (14:11 +1030)]
_bfd_xcoff_read_ar_hdr tidy
* coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Put all data in one
malloc'd block.
Alan Modra [Thu, 27 Feb 2020 03:20:21 +0000 (13:50 +1030)]
bfd_stat_arch_elt buffer overflow
If you manage to put an xcoff object file into a non-xcoff archive
(created by first putting a non-xcoff object file into it), and have
xcoff support compiled into libbfd, then objdump -x on the archive
can segfault. The problem is that _bfd_xcoff_stat_arch_elt expects
abfd->arelt_data->arch_header to be one of the xcoff variants, but
arelt_data is generated depending on the archive format, *not* the
element format.
* bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
if file is an archive element.
* bfd-in2.h: Regenerate.
GDB Administrator [Thu, 27 Feb 2020 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 26 Feb 2020 22:41:07 +0000 (15:41 -0700)]
Specialize partial_symtab for DWARF include files
Include files are represented by a partial symtab, but don't expand to
anything. From dwarf2_psymtab::expand_psymtab:
if (per_cu == NULL)
{
/* It's an include file, no symbols to read for it.
Everything is in the parent symtab. */
readin = true;
return;
}
This patch introduces a new specialization of partial_symtab to handle
this case. In addition to being slightly smaller, I believe an
include file is the only situation where a DWARF psymtab can result in
a null compunit_symtab. This adds an assert to that effect as well.
This change will simplify one of the psymtab sharing patches.
gdb/ChangeLog
2020-02-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct dwarf2_include_psymtab): New.
(dwarf2_create_include_psymtab): Use dwarf2_include_psymtab.
(dwarf2_psymtab::expand_psymtab, dwarf2_psymtab::readin_p)
(dwarf2_psymtab::get_compunit_symtab): Remove null checks for
per_cu_data.
Tom Tromey [Wed, 26 Feb 2020 22:41:07 +0000 (15:41 -0700)]
Remove casts from dwarf2/index-write.c
dwarf2/index-write.c casts pointers to "dwarf2_psymtab *", but as far
as I can tell, it does not actually use any DWARF-specific fields of
the psymtab. So, this patch changes this code to use partial_symtab
instead. This removes nearly every cast, leaving just the unavoidable
one from addrmap iteration.
gdb/ChangeLog
2020-02-26 Tom Tromey <tom@tromey.com>
* dwarf2/index-write.c (psym_index_map): Change type.
(add_address_entry_worker, write_one_signatured_type)
(recursively_count_psymbols, recursively_write_psymbols)
(class debug_names, psyms_seen_size, write_gdbindex)
(write_debug_names): Use partial_symtab, not dwarf2_psymtab.
Aaron Merey [Wed, 26 Feb 2020 22:40:49 +0000 (17:40 -0500)]
Add debuginfod support to GDB
debuginfod is a lightweight web service that indexes ELF/DWARF debugging
resources by build-id and serves them over HTTP.
This patch enables GDB to query debuginfod servers for separate debug
files and source code when it is otherwise not able to find them.
GDB can be built with debuginfod using the --with-debuginfod configure
option.
This requires that libdebuginfod be installed and found at configure time.
debuginfod is packaged with elfutils, starting with version 0.178.
For more information see https://sourceware.org/elfutils/.
Tested on x86_64 Fedora 31.
gdb/ChangeLog:
2020-02-26 Aaron Merey <amerey@redhat.com>
* Makefile.in: Handle optional debuginfod support.
* NEWS: Update.
* README: Add --with-debuginfod summary.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle optional debuginfod support.
* debuginfod-support.c: debuginfod helper functions.
* debuginfod-support.h: Ditto.
* doc/gdb.texinfo: Add --with-debuginfod to configure options
summary.
* dwarf2/read.c (dwarf2_get_dwz_file): Query debuginfod servers
when a dwz file cannot be found.
* elfread.c (elf_symfile_read): Query debuginfod servers when a
debuginfo file cannot be found.
* source.c (open_source_file): Query debuginfod servers when a
source file cannot be found.
* top.c (print_gdb_configuration): Include
--{with,without}-debuginfod in the output.
gdb/testsuite/ChangeLog:
2020-02-26 Aaron Merey <amerey@redhat.com>
* gdb.debuginfod: New directory for debuginfod tests.
* gdb.debuginfod/main.c: New test file.
* gdb.debuginfod/fetch_src_and_symbols.exp: New tests.
Jérémie Galarneau [Tue, 18 Feb 2020 00:08:03 +0000 (19:08 -0500)]
gdb: print thread names in thread apply command output
This makes the thread apply command print the thread's name. The use
of target_pid_to_str is replaced by thread_target_id_str, which
provides the same output as "info threads".
Before:
(gdb) thread apply 2 bt
Thread 2 (Thread 0x7fd245602700 (LWP 3837)):
[...]
After:
(gdb) thread apply 2 bt
Thread 2 (Thread 0x7fd245602700 (LWP 3837) "HT cleanup"):
[...]
The thread's description header is pre-computed before running the
command since the command may change the selected inferior. This is
not permitted by thread_target_id_str as target_thread_name asserts
that `info->inf == current_inferior ()`.
This situation arises in the `gdb.threads/threadapply.exp` test which
kills and removes the inferior as part of a "thread apply" command.
gdb/ChangeLog:
* thread.c (thr_try_catch_cmd): Print thread name.
Simon Marchi [Wed, 26 Feb 2020 14:35:22 +0000 (09:35 -0500)]
Move more declarations from dwarf2/loc.h to dwarf2/read.h
All these functions have their implementations in dwarf2/read.c, so move
their declarations to dwarf2/read.h. Move the doc to the header, at the
same time.
gdb/ChangeLog:
* dwarf2/loc.h (dwarf2_fetch_die_loc_sect_off,
dwarf2_fetch_die_loc_cu_off, dwarf2_fetch_constant_bytes,
dwarf2_fetch_die_type_sect_off): Move to...
* dwarf2/read.h (dwarf2_fetch_die_loc_sect_off,
dwarf2_fetch_die_loc_cu_off, dwarf2_fetch_constant_bytes,
dwarf2_fetch_die_type_sect_off): ... here.
* dwarf2/read.c (dwarf2_fetch_die_loc_sect_off,
dwarf2_fetch_die_loc_cu_off, dwarf2_fetch_constant_bytes,
dwarf2_fetch_die_type_sect_off): Move doc to header file.
Matthew Malcomson [Wed, 26 Feb 2020 14:23:11 +0000 (14:23 +0000)]
[binutils][arm] Arm CDE CX*A instructions allow condition code
The implementation of the Arm CDE CX*A instructions doesn't allow a
condition code on the instructions but does allow the instruction in an
ITBlock.
The specification has been recently updated, though this is yet to be
published.
The instructions now should allow a suffix, and should behave in the
standard way around ITBlocks.
This patch removes the custom pred_instruction_type and handling for
these instructions, and uses the standard INSIDE_IT_INSN predication
type to describe the new instructions.
gas/ChangeLog:
2020-02-26 Matthew Malcomson <matthew.malcomson@arm.com>
* config/tc-arm.c (enum pred_instruction_type): Remove
NEUTRAL_IT_NO_VPT_INSN predication type.
(cxn_handle_predication): Modify to require condition suffixes.
(handle_pred_state): Remove NEUTRAL_IT_NO_VPT_INSN cases.
* testsuite/gas/arm/cde-scalar.s: Update test.
* testsuite/gas/arm/cde-warnings.l: Update test.
* testsuite/gas/arm/cde-warnings.s: Update test.
Tom de Vries [Wed, 26 Feb 2020 13:52:00 +0000 (14:52 +0100)]
[gdb] Don't set initial language if set manually
Initially, gdb sets the language to auto/c:
...
$ gdb -q
(gdb) show language
The current source language is "auto; currently c".
...
And after loading a c++ executable, that changes to auto/c++:
...
(gdb) file a.out
Reading symbols from a.out...
(gdb) show language
The current source language is "auto; currently c++".
...
Now consider setting the language manually to c:
...
$ gdb -q
(gdb) show language
The current source language is "auto; currently c".
(gdb) set language c
(gdb) show language
The current source language is "c".
...
The resulting language is manual/c.
Surprisingly, a subsequent load of the c++ executable:
...
(gdb) file a.out
Reading symbols from a.out...
(gdb) show language
The current source language is "c++".
...
gets us language manual/c++.
Loading the file should get us either:
- auto/c++, or
- manual/c.
That is, either the manual setting should be reset by loading, or the manual
setting should persist.
Fix this in the manual/c fashion. [ Though we could make some gdb setting to
choose one or the other. ]
Build and reg-tested on x86_64-linux.
[ Note: In PR23710 comment 1 a cc1 binary is attached for which gdb is slow when
loading and settting a breakpoint on do_rpo_vn:
...
$ time.sh gdb cc1 -batch -ex "b do_rpo_vn"
Breakpoint 1 at 0xd40e30: do_rpo_vn. (2 locations)
maxmem:
1463496
real: 8.88
user: 8.59
system: 0.35
...
This fix enables a speedup by manually setting the language before
loading, reducing executing time with ~17%, due to not having to load the full
symtab containing main:
...
$ time.sh gdb -iex "set language c++" cc1 -batch -ex "b do_rpo_vn"
Breakpoint 1 at 0xd40e30: do_rpo_vn. (2 locations)
maxmem:
1067308
real: 7.36
user: 7.14
system: 0.28
... ]
gdb/ChangeLog:
2020-02-26 Tom de Vries <tdevries@suse.de>
PR gdb/25603
* symfile.c (set_initial_language): Exit-early if
language_mode == language_mode_manual.
gdb/testsuite/ChangeLog:
2020-02-26 Tom de Vries <tdevries@suse.de>
PR gdb/25603
* gdb.base/persistent-lang.cc: New test.
* gdb.base/persistent-lang.exp: New file.
H.J. Lu [Wed, 26 Feb 2020 11:56:28 +0000 (03:56 -0800)]
ld: Add PR ld/25593 tests
PR ld/25593
* testsuite/ld-plugin/lto.exp: Run PR ld/25593 tests.
* testsuite/ld-plugin/pr25593.d: New file.
* testsuite/ld-plugin/pr25593a-1.c: Likewise.
* testsuite/ld-plugin/pr25593a-2.c: Likewise.
* testsuite/ld-plugin/pr25593b.c: Likewise.
* testsuite/ld-plugin/pr25593c.c: Likewise.
* testsuite/ld-plugin/pr25593d.c: Likewise.
* testsuite/ld-plugin/pr25593e.c: Likewise.
Alan Modra [Wed, 26 Feb 2020 06:32:38 +0000 (17:02 +1030)]
Archive sanity checks
Adds some sanity checking to size values read from file.
* archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and
bfd_set_error on failing test. Don't bother changing bfd_error on
file read error. Check symdef_count is multiple of BSD_SYMDEF_SIZE.
Check sym name is within string buffer. Use size_t for some vars.
(do_slurp_coff_armap): Use size_t for some variables, fix size of
int_buf. Don't change bfd_error on file read error. Use
_bfd_mul_overflow when calculating carsym buffer size. Reorder
calculations to catch overflows before they occur. malloc and
free raw armap rather than using bfd_alloc. Read raw armap before
allocating carsym+strings buffer.
(_bfd_slurp_extended_name_table): Localize variables. Check
name size against file size.
Alan Modra [Wed, 26 Feb 2020 04:44:48 +0000 (15:14 +1030)]
Re: vms buffer overflows and large memory allocation
git commit
c893ce360a changed buffer management, in the process
introducing a bug on an error return path.
* vms-lib.c (vms_lib_read_index): Release correct buffer.
Simon Marchi [Wed, 26 Feb 2020 04:38:26 +0000 (23:38 -0500)]
Move dwarf2_read_addr_index declaration to dwarf2/read.h
The implementation is in dwarf2/read.c, so the declaration belongs in
dwarf2/read.h. Also, move the documentation there.
gdb/ChangeLog:
* dwarf2/loc.h (dwarf2_read_addr_index): Move...
* dwarf2/read.h (dwarf2_read_addr_index): ... here.
* dwarf2/read.c (dwarf2_read_addr_index): Move doc to header.
Alan Modra [Wed, 26 Feb 2020 02:32:42 +0000 (13:02 +1030)]
rx: memory allocation without checking for NULL return
* elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
malloc. Check for NULL return from bfd_malloc.
(rx_table_find, rx_table_map): Likewise.
(rx_set_section_contents): Check bfd_alloc return.
(rx_dump_symtab): Don't alloc internal_syms or external_syms.
Alan Modra [Wed, 26 Feb 2020 02:27:19 +0000 (12:57 +1030)]
gas gettext warning
gettext("") returns the header entry with meta information, not the
empty string.
* config/tc-arm.c (reg_expected_msgs[REG_TYPE_RNB]): Don't use
N_() on empty string.
Alan Modra [Wed, 26 Feb 2020 02:08:11 +0000 (12:38 +1030)]
gas strncpy warning
Avoid a warning that the buffer may not be zero terminated.
* read.c (read_a_source_file): Call strncpy with length one
less than size of original_case_string.
Alan Modra [Tue, 25 Feb 2020 05:04:46 +0000 (15:34 +1030)]
Indent labels
Labels don't go in the first column according to standard emacs C
indent rules, and I got annoyed enough at seeing diff -p show a label
rather than the function name to fix this.
bfd/
* aoutx.h: Indent labels correctly. Format error strings.
* archive.c: Likewise.
* archive64.c: Likewise.
* coff-arm.c: Likewise.
* coff-rs6000.c: Likewise.
* coff-stgo32.c: Likewise.
* cpu-arm.c: Likewise.
* dwarf2.c: Likewise.
* elf-ifunc.c: Likewise.
* elf-properties.c: Likewise.
* elf-s390-common.c: Likewise.
* elf-strtab.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-csky.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-msp430.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-nios2.c: Likewise.
* elf32-pru.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfcode.h: Likewise.
* elfcore.h: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfnn-riscv.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-x86.c: Likewise.
* i386lynx.c: Likewise.
* merge.c: Likewise.
* pdp11.c: Likewise.
* plugin.c: Likewise.
* reloc.c: Likewise.
binutils/
* elfedit.c: Indent labels correctly.
* readelf.c: Likewise.
* resres.c: Likewise.
gas/
* config/obj-elf.c: Indent labels correctly.
* config/obj-macho.c: Likewise.
* config/tc-aarch64.c: Likewise.
* config/tc-alpha.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-cr16.c: Likewise.
* config/tc-crx.c: Likewise.
* config/tc-frv.c: Likewise.
* config/tc-i386-intel.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-nds32.c: Likewise.
* config/tc-riscv.c: Likewise.
* config/tc-s12z.c: Likewise.
* config/tc-xtensa.c: Likewise.
* config/tc-z80.c: Likewise.
* read.c: Likewise.
* symbols.c: Likewise.
* write.c: Likewise.
ld/
* emultempl/cskyelf.em: Indent labels correctly.
* ldfile.c: Likewise.
* ldlang.c: Likewise.
* plugin.c: Likewise.
opcodes/
* aarch64-asm.c: Indent labels correctly.
* aarch64-dis.c: Likewise.
* aarch64-gen.c: Likewise.
* aarch64-opc.c: Likewise.
* alpha-dis.c: Likewise.
* i386-dis.c: Likewise.
* nds32-asm.c: Likewise.
* nfp-dis.c: Likewise.
* visium-dis.c: Likewise.
Alan Modra [Tue, 25 Feb 2020 02:20:10 +0000 (12:50 +1030)]
PR25593, --as-needed breaks DT_NEEDED order with linker plugin
This patch delays setting up DT_NEEDED dynamic tags until all object
files and libraries have been opened and their symbols processed,
rather than adding the tags while processing symbols. Tags are
ordered according to the position of the associated library on the
command line and linker scripts. It is still possible with
--as-needed libs that are mentioned more than once for tags to be
ordered according to which mention was needed. For example with
"--as-needed a.so b.so c.so b.so" when b.so is not needed by a.so or
any other prior object file but is needed by c.so, the order of tags
will be "A C B".
bfd/
PR 25593
* elf-bfd.h (struct elf_link_hash_table): Rename "loaded" to
"dyn_loaded".
(bfd_elf_add_dt_needed_tag): Declare.
* elf-strtab.c (_bfd_elf_strtab_restore): Handle NULL buf.
* elflink.c (bfd_elf_add_dt_needed_tag): Make global and rename
from elf_add_dt_needed_tag. Remove soname and doit param.
(elf_link_add_object_symbols): Don't use elf_add_dt_needed_tag
to see whether as-needed lib is already loaded, use dyn_loaded
list instead. When saving and restoring around as-needed lib
handle possibility that dynstr has not been initialised. Don't
add DT_NEEDED tags here. Limit dyn_loaded list to dynamic libs.
Mark libs loaded via DT_NEEDED entries of other libs with
DYN_NO_NEEDED if they should not be mentioned in DT_NEEDED of
the output.
(elf_link_check_versioned_symbol): Remove now unneccesary
DYNAMIC check when traversing dyn_loaded list.
ld/
PR 25593
* ldelf.c (ldelf_try_needed): Add DT_NEEDED lib to input_bfds.
(ldelf_after_open): Save state of input_bfds list before loading
DT_NEEDED libs. Traverse input_bfds list adding DT_NEEDED tags.
Restore input_bfds list.
* testsuite/ld-cris/gotplt1.d: Adjust for changed .dynstr order.
Alan Modra [Tue, 25 Feb 2020 02:18:43 +0000 (12:48 +1030)]
Limit bogus archive parsed_size
Archive element size is given by data in the archive, and thus is
subject to attack by fuzzers. The only harm this allows is allocation
of huge amounts of memory, but some systems don't handle that well.
So limit archive element size to archive file size.
* bfdio.c (bfd_get_file_size): Ignore bogus archive element sizes.
GDB Administrator [Wed, 26 Feb 2020 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Wed, 19 Feb 2020 19:01:51 +0000 (19:01 +0000)]
Merge upstream GCC changes for include/ and libiberty/ directories
This commit pulls in the latest changes for the include/ and
libiberty/ directories. The last sync was in commit
533da48302a26885a972e4379eccc26b364e5b53.
This commit also removes the file libiberty/rust-demangle.h, this file
has been removed in upstream GCC, and should have been deleted as part
of the previous sync up, which included this ChangeLog entry:
2019-11-16 Eduard-Mihai Burtescu <eddyb@lyken.rs>
....
* rust-demangle.h: Remove.
I've grep'd over the binutils-gdb source and can find no reference to
the rust-demangle.h file, and everything seems to build fine without
it, so I assume its continued existence was a mistake.
include/ChangeLog:
Import from gcc mainline:
2020-02-05 Andrew Burgess <andrew.burgess@embecosm.com>
* hashtab.h (htab_remove_elt): Make a parameter const.
(htab_remove_elt_with_hash): Likewise.
libiberty/ChangeLog:
* rust-demangle.h: Removed.
Import from gcc mainline:
2020-02-05 Andrew Burgess <andrew.burgess@embecosm.com>
* hashtab.c (htab_remove_elt): Make a parameter const.
(htab_remove_elt_with_hash): Likewise.
2020-01-23 Alexandre Oliva <oliva@adacore.com>
* argv.c (writeargv): Output empty args as "".
2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
* cp-demangle.c (cplus_demangle_operators): Add the co_await
operator.
* testsuite/demangle-expected: Test co_await operator mangling.
Andrew Burgess [Sat, 18 Jan 2020 22:38:29 +0000 (22:38 +0000)]
gdb/fortran: Support negative array stride in one limited case
This commit adds support for negative Fortran array strides in one
limited case, that is the case of a single element array with a
negative array stride.
The changes in this commit will be required in order for more general
negative array stride support to work correctly, however, right now
other problems in GDB prevent negative array strides from working in
the general case.
The reason negative array strides don't currently work in the general
case is that when dealing with such arrays, the base address for the
objects data is actually the highest addressed element, subsequent
elements are then accessed with a negative offset from that address,
and GDB is not currently happy with this configuration.
The changes here can be summarised as, stop treating signed values as
unsigned, specifically, the array stride, and offsets calculated using
the array stride.
This issue was identified on the mailing list by Sergio:
https://sourceware.org/ml/gdb-patches/2020-01/msg00360.html
The test for this issue is a new one written by me as the copyright
status of the original test is currently unknown.
gdb/ChangeLog:
* gdbtypes.c (create_array_type_with_stride): Handle negative
array strides.
* valarith.c (value_subscripted_rvalue): Likewise.
gdb/testsuite/ChangeLog:
* gdb.fortran/derived-type-striding.exp: Add a new test.
* gdb.fortran/derived-type-striding.f90: Add pointer variable for
new test.
Luis Machado [Tue, 25 Feb 2020 14:56:58 +0000 (11:56 -0300)]
[AArch64] Fix typo in comment
Just a trivial typo fix in a comment.
gdb/ChangeLog
2020-02-25 Luis Machado <luis.machado@linaro.org>
* aarch64-tdep.c (aarch64_vnv_type): Fix comment typo.
Andrew Burgess [Tue, 25 Feb 2020 14:37:25 +0000 (14:37 +0000)]
gdb/testsuite: Remove source file path from test name
Having paths in test names makes comparing test results from two
separate runs (in different directories) harder.
gdb/testsuite/ChangeLog:
* gdb.base/cached-source-file.exp: Avoid source file paths in test
names.
H.J. Lu [Tue, 25 Feb 2020 11:30:33 +0000 (03:30 -0800)]
Don't call lto-wrapper for ar and ranlib
Since ar and ranlib don't need to know symbol types to work properly,
we should avoid calling lto-wrapper for them to speed them up.
bfd/
PR binutils/25584
* plugin.c (need_lto_wrapper_p): New.
(bfd_plugin_set_program_name): Add an int argument to set
need_lto_wrapper_p.
(get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
set.
* plugin.h (bfd_plugin_set_program_name): Add an int argument.
binutils/
PR binutils/25584
* ar.c (main): Pass 0 to bfd_plugin_set_program_name.
* nm.c (main): Pass 1 to bfd_plugin_set_program_name.
Claudiu Zissulescu [Tue, 25 Feb 2020 08:27:07 +0000 (10:27 +0200)]
[ARC][committed] Update int_vector_base aux register.
INT_VECTOR_BASE auxiliary register is available across all ARC
architectures.
xxxx-xx-xx Claudiu Zissulescu <claziss@gmail.com>
* arc-regs.h (int_vector_base): Make it available for all ARC
CPUs.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
Tom de Vries [Tue, 25 Feb 2020 07:14:41 +0000 (08:14 +0100)]
[gdb/testsuite] Remove gcc/93866 xfail in methods.exp
The test-case gdb.go/methods.exp contains an xfail for PR gcc/93866.
However, that PR has been marked resolved-wontfix, with clarification that the
gccgo symbol names for methods are correct, even if they're not the same as
for gc.
Remove the xfail.
Tested on x86_64-linux with gccgo-10.
gdb/testsuite/ChangeLog:
2020-02-25 Tom de Vries <tdevries@suse.de>
PR go/18926
* gdb.go/methods.exp: Remove gcc/93866 xfail.
Simon Marchi [Tue, 25 Feb 2020 05:13:31 +0000 (00:13 -0500)]
Move dwarf2_get_die_type declaration to dwarf2/read.h
Since its implementation is in dwarf2/read.c, its declaration belongs in
dwarf2/read.h. Move the documentation to the .h at the same time.
gdb/ChangeLog:
* loc.h (dwarf2_get_die_type): Move to...
* read.h (dwarf2_get_die_type): ... here.
* read.c (dwarf2_get_die_type): Move doc to header.
Joel Brobecker [Tue, 25 Feb 2020 03:36:45 +0000 (07:36 +0400)]
gdb/copyright.py: Add generated files in gnulib/ to exclude list
This will prevent this script from updating the copyright year range
for those files.
Note that aclocal.m4 and configure are already in the EXCLUDE_ALL_LIST,
so they don't need to be added to the EXCLUDE_LIST.
gdb/ChangeLog:
* copypright.py (EXCLUDE_LIST): Add 'gnulib/config.in' and
'gnulib/Makefile.in' to the list.
GDB Administrator [Tue, 25 Feb 2020 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 24 Feb 2020 22:50:57 +0000 (15:50 -0700)]
Fix a memory leak and remove an unused member
I noticed that setup_type_unit_groups leaks the symtab vector -- it
allocates this with XNEWVEC, but from what I can tell, nothing frees
it. This patch changes it to use XOBNEWVEC.
Also, the type_unit_unshareable::num_symtabs member is assigned but
never read. So, this removes it.
gdb/ChangeLog
2020-02-24 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct type_unit_unshareable) <num_symtabs>:
Remove.
* dwarf2/read.c (dwarf2_cu::setup_type_unit_groups): Use
XOBNEWVEC.
Tom Tromey [Mon, 24 Feb 2020 22:50:57 +0000 (15:50 -0700)]
Convert IS_TYPE_UNIT_GROUP to method
This converts the IS_TYPE_UNIT_GROUP to a method on
dwarf2_per_cu_data.
gdb/ChangeLog
2020-02-24 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_cu_data) <type_unit_group_p>:
New method.
* dwarf2/read.c (IS_TYPE_UNIT_GROUP): Remove.
(dw2_do_instantiate_symtab, dw2_get_file_names)
(build_type_psymtab_dependencies, load_full_type_unit): Update.
Tom Tromey [Mon, 24 Feb 2020 22:50:57 +0000 (15:50 -0700)]
Simplify setting of reading_partial_symbols
This simplifies the setting and clearing of reading_partial_symbols,
by using scoped_restore in the function that reads partial symbols.
gdb/ChangeLog
2020-02-24 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_build_psymtabs_hard): Use
make_scoped_restore.
(dwarf2_psymtab::read_symtab): Don't clear
reading_partial_symbols.
Andrew Burgess [Mon, 24 Feb 2020 16:39:26 +0000 (16:39 +0000)]
gdb/doc: Fix header alignment of 'info threads' example output
Fixes small white space issue in the example output of 'info threads'.
gdb/doc/ChangeLog:
* gdb.texinfo (Threads): Fix alignment in 'info threads' example
output.
Nick Clifton [Mon, 24 Feb 2020 14:52:34 +0000 (14:52 +0000)]
Updated translations for some of the binutils sub-directories.
Nick Clifton [Mon, 24 Feb 2020 14:39:34 +0000 (14:39 +0000)]
Fix a spelling mistake in the binutils documentation.
PR 25499
* doc/binutils.texi (objdump): Fix typo in description of
objdump's -g option.
Tom de Vries [Mon, 24 Feb 2020 14:32:36 +0000 (15:32 +0100)]
[gdb] Ensure listing of unused static var in info locals
Consider a test-case compiled with -g:
...
int main (void) {
static int b = 2;
return 0;
}
...
When running info locals in main, we get:
...
(gdb) info locals
No locals.
...
The info locals documentation states:
...
Print the local variables of the selected frame, each on a separate line.
These are all variables (declared either static or automatic) accessible at
the point of execution of the selected frame.
...
So, "info locals" should have printed static variable b.
The variable is present in dwarf info:
...
<2><14a>: Abbrev Number: 6 (DW_TAG_variable)
<14b> DW_AT_name : b
<153> DW_AT_const_value : 2
...
but instead of a location attribute, it has a const_value attribute, which
causes the corresponding symbol to have LOC_CONST, which causes info locals to
skip it.
Fix this by handling LOC_CONST in iterate_over_block_locals.
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-02-24 Tom de Vries <tdevries@suse.de>
PR gdb/25592
* stack.c (iterate_over_block_locals): Handle LOC_CONST.
gdb/testsuite/ChangeLog:
2020-02-24 Tom de Vries <tdevries@suse.de>
PR gdb/25592
* gdb.base/info-locals-unused-static-var.c: New test.
* gdb.base/info-locals-unused-static-var.exp: New file.
Tom de Vries [Mon, 24 Feb 2020 11:30:48 +0000 (12:30 +0100)]
[gdb/testsuite] Fix layout next/prev/regs help message
With test-case gdb.gdb/unittest.exp, I run into:
...
(gdb) maintenance selftest^M
...
Running selftest help_doc_invariants.^M
help doc broken invariant: command 'layout next' help doc first line is \
not terminated with a '.' character^M
help doc broken invariant: command 'layout prev' help doc first line is \
not terminated with a '.' character^M
help doc broken invariant: command 'layout regs' help doc first line is \
not terminated with a '.' character^M
Self test failed: self-test failed at help-doc-selftests.c:95^M
...
Fix this by adding the missing '.' character.
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-02-24 Tom de Vries <tdevries@suse.de>
* tui/tui-layout.c (_initialize_tui_layout): Fix help messages for
commands layout next/prev/regs.
Alan Modra [Mon, 24 Feb 2020 02:49:13 +0000 (13:19 +1030)]
Re: vms buffer overflows and large memory allocation
The last patch wasn't quite correct. I'd missed the fact that sbm_off
had been updated.
* vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
Alan Modra [Mon, 24 Feb 2020 01:22:03 +0000 (11:52 +1030)]
vms buffer overflows and large memory allocation
* vms-lib.c (struct carsym_mem): Add limit.
(vms_add_index): Heed limit.
(vms_traverse_index): Catch buffer overflows. Remove outdated fixme.
(vms_lib_read_index): Set up limit. Catch 32-bit overflow.
Always return actual number read.
(_bfd_vms_lib_archive_p): Catch buffer overflows. Replace
assertion with error exit.
GDB Administrator [Mon, 24 Feb 2020 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 23 Feb 2020 01:31:54 +0000 (20:31 -0500)]
gdb: update gnulib import
This is mostly to get this commit from gnulib:
e22cd2677a4b7beacbf30b93bb0559f7b89f96ce
Add ‘extern "C"’ to count-one-bits.h etc.
... which fixes this compilation problem I observed with clang++:
CXXLD gdb
arch/arm-get-next-pcs.o:arm-get-next-pcs.c:function thumb_get_next_pcs_raw(arm_get_next_pcs*): error: undefined reference to 'count_one_bits(unsigned int)'
<more such undefined references>
I built-tested on GNU/Linux x86-64 (gcc-9 and clang-9) as well as with the
x86_64-w64-mingw32-gcc cross-compiler.
gnulib/ChangeLog:
* update-gnulib.sh (GNULIB_COMMIT_SHA1): Bump to
e22cd2677a4b7beacbf30b93bb0559f7b89f96ce.
* Makefile.in, config.in, configure, import/*: Re-generate.
GDB Administrator [Sun, 23 Feb 2020 00:01:37 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 22 Feb 2020 20:49:56 +0000 (13:49 -0700)]
Make dwarf2_compile_expr_to_ax static
I noticed that dwarf2_compile_expr_to_ax can be static. Nothing
outside of loc.c calls it.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* dwarf2/loc.h (dwarf2_compile_expr_to_ax): Don't declare.
* dwarf2/loc.c (dwarf2_compile_expr_to_ax): Now static.
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Fix cast in TUI_DISASM_WIN
I noticed that the TUI_DISASM_WIN macro cast the disassembly window to
a base type, rather than its correct type. This patch fixes this
oversight.
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (TUI_DISASM_WIN): Cast to tui_disasm_window.
Change-Id: Ied3dbac9ef3dc48ceb9e0850fe4ada3c316dd769
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Add "usage" text to all TUI command help
This adds "usage" text to the help for all all the TUI commands. In
some cases the usage is borderline, but I tend to think being complete
is preferable.
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (_initialize_tui_win): Add usage text.
* tui/tui-stack.c (_initialize_tui_stack): Add usage text.
* tui/tui-regs.c (_initialize_tui_regs): Add usage text.
* tui/tui.c (_initialize_tui): Add usage text.
Change-Id: I727f7a7cfc03efa248ef98f30a18be393819e30b
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Use error_no_arg in TUI
This changes a couple of TUI commands to use error_no_arg. The
commands are also simplified a bit, and changed to use other gdb CLI
utility functions like skip_to_space. This lets us removes a couple
of defines that don't interact properly with gettext.
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_set_focus_command)
(tui_set_win_height_command): Use error_no_arg.
(_initialize_tui_win): Update help text.
(FOCUS_USAGE, WIN_HEIGHT_USAGE): Don't define.
Change-Id: I2bf95c2e5cfe1472d068388fa39f0cf07591b76c
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Make some tui_source_window_base members "protected"
This renames a few members of tui_source_window_base, and makes them
"protected".
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (extract_display_start_addr): Rewrite.
* tui/tui-disasm.h (struct tui_disasm_window)
<display_start_addr>: Declare.
* tui/tui-source.h (struct tui_source_window)
<display_start_addr>: Declare.
* tui/tui-winsource.h (struct tui_source_window_base)
<show_source_line, display_start_addr>: New methods.
<m_horizontal_offset, m_start_line_or_addr, m_gdbarch, m_content>:
Rename and move to protected section.
* tui/tui-winsource.c (tui_source_window_base::update_source_window)
(tui_source_window_base::do_erase_source_content): Update.
(tui_source_window_base::show_source_line): Now a method.
(tui_source_window_base::show_source_content)
(tui_source_window_base::tui_source_window_base)
(tui_source_window_base::rerender)
(tui_source_window_base::refill)
(tui_source_window_base::do_scroll_horizontal)
(tui_source_window_base::set_is_exec_point_at)
(tui_source_window_base::update_breakpoint_info)
(tui_source_window_base::update_exec_info): Update.
* tui/tui-source.c (tui_source_window::set_contents)
(tui_source_window::showing_source_p)
(tui_source_window::do_scroll_vertical)
(tui_source_window::location_matches_p)
(tui_source_window::line_is_displayed): Update.
(tui_source_window::display_start_addr): New method.
* tui/tui-disasm.c (tui_disasm_window::set_contents)
(tui_disasm_window::do_scroll_vertical)
(tui_disasm_window::location_matches_p): Update.
(tui_disasm_window::display_start_addr): New method.
Change-Id: I74d72b9da5f458664427db643a108634690c6e19
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Allow TUI windows in Python
This patch adds support for writing new TUI windows in Python.
2020-02-22 Tom Tromey <tom@tromey.com>
* NEWS: Add entry for gdb.register_window_type.
* tui/tui-layout.h (window_factory): New typedef.
(tui_register_window): Declare.
* tui/tui-layout.c (saved_tui_windows): New global.
(tui_apply_current_layout): Use it.
(tui_register_window): New function.
* python/python.c (do_start_initialization): Call
gdbpy_initialize_tui.
(python_GdbMethods): Add "register_window_type" function.
* python/python-internal.h (gdbpy_register_tui_window)
(gdbpy_initialize_tui): Declare.
* python/py-tui.c: New file.
* Makefile.in (SUBDIR_PYTHON_SRCS): Add py-tui.c.
gdb/doc/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* python.texi (Python API): Add menu item.
(TUI Windows In Python): New node.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.python/tui-window.exp: New file.
* gdb.python/tui-window.py: New file.
Change-Id: I85fbfb923a1840450a00a7dce113a05d7f048baa
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Remove the TUI annotation hack
do_tui_putc has some code to remove annotations from gdb output. This
was added in 2001, see commit
a198b876bbcb.
However, I think this code is not needed. It seems very unlikely to
enable both annotations and the TUI, and in any case I think this is
something that should not be supported.
So, this patch removes this code.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-io.c (do_tui_putc): Don't omit annotations.
Change-Id: I05728110365a362d37c9821df9c8779316100bb8
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Remove tui_set_win_with_focus
I noticed that the TUI had two functions with similar names:
tui_set_win_focus_to and tui_set_win_with_focus.
However, one was just an implementation detail of the latter. So,
this patch removes tui_set_win_with_focus entirely, to avoid any
temptation to call it.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
* tui/tui-data.h (tui_set_win_with_focus): Don't declare.
* tui/tui-data.c (tui_set_win_with_focus): Remove.
(tui_set_win_focus_to): Move from tui-win.c.
Change-Id: Idffddab773436bdf80d55480906d76b292981ef2
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Change how TUI windows are instantiated
This adds a new global that maps from window names to window
constructor functions, and then changes tui_get_window_by_name and
validate_window_name to use it. This is another step toward
user-defined window types.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (make_standard_window, get_locator_window): New
functions.
(known_window_types): New global.
(tui_get_window_by_name): Reimplement.
(initialize_known_windows): New function.
(validate_window_name): Rewrite.
(_initialize_tui_layout): Call initialize_known_windows.
Change-Id: I9037aac550299b9d945899220a30c2d3af9dd0de
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
TUI windows do not need to store their type
TUI windows no longer need to store their type -- there's only a
single spot that uses this information, and it can be changed to use
dynamic_cast. (It could be cleaned up even more, by using a virtual
method, but I haven't done so.) This patch removes the "type" field
from tui_gen_win_info, and this in turn allows removing a couple of
enumerator constants.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>:
Remove constants.
* tui/tui-winsource.h (struct tui_source_window_base)
<tui_source_window_base>: Remove parameter.
* tui/tui-winsource.c
(tui_source_window_base::tui_source_window_base): Remove
parameter.
(tui_source_window_base::refill): Update.
* tui/tui-stack.h (struct tui_locator_window)
<tui_locator_window>: Update.
* tui/tui-source.h (struct tui_source_window) <tui_source_window>:
Default the constructor.
* tui/tui-regs.h (struct tui_data_item_window)
<tui_data_item_window>: Default the constructor.
(struct tui_data_window) <tui_data_window>: Likewise.
* tui/tui-disasm.h (struct tui_disasm_window) <tui_disasm_window>:
Default the constructor.
* tui/tui-data.h (struct tui_gen_win_info) <tui_gen_win_info>:
Default the constructor.
<type>: Remove.
(struct tui_win_info) <tui_win_info>: Default the constructor.
* tui/tui-data.c (tui_win_info::tui_win_info): Remove.
* tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>:
Default the constructor.
Change-Id: I594cd07d2e0bba71ad594a6fb263904ce2febcd6
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Remove tui_delete_invisible_windows and tui_make_all_invisible
tui_delete_invisible_windows is only needed after applying a layout,
and tui_make_all_invisible is only needed before applying a layout.
This patch removes these functions, in favor of doing this management
directly in tui_apply_current_layout. This is needed so that the
lifetimes of non-built-in windows will be properly managed.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.h (tui_make_all_invisible): Don't declare.
* tui/tui-wingeneral.c (tui_make_all_invisible): Remove.
* tui/tui-win.c (tui_resize_all): Don't call
tui_delete_invisible_windows.
* tui/tui-layout.c (tui_apply_current_layout): Delete windows when
done.
(tui_set_layout): Update.
(tui_add_win_to_layout): Don't call tui_delete_invisible_windows.
* tui/tui-data.h (tui_delete_invisible_windows): Don't declare.
* tui/tui-data.c (tui_delete_invisible_windows): Remove.
Change-Id: Ia3603b021dcb7ec31700a4a32640cd09b00b8f3b
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Handle ambiguity in tui_partial_win_by_name
This changes tui_partial_win_by_name to correctly handle an ambiguous
name prefix. This will be important once the user can register new
window types.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_partial_win_by_name): Handle ambiguity
correctly.
Change-Id: I59aaacd697eeab649164183457ef722dae58d60d
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Reimplement tui_next_win and tui_prev_win
This reimplements tui_next_win and tui_prev_win. Now they account for
the possibility of windows not on tui_win_list.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-data.c (tui_next_win, tui_prev_win): Reimplement.
Change-Id: Ifcd402f76fe0a16e0fe9275a185d550279c01660
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Change TUI window iteration
This changes the TUI to track all the instantiated windows in a new
global vector. After this, iteration over TUI windows is done by
simply iterating over this vector.
This approach makes it simpler to define new window types. In
particular, a subsequent patch will add the ability to define a TUI
window from Python.
Note that this series will not remove tui_win_list. This will
continue to exist in parallel, only because it was simpler to leave
this alone. Perhaps it could still be removed in the future.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_iterator)
<inner_iterator>: New etytypedef.
<tui_source_window_iterator>: Take "end" parameter.
<tui_source_window_iterator>: Take iterator.
<operator*, advance>: Update.
<m_iter>: Change type.
<m_end>: New field.
(struct tui_source_windows) <begin, end>: Update.
* tui/tui-layout.c (tui_windows): New global.
(tui_apply_current_layout): Clear tui_windows.
(tui_layout_window::apply): Update tui_windows.
* tui/tui-data.h (tui_windows): Declare.
(all_tui_windows): Now inline function.
(class tui_window_iterator, struct all_tui_windows): Remove.
Change-Id: I6ab77976d6326f427178f725434f8f82046e0bbf
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Add horizontal splitting to TUI layout
This changes the TUI layout engine to add horizontal splitting. Now,
windows can be side-by-side.
A horizontal split is defined using the "-horizontal" parameter to
"tui new-layout".
This also adds the first "winheight" test to the test suite. One open
question is whether we want a new "winwidth" command, now that
horizontal layouts are possible. This is easily done using the
generic layout code.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
PR tui/17850:
* tui/tui-win.c (tui_gen_win_info::max_width): New method.
* tui/tui-layout.h (class tui_layout_base) <get_sizes>: Add
"height" argument.
(class tui_layout_window) <get_sizes>: Likewise.
(class tui_layout_split) <tui_layout_split>: Add "vertical"
argument.
<get_sizes>: Add "height" argument.
<m_vertical>: New field.
* tui/tui-layout.c (tui_layout_split::clone): Update.
(tui_layout_split::get_sizes): Add "height" argument.
(tui_layout_split::adjust_size, tui_layout_split::apply): Update.
(tui_new_layout_command): Parse "-horizontal".
(_initialize_tui_layout): Update help string.
(tui_layout_split::specification): Add "-horizontal" when needed.
* tui/tui-layout.c (tui_layout_window::get_sizes): Add "height"
argument.
* tui/tui-data.h (struct tui_gen_win_info) <max_width, min_width>:
New methods.
gdb/doc/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
PR tui/17850:
* gdb.texinfo (TUI Commands): Document horizontal layouts.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
PR tui/17850:
* gdb.tui/new-layout.exp: Add horizontal layout and winheight
tests.
Change-Id: I38b35e504f34698578af86686be03c0fefd954ae
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Change return type of tui_layout_base::adjust_size
This changes tui_layout_base::adjust_size to return a new enum type.
I broke this out into a separate patch because it simplifies a
subsequent patch.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.h (enum tui_adjust_result): New.
(class tui_layout_base) <adjust_size>: Return tui_adjust_result.
(class tui_layout_window) <adjust_size>: Return
tui_adjust_result. Rewrite.
(class tui_layout_split) <adjust_size>: Return tui_adjust_result.
* tui/tui-layout.c (tui_layout_split::adjust_size): Update.
Change-Id: I821b48ab06a9b9485875e147bd08a3bc46b900a0
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Allow TUI sub-layouts in "new-layout" command
The new TUI layout engine has support for "sub-layouts" -- this is a
layout that includes another layout as a child. A sub-layout is
treated as a unit when allocating space.
There's not a very strong reason to use sub-layouts currently. This
patch exists to introduce the idea, and to simplify the subsequent
patch that adds horizontal layouts -- where sub-layouts are needed.
Because this patch won't go in on its own, I chose to defer
documenting this change until the subsequent horizontal layout patch.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.h (class tui_layout_split) <add_split>: Change
parameter and return types.
(class tui_layout_base) <specification>: Add "depth".
(class tui_layout_window) <specification>: Add "depth".
(class tui_layout_split) <specification>: Add "depth".
* tui/tui-layout.c (tui_layout_split::add_split): Change parameter
and return types.
(tui_new_layout_command): Parse sub-layouts.
(_initialize_tui_layout): Update help string.
(tui_layout_window::specification): Add "depth".
(add_layout_command): Update.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.tui/new-layout.exp: Add sub-layout tests.
Change-Id: Iddf52d067a552c168b8a67f29caf7ac86404b10c
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Add the "tui new-layout" command
This adds a new command, "tui new-layout". This command can be used
to define a new TUI window layout.
The command is used like:
(gdb) tui new-layout name src 1 regs 1 status 0 cmd 1
The first argument is the name of the layout. In this example, it is
"name", so the new layout could be seen by "layout name".
Subsequent arguments come in pairs, where the first item in a pair is
the name of a window, and the second item in a pair is the window's
weight. A weight is just an integer -- a window's allocated size is
proportional to the total of the weights given. So, in the above
example, all windows will have the same size (the status windows's
weight does not matter, because it has fixed height).
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* NEWS: Add "tui new-layout" item.
* tui/tui-layout.c (add_layout_command): Return cmd_list_element.
Add new-layout command to help text.
(validate_window_name): New function.
(tui_new_layout_command): New function.
(_initialize_tui_layout): Register "new-layout".
(tui_layout_window::specification): New method.
(tui_layout_window::specification): New method.
* tui/tui-layout.h (class tui_layout_base) <specification>: New
method.
(class tui_layout_window) <specification>: New method.
(class tui_layout_split) <specification>: New method.
gdb/doc/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.texinfo (TUI Overview): Mention user layouts.
(TUI Commands): Document "tui new-layout".
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.tui/new-layout.exp: New file.
Change-Id: Id7c3ace20ab1e8924f8f4ad788f40210f58a5c05
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Remove hard-coded TUI layouts
This changes the TUI so that the available layouts are no longer
completely hard-coded. "enum tui_layout_type" is removed, and then
all the fallout from this is fixed up.
This patch also reimplements the "layout" command to be a prefix
command. The concrete layouts are simply sub-commands now. This
provides completion and correct abbreviation behavior for free.
Finally, this also changes the name of the locator window to "status".
This matches the documentation and will be exposed to the user in a
subsequent patch.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_enable): Call tui_set_initial_layout.
* tui/tui-win.c (window_name_completer): Update comment.
* tui/tui-layout.h (class tui_layout_base) <replace_window>:
Declare method.
(class tui_layout_window) <replace_window>: Likewise.
(class tui_layout_split) <replace_window>: Likewise.
(tui_set_layout): Don't declare.
(tui_set_initial_layout): Declare function.
* tui/tui-layout.c (layouts, applied_skeleton, src_regs_layout)
(asm_regs_layout): New globals.
(tui_current_layout, show_layout): Remove.
(tui_set_layout, tui_add_win_to_layout): Rewrite.
(find_layout, tui_apply_layout): New function.
(layout_completer): Remove.
(tui_next_layout): Reimplement.
(tui_next_layout_command): New function.
(tui_set_initial_layout, tui_prev_layout_command): New functions.
(tui_regs_layout): Reimplement.
(tui_regs_layout_command): New function.
(extract_display_start_addr): Rewrite.
(next_layout, prev_layout): Remove.
(tui_layout_window::replace_window): New method.
(tui_layout_split::replace_window): New method.
(destroy_layout): New function.
(layout_list): New global.
(add_layout_command): New function.
(initialize_layouts): Update.
(tui_layout_command): New function.
(_initialize_tui_layout): Install "layout" commands.
* tui/tui-data.h (enum tui_layout_type): Remove.
(tui_current_layout): Don't declare.
Change-Id: I9b5f7ab3ce838d6b340b8c373ef649a8e0a74b73
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Reimplement "tui reg" command
This reimplements the low-level layout function that is used by the
"tui reg" command. Now it simply calls into the existing "layout"
command, though this will be changed again in a subsequent patch. The
rationale for this patch is that it makes it simpler to remove
"enum tui_layout_type".
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_reg_layout): Remove.
(tui_reg_command): Use tui_regs_layout.
* tui/tui-layout.h (tui_reg_command): Declare.
* tui/tui-layout.c (tui_reg_command): New function.
Change-Id: I0ca6884e2967005e7d3fbf5f13a0ac8f9c3298cf
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Reimplement TUI "C-x 1" binding
The TUI "C-x 1" key binding removes TUI windows, based on the current
layout. With user-defined layouts, this is no longer easy to do.
This patch changes "C-x 1" to simply delete windows, leaving just the
focus window, the locator, and the command window.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_rl_delete_other_windows): Call
tui_remove_some_windows.
* tui/tui-layout.h (class tui_layout_base) <remove_windows>:
Declare method.
(class tui_layout_window) <remove_windows>: New method.
(class tui_layout_split) <remove_windows>: Declare.
(tui_remove_some_windows): Declare.
* tui/tui-layout.c (tui_remove_some_windows): New function.
(tui_layout_split::remove_windows): New method.
Change-Id: If186f9c3f263913e963b965204481d1b4385c6d4
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Simplify TUI C-x 2 binding
The TUI "C-x 2" binding tries to switch to a different layout based on
the current layout. Once user-defined layouts are available, this
won't really make sense. I wasn't entirely sure how to handle this.
This patch changes the binding to simply cycle through the existing
layouts. I considered this a reasonable, though not ideal,
compromise.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_rl_change_windows): Call tui_next_layout.
* tui/tui-layout.h (tui_next_layout): Declare.
* tui/tui-layout.c (tui_next_layout): New function.
Change-Id: Ic101f0e3831a4235a048b3090ef60f025f7449bb
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Fix latent display bug in tui_data_window
tui_data_window creates new curses windows, but does not pass in
coordinates relative to the data window's origin. This means that the
data window could only ever be displayed as the topmost window in a
layout. This is not a currently problem, because all the existing
layouts do this; but a subsequent patch will add user-defined layouts,
which could do otherwise.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::display_registers_from): Use
correct coordinates.
Change-Id: I5101f2b2869557b87381ebdeebd9b7fd28687831
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Simplify tui_add_win_to_layout
tui_add_win_to_layout is only ever called for the source or assembly
windows. This simplifies the function by removing the DATA_WIN case.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.h (tui_add_win_to_layout): Add comment.
* tui/tui-layout.c (tui_add_win_to_layout): Add assert. Remove
DATA_WIN case.
Change-Id: Idfca902c6c90153acc5d19af4c33aa74bc3caf31
Tom Tromey [Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)]
Use TUI_DISASM_WIN instead of tui_win_list array
This is a minor cleanup to change tui_get_low_disassembly_address to
use TUI_DISASM_WIN, rather than the tui_win_list array. This is more
in line with what the rest of the TUI code does.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-disasm.c (tui_get_low_disassembly_address): Use
TUI_DISASM_WIN, not tui_win_list.
Change-Id: I999335ee3f63a4b570e84f320236b78f2bd5b780
Tom Tromey [Sat, 22 Feb 2020 17:02:42 +0000 (10:02 -0700)]
Style field names in "print"
This changes gdb to use the "variable" style when printing field
names. I've added new tests for C and Rust, but not other languages.
I chose "variable" because that seemed most straightforward. However,
another option would be to introduce a new "field" style. Similarly,
this patch uses the variable style for enumerator constants -- but
again, a new style could be used if that's preferred.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* valprint.c (generic_val_print_enum_1)
(val_print_type_code_flags): Style member names.
* rust-lang.c (val_print_struct, rust_print_enum)
(rust_print_struct_def, rust_internal_print_type): Style member
names.
* p-valprint.c (pascal_object_print_value_fields): Style member
names. Only call fprintf_symbol_filtered for static members.
* m2-typeprint.c (m2_record_fields, m2_enum): Style member names.
* f-valprint.c (f_val_print): Style member names.
* f-typeprint.c (f_type_print_base): Style member names.
* cp-valprint.c (cp_print_value_fields): Style member names. Only
call fprintf_symbol_filtered for static members.
(cp_print_class_member): Style member names.
* c-typeprint.c (c_print_type_1, c_type_print_base_1): Style
member names.
* ada-valprint.c (ada_print_scalar): Style enum names.
(ada_val_print_enum): Likewise.
* ada-typeprint.c (print_enum_type): Style enum names.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.rust/rust-style.rs: New file.
* gdb.rust/rust-style.exp: New file.
* gdb.base/style.exp: Test structure printing.
* gdb.base/style.c (struct some_struct): New type.
(enum etype): New type.
(struct_value): New global.
Change-Id: I070e1293c6cc830c9ea916af8243410aa384e944
Alan Modra [Sat, 22 Feb 2020 02:16:33 +0000 (12:46 +1030)]
PR25585, PHDR segment not covered by LOAD segment
I closed this bug as invalid, but I think it is worth mentioning in NEWS
that older linkers didn't check PT_PHDR very well. The patch also allows
people to force an output file with --noinhibit-exec after the error.
bfd/
PR 25585
* elf.c (assign_file_positions_for_load_sections): Continue linking
on "PHDR segment not covered by LOAD segment" errors.
ld/
PR 25585
* NEWS: Mention better "PHDR segment not covered by LOAD segment"
checking.
Tom Tromey [Sat, 22 Feb 2020 01:27:31 +0000 (18:27 -0700)]
Add a mostlyclean target to gdbserver
I noticed gdbserver's Makefile doesn't have a mostlyclean target. I
use this sometimes, so this patch adds it. Adding it as a synonym of
"clean" seemed to make sense, given the contents of that rule.
gdbserver/ChangeLog
2020-02-21 Tom Tromey <tom@tromey.com>
* Makefile.in (mostlyclean): New target.
GDB Administrator [Sat, 22 Feb 2020 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 21 Feb 2020 21:44:41 +0000 (14:44 -0700)]
Update partial_symtab comment
The introductory comment for partial_symtab has been mildly incorrect
since the partial symtab code was changed to allocate partial symtabs
with "new". This patch removes the incorrect text.
gdb/ChangeLog
2020-02-21 Tom Tromey <tom@tromey.com>
* psympriv.h (struct partial_symtab): Update comment.
Tom de Vries [Fri, 21 Feb 2020 19:47:28 +0000 (20:47 +0100)]
[gdb/testsuite] Fix gdb.go/methods.exp
With gccgo-6/7, we have:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
XFAIL: gdb.go/methods.exp: going to first breakpoint \
(the program exited)
FAIL: gdb.go/methods.exp: setting breakpoint at (*main.T).Bar
XFAIL: gdb.go/methods.exp: going to second breakpoint \
(the program is no longer running)
...
And with gccgo-8/9/10, we have:
...
PASS: gdb.go/methods.exp: setting breakpoint 1
XFAIL: gdb.go/methods.exp: going to first breakpoint
FAIL: gdb.go/methods.exp: setting breakpoint at (*main.T).Bar
XFAIL: gdb.go/methods.exp: going to second breakpoint \
(the program exited)
...
The first test passes and fails with different messages:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
...
or:
...
PASS: gdb.go/methods.exp: setting breakpoint 1
...
Fix this by removing the explicit pass call and using the message argument for
gdb_breakpoint, for both breakpoint locations.
The setup of the xfails is non-specific:
...
setup_xfail "*-*-*" ;# mangling issues IIRC
...
so let's start with removing these.
The first FAIL with gccgo-6:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
...
is due an incorrect DW_AT_name attribute:
...
# <554> DW_AT_name : main.Foo.N6_main.T
...
Fix this by recognizing the incorrect attribute, and xfailing the test.
Furthermore, if setting the breakpoint fails, there's not much point in trying
to continue to the breakpoint:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
FAIL: gdb.go/methods.exp: going to first breakpoint (the program exited)
...
Fix this by skipping the second test if the first one fails, also for the
second breakpoint.
With gccgo-10, we manage to set the first breakpoint, but continuing to
breakpoint test fails:
...
PASS: gdb.go/methods.exp: setting breakpoint 1
FAIL: gdb.go/methods.exp: going to first breakpoint
...
This is due to an incorrect regexp, requiring a colon in front of the
breakpoint location. Fix this for both breakpoints.
Setting the second breakpoint fails:
...
FAIL: gdb.go/methods.exp: setting breakpoint at (*main.T).Bar
...
presumably because the breakpoint location "(*main.T).Bar" does not follow the
naming convention explained at https://golang.org/doc/gdb#Naming. Fix this by
updating the breakpoint location to "main.(*T).Bar".
Still this test fails, for gccgo-6/7 because of an incorrect DW_AT_name
attribute:
...
# <529> DW_AT_name : main.Bar.pN6_main.T
...
and for gccgo-8/9/10 because of incorrect DW_AT_name/DW_AT_linkage_name
attributes (filed as gcc PR93866):
...
# <6e5> DW_AT_name : main.Bar..1main.T
# <6ec> DW_AT_linkage_name: main.T.Bar
..
Add xfails for both of these.
All in all, now we have with gccgo-6/7:
...
XFAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
XFAIL: gdb.go/methods.exp: setting breakpoint at main.(*T).Bar
...
and with gccgo-8/9/10, we have:
...
PASS: gdb.go/methods.exp: setting breakpoint at main.T.Foo
PASS: gdb.go/methods.exp: going to first breakpoint
XFAIL: gdb.go/methods.exp: setting breakpoint at main.(*T).Bar
...
Tested on x86_64-linux with gccgo-6/7/8/9/10.
gdb/testsuite/ChangeLog:
2020-02-21 Tom de Vries <tdevries@suse.de>
PR go/18926
* lib/gdb.exp (bp_location2/bp_location2_regexp): Fix.
Remove blanket xfails. Use message argument for gdb_breakpoint.
Make continuing to breakpoint test conditional on setting breakpoint.
Fix continuing to breakpoint regexp. Add xfails for gccgo-6/7
DW_AT_name attribute. Add xfail for GCC PR93866.
Tom Tromey [Fri, 21 Feb 2020 15:41:11 +0000 (08:41 -0700)]
Fix two more mips-tdep.h declarations
My earlier patch to fix a declaration mismatch in mips-tdep.h missed a
couple of spots. Basically, I sent it too soon.
This patch fixes a couple more mismatches between a declaration (using
bfd_vma) and the definition (using CORE_ADDR).
gdb/ChangeLog
2020-02-21 Tom Tromey <tromey@adacore.com>
* mips-tdep.h (mips_pc_is_mips16, mips_pc_is_micromips): Parameter
type is CORE_ADDR.
Tom de Vries [Fri, 21 Feb 2020 15:36:48 +0000 (16:36 +0100)]
[gdb] Fix cc-with-dwz regression
I noticed a regression with board cc-with-dwz:
...
FAIL: gdb.cp/m-static.exp: static const int initialized elsewhere
FAIL: gdb.cp/m-static.exp: info variable everywhere
...
The problem started with commit
0494dbecdf "Consolidate partial symtab
dependency reading".
The commit replaces the dwarf2_psymtab::expand_psymtab specific reading of
dependencies, which contains a "dependencies[i]->user == NULL" test, with a
generic partial_symtab::read_dependencies call, which does not test the user
field.
This patch fixes the regression by adding back the test, in the generic
partial_symtab::read_dependencies.
Build and reg-tested on x86_64-linux.
Tested natively, as well as with boards cc-with-dwz and cc-with-dwz-m.
The patch fixes all 33 regressions with cc-with-dwz, and all 2929 regression
with cc-with-dwz-m.
gdb/ChangeLog:
2020-02-21 Tom de Vries <tdevries@suse.de>
PR gdb/25534
* psymtab.c (partial_symtab::read_dependencies): Don't read dependency
if dependencies[i]->user != NULL.
Andrew Burgess [Wed, 19 Feb 2020 14:06:45 +0000 (14:06 +0000)]
gdb/testsuite: Add test for case where gdb_demangle returns NULL
This adds a test for the commit:
commit
4f180d5396741eb65badba70cf5077b7d48f8641
Date: Fri Feb 21 08:19:21 2020 -0700
Check for null result from gdb_demangle
gdb/testsuite/ChangeLog:
* gdb.dwarf2/cpp-linkage-name.c: New file.
* gdb.dwarf2/cpp-linkage-name.exp: New file.
Ali Tamur via gdb-patches [Fri, 21 Feb 2020 15:19:21 +0000 (08:19 -0700)]
Check for null result from gdb_demangle
I am sending this patch on behalf of kmoy@google.com, who discovered the bug
and wrote the fix.
gdb_demangle can return null for strings that don't properly demangle. The null
check was mistakenly removed in commit
43816ebc335. Without this check, GDB
aborts when loading symbols from some binaries.
gdb/ChangeLog
2020-02-21 Ali Tamur <tamur@google.com>
* dwarf2/read.c (dwarf2_name): Add null check.
Alan Modra [Fri, 21 Feb 2020 08:52:41 +0000 (19:22 +1030)]
Fuzzers whining about mach-o support
It's very easy to make bfd/mach-o.c allocate huge amounts of memory
with fuzzed binaries. This make it a little harder.
The patch also fixes a number of places where an attempt to detect
overflow of multiplication was done with code like
if (x * 4 < x)
/* overflow case */
That of course doesn't work. There are plenty of values of x that
overflow x * 4 but (x * 4) mod 2^n is greater than x. For example
with 16-bit types, 0x6000 * 4 = 0x18000 mod 2^16 = 0x8000.
* mach-o.c (bfd_mach_o_canonicalize_relocs): Fix ineffective
overflow check.
(bfd_mach_o_canonicalize_reloc): Likewise.
(bfd_mach_o_canonicalize_dynamic_reloc): Likewise. Sanity check
counts and offsets against file size.
(bfd_mach_o_build_dysymtab): Fix ineffective overflow check.
(bfd_mach_o_mangle_sections): Remove unnecessary overflow check.
(bfd_mach_o_read_symtab_symbols): Sanity check count and offset
against file size. Delete symbol table error message.
(bfd_mach_o_read_dysymtab): Sanity check counts and offsets
against file size.
(bfd_mach_o_read_symtab): Likewise.
(bfd_mach_o_read_command): Pass file size.
(bfd_mach_o_scan): Sanity check command count against file size.
Shahab Vahedi [Fri, 21 Feb 2020 09:31:50 +0000 (10:31 +0100)]
Fix typo in gdb/testsuite/ChangeLog
The date of my last patch's entry in gdb/testsuite/ChangeLog was
wrong. This fixes it.
Shahab Vahedi [Wed, 19 Feb 2020 13:56:02 +0000 (14:56 +0100)]
gdb/testsuite: Regenerate the testglue if it is not in
For running the DejaGnu tests, some esoteric configurations
may require a testglue. This, for instance, is true about
testing ARC targets which uses its own DejaGnu board and
a simulator which does not support returning the program's exit
code. Therefore, for those tests that use "gdb_compile", a
"gdb_tg.o" file is compiled and linked into the final
executable.
There are tests that invoke "gdb_compile" from different
directories. Let's take a look at an example test:
gdb.base/fullname.exp. The purpose of this test is to build
the executable from different directories (absolute vs. relative
vs. other) and then check if gdb can handle setting breakpoints
accordingly.
When "gdb_compile" generates the "gdb_tg.o", it does not
do it again for the same test. Although this might seem
efficient, it can lead to problems when changing directories
before the next compile:
gdb compile failed, arc-elf32-gcc: error: gdb_tg.o:
No such file or directory
This patch checks if the wrapper file ("gdb_tg.o") is still in
reach and if it is not, it will stimulate the regeneration of
the wrapper.
It is worth mentioning that GCC's DejaGnu tests handle these
scenarios as well and they seem to be more efficient in doing so
by saving the library paths and manipulating them if necessary
[1]. However, for GDB tests, that require less compilations,
I think the proposed solution should be fine compared to a more
full fledged solution from GCC. The glue file in our case is
only 2 KiB.
Last but not least, I ran the x86_64 tests on an x86_64 host and
found no regression.
[1]
Avid coders may look for "set_ld_library_path_env_vars" in
gcc/testsuite/lib/target-libpath.exp.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_wrapper_init): Reset
"gdb_wrapper_initialized" to 0 if "wrapper_file" does
not exist.
Tom Tromey [Fri, 21 Feb 2020 01:22:09 +0000 (18:22 -0700)]
Fix latent bug in dwarf2_find_containing_comp_unit
dwarf2_find_containing_comp_unit has this in its binary search:
if (mid_cu->is_dwz > offset_in_dwz
|| (mid_cu->is_dwz == offset_in_dwz
&& mid_cu->sect_off + mid_cu->length >= sect_off))
high = mid;
The intent here is to determine whether SECT_OFF appears in or before
MID_CU.
I believe this has an off-by-one error, and that the check should use
">" rather than ">=". If the two side are equal, then SECT_OFF
actually appears at the start of the next CU.
I've had this patch kicking around for ages but I forget how I found
the problem.
gdb/ChangeLog
2020-02-20 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_find_containing_comp_unit): Use ">", not
">=", in binary search.
(dwarf2_find_containing_comp_unit): New overload.
(run_test): New self-test.
(_initialize_dwarf2_read): Register new test.
Nelson Chu [Wed, 12 Feb 2020 10:18:51 +0000 (02:18 -0800)]
RISC-V: Support the read-only CSR checking.
CSRRW and CSRRWI always write CSR. CSRRS, CSRRC, CSRRSI and CSRRCI write CSR
when RS1 isn't zero. The CSR is read only if the [11:10] bits of CSR address
is 0x3. The read-only CSR can not be written by the CSR instructions.
gas/
* config/tc-riscv.c (riscv_ip): New boolean insn_with_csr to indicate
we are assembling instruction with CSR. Call riscv_csr_read_only_check
after parsing all arguments.
(enum csr_insn_type): New enum is used to classify the CSR instruction.
(riscv_csr_insn_type, riscv_csr_read_only_check): New functions. These
are used to check if we write a read-only CSR by the CSR instruction.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.s: New testcase. Test
all CSR for the read-only CSR checking.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.d: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-02.s: New testcase. Test
all CSR instructions for the read-only CSR checking.
* testsuite/gas/riscv/priv-reg-fail-read-only-02.d: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-02.l: Likewise.
Nelson Chu [Wed, 12 Feb 2020 10:18:50 +0000 (02:18 -0800)]
RISC-V: Disable the CSR checking by default.
Add new .option `csr-check/no-csr-check` and GAS option `-mcsr-check
/-mno-csr-check` to enbale/disable the CSR checking. Disable the CSR
checking by default.
gas/
* config/tc-riscv.c: Add new .option and GAS options to enbale/disable
the CSR checking. We disable the CSR checking by default.
(reg_lookup_internal): Check the `riscv_opts.csr_check`
before we doing the CSR checking.
* doc/c-riscv.texi: Add description for the new .option and assembler
options.
* testsuite/gas/riscv/priv-reg-fail-fext.d: Add `-mcsr-check` to enable
the CSR checking.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: Likewise.
Nelson Chu [Wed, 12 Feb 2020 10:18:49 +0000 (02:18 -0800)]
RISC-V: Support the ISA-dependent CSR checking.
According to the riscv privilege spec, some CSR are only valid when rv32 or
the specific extension is set. We extend the DECLARE_CSR and DECLARE_CSR_ALIAS
to record more informaton we need, and then check whether the CSR is valid
according to these information. We report warning message when the CSR is
invalid, so we have a choice between error and warning by --fatal-warnings
option. Also, a --no-warn/-W option is used to turn the warnings off, if
people don't want the warnings.
gas/
* config/tc-riscv.c (enum riscv_csr_class): New enum. Used to decide
whether or not this CSR is legal in the current ISA string.
(struct riscv_csr_extra): New structure to hold all extra information
of CSR.
(riscv_init_csr_hash): New function. According to the DECLARE_CSR and
DECLARE_CSR_ALIAS, insert CSR extra information into csr_extra_hash.
Call hash_reg_name to insert CSR address into reg_names_hash.
(md_begin): Call riscv_init_csr_hashes for each DECLARE_CSR.
(reg_csr_lookup_internal, riscv_csr_class_check): New functions.
Decide whether the CSR is valid according to the csr_extra_hash.
(init_opcode_hash): Update 'if (hash_error != NULL)' as hash_error is
not a boolean. This is same as riscv_init_csr_hash, so keep the
consistent usage.
* testsuite/gas/riscv/csr-dw-regnums.d: Add -march=rv32if option.
* testsuite/gas/riscv/priv-reg.d: Add f-ext by -march option.
* testsuite/gas/riscv/priv-reg-fail-fext.d: New testcase. The source
file is `priv-reg.s`, and the ISA is rv32i without f-ext, so the
f-ext CSR are not allowed.
* testsuite/gas/riscv/priv-reg-fail-fext.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: New testcase. The
source file is `priv-reg.s`, and the ISA is rv64if, so the
rv32-only CSR are not allowed.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.
include/
* opcode/riscv-opc.h: Extend DECLARE_CSR and DECLARE_CSR_ALIAS to
record riscv_csr_class.
opcodes/
* riscv-dis.c (print_insn_args): Updated since the DECLARE_CSR is changed.
gdb/
* riscv-tdep.c: Updated since the DECLARE_CSR is changed.
* riscv-tdep.h: Likewise.
* features/riscv/rebuild-csr-xml.sh: Generate the 64bit-csr.xml without
rv32-only CSR.
* features/riscv/64bit-csr.xml: Regernated.
binutils/
* dwarf.c: Updated since the DECLARE_CSR is changed.
Alan Modra [Thu, 20 Feb 2020 13:05:21 +0000 (23:35 +1030)]
pdp11 reloc processing
This allows pdp11 to handle 32-bit fixups that can be applied by gas,
and improves the error message emitted when the required reloc isn't
available.
* config/tc-pdp11.c (md_apply_fix): Handle BFD_RELOC_32.
(tc_gen_reloc): Only give a BAD_CASE assertion on pcrel relocs.
Alan Modra [Thu, 20 Feb 2020 11:23:44 +0000 (21:53 +1030)]
PR25569, PDP11 ld -s clobbers last data byte
This patch fixes an ancient wart in aout support, in that text and
data section sizes are rounded up for alignment rather that just the
corresponding header sizes. Changing section sizes could conceivably
result in buffer overflows if section contents were held in memory.
Also, keeping the original section sizes allows this PR to be fixed
nicely.
bfd/
PR 25569
* aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
"text", "data" and "bss" section pointer vars. Don't update
section size, just exec header sizes.
(adjust_sizes_and_vmas): Don't update text section size. Set
initial exec header a_text. Print exec headers sizes.
* pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
(adjust_sizes_and_vmas): Similarly. Formatting.
(final_link): Correct final file extension.
gas/
PR 25569
* config/obj-aout.c (obj_aout_frob_file_before_fix): Don't loop
on section size adjustment, instead perform another write if
exec header size is larger than section size.
GDB Administrator [Fri, 21 Feb 2020 00:01:08 +0000 (00:01 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Wed, 19 Feb 2020 21:40:48 +0000 (16:40 -0500)]
Make '{putchar,fputc}_unfiltered' use 'fputs_unfiltered'
There is currently a regression when using
'{putchar,fputc}_unfiltered' with 'puts_unfiltered' which was
introduced by one of the commits that reworked the unfiltered print
code.
The regression makes it impossible to use '{putchar,fputc}_unfiltered'
with 'puts_unfiltered', because the former writes directly to the
ui_file stream using 'stream->write', while the latter uses a buffered
mechanism (see 'wrap_buffer') and delays the printing.
If you do a quick & dirty hack on e.g. top.c:show_gdb_datadir:
@@ -2088,6 +2088,13 @@ static void
show_gdb_datadir (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
+ putchar_unfiltered ('\n');
+ puts_unfiltered ("TEST");
+ putchar_unfiltered ('>');
+ puts_unfiltered ("PUTS");
+ putchar_unfiltered ('\n');
rebuild GDB and invoke the "show data-directory" command, you will
see:
(gdb) show data-directory
>
TESTPUTSGDB's data directory is "/usr/local/share/gdb".
Note how the '>' was printed before the output, and "TEST" and "PUTS"
were printed together.
My first attempt to fix this was to always call 'flush_wrap_buffer' at
the end of 'fputs_maybe_filtered', since it seemed to me that the
function should always print what was requested. But I wasn't sure
this was the right thing to do, so I talked to Tom on IRC and he gave
me another, simpler idea: make '{putchar,fputc}_unfiltered' call into
the already existing 'fputs_unfiltered' function.
This patch implements the idea. I regtested it on the Buildbot, and
no regressions were detected.
gdb/ChangeLog:
2020-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
Tom Tromey <tom@tromey.com>
* utils.c (fputs_maybe_filtered): Call 'stream->puts' instead
of 'fputc_unfiltered'.
(putchar_unfiltered): Call 'fputc_unfiltered'.
(fputc_unfiltered): Call 'fputs_unfiltered'.
Tom de Vries [Thu, 20 Feb 2020 16:46:17 +0000 (17:46 +0100)]
[gdb/testsuite] Fix hello.go xpass
With gdb.go/hello.go, we run into an xpass:
...
Thread 1 "hello" hit Breakpoint 1, main.main () at hello.go:7^M
7 func main () {^M
(gdb) print st^M
$1 = 0x0 ""^M
(gdb) XPASS: gdb.go/hello.exp: starting string check
...
The xfail is setup as follows:
...
\# This used to print "", i.e., the local "st" initialized as "".
setup_xfail "*-*-*"
gdb_test "print st" \
".* = $hex \"\"" \
"starting string check"
...
It's not clear what gccgo/gc PR this xfail refers to.
It's also not clear why the empty string is both:
- listed as reason for xfail, and
- used in the pass pattern.
Furthermore, there's a comment in the hello.go testcase:
...
st := "Hello, world!" // this intentionally shadows the global "st"
...
while there's no global st variable present, only a variable myst:
...
var myst = "Shall we?"
...
Fix this by splitting up the test-case in two test-cases, hello.{go,exp} and
global-local-var-shadow.{go,exp}.
In hello.exp we no longer attempt to print st before its declaration. In
hello.go we remove the myst variable as well the comment related to shadowing.
In global-local-var-shadow.go, we rename myst to st, such that the comment
related to shadowing is correct. In global-local-var-shadow.exp we attempt to
print the value of st before the local definition, which should print the
value of the global definition, and xfail this with reference to GCC PR93844.
Tested on x86_64-linux, with gccgo 10.
gdb/testsuite/ChangeLog:
2020-02-20 Tom de Vries <tdevries@suse.de>
PR go/17018
* gdb.go/hello.exp: Copy ...
* gdb.go/global-local-var-shadow.exp: ... here. New file. Expect
print of st to print value of global definition. Add xfail for GCC
PR93844.
* gdb.go/hello.exp: Remove printing of st before definition.
* gdb.go/hello.go: Copy ...
* gdb.go/global-local-var-shadow.go: ... here. New test. Rename myst
to st.
* gdb.go/hello.go: Remove myst. Remove comment about shadowing.
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:04 +0000 (16:12 +0100)]
gdbserver: finish turning the target ops vector into a class
Now that 'process_stratum_target' has a single field left, namely 'pt'
of type 'process_target', and that all the requests to a
'process_stratum_target' are forwarded to 'pt', meld the
'process_target' class into 'process_stratum_target'.
This essentially means
1. All the references of the form 'the_target->pt' become 'the_target'.
2. All the uses of the name 'process_target' become
'process_stratum_target'.
3. The platform-specific target op vectors (e.g. linux_target_ops) are
removed and instances of their "process target" classes are used
instead.
gdbserver/ChangeLog:
2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* target.h (struct process_stratum_target): Remove.
(class process_target): Rename to ...
(class process_stratum_target): ... this.
* linux-low.h (class linux_process_target): Derive from
'process_stratum_target'.
* linux-low.cc (linux_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
linux_process_target.
* lynx-low.h (class lynx_process_target): Derive from
'process_stratum_target'.
* lynx-low.cc (lynx_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
lynx_process_target.
* nto-low.h (class nto_process_target): Derive from
'process_stratum_target'.
* nto-low.cc (nto_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
nto_process_target.
* win32-low.h (class win32_process_target): Derive from
'process_stratum_target'.
* win32-low.cc (win32_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
win32_process_target.
Replace 'the_target->pt' with 'the_target' in the uses below.
* hostio.cc (hostio_error)
(handle_setfs)
(handle_open)
(handle_unlink)
(handle_readlink)
* linux-aarch32-low.cc (arm_breakpoint_at)
* linux-aarch64-low.cc (aarch64_breakpoint_at)
* linux-arm-low.cc (arm_sigreturn_next_pc)
(arm_get_hwcap)
(arm_get_syscall_trapinfo)
* linux-cris-low.cc (cris_breakpoint_at)
* linux-crisv32-low.cc (cris_breakpoint_at)
* linux-low.cc (handle_extended_wait)
(linux_wait_1)
(linux_read_memory)
(linux_process_target::breakpoint_kind_from_pc)
(linux_get_auxv)
* linux-m32r-low.cc (m32r_breakpoint_at)
* linux-mips-low.cc (mips_breakpoint_at)
* linux-nios2-low.cc (nios2_breakpoint_at)
* linux-ppc-low.cc (ppc_breakpoint_at)
* linux-s390-low.cc (s390_get_hwcap)
* linux-sh-low.cc (sh_breakpoint_at)
* linux-sparc-low.cc (sparc_fill_gregset_to_stack)
(sparc_store_gregset_from_stack)
(sparc_breakpoint_at)
* linux-tic6x-low.cc (tic6x_breakpoint_at)
* linux-tile-low.cc (tile_breakpoint_at)
* linux-x86-low.cc (x86_breakpoint_at)
* linux-xtensa-low.cc (xtensa_breakpoint_at)
* mem-break.cc (bp_size)
(bp_opcode)
(insert_memory_breakpoint)
(set_raw_breakpoint_at)
(delete_raw_breakpoint)
(z_type_supported)
(uninsert_raw_breakpoint)
(reinsert_raw_breakpoint)
(validate_inserted_breakpoint)
* regcache.cc (regcache_read_pc)
(regcache_write_pc)
* remote-utils.cc (putpkt_binary_1)
(input_interrupt)
(getpkt)
(prepare_resume_reply)
* server.cc (handle_general_set)
(handle_detach)
(handle_qxfer_auxv)
(handle_qxfer_exec_file)
(handle_qxfer_libraries_svr4)
(handle_qxfer_osdata)
(handle_qxfer_siginfo)
(handle_qxfer_fdpic)
(handle_query)
(resume)
(handle_v_requests)
(queue_stop_reply_callback)
(captured_main)
* target.cc (prepare_to_access_memory)
(done_accessing_memory)
(read_inferior_memory)
(target_write_memory)
(target_stop_and_wait)
(target_wait)
(target_mourn_inferior)
(target_continue_no_signal)
(target_continue)
(target_supports_multi_process)
(kill_inferior)
* target.h
(target_create_inferior)
(target_post_create_inferior)
(myattach)
(target_supports_fork_events)
(target_supports_vfork_events)
(target_supports_exec_events)
(target_handle_new_gdb_connection)
(detach_inferior)
(mythread_alive)
(fetch_inferior_registers)
(store_inferior_registers)
(join_inferior)
(target_supports_non_stop)
(target_async)
(target_process_qsupported)
(target_supports_catch_syscall)
(target_get_ipa_tdesc_idx)
(target_supports_tracepoints)
(target_supports_fast_tracepoints)
(target_get_min_fast_tracepoint_insn_len)
(target_thread_stopped)
(target_pause_all)
(target_unpause_all)
(target_stabilize_threads)
(target_install_fast_tracepoint_jump_pad)
(target_emit_ops)
(target_supports_disable_randomization)
(target_supports_agent)
(target_enable_btrace)
(target_disable_btrace)
(target_read_btrace)
(target_read_btrace_conf)
(target_supports_range_stepping)
(target_supports_stopped_by_sw_breakpoint)
(target_stopped_by_sw_breakpoint)
(target_supports_stopped_by_hw_breakpoint)
(target_supports_hardware_single_step)
(target_stopped_by_hw_breakpoint)
(target_breakpoint_kind_from_pc)
(target_breakpoint_kind_from_current_state)
(target_supports_software_single_step)
(target_core_of_thread)
(target_thread_name)
(target_thread_handle)
* win32-low.cc (do_initial_child_stuff)
Rename target op default definitions listed below.
* target.cc (process_target::post_create_inferior): Rename as ...
(process_stratum_target::post_create_inferior): ... this.
(process_target::prepare_to_access_memory): Rename as ...
(process_stratum_target::prepare_to_access_memory): ... this.
(process_target::done_accessing_memory): Rename as ...
(process_stratum_target::done_accessing_memory): ... this.
(process_target::look_up_symbols): Rename as ...
(process_stratum_target::look_up_symbols): ... this.
(process_target::supports_read_auxv): Rename as ...
(process_stratum_target::supports_read_auxv): ... this.
(process_target::read_auxv): Rename as ...
(process_stratum_target::read_auxv): ... this.
(process_target::supports_z_point_type): Rename as ...
(process_stratum_target::supports_z_point_type): ... this.
(process_target::insert_point): Rename as ...
(process_stratum_target::insert_point): ... this.
(process_target::remove_point): Rename as ...
(process_stratum_target::remove_point): ... this.
(process_target::stopped_by_sw_breakpoint): Rename as ...
(process_stratum_target::stopped_by_sw_breakpoint): ... this.
(process_target::supports_stopped_by_sw_breakpoint): Rename as ...
(process_stratum_target::supports_stopped_by_sw_breakpoint): ... this.
(process_target::stopped_by_hw_breakpoint): Rename as ...
(process_stratum_target::stopped_by_hw_breakpoint): ... this.
(process_target::supports_stopped_by_hw_breakpoint): Rename as ...
(process_stratum_target::supports_stopped_by_hw_breakpoint): ... this.
(process_target::supports_hardware_single_step): Rename as ...
(process_stratum_target::supports_hardware_single_step): ... this.
(process_target::stopped_by_watchpoint): Rename as ...
(process_stratum_target::stopped_by_watchpoint): ... this.
(process_target::stopped_data_address): Rename as ...
(process_stratum_target::stopped_data_address): ... this.
(process_target::supports_read_offsets): Rename as ...
(process_stratum_target::supports_read_offsets): ... this.
(process_target::read_offsets): Rename as ...
(process_stratum_target::read_offsets): ... this.
(process_target::supports_get_tls_address): Rename as ...
(process_stratum_target::supports_get_tls_address): ... this.
(process_target::get_tls_address): Rename as ...
(process_stratum_target::get_tls_address): ... this.
(process_target::hostio_last_error): Rename as ...
(process_stratum_target::hostio_last_error): ... this.
(process_target::supports_qxfer_osdata): Rename as ...
(process_stratum_target::supports_qxfer_osdata): ... this.
(process_target::qxfer_osdata): Rename as ...
(process_stratum_target::qxfer_osdata): ... this.
(process_target::supports_qxfer_siginfo): Rename as ...
(process_stratum_target::supports_qxfer_siginfo): ... this.
(process_target::qxfer_siginfo): Rename as ...
(process_stratum_target::qxfer_siginfo): ... this.
(process_target::supports_non_stop): Rename as ...
(process_stratum_target::supports_non_stop): ... this.
(process_target::async): Rename as ...
(process_stratum_target::async): ... this.
(process_target::start_non_stop): Rename as ...
(process_stratum_target::start_non_stop): ... this.
(process_target::supports_multi_process): Rename as ...
(process_stratum_target::supports_multi_process): ... this.
(process_target::supports_fork_events): Rename as ...
(process_stratum_target::supports_fork_events): ... this.
(process_target::supports_vfork_events): Rename as ...
(process_stratum_target::supports_vfork_events): ... this.
(process_target::supports_exec_events): Rename as ...
(process_stratum_target::supports_exec_events): ... this.
(process_target::handle_new_gdb_connection): Rename as ...
(process_stratum_target::handle_new_gdb_connection): ... this.
(process_target::handle_monitor_command): Rename as ...
(process_stratum_target::handle_monitor_command): ... this.
(process_target::core_of_thread): Rename as ...
(process_stratum_target::core_of_thread): ... this.
(process_target::supports_read_loadmap): Rename as ...
(process_stratum_target::supports_read_loadmap): ... this.
(process_target::read_loadmap): Rename as ...
(process_stratum_target::read_loadmap): ... this.
(process_target::process_qsupported): Rename as ...
(process_stratum_target::process_qsupported): ... this.
(process_target::supports_tracepoints): Rename as ...
(process_stratum_target::supports_tracepoints): ... this.
(process_target::read_pc): Rename as ...
(process_stratum_target::read_pc): ... this.
(process_target::write_pc): Rename as ...
(process_stratum_target::write_pc): ... this.
(process_target::supports_thread_stopped): Rename as ...
(process_stratum_target::supports_thread_stopped): ... this.
(process_target::thread_stopped): Rename as ...
(process_stratum_target::thread_stopped): ... this.
(process_target::supports_get_tib_address): Rename as ...
(process_stratum_target::supports_get_tib_address): ... this.
(process_target::get_tib_address): Rename as ...
(process_stratum_target::get_tib_address): ... this.
(process_target::pause_all): Rename as ...
(process_stratum_target::pause_all): ... this.
(process_target::unpause_all): Rename as ...
(process_stratum_target::unpause_all): ... this.
(process_target::stabilize_threads): Rename as ...
(process_stratum_target::stabilize_threads): ... this.
(process_target::supports_fast_tracepoints): Rename as ...
(process_stratum_target::supports_fast_tracepoints): ... this.
(process_target::get_min_fast_tracepoint_insn_len): Rename as ...
(process_stratum_target::get_min_fast_tracepoint_insn_len): ... this.
(process_target::emit_ops): Rename as ...
(process_stratum_target::emit_ops): ... this.
(process_target::supports_disable_randomization): Rename as ...
(process_stratum_target::supports_disable_randomization): ... this.
(process_target::supports_qxfer_libraries_svr4): Rename as ...
(process_stratum_target::supports_qxfer_libraries_svr4): ... this.
(process_target::qxfer_libraries_svr4): Rename as ...
(process_stratum_target::qxfer_libraries_svr4): ... this.
(process_target::supports_agent): Rename as ...
(process_stratum_target::supports_agent): ... this.
(process_target::enable_btrace): Rename as ...
(process_stratum_target::enable_btrace): ... this.
(process_target::disable_btrace): Rename as ...
(process_stratum_target::disable_btrace): ... this.
(process_target::read_btrace): Rename as ...
(process_stratum_target::read_btrace): ... this.
(process_target::read_btrace_conf): Rename as ...
(process_stratum_target::read_btrace_conf): ... this.
(process_target::supports_range_stepping): Rename as ...
(process_stratum_target::supports_range_stepping): ... this.
(process_target::supports_pid_to_exec_file): Rename as ...
(process_stratum_target::supports_pid_to_exec_file): ... this.
(process_target::pid_to_exec_file): Rename as ...
(process_stratum_target::pid_to_exec_file): ... this.
(process_target::supports_multifs): Rename as ...
(process_stratum_target::supports_multifs): ... this.
(process_target::multifs_open): Rename as ...
(process_stratum_target::multifs_open): ... this.
(process_target::multifs_unlink): Rename as ...
(process_stratum_target::multifs_unlink): ... this.
(process_target::multifs_readlink): Rename as ...
(process_stratum_target::multifs_readlink): ... this.
(process_target::breakpoint_kind_from_pc): Rename as ...
(process_stratum_target::breakpoint_kind_from_pc): ... this.
(process_target::breakpoint_kind_from_current_state): Rename as ...
(process_stratum_target::breakpoint_kind_from_current_state): ... this.
(process_target::thread_name): Rename as ...
(process_stratum_target::thread_name): ... this.
(process_target::thread_handle): Rename as ...
(process_stratum_target::thread_handle): ... this.
(process_target::supports_software_single_step): Rename as ...
(process_stratum_target::supports_software_single_step): ... this.
(process_target::supports_catch_syscall): Rename as ...
(process_stratum_target::supports_catch_syscall): ... this.
(process_target::get_ipa_tdesc_idx): Rename as ...
(process_stratum_target::get_ipa_tdesc_idx): ... this.
Pedro Alves [Mon, 17 Feb 2020 15:12:03 +0000 (16:12 +0100)]
gdbserver: simply copy the pointer in 'set_target_ops'
The 'set_target_ops' function takes a target op vector and creates a
clone of it via XNEW and memcpy. This is not necessary. 'the_target'
is a singleton, and the argument that is passed to 'set_target_ops' is
always the address of a global, static object. Therefore, update the
implementation to simply copy the pointer.
gdbserver/ChangeLog:
2020-02-20 Pedro Alves <palves@redhat.com>
* target.cc (set_target_ops): Simply copy the given target pointer
instead of creating a copy of the pointed object.
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:03 +0000 (16:12 +0100)]
gdbserver: turn target op 'get_ipa_tdesc_idx' into a method
gdbserver/ChangeLog:
2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn process_stratum_target's get_ipa_tdesc_idx op into a method
of process_target.
* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_get_ipa_tdesc_idx): Update the macro.
* target.cc (process_target::get_ipa_tdesc_idx): Define.
Update the derived classes and callers below.
* linux-low.cc (linux_target_ops): Update.
(linux_get_ipa_tdesc_idx): Turn into ...
(linux_process_target::get_ipa_tdesc_idx): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:03 +0000 (16:12 +0100)]
gdbserver: turn target op 'supports_catch_syscall' into a method
gdbserver/ChangeLog:
2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn process_stratum_target's supports_catch_syscall op into a
method of process_target.
* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_catch_syscall): Update the macro.
* target.cc (process_target::supports_catch_syscall): Define.
Update the derived classes and callers below.
* linux-low.cc (linux_target_ops): Update.
(linux_supports_catch_syscall): Turn into ...
(linux_process_target::supports_catch_syscall): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.