Commit graph

108886 commits

Author SHA1 Message Date
GDB Administrator
5224aea8c2 Automatic date update in version.in 2022-01-05 00:00:18 +00:00
H.J. Lu
7131d475da ld/x86: Update -z report-relative-reloc
Use 0x%v, instead of bfd_sprintf_vma, to report relative relocations.
Change linker relative relocations report from

tmpdir/dump: R_X86_64_IRELATIVE (offset: 0x0000000000002000, info: 0x0000000000000025, addend: 0x0000000000001007) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o

to

tmpdir/dump: R_X86_64_IRELATIVE (offset: 0x2000, info: 0x25, addend: 0x1007) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o

bfd/

	* elfxx-x86.c (_bfd_x86_elf_link_report_relative_reloc): Use
	0x%v instead of bfd_sprintf_vma.

ld/

	* testsuite/ld-i386/report-reloc-1.l: Updated.
	* testsuite/ld-x86-64/report-reloc-1.l: Likewise.
2022-01-04 11:12:01 -08:00
H.J. Lu
6395a10210 ld: Improve thin archive member error message
Improve thin archive member error message with:

ld: libbar.a(bar.o): error opening thin archive member: No such file or directory

instead of

ld: libbar.a: error adding symbols: No such file or directory

	PR ld/28722
	* archive.c (_bfd_get_elt_at_filepos): Add a pointer argument
	for struct bfd_link_info.  Call linker callback when failing to
	open thin archive member.
	(_bfd_generic_get_elt_at_index): Pass NULL to
	_bfd_get_elt_at_filepos.
	(bfd_generic_openr_next_archived_file): Likewise.
	* coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Add a pointer
	argument for struct bfd_link_info and pass it to
	_bfd_get_elt_at_filepos.
	(alpha_ecoff_openr_next_archived_file): Pass NULL to
	_bfd_get_elt_at_filepos.
	(alpha_ecoff_get_elt_at_index): Likewise.
	* coff-rs6000.c (_bfd_xcoff_openr_next_archived_file): Likewise.
	* ecoff.c (ecoff_link_add_archive_symbols): Pass info to
	backend->get_elt_at_filepos.
	* elflink.c (elf_link_is_defined_archive_symbol): info to
	_bfd_get_elt_at_filepos.
	* libbfd-in.h (_bfd_get_elt_at_filepos): Add a pointer argument
	for struct bfd_link_info.
	* libbfd.h: Regenerate.
	* libecoff.h (ecoff_backend_data): Add a pointer argument for
	struct bfd_link_info to get_elt_at_filepos.
	* linker.c (_bfd_generic_link_add_archive_symbols): Pass info to
	_bfd_get_elt_at_filepos.
2022-01-04 09:51:02 -08:00
Lancelot SIX
0b1e7ee5b5 gdb/testsuite: fix inferior-clone.exp for native-extended-gdbserver
003aae0762 (gdb: Copy inferior properties
in clone-inferior) introduced a testcase that fails when testing with
the native-extended-gdbserver board:

    Running ../gdb/testsuite/gdb.base/inferior-clone.exp ...
    FAIL: gdb.base/inferior-clone.exp: inferior 2: clone-inferior
    FAIL: gdb.base/inferior-clone.exp: inferior 3: clone-inferior

The error is as follows:

    clone-inferior
    [New inferior 2]
    Added inferior 2 on connection 1 (extended-remote localhost:2346)
    (gdb) FAIL: gdb.base/inferior-clone.exp: inferior 2: clone-inferior

This fails because the testcase only expect the 'Added inferior 2' part
of the message.  The 'on connection 1 [...]' part is unexpected.

Fix by adjusting the testcase to a account for the possible trailing
part of the message.

Tested on x86_64-linux with native-extende-gdbserver and unix boards.

