Commit Graph

108574 Commits

Author SHA1 Message Date
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
Tom Tromey
ca78fadba9 Use debug_prefixed_printf_cond_nofunc in index-cache
This changes index-cache.c to use debug_prefixed_printf_cond_nofunc.
As a side effect, logs are now written 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
Tom Tromey
ed670d4118 Send minsym logging to gdb_stdlog
This changes minsyms.c to send logging output to gdb_stdlog.  This is
part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:47:48 -07:00
Tom Tromey
0bc1fe382e Use gdb_stdlog for separate debug file logging
This changes the separate debug file logging code (spread across two
files) to use gdb_stdlog for its output.  This is part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:47:48 -07:00
Tom Tromey
3defe97705 Use debug_prefixed_printf_cond_nofunc in machoread
This changes machoread.c to use debug_prefixed_printf_cond_nofunc.  As
a side effect, the logs are now written to gdb_stdlog.  This is part
of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:47:48 -07:00
Tom Tromey
7fea6c34a1 Use debug_prefixed_printf_cond_nofunc in microblaze.c
This changes microblaze.c to use the standard logging macro.  As a
side effect, logs will now go to gdb_stdlog.  This is part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:47:48 -07:00
Tom Tromey
25c25f90bf Send debugging data to gdb_stdlog in mips-linux-nat.c
This changes mips-linux-nat.c to send some logging output to
gdb_stdlog, rather than stdout.  This is part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:47:48 -07:00
Tom Tromey
728ab7b643 Send arch-utils error messages to gdb_stderr
This changes arch-utils.c to send some error messages to gdb_stderr.
This is part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:40:10 -07:00
Tom Tromey
d68510ac19 Use correct stream for process record output
The process record code often emits unfiltered output.  In some cases,
this output ought to go to gdb_stderr (but see below).  In other
cases, the output is guarded by a logging variable and so ought to go
to gdb_stdlog.  This patch makes these changes.

Note that in many cases, the output to stderr is followed by a
"return -1", which is how process record indicates an error.  It seems
to me that calling error here would be preferable, because, in many
cases, that's all the caller does when it sees a -1.  However, I
haven't made this change.

This is part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:40:10 -07:00
Tom Tromey
0fed74615b Send jit.c errors to gdb_stderr
jit.c writes some error messages to gdb_stdout, but using gdb_stderr
is better.  This is part of PR gdb/7233.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
2021-12-29 10:40:10 -07:00
Tom Tromey
84b334970b Fix logging redirection bug with pager
I noticed yesterday that if gdb output is redirected to a file, the
pager will still be active.  This is irritating, because the output
isn't actually visible -- just the pager prompt.  Looking in bugzilla,
I found that this had been filed 17 years ago, as PR cli/8798.

This patch fixes the bug.  It changes the pagination code to query the
particular ui-file to see if paging is allowable.  The ui-file
implementations are changed so that only the stdout implementation and
a tee (where one sub-file is stdout) can page.

Regression tested on x86-64 Fedora 34.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=8798
2021-12-29 10:30:24 -07:00
Tom Tromey
ba0084966c Remove unusual use of core_addr_eq and core_addr_hash
gdbtypes.h uses core_addr_eq and core_addr_hash in a weird way: taking
the address of a member and then passing this (as a void*) to these
functions.

It seems better to simply inline the ordinary code here.  CORE_ADDR is
a scalar so it can be directly compared, and the identity hash
function seems safe to assume as well.

After this, core_addr_eq and core_addr_hash are unused, so this patch
removes them.
2021-12-29 10:24:05 -07:00
Lancelot SIX
003aae0762 gdb: Copy inferior properties in clone-inferior
This commit ensures that the following settings are cloned from one
inferior to the new one when processing the clone-inferior command:
  - inferior-tty
  - environment variables
  - cwd
  - args

Some of those parameters can be passed as command line arguments to GDB
(-args and -tty), so one could expect the clone-inferior to respect
those flags.  The following debugging session illustrates that:

    gdb -nx -quiet -batch \
         -ex "show args" \
         -ex "show inferior-tty" \
         -ex "clone-inferior" \
         -ex "inferior 2" \
         -ex "show args" \
         -ex "show inferior-tty" \
         -tty=/some/tty \
         -args echo foo bar
    Argument list to give program being debugged when it is started is "foo bar".
    Terminal for future runs of program being debugged is "/some/tty".
    [New inferior 2]
    Added inferior 2.
    [Switching to inferior 2 [<null>] (/bin/echo)]
    Argument list to give program being debugged when it is started is "".
    Terminal for future runs of program being debugged is "".

The other properties this commit copies on clone (i.e. CWD and the
environment variables) are included since they are related (in the sense
that they influence the runtime behavior of the program) even if they
cannot be directly set using command line switches.

There is a chance that this patch changes existing user workflow.  I
think that this change is mostly harmless.  If users want to start a new
inferior based on an existing one, they probably already propagate those
settings to the new inferior in some way.

Tested on x86_64-linux.

Change-Id: I3b1f28b662f246228b37bb24c2ea1481567b363d
2021-12-29 03:27:38 -05:00