Simon Marchi [Fri, 17 Jan 2020 18:40:10 +0000 (13:40 -0500)]
Make all-gdbsupport depend on all-bfd
Trying to run "make all-gdbsupport" at the top-level in a build from scratch
results in:
make[2]: Entering directory '/home/smarchi/build/binutils-gdb/gdbsupport'
CC agent.o
In file included from /home/smarchi/src/binutils-gdb/gdbsupport/common-defs.h:133,
from /home/smarchi/src/binutils-gdb/gdbsupport/agent.c:20:
/home/smarchi/src/binutils-gdb/gdbsupport/common-types.h:35:10: fatal error: bfd.h: No such file or directory
35 | #include "bfd.h"
| ^~~~~~~
Before building all-gdbsupport, we need all-bfd to run, so that bfd.h is
generated.
(Once this patch is merged in the binutils-gdb repo, I'll send it to gcc
to keep the files in sync.)
ChangeLog:
* Makefile.def: Add dependencies of all-gdbsupport on all-bfd.
* Makefile.in: Re-generate.
Christian Biesinger [Fri, 17 Jan 2020 18:34:03 +0000 (12:34 -0600)]
Fix spelling errors
seperate -> separate
bfd/ChangeLog:
2020-01-17 Christian Biesinger <cbiesinger@google.com>
* coff-arm.c: Fix spelling error (seperate).
* elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
error (seperate).
* sysdep.h (strnlen): Fix spelling error (seperate).
opcodes/ChangeLog:
2020-01-17 Christian Biesinger <cbiesinger@google.com>
* opintl.h: Fix spelling error (seperate).
sim/arm/ChangeLog:
2020-01-17 Christian Biesinger <cbiesinger@google.com>
* iwmmxt.c: Fix spelling error (seperate).
Change-Id: I55e5f47bcf3cf3533d2acb7ad338f1be0d5f30f9
Nick Clifton [Fri, 17 Jan 2020 15:56:55 +0000 (15:56 +0000)]
Fix a libiberty testsuite failure.
* testsuite/demangle-expected: Update expected demangling of
enable_if pattern.
Thomas Troeger [Fri, 17 Jan 2020 15:27:31 +0000 (15:27 +0000)]
Improve the performance of the ascii art jump visualizer.
* objdump.c (jump_info_visualize_address): Discard jumps that are
no longer needed.
(disassemble_bytes): Only compute the maximum level if jumps were
detected.
Pedro Alves [Wed, 15 Jan 2020 21:55:29 +0000 (21:55 +0000)]
Fix gdbsupport build on compilers that don't default to C++11 or above
gdbsupport fails to build with compilers that don't default to C++11
or above. gdbsupport's configure.ac is already using
AX_CXX_COMPILE_STDCXX, which sets CXX_DIALECT to the -std=gnu++11
switch if necessary, but the problem is that nowhere are we using
CXX_DIALECT. This fixes it.
gdbsupport/ChangeLog:
2020-01-17 Pedro Alves <palves@redhat.com>
* Makefile.am: Append CXX_DIALECT to CXX.
* Makefile.in: Regenerate.
Pedro Alves [Fri, 17 Jan 2020 15:14:56 +0000 (15:14 +0000)]
Fix gdbsupport build
I'm seeing this on F27 (a clean build from scratch):
~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport'
CC gdb_tilde_expand.o
In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0,
from ../gnulib/import/glob.h:544,
from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22:
../bfd/config.h:7:4: error: #error config.h must be #included before system headers
# error config.h must be #included before system headers
^~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
libc-config.h, where it includes config.h, says:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* This is intended to be a good-enough substitute for glibc system
macros like those defined in <sys/cdefs.h>, so that Gnulib code
shared with glibc can do this as the first #include:
#ifndef _LIBC
# include <libc-config.h>
#endif
When compiled as part of glibc this is a no-op; when compiled as
part of Gnulib this includes Gnulib's <config.h> and defines macros
that glibc library code would normally assume. */
#include <config.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The issue is that that '#include <config.h>' picks up bfd's config.h
instead of gnulib's.
This problem doesn't trigger in the gdb dir because there we generate
config.h under that exact name so gnulib's libc-config.h ends up
picking gdb's config.h instead of gnulib.c and that ends up harmless.
In gdbsupport, the config.h file is really named support-config.h, so
that '#include <config.h>' in libc-config.h doesn't pick it like it
would if it had the conventional config.h name.
This patch fixes it by simply renaming gdbserver's support-config.h to
config.h.
gdbsupport/ChangeLog:
2020-01-17 Pedro Alves <palves@redhat.com>
* configure.ac: Generate config.h instead of support-config.h.
* common-defs.h: Include <gdbsupport/config.h> instead of
<gdbsupport/support-config.h>.
* Makefile.in: Regenerate.
* configure: Regenerate.
H.J. Lu [Fri, 17 Jan 2020 15:07:55 +0000 (07:07 -0800)]
x86: Add {vex} pseudo prefix
There are 2-byte VEX prefix and 3-byte VEX prefix. 2-byte VEX prefix
can't encode all operands. By default, assembler tries 2-byte VEX prefix
first. {vex3} can be used to force 3-byte VEX prefix. This patch adds
{vex} pseudo prefix and keeps {vex2} for backward compatibility.
gas/
* config/tc-i386.c (_i386_insn): Replace vex_encoding_vex2
with vex_encoding_vex.
(parse_insn): Likewise.
* doc/c-i386.texi: Replace {vex2} with {vex}. Update {vex}
and {vex3} documentation.
* testsuite/gas/i386/pseudos.s: Replace 3 {vex2} tests with
{vex}.
* testsuite/gas/i386/x86-64-pseudos.s: Likewise.
opcodes/
* i386-opc.tbl: Add {vex} pseudo prefix.
* i386-tbl.h: Regenerated.
Simon Marchi [Fri, 17 Jan 2020 14:58:57 +0000 (09:58 -0500)]
gdb: remove uses of iterate_over_inferiors in top.c
Replace with range-based for loops.
gdb/ChangeLog:
* top.c (struct qt_args): Remove.
(kill_or_detach): Change return type to void, replace `void *`
parameter with a proper one.
(print_inferior_quit_action): Likewise.
(quit_confirm): Use range-based for loop to iterate over inferiors.
(quit_force): Likewise.
Simon Marchi [Fri, 17 Jan 2020 14:57:58 +0000 (09:57 -0500)]
gdb: remove uses of iterate_over_inferiors in mi/mi-main.c
Replace with range-based loops.
gdb/ChangeLog:
* mi/mi-main.c (run_one_inferior): Change return type to void, replace
`void *` parameter with proper parameters.
(mi_cmd_exec_run): Use range-based loop to iterate over inferiors.
(print_one_inferior): Change return type to void, replace `void *`
parameter with proper parameters.
(mi_cmd_list_thread_groups): Use range-based loop to iterate over
inferiors.
(get_other_inferior): Remove.
(mi_cmd_remove_inferior): Use range-based loop to iterate over
inferiors.
Simon Marchi [Fri, 17 Jan 2020 14:57:07 +0000 (09:57 -0500)]
gdb: remove use of iterate_over_inferiors in mi/mi-interp.c
Replace it with a range-based for. I've updated the comment in
mi_interp::init, which was a bit stale.
gdb/ChangeLog:
* mi/mi-interp.c (report_initial_inferior): Remove.
(mi_interp::init): Use range-based for to iterate over inferiors.
Simon Marchi [Fri, 17 Jan 2020 14:51:10 +0000 (09:51 -0500)]
gdb: remove use of iterate_over_inferiors in py-inferior.c
Use range-based for instead of iterate_over_inferiors in one spot in the Python
code.
gdb/ChangeLog:
* python/py-inferior.c (build_inferior_list): Remove.
(gdbpy_ref): Use range-based for loop to iterate over inferiors.
Andre Vieira [Fri, 17 Jan 2020 14:19:35 +0000 (14:19 +0000)]
Forgot to add testcases to commit for [binutils][arm] PR25376 Change MVE ...
The original commit was
2da2eaf4ce299c84c5a1f1bc6f7944266cb36d6e
Nick Clifton [Fri, 17 Jan 2020 14:13:22 +0000 (14:13 +0000)]
Update libiberty sources with changes in the gcc mainline.
+2020-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ Update copyright years.
+
+2019-12-06 Tim Ruehsen <tim.ruehsen@gmx.de>
+
+ * make-relative-prefix.c (split_directories):
+ Return early on empty 'name'
+
+2019-11-16 Tim Ruehsen <tim.ruehsen@gmx.de>
+
+ * cp-demangle.c (d_print_init): Remove const from 4th param.
+ (cplus_demangle_fill_name): Initialize d->d_counting.
+ (cplus_demangle_fill_extended_operator): Likewise.
+ (cplus_demangle_fill_ctor): Likewise.
+ (cplus_demangle_fill_dtor): Likewise.
+ (d_make_empty): Likewise.
+ (d_count_templates_scopes): Remobe const from 3rd param,
+ Return on dc->d_counting > 1,
+ Increment dc->d_counting.
+ * cp-demint.c (cplus_demangle_fill_component): Initialize d->d_counting.
+ (cplus_demangle_fill_builtin_type): Likewise.
+ (cplus_demangle_fill_operator): Likewise.
+
+2019-11-16 Eduard-Mihai Burtescu <eddyb@lyken.rs>
+
+ * cplus-dem.c (cplus_demangle): Use rust_demangle directly.
+ (rust_demangle): Remove.
+ * rust-demangle.c (is_prefixed_hash): Rename to is_legacy_prefixed_hash.
+ (parse_lower_hex_nibble): Rename to decode_lower_hex_nibble.
+ (parse_legacy_escape): Rename to decode_legacy_escape.
+ (rust_is_mangled): Remove.
+ (struct rust_demangler): Add.
+ (peek): Add.
+ (next): Add.
+ (struct rust_mangled_ident): Add.
+ (parse_ident): Add.
+ (rust_demangle_sym): Remove.
+ (print_str): Add.
+ (PRINT): Add.
+ (print_ident): Add.
+ (rust_demangle_callback): Add.
+ (struct str_buf): Add.
+ (str_buf_reserve): Add.
+ (str_buf_append): Add.
+ (str_buf_demangle_callback): Add.
+ (rust_demangle): Add.
+ * rust-demangle.h: Remove.
+
+2019-11-15 Miguel Saldivar <saldivarcher@gmail.com>
+
+ * testsuite/demangle-expected: Fix test.
+
+2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
+
+ * cp-demangle.c (d_expr_primary): Handle
+ nullptr demangling.
+ * testsuite/demangle-expected: Added test.
+
+2019-10-29 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * cp-demangle.c (d_number): Avoid signed int overflow.
+
+2019-10-28 Miguel Saldivar <saldivarcher@gmail.com>
+
+ * cp-demangle.c (d_print_mod): Add a space before printing `complex`
+ and `imaginary`, as opposed to after.
+ * testsuite/demangle-expected: Adjust test.
+
+2019-10-03 Eduard-Mihai Burtescu <eddyb@lyken.rs>
+
+ * rust-demangle.c (looks_like_rust): Remove.
+ (rust_is_mangled): Don't check escapes.
+ (is_prefixed_hash): Allow 0-9a-f permutations.
+ (rust_demangle_sym): Don't bail on unknown escapes.
+ * testsuite/rust-demangle-expected: Update 'main::$99$' test.
+
+2019-09-03 Eduard-Mihai Burtescu <eddyb@lyken.rs>
+
+ * rust-demangle.c (unescape): Remove.
+ (parse_lower_hex_nibble): New function.
+ (parse_legacy_escape): New function.
+ (is_prefixed_hash): Use parse_lower_hex_nibble.
+ (looks_like_rust): Use parse_legacy_escape.
+ (rust_demangle_sym): Use parse_legacy_escape.
+ * testsuite/rust-demangle-expected: Add 'llv$u6d$' test.
+
+2019-08-27 Martin Liska <mliska@suse.cz>
+
+ PR lto/91478
+ * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
+ First find a WEAK HIDDEN symbol in symbol table that will be
+ preserved. Later, use the symbol name for all removed symbols.
+
+2019-08-12 Martin Liska <mliska@suse.cz>
+
+ * Makefile.in: Add filedescriptor.c.
+ * filedescriptor.c: New file.
+ * lrealpath.c (is_valid_fd): Remove.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index
0be45b4ae8..
fe738d0db4 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -1,7 +1,7 @@
# Makefile for the libiberty library.
# Originally written by K. Richard Pixley <rich@cygnus.com>.
#
-# Copyright (C) 1990-2019 Free Software Foundation, Inc.
+# Copyright (C) 1990-2020 Free Software Foundation, Inc.
#
# This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or
@@ -127,7 +127,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
calloc.c choose-temp.c clock.c concat.c cp-demangle.c \
cp-demint.c cplus-dem.c crc32.c \
d-demangle.c dwarfnames.c dyn-string.c \
- fdmatch.c ffs.c fibheap.c filename_cmp.c floatformat.c \
+ fdmatch.c ffs.c fibheap.c filedescriptor.c filename_cmp.c floatformat.c \
fnmatch.c fopen_unlocked.c \
getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
gettimeofday.c \
@@ -171,6 +171,7 @@ REQUIRED_OFILES = \
./cp-demint.$(objext) ./crc32.$(objext) ./d-demangle.$(objext) \
./dwarfnames.$(objext) ./dyn-string.$(objext) \
./fdmatch.$(objext) ./fibheap.$(objext) \
+ ./filedescriptor.$(objext) \
./filename_cmp.$(objext) ./floatformat.$(objext) \
./fnmatch.$(objext) ./fopen_unlocked.$(objext) \
./getopt.$(objext) ./getopt1.$(objext) ./getpwd.$(objext) \
@@ -756,6 +757,17 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
else true; fi
$(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION)
+./filedescriptor.$(objext): $(srcdir)/filedescriptor.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/filedescriptor.c -o pic/$@; \
+ else true; fi
+ if [ x"$(NOASANFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/filedescriptor.c -o noasan/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/filedescriptor.c $(OUTPUT_OPTION)
+
+
./filename_cmp.$(objext): $(srcdir)/filename_cmp.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/safe-ctype.h
diff --git a/libiberty/_doprnt.c b/libiberty/_doprnt.c
index
d44dc415ed..
a739f4304f 100644
--- a/libiberty/_doprnt.c
+++ b/libiberty/_doprnt.c
@@ -1,5 +1,5 @@
/* Provide a version of _doprnt in terms of fprintf.
- Copyright (C) 1998-2019 Free Software Foundation, Inc.
+ Copyright (C) 1998-2020 Free Software Foundation, Inc.
Contributed by Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
This program is free software; you can redistribute it and/or modify it
diff --git a/libiberty/argv.c b/libiberty/argv.c
index
6444896f99..
8c9794db6a 100644
--- a/libiberty/argv.c
+++ b/libiberty/argv.c
@@ -1,5 +1,5 @@
/* Create and destroy argument vectors (argv's)
- Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ Copyright (C) 1992-2020 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support
This file is part of the libiberty library.
diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c
index
5718682f69..
6e38e2234d 100644
--- a/libiberty/asprintf.c
+++ b/libiberty/asprintf.c
@@ -1,6 +1,6 @@
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller.
- Copyright (C) 1997-2019 Free Software Foundation, Inc.
+ Copyright (C) 1997-2020 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This file is part of the libiberty library.
diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c
index
72c1b710bd..
49a2faaa51 100644
--- a/libiberty/choose-temp.c
+++ b/libiberty/choose-temp.c
@@ -1,5 +1,5 @@
/* Utility to pick a temporary filename prefix.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
diff --git a/libiberty/clock.c b/libiberty/clock.c
index
a3730714bd..
0de74657d0 100644
--- a/libiberty/clock.c
+++ b/libiberty/clock.c
@@ -1,5 +1,5 @@
/* ANSI-compatible clock function.
- Copyright (C) 1994-2019 Free Software Foundation, Inc.
+ Copyright (C) 1994-2020 Free Software Foundation, Inc.
This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the
diff --git
GDB Administrator [Fri, 17 Jan 2020 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Thu, 16 Jan 2020 22:41:53 +0000 (16:41 -0600)]
Fix some spelling errors.
I noticed those from a lintian run:
https://salsa.debian.org/cbiesinger-guest/gdb/-/jobs/514119
gdb/ChangeLog:
2020-01-16 Christian Biesinger <cbiesinger@google.com>
* btrace.c (btrace_compute_ftrace_1): Fix spelling error (Unkown).
(btrace_stitch_trace): Likewise.
* charset.c (intermediate_encoding): Likewise (vaild).
* nat/linux-btrace.c (linux_read_pt): Likewise (Unkown).
* python/py-record-btrace.c (struct PyMethodDef): Likewise (occurences).
* record-btrace.c (record_btrace_print_conf): Likewise (unkown).
gdb/testsuite/ChangeLog:
2020-01-16 Christian Biesinger <cbiesinger@google.com>
* lib/gdb.exp: Fix spelling error (seperatelly).
Change-Id: I2a44936bac295020f217fb6c78b99b0a8d09cf9a
Hannes Domani [Mon, 23 Dec 2019 15:38:13 +0000 (16:38 +0100)]
Add type for $_tlb->process_environment_block->process_parameters
The type then looks like this:
(gdb) pt $_tlb->process_environment_block->process_parameters
type = struct rtl_user_process_parameters {
DWORD32 maximum_length;
DWORD32 length;
DWORD32 flags;
DWORD32 debug_flags;
void *console_handle;
DWORD32 console_flags;
void *standard_input;
void *standard_output;
void *standard_error;
unicode_string current_directory;
void *current_directory_handle;
unicode_string dll_path;
unicode_string image_path_name;
unicode_string command_line;
void *environment;
DWORD32 starting_x;
DWORD32 starting_y;
DWORD32 count_x;
DWORD32 count_y;
DWORD32 count_chars_x;
DWORD32 count_chars_y;
DWORD32 fill_attribute;
DWORD32 window_flags;
DWORD32 show_window_flags;
unicode_string window_title;
unicode_string desktop_info;
unicode_string shell_info;
unicode_string runtime_data;
} *
It's mainly useful to get the current directory, or the full command line:
(gdb) p $_tlb->process_environment_block->process_parameters->current_directory
$1 = {
length = 26,
maximum_length = 520,
buffer = 0xe36c8 L"C:\\src\\tests\\"
}
(gdb) p $_tlb->process_environment_block->process_parameters->command_line
$2 = {
length = 94,
maximum_length = 96,
buffer = 0xe32aa L"\"C:\\gdb\\build64\\gdb-git\\gdb\\gdb.exe\" access.exe"
}
The type names are all lowercase because the existing types created
by windows_get_tlb_type are also lowercase.
Type unicode_string is documented at [1].
The official documentation [2] for rtl_user_process_parameters is limited,
so I've used this other page [3].
[1] https://docs.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_unicode_string
[2] https://docs.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-rtl_user_process_parameters
[3] https://www.nirsoft.net/kernel_struct/vista/RTL_USER_PROCESS_PARAMETERS.html
gdb/ChangeLog:
2020-01-16 Hannes Domani <ssbssa@yahoo.de>
* windows-tdep.c (windows_get_tlb_type):
Add rtl_user_process_parameters type.
Pedro Alves [Thu, 16 Jan 2020 18:35:30 +0000 (18:35 +0000)]
Ensure proc-service symbols have default visibility (PR build/24805)
Compiling GDB with '-fvisibility=hidden' removes the symbols that
should be exported.
This patch explicitly marks them as visible.
gdb/ChangeLog:
2020-01-16 Pedro Alves <palves@redhat.com>
Norbert Lange <nolange79@gmail.com>
PR build/24805
* gdbsupport/gdb_proc_service.h (PS_EXPORT): New.
(ps_get_thread_area, ps_getpid, ps_lcontinue, ps_lgetfpregs)
(ps_lgetregs, ps_lsetfpregs, ps_lsetregs, ps_lstop, ps_pcontinue)
(ps_pdread, ps_pdwrite, ps_pglobal_lookup, ps_pstop, ps_ptread)
(ps_ptwrite, ps_lgetxregs, ps_lgetxregsize, ps_lsetxregs)
(ps_plog): Redeclare exported functions with default visibility.
Pedro Alves [Thu, 16 Jan 2020 18:11:06 +0000 (18:11 +0000)]
[gdb] Move ChangeLog entries to their right files
I spotted a few misplaced entries in the ChangeLog-2019 entries, and
went on to fix them.
Looking around I saw a good number of other entries in other years.
Then OCD got the best of me and I fixed them all.
Also fixes cases of wrong paths in entries, like "* gdb/foo.c" instead
of "* foo.c".
Nitika Achra [Thu, 16 Jan 2020 16:51:06 +0000 (11:51 -0500)]
Support for DWARF5 location lists entries
This patch handles DW_LLE_base_addressx, DW_LLE_startx_length and
DW_LLE_start_length.
Tested by running the testsuite before and after the patch and there is
no increase in the number of test cases that fails. Tested with both
-gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with
-gdwarf-4 as well as -gdwarf5 flags.
This is an effort to support DWARF5 in gdb.
gdb/ChangeLog:
* dwarf2loc.c (decode_debug_loclists_addresses): Handle
DW_LLE_base_addressx, DW_LLE_startx_length, DW_LLE_start_length.
Andre Vieira [Thu, 16 Jan 2020 13:50:52 +0000 (13:50 +0000)]
[binutils][arm] PR25376 Change MVE into a CORE_HIGH feature
This patch moves MVE feature bits into the CORE_HIGH section. This makes sure
.fpu and -mfpu does not reset the bits set by MVE. This is important because
.fpu has no option to "set" these same bits and thus, mimic'ing GCC, we choose
to define MVE as an architecture extension rather than put it together with
other the legacy fpu features.
This will enable the following behavior:
.arch armv8.1-m.main
.arch mve
.fpu fpv5-sp-d16 #does not disable mve.
vadd.i32 q0, q1, q2
This patch also makes sure MVE is not taken into account during auto-detect.
This was already the case, but because we moved the MVE bits to the
architecture feature space we must make sure ARM_ANY does not include MVE.
gas/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* config/tc-arm.c (mve_ext, mve_fp_ext): Use CORE_HIGH.
(armv8_1m_main_ext_table): Use CORE_HIGH for mve.
* testsuite/arm/armv8_1-m-fpu-mve-1.s: New.
* testsuite/arm/armv8_1-m-fpu-mve-1.d: New.
* testsuite/arm/armv8_1-m-fpu-mve-2.s: New.
* testsuite/arm/armv8_1-m-fpu-mve-2.d: New.
include/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* opcodes/arm.h (FPU_MVE, FPU_MVE_FPU): Move these features to...
(ARM_EXT2_MVE, ARM_EXT2_MVE_FP): ... the CORE_HIGH space.
(ARM_ANY): Redefine to not include any MVE bits.
(ARM_FEATURE_ALL): Removed.
opcodes/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* opcodes/arm-dis.c (coprocessor_opcodes): Use CORE_HIGH for MVE bits.
(neon_opcodes): Likewise.
(select_arm_features): Make sure we enable MVE bits when selecting
armv8.1-m.main. Make sure we do not enable MVE bits when not selecting
any architecture.
Jozef Lawrynowicz [Thu, 16 Jan 2020 13:44:21 +0000 (13:44 +0000)]
MSP430: Remove unused linker script template elf32msp430_3.sc
ld/ChangeLog:
2020-01-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* scripttempl/elf32msp430_3.sc: Remove.
Jozef Lawrynowicz [Thu, 16 Jan 2020 11:32:23 +0000 (11:32 +0000)]
MSP430: Add input section rules for .upper sections to default linker script
ld/ChangeLog:
2020-01-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* scripttempl/elf32msp430.sc: Add input section rules for
.upper.{text,data,rodata,bss}.
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new test.
* testsuite/ld-msp430-elf/upper-input-sections.s: New test.
Jan Beulich [Thu, 16 Jan 2020 09:07:36 +0000 (10:07 +0100)]
x86: drop found_cpu_match local variable
50aecf8c5f could have done so right away; perhaps the variable shouldn't
have been introduced in the first place.
Jan Beulich [Thu, 16 Jan 2020 09:07:05 +0000 (10:07 +0100)]
x86: drop stale Vec_Imm4 related comment
I overlooked this in commit
9d3bf266fd ("x86: drop Vec_Imm4"), presumably
because of the mis-spelling.
Jan Beulich [Thu, 16 Jan 2020 09:06:21 +0000 (10:06 +0100)]
x86: add a few more missing VexWIG
Alternatively it could also be VexW0 (to match other SSE2AVX), but the
VexW attribute shouldn't be left unset.
Jan Beulich [Thu, 16 Jan 2020 09:05:35 +0000 (10:05 +0100)]
x86: VPEXTRQ/VPINSRQ are unavailable outside of 64-bit mode
The AVX512DQ patterns lacking a Cpu64 attribute made the memory operand
forms accepted even outside of 64-bit mode, and this even without any
{evex} pseudo-prefix (otherwise one could argue that this is an attempt
to follow one possible, albeit somewhat odd, interpretation of the SDM
wording to this effect).
For consistency between the various involved templates drop the
* (now) unnecessary IgnoreSize attributes
* unnecessary (due to VexW1) Size64 attributes from VEX encoded forms
* redundant (with Reg64) Qword operand attributes
uniformly.
GDB Administrator [Thu, 16 Jan 2020 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 15 Jan 2020 17:58:08 +0000 (12:58 -0500)]
texi2pod.pl: import support for @t{...} from gcc
GDB's man page source (in gdb.texinfo) contains:
@t{++}
The @t{...} part is supposed to display the wrapped text with a
fixed-width font. The texi2pod.pl script currently doesn't handle
@t{...}, so it appears as-is in the man page:
You can use GDB to debug programs written in C, C@t{++}, Fortran and Modula-2.
gcc's version of texi2pod.pl (at contrib/texi2pod.pl in gcc's repo)
replaces @t{...} with the wrapped text as-is, which I think is an
acceptable behavior. The fixed-width font distinction is not really
important for a man page, where the text will be displayed with whatever
font the user is using.
Import the line that does that from gcc's version.
I have verified that there is no other, unwanted change in man pages
generated in binutils' and GDB's doc, with this patch applied.
etc/ChangeLog:
* texi2pod.pl: Handle @t{...} tags.
Simon Marchi [Wed, 15 Jan 2020 17:47:44 +0000 (12:47 -0500)]
Use get_thread_regcache instead of get_current_regcache in post_create_inferior
In post_create_inferior, we get the current thread using the
inferior_thread function and store it in `thr`. We then call
get_current_regcache immediately after, which does:
return get_thread_regcache (inferior_thread ());
This patch makes post_create_inferior use get_thread_regcache, passing
`thr`, saving an unnecessary inferior_thread call.
gdb/ChangeLog:
* infcmd.c (post_create_inferior): Use get_thread_regcache
instead of get_current_regcache.
Lars Brinkhoff [Wed, 15 Jan 2020 14:18:54 +0000 (14:18 +0000)]
Set the default page size of the PDP11 target to 8192 bytes.
PR 20694
bfd * pdp11.c (TARGET_PAGE_SIZE): Set to 8192.
ld * temulparams/pdp11.sh (TARGET_PAGE_SIZE): Set to 8192.
Alan Modra [Wed, 15 Jan 2020 05:37:16 +0000 (16:07 +1030)]
tic4x disassembly static variables
tic4x uses a number of static variables for tables that are generated
depending on the current machine (tic4x vs. tic3x). However, it is
possible to change the machine from one invocation of print_insn_tic4x
to the next. This patch throws away the old state if that happens,
and uses a relatively small known size array of register names rather
than a malloc'd table.
* tic4x-dis.c (tic4x_version): Make unsigned long.
(optab, optab_special, registernames): New file scope vars.
(tic4x_print_register): Set up registernames rather than
malloc'd registertable.
(tic4x_disassemble): Delete optable and optable_special. Use
optab and optab_special instead. Throw away old optab,
optab_special and registernames when info->mach changes.
Jozef Lawrynowicz [Wed, 15 Jan 2020 13:17:27 +0000 (13:17 +0000)]
MSP430: Fix relocation overflow when using #lo(EXP) macro
gas/ChangeLog:
2020-01-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/tc-msp430.c (CHECK_RELOC_MSP430): Always generate 430X
relocations when the target is 430X, except when extracting part of an
expression.
(msp430_srcoperand): Adjust comment.
Initialize the expp member of the msp430_operand_s struct as
appropriate.
(msp430_dstoperand): Likewise.
* testsuite/gas/msp430/msp430.exp: Run new test.
* testsuite/gas/msp430/reloc-lo-430x.d: New test.
* testsuite/gas/msp430/reloc-lo-430x.s: New test.
include/ChangeLog:
2020-01-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* opcode/msp430.h (enum msp430_expp_e): New.
(struct msp430_operand_s): Add expp member to struct.
ld/ChangeLog:
2020-01-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new test.
* testsuite/ld-msp430-elf/reloc-lo-430x.s: New test.
Alan Modra [Wed, 15 Jan 2020 05:45:43 +0000 (16:15 +1030)]
Reinstate gas em=freebsd for sparc-freebsd
In commit
c9098af41e3 I over-simplified the sparc target decoding,
missing the fact that prior to that patch sparc-*-freebsd fell through
to the generic *-*-freebsd match.
* configure.tgt: Add sparc-*-freebsd case.
Alan Modra [Tue, 14 Jan 2020 10:15:53 +0000 (20:45 +1030)]
PR25384, PowerPC64 ELFv1 copy relocs against function symbols
Function symbols of course don't normally want .dynbss copies but
with some old versions of gcc they are needed to copy the function
descriptor. This patch restricts the cases where they are useful to
compilers using dot-symbols, and enables the warning regardless of
whether a PLT entry is emitted in the executable. PLTs in shared
libraries are affected by a .dynbss copy in the executable.
bfd/
PR 25384
* elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment.
(ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies
of function symbols unless dot symbols are present. Do warn
whenever one is created, regardles of whether a PLT entry is
also emitted for the function symbol.
ld/
* testsuite/ld-powerpc/ambiguousv1b.d: Adjust expected output.
* testsuite/ld-powerpc/funref.s: Align func_tab.
* testsuite/ld-powerpc/funref2.s: Likewise.
* testsuite/ld-powerpc/funv1.s: Add dot symbols.
Tom Tromey [Sat, 21 Dec 2019 16:51:05 +0000 (09:51 -0700)]
Fix valgrind error from gdb.decode_line
PR symtab/12535 points out that gdb.decode_line("") will cause a
valgrind report.
I think the empty linespec does not really make sense. So, this patch
changes gdb.decode_line to treat a whitespace-only linespec the same
as a non-existing argument.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
PR symtab/12535:
* python/python.c (gdbpy_decode_line): Treat empty string the same
as no argument.
gdb/testsuite/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
PR symtab/12535:
* gdb.python/python.exp: Test decode_line with empty string
argument.
Change-Id: I1d95812b4b7a21d69a3e9afd05b9e3141a931897
GDB Administrator [Wed, 15 Jan 2020 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 9 Jan 2020 00:43:29 +0000 (17:43 -0700)]
Don't link gdb twice against libiberty
I noticed that gdb includes libiberty twice in its link line. I don't
think there's a need for this, so this patch removes one of the
references.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* Makefile.in (CLIBS): Remove second use of $(LIBIBERTY).
Change-Id: I43bb7100660867081f937c67ea70ff751c62bbfb
Tom Tromey [Fri, 20 Dec 2019 00:51:40 +0000 (17:51 -0700)]
Add gdbsupport check-defines script
This adds a new script that tries to check that none of the support
code uses defines that are not defined by common.m4. This check is
necessarily inexact, but this script caught all the issues fixed in
the previous patches.
gdbsupport/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.am (check-defines): New target.
* check-defines.el: New file.
Change-Id: I59450e91394d5e6a7fa59e9ab53c95843c4bacd9
Tom Tromey [Fri, 20 Dec 2019 00:49:25 +0000 (17:49 -0700)]
Remove use of <config.h> from gdb/nat/
This removes the use of <config.h> from the files in gdb/nat/.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* nat/linux-btrace.c: Don't include <config.h>.
* nat/linux-ptrace.c: Don't include <config.h>.
* nat/x86-linux-dregs.c: Don't include <config.h>.
Change-Id: Ie8c734c54ada848aa020c77ec727704d367eff81
Tom Tromey [Thu, 19 Dec 2019 23:40:15 +0000 (16:40 -0700)]
Move many configure checks to common.m4
This moves many needed configure checks from gdb and gdbserver into
common.m4. This helps gdbsupport, nat, and target be self-contained.
The result is a bit spaghetti-ish, because gdbsupport uses another m4
file from gdb/. The resulting code is somewhat non-obvious. However,
these problems already exist, so it's not really that much worse than
what is already done.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Move many checks to ../gdbsupport/common.m4.
gdb/gdbserver/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Remove any checks that were added to common.m4.
* acinclude.m4: Include lib-ld.m4, lib-prefix.m4, and
lib-link.m4.
gdbsupport/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure, Makefile.in, aclocal.m4, common.m4, config.in:
Rebuild.
* common.m4 (GDB_AC_COMMON): Move many checks from
gdb/configure.ac.
* acinclude.m4: Include bfd.m4, ptrace.m4.
Change-Id: I931eaa94065df268b30a2f1354390710df89c7f8
Tom Tromey [Tue, 9 Jul 2019 14:06:39 +0000 (08:06 -0600)]
Move gdbsupport to the top level
This patch moves the gdbsupport directory to the top level. This is
the next step in the ongoing project to move gdbserver to the top
level.
The bulk of this patch was created by "git mv gdb/gdbsupport gdbsupport".
This patch then adds a build system to gdbsupport and wires it into
the top level. Then it changes gdb to use the top-level build.
gdbserver, on the other hand, is not yet changed. It still does its
own build of gdbsupport.
ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport.
* MAINTAINERS: Add gdbsupport.
* configure: Rebuild.
* configure.ac (configdirs): Add gdbsupport.
* gdbsupport: New directory, move from gdb/gdbsupport.
* Makefile.def (host_modules, dependencies): Add gnulib.
* Makefile.in: Rebuild.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* nat/x86-linux-dregs.c: Include configh.h.
* nat/linux-ptrace.c: Include configh.h.
* nat/linux-btrace.c: Include configh.h.
* defs.h: Include config.h, bfd.h.
* configure.ac: Don't source common.host.
(CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files.
* configure: Rebuild.
* acinclude.m4: Update path.
* Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables.
(CONFIG_SRC_SUBDIR): Remove gdbsupport.
(INTERNAL_CFLAGS_BASE): Add INCSUPPORT.
(CLIBS): Add LIBSUPPORT.
(CDEPS): Likewise.
(COMMON_SFILES): Remove gdbsupport files.
(HFILES_NO_SRCDIR): Likewise.
(stamp-version): Update path to create-version.sh.
(ALLDEPFILES): Remove gdbsupport files.
gdb/gdbserver/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* server.h: Include config.h.
* gdbreplay.c: Include config.h.
* configure: Rebuild.
* configure.ac: Don't source common.host.
* acinclude.m4: Update path.
* Makefile.in (INCSUPPORT): New variable.
(INCLUDE_CFLAGS): Add INCSUPPORT.
(SFILES): Update paths.
(version-generated.c): Update path to create-version.sh.
(gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths.
gdbsupport/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* common-defs.h: Add GDBSERVER case. Update includes.
* acinclude.m4, aclocal.m4, config.in, configure, configure.ac,
Makefile.am, Makefile.in, README: New files.
* Moved from ../gdb/gdbsupport/
Change-Id: I07632e7798635c1bab389bf885971e584fb4bb78
Tom Tromey [Tue, 22 Oct 2019 22:22:58 +0000 (16:22 -0600)]
Consolidate definition of USE_WIN32API
I noticed that USE_WIN32API is defined separately by gdbserver and
gdb. However, because it is used by code in gdbsupport, it should be
defined by common.m4. This approach ensures that the code will
continue to work when it is moved to the top level.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* gdbsupport/common.m4 (GDB_AC_COMMON): Define WIN32APILIBS and
USE_WIN32API when needed.
* configure.ac (USE_WIN32API): Don't define.
(WIN32LIBS): Use WIN32APILIBS.
* configure: Rebuild.
gdb/gdbserver/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure.ac (LIBS): Use WIN32APILIBS.
(USE_WIN32API): Don't define.
* configure: Rebuild.
Change-Id: I40d524d5445ebfb452b36f4d0e102f0b1e1089df
Tom Tromey [Tue, 14 Jan 2020 23:16:39 +0000 (16:16 -0700)]
Fix indentation in common.m4
Simon pointed out that the indentation in common.m4 is off. This
patch fixes the problem.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* gdbsupport/common.m4 (GDB_AC_COMMON): Fix indentation.
gdb/gdbserver/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
Change-Id: I6a629bd5873cca95ba3e17656f0d0ce583a08361
Bernd Edlinger [Wed, 25 Dec 2019 15:35:32 +0000 (16:35 +0100)]
Make skip without argument skip the current inline function
Previously always the outermost function block was used, but
since skip is now able to skip over inline functions it is more
natural to skip the inline function that the program is currently
executing.
gdb:
2020-01-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* skip.c (skip_function_command): Make skip w/o arguments use the
name of the inlined function if pc is inside any inlined function.
gdb/testsuite:
2020-01-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gdb.base/skip-inline.exp: Extend test.
Lili Cui [Tue, 14 Jan 2020 16:59:37 +0000 (08:59 -0800)]
x86: Updated align branch tests for Darwin and i686-pc-elf
1. Update align branch assembler tests to match Darwin disassembler
outputs.
2. Skip unsupported "call *foo" tests in 64-bit mode on Darwin.
3. Update align branch linker test to match any addresses for i686-pc-elf.
gas/
* testsuite/gas/i386/align-branch-1a.d: Updated for Darwin.
* testsuite/gas/i386/align-branch-1b.d: Likewise.
* testsuite/gas/i386/align-branch-1c.d: Likewise.
* testsuite/gas/i386/align-branch-1d.d: Likewise.
* testsuite/gas/i386/align-branch-1e.d: Likewise.
* testsuite/gas/i386/align-branch-1f.d: Likewise.
* testsuite/gas/i386/align-branch-1g.d: Likewise.
* testsuite/gas/i386/align-branch-1h.d: Likewise.
* testsuite/gas/i386/align-branch-1i.d: Likewise.
* testsuite/gas/i386/align-branch-5.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1e.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1h.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1i.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-5.d: Likewise.
* testsuite/gas/i386/i386.exp: Skip x86-64-align-branch-2a,
x86-64-align-branch-2b and x86-64-align-branch-2c on Darwin.
ld/
* testsuite/ld-i386/align-branch-1.d: Updated for i686-pc-elf.
Luis Machado [Fri, 6 Dec 2019 21:12:37 +0000 (18:12 -0300)]
Fix/Update misc comments
While doing some investigation of mine, i noticed a few typos,
inaccuracies and missing information.
I went ahead and updated/improved those.
gdb/ChangeLog:
2020-01-14 Luis Machado <luis.machado@linaro.org>
* inf-ptrace.c (inf_ptrace_target::resume): Update comments.
* infrun.c (resume_1): Likewise.
(handle_inferior_event): Remove stale comment.
* linux-nat.c (linux_nat_target::resume): Update comments.
(save_stop_reason): Likewise.
(linux_nat_filter_event): Likewise.
* linux-nat.h (struct lwp_info) <stop_pc>, <stop_reason>: Likewise.
Sergey Belyashov [Tue, 14 Jan 2020 13:13:57 +0000 (13:13 +0000)]
Fix various assembler testsuite failures for the Z80 target.
PR 25377
gas * config/tc-z80.c: Add support for half precision, single
precision and double precision floating point values.
* config/tc-z80.h b/gas/config/tc-z80.h: Disable string escapes.
* doc/as.texi: Add new z80 command line options.
* doc/c-z80.texi: Document new z80 command line options.
* testsuite/gas/z80/ez80_pref_dis.s: New test.
* testsuite/gas/z80/ez80_pref_dis.d: New test driver.
* testsuite/gas/z80/z80.exp: Run the new test.
* testsuite/gas/z80/fp_math48.d: Use correct command line option.
* testsuite/gas/z80/fp_zeda32.d: Likewise.
* testsuite/gas/z80/strings.d: Update expected output.
opcodes * z80-dis.c (suffix): Use .db instruction to generate double
prefix.
Alan Modra [Tue, 14 Jan 2020 00:15:41 +0000 (10:45 +1030)]
som: Don't loop forever reading symbol chains
* som.c (som_bfd_count_ar_symbols): Error when file position
of symbols on chains is not strictly increasing.
Alan Modra [Mon, 13 Jan 2020 23:09:47 +0000 (09:39 +1030)]
ubsan: alpha-vms: segv
I thought the fuzzers were really going overboard by defining
VMS_DEBUG but that wasn't the case. VMS_DEBUG is defined by
default. Let's not do that, and fix the segv as well.
* vms.h (VMS_DEBUG): Define as 0.
* vms-alpha.c (image_write): Move debug output after bounds check.
Tidy bounds check.
(_bfd_vms_slurp_eihd): Warning fix.
(_bfd_vms_slurp_etir): Init variables to avoid bogus warnings.
Alan Modra [Mon, 13 Jan 2020 22:47:09 +0000 (09:17 +1030)]
ubsan: z8k: left shift cannot be represented in type 'int'
* z8k-dis.c (unpack_instr): Formatting. Cast unsigned short
values to unsigned before shifting.
GDB Administrator [Tue, 14 Jan 2020 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 6 Dec 2019 23:12:29 +0000 (23:12 +0000)]
gdb: Handle malformed ELF, symbols in non-allocatable sections
I ended up debugging a malformed ELF where a section containing
executable code was not correctly marked as allocatable. Before
realising the ELF was corrupted I tried to place a breakpoint on a
symbol in the non-allocatable, executable section, and GDB crashed.
Though trying to debug such an ELF clearly isn't going to go well I
would prefer, as far as possible, that any input, no matter how
corrupted, not crash GDB.
The crash occurs when trying to set a breakpoint on the name of a
function from the corrupted section. GDB converts the symbol to a
symtab_and_line, and looks up a suitable section for this.
The problem is that the section is actually an obj_section, which is
stored in the table within the objfile, and we only initialise this
table for allocatable sections (see add_to_objfile_sections_full in
objfiles.c). So, if the symbol is in a non-allocatable section then
we end up referencing an uninitialised obj_section.
Later we call get_sal_arch on the symtab_and_line, which calls
get_objfile_arch, which uses the objfile from the uninitialised
obj_section, which will be nullptr, at which point GDB crashes.
The fix I propose here is that when we setup the section references on
msymbols, we should check if the bfd_section being referenced is
allocatable or not. If it is not then we should set the section
reference back to the default 0 section (see how MSYMBOL_OBJ_SECTION
and SYMBOL_OBJ_SECTION treat the 0 section index).
With this fix in place GDB no longer crashes. Instead GDB creates the
breakpoint at the non-allocated address, and then fails, with an
error, when it tries to insert the breakpoint.
gdb/ChangeLog:
* elfread.c (record_minimal_symbol): Set section index to 0 for
non-allocatable sections.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-bad-elf-other.S: New file.
* gdb.dwarf2/dw2-bad-elf.c: New file.
* gdb.dwarf2/dw2-bad-elf.exp: New file.
Change-Id: Ie05436ab4c6a71440304d20ee639dfb021223f8b
Andrew Burgess [Fri, 6 Dec 2019 21:35:18 +0000 (21:35 +0000)]
gdb/testsuite: Allow DWARF assembler to create multiple line tables
Fixes a bug in the DWARF assembler that prevents multiple line tables
from being created in a test. We currently don't initialise a couple
of flags, as a result we will only ever generate one end of file list,
and one end of header, in the first line table. Any additional line
tables will be missing these parts, and will therefore be corrupt.
This fix will be required for a later commit. There should be no
change in the testsuite after this commit.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (Dwarf::lines): Reset _line_saw_program and
_line_saw_file.
Change-Id: Id7123f217a036f26ee32d608db3064dd43164596
Ali Tamur [Tue, 24 Dec 2019 03:31:24 +0000 (19:31 -0800)]
Dwarf 5: Handle debug_str_offsets and indexed attributes that have base offsets.
* Process debug_str_offsets section. Handle DW_AT_str_offsets_base attribute and
keep the value in dwarf2_cu.
* Make addr_base field in dwarf2_cu optional to disambiguate 0 value
(absent or present and 0).
* During parsing, there is no guarantee that DW_AT_str_offsets_base and
DW_AT_rnglists_base fields will be processed before the attributes that need
those values for correct computation. So make two passes, on the first one mark
the attributes that depend on *_base attributes and process only the others.
On the second pass, only process the attributes that are marked on the first
pass.
* For string attributes, differentiate between addresses that directly point to
a string and those that point to an offset in debug_str_offsets section.
* There are now two attributes, DW_AT_addr_base and DW_AT_GNU_addr_base to read
address offset base. Likewise, there are two attributes, DW_AT_rnglists_base
and DW_AT_GNU_ranges_base to read ranges base. Since there is no guarantee which
ones the compiler will generate, create helper functions to handle all cases.
Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with
-gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of
tests that fails. (gdb still cannot debug a 'hello world' program with DWARF 5,
so for the time being, this is all we care about).
This is part of an effort to support DWARF-5 in gdb.
Simon Marchi [Mon, 13 Jan 2020 23:12:08 +0000 (18:12 -0500)]
gdb: use gdb::byte_vector instead of std::vector<char> in core_target::get_core_register_section
Since the data held by the `contents` variable is arbitrary binary data,
it should have gdb_byte elements, not char elements. Also, using
gdb::byte_vector is preferable, since it doesn't unnecessarily
zero-initialize the values.
Instead of adding a cast in the call to m_core_vec->core_read_registers,
I have changed core_read_registers' argument to be a gdb_byte* instead
of a char*.
gdb/ChangeLog:
* gdbcore.h (struct core_fns) <core_read_registers>: Change
core_reg_sect type to gdb_byte *.
* arm-nbsd-nat.c (fetch_elfcore_registers): Likewise.
* cris-tdep.c (fetch_core_registers): Likewise.
* corelow.c (core_target::get_core_register_section): Change
type of `contents` to gdb::byte_vector.
Andrew Burgess [Fri, 10 Jan 2020 00:04:25 +0000 (00:04 +0000)]
gdb/tui: Place window titles in the center of the border
In tui-wingeneral.c:box_win () a comment suggest we should display
titles like this:
+-WINDOW TITLE GOES HERE-+
However, we actually display them like this:
+--WINDOW TITLE GOES HERE+
The former seems nicer to me, so that's what this commit does. Short
titles will appear as:
+-SHORT TITLE------------+
We previously didn't test the horizontal windows borders in the test
suite, however, I've updated things so that we do now check for the
'+-' and '-+' on the upper border, this will give us some protection.
gdb/ChangeLog:
* tui/tui-wingeneral.c (box_win): Position the title in the center
of the border.
gdb/testsuite/ChangeLog:
* lib/tuiterm.exp (Term::_check_box): Check some parts of the top
border.
Change-Id: Iead6910e3b4e68bdf6871f861f23d2efd699faf0
Simon Marchi [Mon, 13 Jan 2020 19:32:52 +0000 (14:32 -0500)]
gdb: use std::vector instead of alloca in core_target::get_core_register_section
As I was trying to compile gdb for an m68k host, I got this error:
CXX corelow.o
In file included from /binutils-gdb/gdb/gdbsupport/common-defs.h:120,
from /binutils-gdb/gdb/defs.h:28,
from /binutils-gdb/gdb/corelow.c:20:
/binutils-gdb/gdb/corelow.c: In member function 'void core_target::get_core_register_section(regcache*, const regset*, const char*, int, int, const char*, bool)':
/binutils-gdb/gdb/../include/libiberty.h:727:36: error: 'alloca' bound is unknown [-Werror=alloca-larger-than=]
727 | # define alloca(x) __builtin_alloca(x)
| ~~~~~~~~~~~~~~~~^~~
/binutils-gdb/gdb/corelow.c:625:23: note: in expansion of macro 'alloca'
625 | contents = (char *) alloca (size);
| ^~~~~~
We are using alloca to hold the contents of a the core register
sections. These sections are typically fairly small, but there is no
realy guarantee, so I think it would be more reasonable to just use
dynamic allocation here.
gdb/ChangeLog:
* corelow.c (core_target::get_core_register_section): Use
std::vector instead of alloca.
Simon Marchi [Mon, 13 Jan 2020 19:19:05 +0000 (14:19 -0500)]
gdbserver: remove rule for files from regformats/i386
The dat files in regformats/i386 were removed a while ago, this rule is
no longer necessary.
gdb/gdbserver/ChangeLog:
* Makefile.in (%-generated.c): Remove rule for files from
regformats/i386.
Simon Marchi [Mon, 13 Jan 2020 19:05:44 +0000 (14:05 -0500)]
Enable -Wmissing-declarations diagnostic
Now that most warnings of this kind are fixed, we can enable
-Wmissing-declarations. I say "most", because it is likely that there
are some more in some configurations I am not able to build, but they
should be pretty easy to fix.
gdb/ChangeLog:
* warning.m4: Add -Wmissing-declarations to build_warnings.
* configure: Re-generate.
gdb/gdbserver/ChangeLog:
* configure: Re-generate.
Change-Id: Iae9b59f22eb5dd1965d09f34c5c9e212cddf67ba
Simon Marchi [Mon, 13 Jan 2020 19:05:32 +0000 (14:05 -0500)]
gdbserver: set IP_AGENT_EXPORT_FUNC to static when not building IPA, add declarations
Fixing the -Wmissing-declarations errors in gdbserver's tracepoint.c is
a bit tricky, because some functions are compiled for both gdbserver, in
which case they should be static, since they are only used in that file,
and for libinproctrace.so, in which case they should be externally
visible, since they need to be looked up. In the case where they are
externally visible, -Wmissing-declarations requires that a declaration
exists (that's the point of the warning).
I've reused the IP_AGENT_EXPORT_FUNC macro to mark the functions as
static when compiled for gdbserver. Some seemingly unnecessary
declarations are added for when compiling libinproctrace.so (thanks to
Tom for the suggestion).
gdb/gdbserver/ChangeLog:
* tracepoint.h (IP_AGENT_EXPORT_FUNC) [!IN_PROCESS_AGENT]:
Define to static.
* tracepoint.c (stop_tracing, flush_trace_buffer,
about_to_request_buffer_space, get_trace_state_variable_value,
set_trace_state_variable_value, gdb_collect): Add declaration.
Change-Id: If9c66151bd00c3b9c5caa27a7c21c5a3a952de2a
Simon Marchi [Mon, 13 Jan 2020 19:04:53 +0000 (14:04 -0500)]
gdbserver: make some functions static in linux-x86-low.c
These functions are only used in this file, so should be static.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_regs_info, amd64_emit_eq_goto,
amd64_emit_ne_goto, amd64_emit_lt_goto, amd64_emit_le_goto,
amd64_emit_gt_goto, amd64_emit_ge_goto, amd64_emit_ge_goto,
i386_emit_eq_goto, i386_emit_ne_goto, i386_emit_lt_goto,
i386_emit_le_goto, i386_emit_gt_goto, i386_emit_ge_goto): Make
static.
Change-Id: I703da41867735aefadd49140e80cd60f6ab9ad39
Simon Marchi [Mon, 13 Jan 2020 19:03:18 +0000 (14:03 -0500)]
gdbserver: include gdbsupport/common-inferior.h in inferiors.c
So that the definitions of get_inferior_cwd/set_inferior_cwd see their
declarations.
CXX inferiors.o
/home/smarchi/src/binutils-gdb/gdb/gdbserver/inferiors.c: In function ‘const char* get_inferior_cwd()’:
/home/smarchi/src/binutils-gdb/gdb/gdbserver/inferiors.c:228:1: error: no previous declaration for ‘const char* get_inferior_cwd()’ [-Werror=missing-declarations]
get_inferior_cwd ()
^~~~~~~~~~~~~~~~
/home/smarchi/src/binutils-gdb/gdb/gdbserver/inferiors.c: In function ‘void set_inferior_cwd(const char*)’:
/home/smarchi/src/binutils-gdb/gdb/gdbserver/inferiors.c:236:1: error: no previous declaration for ‘void set_inferior_cwd(const char*)’ [-Werror=missing-declarations]
set_inferior_cwd (const char *cwd)
^~~~~~~~~~~~~~~~
gdb/gdbserver/ChangeLog:
* inferiors.c: Include gdbsupport/common-inferior.h.
Change-Id: Iae5ccb3e1dc37ce79f03f08465f603a0411e7af0
Simon Marchi [Mon, 13 Jan 2020 19:03:13 +0000 (14:03 -0500)]
gdbserver: include hostio.h in hostio-errno.c
... so that the definition of hostio_last_error_from_errno in hostio-errno.c
sees the declaration in hostio.h.
Fix this error:
CXX hostio-errno.o
/home/smarchi/src/binutils-gdb/gdb/gdbserver/hostio-errno.c: In function ‘void hostio_last_error_from_errno(char*)’:
/home/smarchi/src/binutils-gdb/gdb/gdbserver/hostio-errno.c:28:1: error: no previous declaration for ‘void hostio_last_error_from_errno(char*)’ [-Werror=missing-declarations]
hostio_last_error_from_errno (char *buf)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdb/gdbserver/ChangeLog:
* hostio-errno.c: Include hostio.h.
Change-Id: I056308fd4ce12810d0a1b826c423bd0c7eeb8944
Simon Marchi [Mon, 13 Jan 2020 19:03:04 +0000 (14:03 -0500)]
gdb: add declaration to Python init function
When I try to enable -Wmissing-declarations, I get this error:
CXX python/python.o
/home/smarchi/src/binutils-gdb/gdb/python/python.c: In function ‘PyObject* init__gdb_module()’:
/home/smarchi/src/binutils-gdb/gdb/python/python.c:1582:1: error: no previous declaration for ‘PyObject* init__gdb_module()’ [-Werror=missing-declarations]
init__gdb_module (void)
^~~~~~~~~~~~~~~~
Prevent it by providing a declaration just before the definition.
gdb/ChangeLog:
* python/python.c (init__gdb_module): Add declaration.
Change-Id: I394bc691b7db624708cc4cb2cda28a56ab85a82b
Simon Marchi [Mon, 13 Jan 2020 19:01:38 +0000 (14:01 -0500)]
gdb: add back declarations for _initialize functions
I'd like to enable the -Wmissing-declarations warning. However, it
warns for every _initialize function, for example:
CXX dcache.o
/home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’:
/home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations]
_initialize_dcache (void)
^~~~~~~~~~~~~~~~~~
The only practical way forward I found is to add back the declarations,
which were removed by this commit:
commit
481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9
Author: John Baldwin <jhb@FreeBSD.org>
Date: Sat Sep 9 11:02:37 2017 -0700
Remove unnecessary function prototypes.
I don't think it's a big problem to have the declarations for these
functions, but if anybody has a better solution for this, I'll be happy
to use it.
gdb/ChangeLog:
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration.
* aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration.
* aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration.
* aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration.
* aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration.
* ada-exp.y (_initialize_ada_exp): Add declaration.
* ada-lang.c (_initialize_ada_language): Add declaration.
* ada-tasks.c (_initialize_tasks): Add declaration.
* agent.c (_initialize_agent): Add declaration.
* aix-thread.c (_initialize_aix_thread): Add declaration.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration.
* alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration.
* alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration.
* alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration.
* alpha-tdep.c (_initialize_alpha_tdep): Add declaration.
* amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration.
* amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration.
* amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration.
* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration.
* amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration.
* amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration.
* amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration.
* amd64-tdep.c (_initialize_amd64_tdep): Add declaration.
* amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration.
* amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration.
* annotate.c (_initialize_annotate): Add declaration.
* arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration.
* arc-tdep.c (_initialize_arc_tdep): Add declaration.
* arch-utils.c (_initialize_gdbarch_utils): Add declaration.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration.
* arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration.
* arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration.
* arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration.
* arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration.
* arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration.
* arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration.
* arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration.
* arm-tdep.c (_initialize_arm_tdep): Add declaration.
* arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration.
* auto-load.c (_initialize_auto_load): Add declaration.
* auxv.c (_initialize_auxv): Add declaration.
* avr-tdep.c (_initialize_avr_tdep): Add declaration.
* ax-gdb.c (_initialize_ax_gdb): Add declaration.
* bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration.
* bfin-tdep.c (_initialize_bfin_tdep): Add declaration.
* break-catch-sig.c (_initialize_break_catch_sig): Add declaration.
* break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration.
* break-catch-throw.c (_initialize_break_catch_throw): Add declaration.
* breakpoint.c (_initialize_breakpoint): Add declaration.
* bsd-uthread.c (_initialize_bsd_uthread): Add declaration.
* btrace.c (_initialize_btrace): Add declaration.
* charset.c (_initialize_charset): Add declaration.
* cli/cli-cmds.c (_initialize_cli_cmds): Add declaration.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-logging.c (_initialize_cli_logging): Add declaration.
* cli/cli-script.c (_initialize_cli_script): Add declaration.
* cli/cli-style.c (_initialize_cli_style): Add declaration.
* coff-pe-read.c (_initialize_coff_pe_read): Add declaration.
* coffread.c (_initialize_coffread): Add declaration.
* compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration.
* compile/compile.c (_initialize_compile): Add declaration.
* complaints.c (_initialize_complaints): Add declaration.
* completer.c (_initialize_completer): Add declaration.
* copying.c (_initialize_copying): Add declaration.
* corefile.c (_initialize_core): Add declaration.
* corelow.c (_initialize_corelow): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* cp-namespace.c (_initialize_cp_namespace): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-valprint.c (_initialize_cp_valprint): Add declaration.
* cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration.
* cris-tdep.c (_initialize_cris_tdep): Add declaration.
* csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration.
* csky-tdep.c (_initialize_csky_tdep): Add declaration.
* ctfread.c (_initialize_ctfread): Add declaration.
* d-lang.c (_initialize_d_language): Add declaration.
* darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration.
* darwin-nat.c (_initialize_darwin_nat): Add declaration.
* dbxread.c (_initialize_dbxread): Add declaration.
* dcache.c (_initialize_dcache): Add declaration.
* disasm-selftests.c (_initialize_disasm_selftests): Add declaration.
* disasm.c (_initialize_disasm): Add declaration.
* dtrace-probe.c (_initialize_dtrace_probe): Add declaration.
* dummy-frame.c (_initialize_dummy_frame): Add declaration.
* dwarf-index-cache.c (_initialize_index_cache): Add declaration.
* dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration.
* dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration.
* dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration.
* dwarf2expr.c (_initialize_dwarf2expr): Add declaration.
* dwarf2loc.c (_initialize_dwarf2loc): Add declaration.
* dwarf2read.c (_initialize_dwarf2_read): Add declaration.
* elfread.c (_initialize_elfread): Add declaration.
* exec.c (_initialize_exec): Add declaration.
* extension.c (_initialize_extension): Add declaration.
* f-lang.c (_initialize_f_language): Add declaration.
* f-valprint.c (_initialize_f_valprint): Add declaration.
* fbsd-nat.c (_initialize_fbsd_nat): Add declaration.
* fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration.
* filesystem.c (_initialize_filesystem): Add declaration.
* findcmd.c (_initialize_mem_search): Add declaration.
* findvar.c (_initialize_findvar): Add declaration.
* fork-child.c (_initialize_fork_child): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (_initialize_frame): Add declaration.
* frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration.
* frv-tdep.c (_initialize_frv_tdep): Add declaration.
* ft32-tdep.c (_initialize_ft32_tdep): Add declaration.
* gcore.c (_initialize_gcore): Add declaration.
* gdb-demangle.c (_initialize_gdb_demangle): Add declaration.
* gdb_bfd.c (_initialize_gdb_bfd): Add declaration.
* gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration.
* gdbarch.c (_initialize_gdbarch): Add declaration.
* gdbtypes.c (_initialize_gdbtypes): Add declaration.
* gnu-nat.c (_initialize_gnu_nat): Add declaration.
* gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration.
* gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration.
* go-lang.c (_initialize_go_language): Add declaration.
* go32-nat.c (_initialize_go32_nat): Add declaration.
* guile/guile.c (_initialize_guile): Add declaration.
* h8300-tdep.c (_initialize_h8300_tdep): Add declaration.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration.
* hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration.
* hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration.
* hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration.
* hppa-tdep.c (_initialize_hppa_tdep): Add declaration.
* i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration.
* i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration.
* i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration.
* i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration.
* i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration.
* i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration.
* i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration.
* i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration.
* i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration.
* i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration.
* i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration.
* i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration.
* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration.
* i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration.
* i386-tdep.c (_initialize_i386_tdep): Add declaration.
* i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration.
* ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration.
* ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration.
* ia64-tdep.c (_initialize_ia64_tdep): Add declaration.
* ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration.
* infcall.c (_initialize_infcall): Add declaration.
* infcmd.c (_initialize_infcmd): Add declaration.
* inflow.c (_initialize_inflow): Add declaration.
* infrun.c (_initialize_infrun): Add declaration.
* interps.c (_initialize_interpreter): Add declaration.
* iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration.
* jit.c (_initialize_jit): Add declaration.
* language.c (_initialize_language): Add declaration.
* linux-fork.c (_initialize_linux_fork): Add declaration.
* linux-nat.c (_initialize_linux_nat): Add declaration.
* linux-tdep.c (_initialize_linux_tdep): Add declaration.
* linux-thread-db.c (_initialize_thread_db): Add declaration.
* lm32-tdep.c (_initialize_lm32_tdep): Add declaration.
* m2-lang.c (_initialize_m2_language): Add declaration.
* m32c-tdep.c (_initialize_m32c_tdep): Add declaration.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration.
* m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration.
* m32r-tdep.c (_initialize_m32r_tdep): Add declaration.
* m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration.
* m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration.
* m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration.
* m68k-tdep.c (_initialize_m68k_tdep): Add declaration.
* machoread.c (_initialize_machoread): Add declaration.
* macrocmd.c (_initialize_macrocmd): Add declaration.
* macroscope.c (_initialize_macroscope): Add declaration.
* maint-test-options.c (_initialize_maint_test_options): Add declaration.
* maint-test-settings.c (_initialize_maint_test_settings): Add declaration.
* maint.c (_initialize_maint_cmds): Add declaration.
* mdebugread.c (_initialize_mdebugread): Add declaration.
* memattr.c (_initialize_mem): Add declaration.
* mep-tdep.c (_initialize_mep_tdep): Add declaration.
* mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration.
* mi/mi-cmds.c (_initialize_mi_cmds): Add declaration.
* mi/mi-interp.c (_initialize_mi_interp): Add declaration.
* mi/mi-main.c (_initialize_mi_main): Add declaration.
* microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration.
* microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration.
* mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration.
* mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration.
* mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration.
* mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration.
* mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration.
* mips-tdep.c (_initialize_mips_tdep): Add declaration.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration.
* mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration.
* mipsread.c (_initialize_mipsread): Add declaration.
* mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration.
* mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration.
* moxie-tdep.c (_initialize_moxie_tdep): Add declaration.
* msp430-tdep.c (_initialize_msp430_tdep): Add declaration.
* nds32-tdep.c (_initialize_nds32_tdep): Add declaration.
* nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration.
* nios2-tdep.c (_initialize_nios2_tdep): Add declaration.
* nto-procfs.c (_initialize_procfs): Add declaration.
* objc-lang.c (_initialize_objc_language): Add declaration.
* observable.c (_initialize_observer): Add declaration.
* opencl-lang.c (_initialize_opencl_language): Add declaration.
* or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration.
* or1k-tdep.c (_initialize_or1k_tdep): Add declaration.
* osabi.c (_initialize_gdb_osabi): Add declaration.
* osdata.c (_initialize_osdata): Add declaration.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* parse.c (_initialize_parse): Add declaration.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration.
* ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration.
* ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration.
* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration.
* ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration.
* printcmd.c (_initialize_printcmd): Add declaration.
* probe.c (_initialize_probe): Add declaration.
* proc-api.c (_initialize_proc_api): Add declaration.
* proc-events.c (_initialize_proc_events): Add declaration.
* proc-service.c (_initialize_proc_service): Add declaration.
* procfs.c (_initialize_procfs): Add declaration.
* producer.c (_initialize_producer): Add declaration.
* psymtab.c (_initialize_psymtab): Add declaration.
* python/python.c (_initialize_python): Add declaration.
* ravenscar-thread.c (_initialize_ravenscar): Add declaration.
* record-btrace.c (_initialize_record_btrace): Add declaration.
* record-full.c (_initialize_record_full): Add declaration.
* record.c (_initialize_record): Add declaration.
* regcache-dump.c (_initialize_regcache_dump): Add declaration.
* regcache.c (_initialize_regcache): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* remote-notif.c (_initialize_notif): Add declaration.
* remote-sim.c (_initialize_remote_sim): Add declaration.
* remote.c (_initialize_remote): Add declaration.
* reverse.c (_initialize_reverse): Add declaration.
* riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration.
* riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration.
* riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration.
* riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration.
* riscv-tdep.c (_initialize_riscv_tdep): Add declaration.
* rl78-tdep.c (_initialize_rl78_tdep): Add declaration.
* rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration.
* rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep):
Add declaration.
* rs6000-nat.c (_initialize_rs6000_nat): Add declaration.
* rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration.
* run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration.
* rust-exp.y (_initialize_rust_exp): Add declaration.
* rx-tdep.c (_initialize_rx_tdep): Add declaration.
* s12z-tdep.c (_initialize_s12z_tdep): Add declaration.
* s390-linux-nat.c (_initialize_s390_nat): Add declaration.
* s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration.
* s390-tdep.c (_initialize_s390_tdep): Add declaration.
* score-tdep.c (_initialize_score_tdep): Add declaration.
* ser-go32.c (_initialize_ser_dos): Add declaration.
* ser-mingw.c (_initialize_ser_windows): Add declaration.
* ser-pipe.c (_initialize_ser_pipe): Add declaration.
* ser-tcp.c (_initialize_ser_tcp): Add declaration.
* ser-uds.c (_initialize_ser_socket): Add declaration.
* ser-unix.c (_initialize_ser_hardwire): Add declaration.
* serial.c (_initialize_serial): Add declaration.
* sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration.
* sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration.
* sh-tdep.c (_initialize_sh_tdep): Add declaration.
* skip.c (_initialize_step_skip): Add declaration.
* sol-thread.c (_initialize_sol_thread): Add declaration.
* solib-aix.c (_initialize_solib_aix): Add declaration.
* solib-darwin.c (_initialize_darwin_solib): Add declaration.
* solib-dsbt.c (_initialize_dsbt_solib): Add declaration.
* solib-frv.c (_initialize_frv_solib): Add declaration.
* solib-svr4.c (_initialize_svr4_solib): Add declaration.
* solib-target.c (_initialize_solib_target): Add declaration.
* solib.c (_initialize_solib): Add declaration.
* source-cache.c (_initialize_source_cache): Add declaration.
* source.c (_initialize_source): Add declaration.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration.
* sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration.
* sparc-nat.c (_initialize_sparc_nat): Add declaration.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration.
* sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration.
* sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration.
* sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration.
* sparc-tdep.c (_initialize_sparc_tdep): Add declaration.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration.
* sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration.
* sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration.
* sparc64-nat.c (_initialize_sparc64_nat): Add declaration.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration.
* sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration.
* sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration.
* sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration.
* sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration.
* stabsread.c (_initialize_stabsread): Add declaration.
* stack.c (_initialize_stack): Add declaration.
* stap-probe.c (_initialize_stap_probe): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* symfile-debug.c (_initialize_symfile_debug): Add declaration.
* symfile-mem.c (_initialize_symfile_mem): Add declaration.
* symfile.c (_initialize_symfile): Add declaration.
* symmisc.c (_initialize_symmisc): Add declaration.
* symtab.c (_initialize_symtab): Add declaration.
* target.c (_initialize_target): Add declaration.
* target-connection.c (_initialize_target_connection): Add
declaration.
* target-dcache.c (_initialize_target_dcache): Add declaration.
* target-descriptions.c (_initialize_target_descriptions): Add declaration.
* thread.c (_initialize_thread): Add declaration.
* tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration.
* tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration.
* tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration.
* tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration.
* tracectf.c (_initialize_ctf): Add declaration.
* tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration.
* tracefile.c (_initialize_tracefile): Add declaration.
* tracepoint.c (_initialize_tracepoint): Add declaration.
* tui/tui-hooks.c (_initialize_tui_hooks): Add declaration.
* tui/tui-interp.c (_initialize_tui_interp): Add declaration.
* tui/tui-layout.c (_initialize_tui_layout): Add declaration.
* tui/tui-regs.c (_initialize_tui_regs): Add declaration.
* tui/tui-stack.c (_initialize_tui_stack): Add declaration.
* tui/tui-win.c (_initialize_tui_win): Add declaration.
* tui/tui.c (_initialize_tui): Add declaration.
* typeprint.c (_initialize_typeprint): Add declaration.
* ui-style.c (_initialize_ui_style): Add declaration.
* unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration.
* unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration.
* unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration.
* unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration.
* unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration.
* unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration.
* unittests/filtered_iterator-selftests.c
(_initialize_filtered_iterator_selftests): Add declaration.
* unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration.
* unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration.
* unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration.
* unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration.
* unittests/main-thread-selftests.c
(_initialize_main_thread_selftests): Add declaration.
* unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration.
* unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration.
* unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration.
* unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration.
* unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration.
* unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration.
* unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration.
* unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration.
* unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration.
* unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration.
* unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration.
* unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration.
* unittests/style-selftests.c (_initialize_style_selftest): Add declaration.
* unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration.
* unittests/tui-selftests.c (_initialize_tui_selftest): Add
declaration.
* unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration.
* unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration.
* unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration.
* unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration.
* user-regs.c (_initialize_user_regs): Add declaration.
* utils.c (_initialize_utils): Add declaration.
* v850-tdep.c (_initialize_v850_tdep): Add declaration.
* valops.c (_initialize_valops): Add declaration.
* valprint.c (_initialize_valprint): Add declaration.
* value.c (_initialize_values): Add declaration.
* varobj.c (_initialize_varobj): Add declaration.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration.
* vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration.
* vax-tdep.c (_initialize_vax_tdep): Add declaration.
* windows-nat.c (_initialize_windows_nat): Add declaration.
(_initialize_check_for_gdb_ini): Add declaration.
(_initialize_loadable): Add declaration.
* windows-tdep.c (_initialize_windows_tdep): Add declaration.
* x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration.
* x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration.
* xcoffread.c (_initialize_xcoffread): Add declaration.
* xml-support.c (_initialize_xml_support): Add declaration.
* xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration.
* xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration.
* xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration.
Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
Simon Marchi [Mon, 13 Jan 2020 18:59:18 +0000 (13:59 -0500)]
gdb: make regformats output a declaration for the init function
When compiling gdbserver for an architecture that uses the regdat.sh
script (such as m68k) and the -Wmissing-declarations compiler flag, I
get:
REGDAT reg-m68k-generated.c
CXX reg-m68k.o
reg-m68k-generated.c:30:1: error: no previous declaration for 'void init_registers_m68k()' [-Werror=missing-declarations]
30 | init_registers_m68k (void)
| ^~~~~~~~~~~~~~~~~~~
The same happens with other architectures, such as s390, but I'll be
using 68k as an example.
The init_registers_m68k function is defined in reg-m68k-generated.c,
which is produced by the regformats/regdat.sh script. This script reads
the regformats/reg-m68k.dat file, containing a register description, and
produces C code that creates a corresponding target description at
runtime.
The init_registers_m68k function is invoked at initialization time in
linux-m68k-low.c. The function must therefore be non-static, but does
not have a declaration at the moment.
The real clean way of fixing this would be to make regdat.sh generate a
.h file (in addition to the .c file) with declarations for whatever is
in the .c file. The generated .c file would include the .h file, and
therefore the definition would have a corresponding declaration. The
linux-m68k-low.c file would also include this .h file, instead of having
its own declaration of init_registers_m68k, like it does now.
However, this would be a quite big change for not much gain. As far as
I understand, some common architectures (i386, x86-64, ARM, AArch64)
have been moved to dynamically building target descriptions based on
features (the linux-*-tdesc.c files in gdbserver) and don't use
regdat.sh anymore. Logically (and given infinite development
resources), the other architectures would be migrated to this system too
and the regdat.sh script would be dropped. A new architecture would
probably not use regdat.sh either. So I therefore propose this simpler
patch instead, which just adds a local declaration in the generated
file.
gdb/ChangeLog:
* regformats/regdat.sh: Generate declaration for init function.
Simon Marchi [Mon, 13 Jan 2020 18:57:32 +0000 (13:57 -0500)]
gdbserver: fix Makefile dependency of regformat-generated files on regdat.sh
The intent of the rules modified by this patch is that the *-generated.c
files generated by regdat.sh are re-generated in the event that
regdat.sh is modified. However, if I build, touch regdat.sh, and build
again, the files are not re-generated during the second build.
This is because regdat.sh is specified as an order-only dependency [1],
after the pipe. Make therefore only ensures that regdat.sh exists
before generating the target file, it doesn't check the timestamp of
regdat.sh.
This patch changes it to be a regular prerequisite.
The rules use the $< variable, which is substituted by the first
prerequisite only, so the command lines won't change.
[1] https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
gdb/gdbserver/ChangeLog:
* Makefile.in (%-generated.c): Make $(regdat_sh) a regular
prerequisite.
Nick Clifton [Mon, 13 Jan 2020 17:28:41 +0000 (17:28 +0000)]
Moev declaration of loop variable outside of the loop.
* objdump.c (disassemble_bytes): Remove C99-ism.
Simon Marchi [Mon, 13 Jan 2020 15:58:52 +0000 (10:58 -0500)]
gdb: adjust remote-sim.c to multi-target
The remote-sim.c file doesn't build since the main multi-target patch
(
5b6d1e4f, "Multi-target support"), this patch is an attempt to fix it.
I have only build-tested it, so I'm not sure it runs fine, but it should
get us close at least.
I made these functions methods of the gdbsim_target, because they need
to pass the target down to some GDB core functions, like
find_inferior_ptid:
- get_sim_inferior_data_by_ptid (renamed to get_inferior_data_by_ptid)
- gdbsim_resume_inferior (renamed to resume_one_inferior)
- gdbsim_close_inferior (renamed to close_one_inferior)
In the last two, I changed iterate_over_inferiors to a range-based for,
since that gives simpler code (no need to pass data through the void
pointer).
The next_pid variable, INITIAL_PID macro and sim_inferior_data structure
are simply moved up in the file, above gdbsim_target.
gdb/ChangeLog:
* remote-sim.c (next_pid, INITIAL_PID, sim_inferior_data): Move
up.
(gdbsim_target) <get_inferior_data_by_ptid, resume_one_inferior,
close_one_inferior>: New methods.
(get_sim_inferior_data_by_ptid): Move to gdbsim_target,
pass down target to find_inferior_pid.
(gdbsim_target::fetch_registers, gdbsim_target::store_registers):
Pass down target to find_inferior_ptid.
(gdbsim_target::create_inferior): Pass down target to
add_thread_silent.
(gdbsim_close_inferior): Move to gdbsim_close_inferior, pass
target down to find_inferior_ptid and switch_to_thread.
(gdbsim_target::close): Update to call close_one_inferior.
(struct resume_data): Remove.
(gdbsim_resume_inferior): Move to gdbsim_target. Take arguments
directly, rather than through a void pointer.
(gdbsim_target::resume): Update to call resume_one_inferior.
Matthew Malcomson [Mon, 13 Jan 2020 15:31:39 +0000 (15:31 +0000)]
[gas][aarch64] Turn on SVE when using f32mm or f64mm extensions
There are no instructions under these matrix multiply extensions that
can be used without having SVE enabled.
Since these extensions require SVE, we make that explicit in the options
table.
Tested on aarch64-none-elf without regressions.
gas/ChangeLog:
2020-01-13 Matthew Malcomson <matthew.malcomson@arm.com>
* config/tc-aarch64.c (f64mm, f32mm): Add sve as a feature
dependency.
Nick Clifton [Mon, 13 Jan 2020 15:18:57 +0000 (15:18 +0000)]
Add test driver for the debuginfod support in the binutils sub-directory.
* testsuite/binutils-all/debuginfod.exp: New tests.
Thomas Troeger [Mon, 13 Jan 2020 12:36:55 +0000 (12:36 +0000)]
Add an option to objdump's disassembler to generate ascii art diagrams showing the destinations of flow control instructions.
binutils* objdump.c (visualize_jumps, color_output, extended_color_output)
(detected_jumps): New variables.
(usage): Add the new jump visualization options.
(option_values): Add new option value.
(long_options): Add the new option.
(jump_info_new, jump_info_free): New functions.
(jump_info_min_address, jump_info_max_address): Likewise.
(jump_info_end_address, jump_info_is_start_address): Likewise.
(jump_info_is_end_address, jump_info_size): Likewise.
(jump_info_unlink, jump_info_insert): Likewise.
(jump_info_add_front, jump_info_move_linked): Likewise.
(jump_info_intersect, jump_info_merge): Likewise.
(jump_info_sort, jump_info_visualize_address): Likewise.
(disassemble_jumps): New function - used to locate jumps.
(disassemble_bytes): Add ascii art generation.
(disassemble_section): Add scan to locate jumps.
(main): Parse the new visualization option.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.
opcodes * arm-dis.c (print_insn_arm): Fill in insn info fields for control
flow instructions.
(print_insn_thumb16, print_insn_thumb32): Likewise.
(print_insn): Initialize the insn info.
* i386-dis.c (print_insn): Initialize the insn info fields, and
detect jumps.
Alan Modra [Mon, 13 Jan 2020 12:23:02 +0000 (22:53 +1030)]
Re: PR23560, PR23561, readelf memory leaks
PR 25360
PR 25361
Dyslexia strikes again.
Fix git commit
a788aedd86da983faf0afef3cb41461118a2e9f2 ChangeLog.
Alan Modra [Mon, 13 Jan 2020 12:14:04 +0000 (22:44 +1030)]
Regen ld BLD-POTFILES.in
* po/BLD-POTFILES.in: Regenerate.
Alan Modra [Mon, 13 Jan 2020 12:00:46 +0000 (22:30 +1030)]
PR23560, PR23561, readelf memory leaks
PR 23560
PR 23561
* dwarf.c (display_debug_frames): Move fde_fc earlier. Free
fde_fc col_type and col_offset.
* readelf.c (apply_relocations): Move symsec check earlier.
(free_debug_section): Free reloc_info.
(process_notes_at): Free pnotes on error path.
(process_object): Free dump_sects here..
(process_archive): ..not here.
Alan Modra [Mon, 13 Jan 2020 09:06:13 +0000 (19:36 +1030)]
PR25362, memory leak in nm
PR 25362
* nm.c (display_rel_file): Free dyn_syms.
Claudiu Zissulescu [Mon, 13 Jan 2020 09:16:47 +0000 (11:16 +0200)]
[ARC][committed] Update test matching pattern.
xxxx-xx-xx Claudiu Zissulescu <claziss@gmail.com>
* testsuite/ld-arc/relax-local-pic.d: Improve matching patterns.
Claudiu Zissulescu [Mon, 13 Jan 2020 09:16:47 +0000 (11:16 +0200)]
[ARC][committed] Code cleanup and improvements.
Code clean up and improvements when changing the cpu from command
line. Also, remove unused/old emulations.
gas/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* config/tc-arc.c (arc_select_cpu): Re-init the bfd if we change
the CPU.
* config/tc-arc.h: Add header if/defs.
* testsuite/gas/arc/pseudos.d: Improve matching pattern.
ls/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* Makefile.am: Remove earcelf_prof.c and earclinux_prof.c
emulations.
* Makefile.in: Regenerate.
* configure.tgt: Likewise.
* emulparams/arcelf_prof.sh: Remove file.
* emulparams/arclinux_prof.sh: Likewise.
opcodes/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* arc-opc.c (C_NE): Make it required.
Claudiu Zissulescu [Mon, 13 Jan 2020 09:16:47 +0000 (11:16 +0200)]
[ARC][committed] Update ARC cpu list
include/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* elf/arc-cpu.def: Update ARC cpu list.
Claudiu Zissulescu [Mon, 13 Jan 2020 09:16:47 +0000 (11:16 +0200)]
[ARC][committed] Use DWARF.sc in elf linker script templates.
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* elfarcv2.sc : Allow interrupt vector table to be located at an
arbitrary address. Use DWARF.sc file.
* elfarc.sc: Use DWARF.sc file.
Claudiu Zissulescu [Mon, 13 Jan 2020 08:21:30 +0000 (10:21 +0200)]
[ARC] [COMMITTED] Change ACCL/ACCH reg name to generic.
ACCL/ACCH register names are only available for ARCv2 architecture,
leading to a confusion when disassembling for any other ARC
variants. This patch is changing the default names for ACCL/ACCH to
generic r58/r59.
2012-01-13 Claudiu Zissulescu <claziss@gmail.com>
* opcode/arc-dis.c (regnames): Correct ACCL/ACCH naming, fix typo
reserved register name.
Alan Modra [Mon, 13 Jan 2020 07:28:02 +0000 (17:58 +1030)]
asan: ns32k: wild memory write
index_offset isn't set up for "sfsr", resulting in a random offset
being used when trying to disassemble the following.
.byte 0x3e, 0xf7, 0x07, 0x00
* ns32k-dis.c (Is_gen): Use strchr, add 'f'.
(print_insn_ns32k): Adjust ioffset for 'f' index_offset.
Alan Modra [Mon, 13 Jan 2020 03:57:19 +0000 (14:27 +1030)]
ubsan: wasm32: signed integer overflow
The signed integer overflow occurred when adding one to target_count
for (i = 0; i < target_count + 1; i++)
but that's the least of the worries here. target_count was long and i
int, leading to the possibility of a loop that never ended.
So to avoid this type of vulnerability, this patch uses what I believe
to be the proper types for arguments of various wasm32 opcodes, rather
than using "long" which may change in size.
gas/
* testsuite/gas/wasm32/allinsn.d: Update expected output.
opcodes/
* wasm32-dis.c (print_insn_wasm32): Localise variables. Store
result of wasm_read_leb128 in a uint64_t and check that bits
are not lost when copying to other locals. Use uint32_t for
most locals. Use PRId64 when printing int64_t.
Alan Modra [Mon, 13 Jan 2020 00:48:36 +0000 (11:18 +1030)]
score formatting
* score-dis.c: Formatting.
* score7-dis.c: Formatting.
Alan Modra [Mon, 13 Jan 2020 00:16:55 +0000 (10:46 +1030)]
ubsan: score: left shift of negative value
* score-dis.c (print_insn_score48): Use unsigned variables for
unsigned values. Don't left shift negative values.
(print_insn_score32): Likewise.
* score7-dis.c (print_insn_score32, print_insn_score16): Likewise.
Alan Modra [Sun, 12 Jan 2020 23:40:41 +0000 (10:10 +1030)]
ubsan: alpha-vma: timeout
* vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
for "ignored" records.
Alan Modra [Sun, 12 Jan 2020 21:42:18 +0000 (08:12 +1030)]
Memory leaks and ineffective bounds checking in wasm_scan
It's always a bad idea to perform arithmetic on an unknown value read
from an object file before comparing against bounds. Code like the
following attempting to bounds check "len", a 64-bit value, isn't
effective because the pointer arithmetic ignores the high 32 bits when
compiled for a 32-bit host.
READ_LEB128 (len, p, end);
if (p + len < p || p + len > end)
goto error_return;
Instead, perform any arithmetic on known values where we don't need to
worry about overflows:
READ_LEB128 (len, p, end);
if (len > (size_t) (end - p))
goto error_return;
I'll note that this check does do things the right way:
READ_LEB128 (symcount, p, end);
/* Sanity check: each symbol has at least two bytes. */
if (symcount > payload_size / 2)
return FALSE;
"symcount * 2 > payload_size" would be wrong since the multiply could
overflow.
* wasm-module.c (wasm_scan_name_function_section): Formatting.
Delete asect name check. Move asect NULL check to wasm_object_p.
Correct bounds check of sizes against end. Replace uses of
bfd_zalloc with bfd_alloc, zeroing only necessary bytes. Use
just one bfd_release.
(wasm_scan): Don't use malloc/strdup for section names,
bfd_alloc instead. Simplify code prefixing section name.
Formatting. Don't attempt to free memory here..
(wasm_object_p): ..do so here. Formatting.
Alan Modra [Sun, 12 Jan 2020 09:46:22 +0000 (20:16 +1030)]
tic4x: sign extension using shifts
Don't do that. Especially don't use shift counts that assume the type
being shifted is 32 bits when the type is long/unsigned long. Also
reverts part of a change I made on 2019-12-11 to tic4x_print_register
that on closer inspection turns out to be unnecessary.
include/
* opcode/tic4x.h (EXTR): Delete.
(EXTRU, EXTRS, INSERTU, INSERTS): Rewrite without zero/sign
extension using shifts. Do trim INSERTU value to specified bitfield.
opcodes/
* tic4x-dis.c (tic4x_print_register): Remove dead code.
gas/
* config/tc-tic4x.c (tic4x_operands_match): Correct tic3x trap
insertion.
Alan Modra [Sat, 11 Jan 2020 02:02:11 +0000 (12:32 +1030)]
ubsan: fr30: left shift of negative value
cpu/
* fr30.cpu (f-disp9, f-disp10, f-s10, f-rel9, f-rel12): Don't
left shift signed values.
opcodes/
* fr30-ibld.c: Regenerate.
Alan Modra [Sat, 11 Jan 2020 01:53:47 +0000 (12:23 +1030)]
ubsan: xgate: left shift of negative value
* xgate-dis.c (print_insn): Don't left shift signed value.
(ripBits): Formatting, use 1u.
GDB Administrator [Mon, 13 Jan 2020 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 12 Jan 2020 20:11:07 +0000 (15:11 -0500)]
gdb: include gdb_wait.h in gdb_wait.c
When building for mingw with -Wmissing-declarations, I get:
CXX gdbsupport/gdb_wait.o
/binutils-gdb/gdb/gdbsupport/gdb_wait.c:52:1: error: no previous declaration for 'int windows_status_to_termsig(long unsigned int)' [-Wer
ror=missing-declarations]
52 | windows_status_to_termsig (unsigned long status)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Make gdb_wait.c include gdb_wait.h to fix it.
gdb/ChangeLog:
* gdbsupport/gdb_wait.c: Include gdb_wait.h.
Simon Marchi [Sun, 12 Jan 2020 17:07:30 +0000 (12:07 -0500)]
gdbserver: include linux-arm-tdesc.h in linux-arm-tdesc.c
When building with -Wmissing-declarations, I get:
CXX linux-arm-tdesc.o
/binutils-gdb/gdb/gdbserver/linux-arm-tdesc.c:29:1: error: no previous declaration for 'const target_desc* arm_linux_read_description(arm_fp_type)' [-Werror=missing-declarations]
29 | arm_linux_read_description (arm_fp_type fp_type)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/binutils-gdb/gdb/gdbserver/linux-arm-tdesc.c:49:1: error: no previous declaration for 'arm_fp_type arm_linux_get_tdesc_fp_type(const target_desc*)' [-Werror=missing-declarations]
49 | arm_linux_get_tdesc_fp_type (const target_desc *tdesc)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Include linux-arm-tdesc.h in linux-arm-tdesc.c to fix it. And because
linux-arm-tdesc.h uses the arm_fp_type, it should include arch/arm.h as
well.
gdb/gdbserver/ChangeLog:
* linux-arm-tdesc.c: Include linux-arm-tdesc.h.
* linux-arm-tdesc.h: Include arch/arm.h.
Simon Marchi [Sun, 12 Jan 2020 16:06:23 +0000 (11:06 -0500)]
gdbserver: make aarch64_write_goto_address static
This function is only used in this file, so make it static. It fixes
this error, when building with -Wmissing-declarations:
CXX linux-aarch64-low.o
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-aarch64-low.c:2642:1: error: no previous declaration for 'void aarch64_write_goto_address(CORE_ADDR, CORE_ADDR, int)' [-Werror=missing-declarations]
aarch64_write_goto_address (CORE_ADDR from, CORE_ADDR to, int size)
^~~~~~~~~~~~~~~~~~~~~~~~~~
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_write_goto_address): Make static.
Simon Marchi [Sun, 12 Jan 2020 16:06:21 +0000 (11:06 -0500)]
gdbserver: include aarch32/aarch64 header file in corresponding source file
When building gdbserver for an aarch64 host with -Wmissing-declarations,
I see:
CXX linux-aarch32-tdesc.o
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-aarch32-tdesc.c:28:1: error: no previous declaration for 'const target_desc* aarch32_linux_read_description()' [-Werror=missing-declarations]
aarch32_linux_read_description ()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-aarch32-tdesc.c:43:1: error: no previous declaration for 'bool is_aarch32_linux_description(const target_desc*)' [-Werror=missing-declarations]
is_aarch32_linux_description (const target_desc *tdesc)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
CXX linux-aarch64-tdesc.o
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-aarch64-tdesc.c:32:1: error: no previous declaration for 'const target_desc* aarch64_linux_read_description(uint64_t, bool)' [-Werror=missing-declarations]
aarch64_linux_read_description (uint64_t vq, bool pauth_p)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix it by including linux-aarch32-tdesc.h in linux-aarch32-tdesc.c and
linux-aarch64-tdesc.h in linux-aarch64-tdesc.c.
gdb/gdbserver/ChangeLog:
* linux-aarch32-tdesc.c: Include linux-aarch32-tdesc.h.
* linux-aarch64-tdesc.c: Include linux-aarch64-tdesc.h.
Pedro Alves [Sun, 12 Jan 2020 00:40:02 +0000 (00:40 +0000)]
Remove last traces of discard_all_inferiors
The multi-target patch should have removed all traces of
discard_all_inferiors, but somehow one use stayed behind along with
the definition of the function.
discard_all_inferiors is bad now because it blindly exits inferiors of
all target connections. It's best to remove it.
gdb/ChangeLog:
2020-01-12 Pedro Alves <palves@redhat.com>
* bsd-kvm.c (bsd_kvm_target::close): Call exit_inferior_silent
directly for the current inferior instead of
discard_all_inferiors.
(discard_all_inferiors): Delete.
GDB Administrator [Sun, 12 Jan 2020 00:01:17 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 4 Jan 2020 21:35:02 +0000 (14:35 -0700)]
Make TUI borders respect "set style enabled"
When adding support for styling the TUI borders, I neglected to have
this code check cli_styling. As a result, "set style enabled off"
does not affect the borders.
This patch fixes this oversight. While doing this, I found that
running gdb without an executable, enabling the TUI, and then trying
"set style enabled off" would fail with the mysterious "No registers".
The fix for this is to use deprecated_safe_get_selected_frame in
tui_source_window_base::refill.
gdb/ChangeLog
2020-01-11 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (box_win): Check cli_styling.
* tui/tui-winsource.c (tui_source_window_base::refill): Use
deprecated_safe_get_selected_frame.
Change-Id: I36acda25dd9014d994d366b4a0e8faee9d95d0f8
GDB Administrator [Sat, 11 Jan 2020 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
Tankut Baris Aktemur [Fri, 10 Jan 2020 20:06:17 +0000 (20:06 +0000)]
Switch the inferior before outputting its id in "info inferiors"
GDB uses the 'current_top_target' when displaying the description of
an inferior. This leads to same target being used for each inferior
and, in turn, yields incorrect output when the inferior has a target
that is supposed to give a specialized output. For instance, the
remote target outputs "Remote target" instead of "process XYZ" as the
description if the multi-process feature is not supported or turned
off.
E.g.: Suppose we have a native and a remote target, and the native is
the current inferior. The remote target does not support multi-process.
For "info inferiors", we would expect to see:
~~~
(gdb) i inferiors
Num Description Connection Executable
* 1 process 29060 1 (native) /a/path
2 Remote target 2 (remote ...)
~~~
but instead we get
~~~
(gdb) i inferiors
Num Description Connection Executable
* 1 process 29060 1 (native) /a/path
2 process 42000 2 (remote ...)
~~~
Similarly, if the current inferior is the remote one, we would expect
to see
~~~
(gdb) i inferiors
Num Description Connection Executable
1 process 29060 1 (native) /a/path
* 2 Remote target 2 (remote ...)
~~~
but we get
~~~
(gdb) i inferiors
Num Description Connection Executable
* 1 Remote target 1 (native) /a/path
2 Remote target 2 (remote ...)
~~~
With this patch, we switch to the inferior when outputting its
description, so that the current_top_target will be aligned to the
inferior we are displaying.
For testing, this patch expands the "info inferiors" test for the
multi-target feature. The test was checking for the output of the
info commands after setup, only when the current inferior is the last
added inferior.
This patch does the following to the testcase:
1. The "info inferiors" and "info connections" test is extracted out
from the "setup" procedure to a separate procedure.
2. The test is enriched to check the output after switching to each
inferior, not just the last one.
3. The test is performed twice; one for when the multi-process feature
is turned on, one for off.
gdb/ChangeLog:
2020-01-10 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* inferior.c (print_inferior): Switch inferior before printing it.
gdb/testsuite/ChangeLog:
2020-01-10 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdb.multi/multi-target.exp (setup): Factor out "info
connections" and "info inferiors" tests to ...
(test_info_inferiors): ... this new procedure.
(top level): Run new "info-inferiors" tests.