Change-Id: Ie3d6f04c9ffe9cab1fbda8ddf4935ee09b858c7a
2022-01-04 09:30:01 -05:00
Nick Clifton
40c01d1b3d Add ATTRIBUTE_UNUSED to load_build_id_debug_file()'s main_filename parameter. 2022-01-04 10:34:01 +00:00
Andrew Burgess
926ac872e9 gdb: don't pass nullptr to sigwait
I tried building GDB on GNU/Hurd, and ran into this warning:

  gdbsupport/scoped_ignore_signal.h:78:16: error: null argument where non-null required (argument 2) [-Werror=nonnull]

This is because in this commit:

  commit 99624310dd
  Date:   Sun Jun 27 15:13:14 2021 -0400

      gdb: fall back on sigpending + sigwait if sigtimedwait is not available

A call to sigwait was introduced that passes nullptr as the second
argument, this call is only reached if sigtimedwait is not supported.

The original patch was written for macOS, I assume on that target
passing nullptr as the second argument is fine.

On my GNU/Linux box, the man-page for sigwait doesn't mention that
nullptr is allowed for the second argument, so my assumption would be
that nullptr is not OK, and, if I change the '#ifdef
HAVE_SIGTIMEDWAIT' introduced by the above patch to '#if 0', and
rebuild on GNU/Linux, I see the same warning that I see on GNU/Hurd.

I propose that we stop passing nullptr as the second argument to
sigwait, and instead pass a valid int pointer.  The value returned in
the int can then be used in an assert.

For testing, I (locally) made the change to the #ifdef I mentioned
above, compiled GDB, and ran the usual tests, this meant I was using
sigwait instead on sigtimedwait on GNU/Linux, I saw no regressions.
2022-01-04 10:28:19 +00:00
Nick Clifton
e2c0cef94d Remove a spurious debugging message.
PR 28716
	* dwarf.c (load_build_id_debug_file): Remove spurious printf.
2022-01-04 10:26:15 +00:00
Tom de Vries
f1e044bbb6 [gdb/build] Fix build breaker in gdb/cli/cli-logging.c
Fix build breaker in gdb/cli/cli-logging.c:
...
gdb/cli/cli-logging.c: In function \
  ‘void show_logging_enabled(ui_file*, int, cmd_list_element*, const char*)’:
gdb/gdbsupport/gdb_locale.h:28:28: error: cannot convert ‘char*’ to ‘ui_file*’
   28 | # define _(String) gettext (String)
      |                    ~~~~~~~~^~~~~~~~
      |                            |
      |                            char*
gdb/cli/cli-logging.c:202:25: note: in expansion of macro ‘_’
  202 |     fprintf_unfiltered (_("on: Logging is enabled.\n"));
      |                         ^
...

Build and tested on x86_64-linux.

Fixes: 45aec4e5ed ("[gdb/cli] Improve show logging output")
2022-01-04 10:24:36 +01:00
Jan Beulich
125ff8197d x86/Intel: correct VFPCLASSP{S,D} handling when displacement is present
fits_in_disp8() can be called before ambiguous operands get resolved
or rejected (in process_suffix()), which requires that i.memshift be
non-negative to avoid an internal error. This case wasn't covered by
6c0946d0d2 ("x86: correct VFPCLASSP{S,D} operand size handling").
2022-01-04 10:05:53 +01:00
Jan Beulich
5ed4d49d10 gas: rework handling of backslashes in quoted symbol names
Strange effects can result from the present handling, e.g.:

.if 1
"backslash\\":
.endif

yields first (correctly) "missing closing `"'" but then also "invalid
character '\' in mnemonic" and further "end of file inside conditional".
Symbols names ending in \ are in principle not expressable with that
scheme.

Instead of recording whether a backslash was seen, inspect the
subsequent character right away. Only accept \\ (meaning a single
backslash in the resulting symbol name) and \" (meaning an embedded
double quote in the resulting symbol name) for now, warning about any
other combination.

While perhaps not necessary immediately, also permit concatenated
strings to form a symbol name. This may become useful if going forward
we would want to support \<octal> or \x<hex> sequences, where closing
and re-opening quotes can be useful to delimit such sequences.

The ELF "Multibyte symbol names" test gets switched away from using
.set, as that would now also mean excluding nios2 and pru. By using
.equiv instead, even the existing #notarget can be dropped. (For h8300
the .section directive additionally needs attributes specified, to avoid
a target specific warning.)
2022-01-04 10:05:17 +01:00
GDB Administrator
79541a6d92 Automatic date update in version.in 2022-01-04 00:00:20 +00:00
Tom de Vries
45aec4e5ed [gdb/cli] Improve show logging output
Before commit 3b6acaee89 "Update more calls to add_prefix_cmd" we had the
following output for "show logging":
...
$ gdb -q -batch -ex "set trace-commands on" \
    -ex "set logging off" \
    -ex "show logging" \
    -ex "set logging on" \
    -ex "show logging"
+set logging off
+show logging
Future logs will be written to gdb.txt.
Logs will be appended to the log file.
Output will be logged and displayed.
Debug output will be logged and displayed.
+set logging on
+show logging
Currently logging to "gdb.txt".
Logs will be appended to the log file.
Output will be logged and displayed.
Debug output will be logged and displayed.
...

After that commit we have instead:
...
+set logging off
+show logging
debugredirect:  The logging output mode is off.
file:  The current logfile is "gdb.txt".
overwrite:  Whether logging overwrites or appends to the log file is off.
redirect:  The logging output mode is off.
+set logging on
+show logging
debugredirect:  The logging output mode is off.
file:  The current logfile is "gdb.txt".
overwrite:  Whether logging overwrites or appends to the log file is off.
redirect:  The logging output mode is off.
...
which gives less clear output for some subcommands.

OTOH, it's explicit about whether boolean values are on or off.

The new text seems to have been chosen to match the set/show help texts:
...
(gdb) help show logging
Show logging options.

List of show logging subcommands:

show logging debugredirect -- Show the logging debug output mode.
show logging file -- Show the current logfile.
show logging overwrite -- \
  Show whether logging overwrites or appends to the log file.
show logging redirect -- Show the logging output mode.
...

Make the show logging messages more clear, while still keep the boolean
values explicit, such that we have:
...
$ ./gdb.sh -q -batch -ex "show logging"
logging debugredirect:  off: \
  Debug output will go to both the screen and the log file.
logging enabled:  off: Logging is disabled.
logging file:  The current logfile is "gdb.txt".
logging overwrite:  off: Logging appends to the log file.
logging redirect:  off: Output will go to both the screen and the log file.
...

Tested on x86_64-linux.
2022-01-03 23:59:30 +01:00
Tom Tromey
23bb7876f0 Fix use of 'printf' in gdbtypes.c
An earlier patch of mine, commit 64b7cc50 ("Remove
gdb_print_host_address") inadvertently changed a function in
gdbtypes.c to use printf rather than printf_filtered.  This patch
fixes the problem.
2022-01-03 11:04:01 -07:00
Tom Tromey
b896e87d76 Fix regression in page-logging.exp
Simon and Tom pointed out that page-logging.exp failed on their
machines.  Tom tracked this down to the "width" setting.  Since
there's no need in the test to change the width, it seems simplest to
remove the setting.  I confirmed that the test still fails if the fix
is backed out, ensuring that the test is still testing what it
purports to.
2022-01-03 09:06:01 -07:00
Tom Tromey
4d603089c8 Small indentation fix in eval.c
I noticed that the AdaCore tree had a small divergence in eval.c -- it
had a fix for an indentation problem in binop_promote.  I'm checking
in this small fix as obvious.
2022-01-03 07:55:20 -07:00
Tom de Vries
b19f4f6178 [gdb/testsuite] Handle for loop initial decl with gcc 4.8.5
When running test-case gdb.threads/schedlock-thread-exit.exp on a system with
system compiler gcc 4.8.5, I run into:
...
src/gdb/testsuite/gdb.threads/schedlock-thread-exit.c:33:3: error: \
  'for' loop initial declarations are only allowed in C99 mode
...

Fix this by:
- using -std=c99, or
- using -std=gnu99, in case that's required, or
- in the case of the jit test-cases, rewriting the for loops.

Tested on x86_64-linux, both with gcc 4.8.5 and gcc 7.5.0.
2022-01-03 15:36:36 +01:00
GDB Administrator
1eeb031630 Automatic date update in version.in 2022-01-03 00:00:20 +00:00
Tom Tromey
5046fddb3a Update copying.awk for _initialize declaration patch
Commit 6c265988 ("gdb: add back declarations for _initialize
functions") modified copying.c, but not copying.awk.  This patch
updates copying.awk to backport the appropriate fix.  This way, if
copying.awk is run again, it will create the correct output.

I'm checking this in as obvious.
2022-01-02 12:47:19 -07:00
Tom Tromey
d365c1c51c Use filtered output in print_i387_ext
print_i387_ext mostly uses filtered output, but one call in the middle
of the function uses the _unfiltered form.  This patch fixes this
call.  I'm checking this in as obvious.
2022-01-02 10:40:35 -07:00
Alan Modra
a2c5833233 Update year range in copyright notice of binutils files
The result of running etc/update-copyright.py --this-year, fixing all
the files whose mode is changed by the script, plus a build with
--enable-maintainer-mode --enable-cgen-maint=yes, then checking
out */po/*.pot which we don't update frequently.

The copy of cgen was with commit d1dd5fcc38ead reverted as that commit
breaks building of bfp opcodes files.
2022-01-02 12:04:28 +10:30
GDB Administrator
8b91f9ce09 Automatic date update in version.in 2022-01-02 00:00:18 +00:00
Mike Frysinger
baff9aa273 gdb: copyright: fix a few comment typos 2022-01-01 13:48:25 -05:00
Mike Frysinger
03b46de590 sim: ppc: drop natural types
These are almost entirely unused.  For the very few places using them,
replace with explicit signed types.  This matches what was done in the
common sim code.
2022-01-01 13:31:34 -05:00
Mike Frysinger
d3eb0aa287 sim: mips: clean up bad style/whitespace
This doesn't fix all the problems, but grabs a bunch of the more
obvious ones.
2022-01-01 13:26:34 -05:00
Mike Frysinger
efd811591c sim: tweak copyright lines for gnulib update-copyright
The regex it uses does not like so many leading spaces which causes
it to think the files lack copyright.  Trim them down so the script
can find & update them accordingly.
2022-01-01 13:14:01 -05:00
Mike Frysinger
6fb89fa135 gdb: update sim mips testsuite copyright exemption
The sim testsuite was reorganized last year, so update the path.
2022-01-01 13:04:49 -05:00
Mike Frysinger
1d5269c994 unify 64-bit bfd checks
Move the 64-bit bfd logic out of bfd/configure.ac and into bfd64.m4
under config so it can be shared between all the other subdirs.

This replaces want64 with enable_64_bit_bfd which was already being
declared, but not used directly.
2022-01-01 12:49:07 -05:00
Joel Brobecker
3cc8ed6aae Update Copyright year in gdb/testsuite/gdb.arch/powerpc-power10.exp
This commit updates the copyright year range in the script
gdb/testsuite/gdb.arch/powerpc-power10.exp. The update was
performed by running gdb/copyright.py again, to make sure
that the copyright year range will be automatically updated
in years forward.
2022-01-01 19:13:23 +04:00
Joel Brobecker
70f4fcd688 Fix copyright header in gdb/testsuite/gdb.arch/powerpc-power10.exp
The copyright year and holder line is slight malformed, missing
a space after a comma, and this is sufficient for gdb's
copyright.py script to miss this file during its automated
copyright year update.

This commit fixes this.
2022-01-01 19:13:23 +04:00
Joel Brobecker
936623f4e0 gdb/copyright.py: Add update-netbsd.sh to MULTIPLE_COPYRIGHT_HEADERS
Add gdb/syscalls/update-netbsd.sh to the reminder printed
at the end of the execution listing all the files where
a manual update of the copyright header is needed. This
scripts contains some inline code which includes a copyright
header.
2022-01-01 19:13:23 +04:00
Joel Brobecker
2da76ea456 Manual copyright year update of various GDB files
This commit updates the copyright year in some files where
we have a copyright year outside of the copyright year,
and thus are not included in gdb's copyright.py script.
2022-01-01 19:13:23 +04:00
Joel Brobecker
4a94e36819 Automatic Copyright Year update after running gdb/copyright.py
This commit brings all the changes made by running gdb/copyright.py
as per GDB's Start of New Year Procedure.

For the avoidance of doubt, all changes in this commits were
performed by the script.
2022-01-01 19:13:23 +04:00
Joel Brobecker
dd10f20452 Update Copyright Year in gdb, gdbserver and gdbreplay version output
This commit changes the copyright year printed by gdb, gdbserver
and gdbreplay when printing the tool's version.
2022-01-01 19:13:22 +04:00
Alan Modra
b685de86cc ubsan: next_char_of_string signed integer overflow
Squash another totally useless fuzz report that I should have ignored.

	* read.c (next_char_of_string): Avoid integer overflow.
2022-01-01 14:22:13 +10:30
Alan Modra
fcec5debef ubsan: bfd_mach_o_build_commands shift exponent 64 is too large
* mach-o.c (bfd_mach_o_read_section_32): Limit alignment further.
	(bfd_mach_o_read_section_64): Likewise.
2022-01-01 14:22:13 +10:30
Alan Modra
487b0ff02d ubsan: signed integer multiply overflow
9223371018427387904 * 2 cannot be represented in type 'long', yes, but
we don't care.

	* expr.c (expr): Avoid signed overflow.
2022-01-01 14:22:11 +10:30
Alan Modra
ad3d14c47e asan: Null-dereference in _bfd_xcoff_copy_private_bfd_data
sec->output_section will be NULL when objcopy removes sections.

	* coff-rs6000.c (_bfd_xcoff_copy_private_bfd_data): Protect against
	objcopy removing sections.
2022-01-01 14:22:11 +10:30
Alan Modra
aebb3d543d ubsan: integer overflow in section filepos subtraction
* elf.c (assign_file_positions_for_non_load_sections): Avoid
	signed integer overflow.
2022-01-01 14:22:09 +10:30
Alan Modra
bb67763979 Remove unnecessary ELF_MINPAGESIZE defines
The idea of this patch is to make it easy to see which targets (just
sparc) have ELF_MINPAGESIZE != ELF_COMMONPAGESIZE.

	* elf32-arm.c (ELF_MINPAGESIZE): Don't define.
	* elf32-metag.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elf64-x86-64.c: Likewise.  Also don't redefine a bunch of other
	macros for l1om elf64-target.h use that are unchanged from default.
2022-01-01 14:22:09 +10:30
H.J. Lu
f01e6568a8 ld-x86-64: Pass options to linker with "-Wl,"
* testsuite/ld-x86-64/x86-64.exp: Pass options to linker with
	"-Wl,".
2021-12-31 19:42:44 -08:00
GDB Administrator
63f8d12d6c Automatic date update in version.in 2022-01-01 00:00:12 +00:00
Tom Tromey
e0037ba912 Do not call reinitialize_more_filter from avr_io_reg_read_command
avr_io_reg_read_command is an ordinary gdb command, and so should not
be calling reinitialize_more_filter.  This patch removes it.  I'm
checking this in as obvious.  Tested by rebuilding.
2021-12-31 13:29:46 -07:00
H.J. Lu
a321de3f5c x86: Define check_relocs_failed in elfxx-x86.h
* elf32-i386.c (check_relocs_failed): Moved to ...
	* elfxx-x86.h (check_relocs_failed): Here.  New.
	* elf64-x86-64.c (check_relocs_failed): Removed.
2021-12-31 07:16:32 -08:00
H.J. Lu
831083d300 Define X86_PCREL_TYPE_P/X86_SIZE_TYPE_P in elfxx-x86.h
* elf32-i386.c: Don't include "elf/i386.h".
	(X86_PCREL_TYPE_P): Removed.
	(X86_SIZE_TYPE_P): Likewise.
	(elf_i386_check_relocs): Pass false to NEED_DYNAMIC_RELOCATION_P.
	(elf_i386_relocate_section): Pass false to
	GENERATE_DYNAMIC_RELOCATION_P and COPY_INPUT_RELOC_P.
	* elf64-x86-64.c: Don't include "elf/x86-64.h".
	(X86_PCREL_TYPE_P): Removed.
	(X86_SIZE_TYPE_P): Likewise.
	(elf_x86_64_check_relocs): Pass true to NEED_DYNAMIC_RELOCATION_P
	and X86_PCREL_TYPE_P.
	(elf_x86_64_relocate_section): Pass true to X86_PCREL_TYPE_P,
	X86_SIZE_TYPE_P, GENERATE_DYNAMIC_RELOCATION_P and
	COPY_INPUT_RELOC_P.
	* elfxx-x86.c: Don't include "elf/i386.h" nor "elf/x86-64.h".
	* elfxx-x86.h (X86_64_PCREL_TYPE_P): New.
	(I386_PCREL_TYPE_P): Likewise.
	(X86_PCREL_TYPE_P): Likewise.
	(X86_64_SIZE_TYPE_P): Likewise.
	(I386_SIZE_TYPE_P): Likewise.
	(X86_SIZE_TYPE_P): Likewise.
	(NEED_DYNAMIC_RELOCATION_P): Add IS_X86_64 and pass it to
	X86_PCREL_TYPE_P.
	(COPY_INPUT_RELOC_P): Likewise.
	(GENERATE_DYNAMIC_RELOCATION_P): Add IS_X86_64, pass it to
	X86_PCREL_TYPE_P and X86_SIZE_TYPE_P.
2021-12-31 07:02:41 -08:00
Tamar Christina
e5b10c4079 ld: fix coff PE SEH
COFF_WITH_pex64 and COFF_WITH_peAArch64 can't be true at the same time.
That means that two conditionals that control the sorting of the .pdata section
became a falsum.

The testsuite doesn't catch this because the linker does the sorting and to link
you require library support from the unwinder so we can't test from binutils in
isolation.

bfd/ChangeLog:

2021-12-31  Tamar Christina  <tamar.christina@arm.com>

	PR ld/28682
	* peXXigen.c: Fix conditional.
2021-12-31 11:42:07 +00:00
GDB Administrator
2e91308fb4 Automatic date update in version.in 2021-12-31 00:00:14 +00:00
GDB Administrator
b4edb38e82 Automatic date update in version.in 2021-12-30 00:00:15 +00:00
Tom Tromey
3de0d96078 Use filtered output in show callbacks
"show" command callbacks, like most ordinary gdb commands, should use
filtered output.  I found a few that did not, so this patch changes
them to use the filtered form.
2021-12-29 11:08:14 -07:00
Tom Tromey
7514a66128 Consistently Use ui_file parameter to show callbacks
I happened to notice that one "show" callback was printing to
gdb_stdout rather than to the passed-in ui_file parameter.  I went
through all such callbacks and fixed them to consistently use the
ui_file.

Regression tested on x86-64 Fedora 34.
2021-12-29 11:08:04 -07:00
Tom Tromey
de4686ffaf Use gdb_stdlog for MI debugging
When MI debugging is enabled, the logging output should be sent to
gdb_stdlog.  This is part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:54:29 -07:00