binutils-gdb.git
2 years agoAutomatic date update in version.in
GDB Administrator [Fri, 5 Nov 2021 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

2 years agogdb: introduce "set index-cache enabled", deprecate "set index-cache on/off"
Simon Marchi [Thu, 4 Nov 2021 19:31:28 +0000 (15:31 -0400)]
gdb: introduce "set index-cache enabled", deprecate "set index-cache on/off"

The "set index-cache" command is used at the same time as a prefix
command (prefix for "set index-cache directory", for example), and a
boolean setting for turning the index-cache on and off.  Even though I
did introduce that, I now don't think it's a good idea to do something
non-standard like this.

First, there's no dedicated CLI command to show whether the index-cache
is enabled, so it has to be custom output in the "show index-cache
handler".  Also, it means there's no good way a MI frontend can find out
if the index-cache is enabled.  "-gdb-show index-cache" doesn't show it
in the MI output record:

    (gdb) interpreter-exec mi "-gdb-show index-cache"
    ~"\n"
    ~"The index cache is currently disabled.\n"
    ^done,showlist={option={name="directory",value="/home/simark/.cache/gdb"}}

Fix this by introducing "set/show index-cache enabled on/off", regular
boolean setting commands.  Keep commands "set index-cache on" and "set
index-cache off" as deprecated aliases of "set index-cache enabled",
with respectively the default arguments "on" and "off".

Update tests using "set index-cache on/off" to use the new command.
Update the regexps in gdb.base/maint.exp to figure out whether the
index-cache is enabled or not.  Update the doc to mention the new
commands.

Change-Id: I7d5aaaf7fd22bf47bd03e0023ef4fbb4023b37b3

2 years agogdb: pass/return setting setter/getter scalar values by value
Simon Marchi [Sun, 31 Oct 2021 16:02:03 +0000 (12:02 -0400)]
gdb: pass/return setting setter/getter scalar values by value

The getter and setter in struct setting always receive and return values
by const reference.  This is not necessary for scalar values (like bool
and int), but more importantly it makes it a bit annoying to write a
getter, you have to use a scratch static variable or something similar
that you can refer to:

  const bool &
  my_getter ()
  {
    static bool value;
    value = function_returning_bool ();
    return value;
  }

Change the getter and setter function signatures to receive and return
value by value instead of by reference, when the underlying data type is
scalar.  This means that string-based settings will still use
references, but all others will be by value.  The getter above would
then be re-written as:

  bool
  my_getter ()
  {
    return function_returning_bool ();
  }

This is useful for a patch later in this series that defines a boolean
setting with a getter and a setter.

Change-Id: Ieca3a2419fcdb75a6f75948b2c920b548a0af0fd

2 years agogdb: remove command_class enum class_deprecated
Simon Marchi [Sun, 31 Oct 2021 14:52:36 +0000 (10:52 -0400)]
gdb: remove command_class enum class_deprecated

The class_deprecated enumerator isn't assigned anywhere, so remove it.
Commands that are deprecated have cmd_list_element::cmd_deprecated set
instead.

Change-Id: Ib35e540915c52aa65f13bfe9b8e4e22e6007903c

2 years agogdb: remove unnecessary cmd_list_element::aliases nullptr checks
Simon Marchi [Sun, 31 Oct 2021 14:58:47 +0000 (10:58 -0400)]
gdb: remove unnecessary cmd_list_element::aliases nullptr checks

Remove two unnecessary nullptr checks.  If aliases is nullptr, then the
for loops will simply be skipped.

Change-Id: I9132063bb17798391f8d019af305383fa8e0229f

2 years agogdbserver: re-generate configure
Simon Marchi [Thu, 4 Nov 2021 18:13:30 +0000 (14:13 -0400)]
gdbserver: re-generate configure

I get some diffs when running autoconf in gdbserver, probably leftovers
from commit 5dfe4bfcb969 ("Fix format_pieces selftest on Windows").
Re-generate configure in that directory.

Change-Id: Icdc9906af95fbaf1047a579914b2983f8ec5db08

2 years agoRevert "bfd: Always check sections with the corrupt size"
H.J. Lu [Thu, 4 Nov 2021 15:07:09 +0000 (08:07 -0700)]
Revert "bfd: Always check sections with the corrupt size"

This reverts commit e0f7ea91436dd308a094c4c101fd4169e8245a91.

2 years agobfd: Always check sections with the corrupt size
H.J. Lu [Thu, 4 Nov 2021 13:27:16 +0000 (06:27 -0700)]
bfd: Always check sections with the corrupt size

Always check sections with the corrupt size for non-MMO files.  Skip MMO
files for compress_status == COMPRESS_SECTION_NONE since MMO has special
handling for COMPRESS_SECTION_NONE.

PR binutils/28530
* compress.c (bfd_get_full_section_contents): Always check
sections with the corrupt size.

2 years agoRISC-V: Clarify the behavior of .option rvc or norvc.
Nelson Chu [Thu, 4 Nov 2021 06:31:48 +0000 (14:31 +0800)]
RISC-V: Clarify the behavior of .option rvc or norvc.

Add/Remove the rvc extension to/from the riscv_subsets once the
.option rvc/norvc is set.  So that we don't need to always check
the riscv_opts.rvc in the riscv_subset_supports, just call the
riscv_lookup_subset to search the subset list is enough.

Besides, we will need to dump the instructions according to the
elf architecture attributes.  That means the dis-assembler needs
to parse the architecture string from the elf attribute before
dumping any instructions, and also needs to recognized the
INSN_CLASS* classes from riscv_opcodes.  Therefore, I suppose
some functions will need to be moved from gas/config/tc-riscv.c
to bfd/elfxx-riscv.c, including riscv_multi_subset_supports and
riscv_subset_supports.  This is one of the reasons why we need
this patch.

This patch passes the gcc/binutils regressions of rv32emc-elf,
rv32i-elf, rv64gc-elf and rv64gc-linux toolchains.

bfd/
* elfxx-riscv.c (riscv_remove_subset): Remove the extension
from the subset list.
(riscv_update_subset): Add/Remove an extension to/from the
subset list.  This is used for the .option rvc or norvc.
* elfxx-riscv.h: Added the extern bool riscv_update_subset.
gas/
* config/tc-riscv.c (riscv_set_options): Removed the unused
rve flag.
(riscv_opts): Likewise.
(riscv_set_rve): Removed.
(riscv_subset_supports): Removed the riscv_opts.rvc check.
(riscv_set_arch): Don't need to call riscv_set_rve.
(reg_lookup_internal): Call riscv_subset_supports to check
whether the rve is supported.
(s_riscv_option): Add/Remove the rvc extension to/from the
subset list once the .option rvc/norvc is set.

2 years agosim: mips: fix missing prototype in multi-run generation
Mike Frysinger [Thu, 4 Nov 2021 03:44:19 +0000 (23:44 -0400)]
sim: mips: fix missing prototype in multi-run generation

The multi-run logic for mips involves a bit of codegen and rewriting
of files to include per-architecture prefixes.  That can result in
files with missing prototypes which cause compiler errors.  In the
case of mips-sde-elf targets, we have:
$srcdir/m16run.c -> $builddir/m16mips64r2_run.c
  sim_engine_run -> m16mips64r2_engine_run
$srcdir/micromipsrun.c -> micromipsmicromips_run.c
  sim_engine_run -> micromips64micromips_engine_run

micromipsmicromips_run.c:80:1: error: no previous prototype for 'micromips64micromips_engine_run' [-Werror=missing-prototypes]
   80 | micromips64micromips_engine_run (SIM_DESC sd, int next_cpu_nr, int nr_cpus,

We generate headers for those prototypes in the configure script,
but only include them in the generated multi-run.c file.  Update the
rewrite logic to turn the sim-engine.h include into the relevant
generated engine include so these files also have their prototypes.
$srcdir/m16run.c -> $builddir/m16mips64r2_run.c
  sim-engine.h -> m16mips64r2_engine.h
$srcdir/micromipsrun.c -> micromipsmicromips_run.c
  sim-engine.h -> micromips64micromips_engine.h

2 years agoPR28540, segmentation fault on NULL byte_get
Alan Modra [Thu, 4 Nov 2021 03:41:02 +0000 (14:11 +1030)]
PR28540, segmentation fault on NULL byte_get

PR 28540
* objdump.c (dump_bfd): Don't attempt load_separate_debug_files
when byte_get is NULL.

2 years agoAutomatic date update in version.in
GDB Administrator [Thu, 4 Nov 2021 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

2 years agosim: ppc: inline common sim-fpu.c logic
Mike Frysinger [Wed, 3 Nov 2021 07:13:02 +0000 (03:13 -0400)]
sim: ppc: inline common sim-fpu.c logic

We will never bother building w/out a ../common/ sim directory,
so drop ancient logic supporting that method.

2 years agosim: ppc: switch to common builds for callback objects
Mike Frysinger [Wed, 3 Nov 2021 07:08:53 +0000 (03:08 -0400)]
sim: ppc: switch to common builds for callback objects

We don't need to build this anymore ourselves since the common build
includes it and produces the same object code.  We also need to pull
in the split constant modules after the refactoring and pulling them
out of nltvals.def & targ-map.o.  This doesn't matter for the sim
directly, but does for gdb and other users of libsim.

We also delete some conditional source tree logic since we already
require this be the "new" combined tree with a ../common/ dir.  This
has been the case for decades at this point.

2 years agogdb: fix gnu-nat build
Simon Marchi [Wed, 3 Nov 2021 19:09:19 +0000 (15:09 -0400)]
gdb: fix gnu-nat build

When building gnu-nat.c, we get:

      CXX    gnu-nat.o
    gnu-nat.c: In member function 'virtual void gnu_nat_target::create_inferior(const char*, const string&, char**, int)':
    gnu-nat.c:2117:13: error: 'struct inf' has no member named 'target_is_pushed'
     2117 |   if (!inf->target_is_pushed (this))
          |             ^~~~~~~~~~~~~~~~
    gnu-nat.c:2118:10: error: 'struct inf' has no member named 'push_target'
     2118 |     inf->push_target (this);
          |          ^~~~~~~~~~~

This is because of a confusion between the generic `struct inferior`
variable and the gnu-nat-specific `struct inf` variable.  Fix by
referring to `inferior`, not `inf`.

Adjust the comment on top of `struct inf` to clarify the purpose of that
type.

Co-Authored-By: Andrea Monaco <andrea.monaco@autistici.org>
Change-Id: I2fe2f7f6ef61a38d79860fd262b08835c963fc77

2 years agogdb/testsuite: set ASAN_OPTIONS=detect_leaks=0 while running tests
Simon Marchi [Wed, 3 Nov 2021 14:46:56 +0000 (10:46 -0400)]
gdb/testsuite: set ASAN_OPTIONS=detect_leaks=0 while running tests

We see some additional failures when running the testsuite against a GDB
compiled with ASan, compared to a GDB compiled without ASan.  Some of
them are caused by the memory leak report shown by the GDB process when
it exits, and the fact that it makes it exit with a non-zero exit code.

I generally try to remember to set ASAN_OPTIONS=detect_leaks=0 in my
environment when running the tests, but I don't always do it.  I think
it would be nice if the testsuite did it.  I don't see any use to have
leak detection when running the tests.  That is, unless we ever have a
test that ensures GDB doesn't leak memory, which isn't going to happen
any time soon.

Here are some tests I found that were affected by this:

    gdb.base/batch-exit-status.exp
    gdb.base/many-headers.exp
    gdb.base/quit.exp
    gdb.base/with-mf.exp
    gdb.dwarf2/gdb-add-index.exp
    gdb.dwarf2/gdb-add-index-symlink.exp
    gdb.dwarf2/imported-unit-runto-main.exp

Change-Id: I784c7df8a13979eb96587f735c1d33ba2cc6e0ca

2 years agoUse section name in warnings in display_debug_loc
Tom Tromey [Wed, 3 Nov 2021 13:33:24 +0000 (07:33 -0600)]
Use section name in warnings in display_debug_loc

While looking at an apparently malformed executable with
"readelf --debug-dump=loc", I got this warning:

    readelf: ./main: Warning: There is a hole [0x89 - 0x95] in .debug_loc section.

However, the executable only has a .debug_loclists section.

This patch fixes the warning messages in display_debug_loc to use the
name of the section that is being processed.

binutils/ChangeLog
2021-11-03  Tom Tromey  <tromey@adacore.com>

* dwarf.c (display_debug_loc): Use section name in warnings.

2 years ago[AArch64] Make gdbserver register set selection dynamic
Luis Machado [Fri, 29 Oct 2021 17:54:36 +0000 (14:54 -0300)]
[AArch64] Make gdbserver register set selection dynamic

The current register set selection mechanism for AArch64 is static, based
on a pre-populated array of register sets.

This means that we might potentially probe register sets that are not
available. This is OK if the kernel errors out during ptrace, but probing the
tag_ctl register, for example, does not result in a ptrace error if the kernel
supports the tagged address ABI but not MTE (PR 28355).

Making the register set selection dynamic, based on feature checks, solves
this and simplifies the code a bit. It allows us to list all of the register
sets only once, and pick and choose based on HWCAP/HWCAP2 or other properties.

I plan to backport this fix to GDB 11 as well.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28355

2 years agoFix LD_PRELOAD=/usr/lib64/libasan.so.6 gdb
Jan Kratochvil [Wed, 3 Nov 2021 10:29:18 +0000 (11:29 +0100)]
Fix LD_PRELOAD=/usr/lib64/libasan.so.6 gdb

Currently for a binary compiled normally (without -fsanitize=address) but with
LD_PRELOAD of ASAN one gets:

$ ASAN_OPTIONS=detect_leaks=0:alloc_dealloc_mismatch=1:abort_on_error=1:fast_unwind_on_malloc=0 LD_PRELOAD=/usr/lib64/libasan.so.6 gdb
=================================================================
==1909567==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) on 0x602000001570
    #0 0x7f1c98e5efa7 in operator delete[](void*) (/usr/lib64/libasan.so.6+0xb0fa7)
...
0x602000001570 is located 0 bytes inside of 2-byte region [0x602000001570,0x602000001572)
allocated by thread T0 here:
    #0 0x7f1c98e5cd1f in __interceptor_malloc (/usr/lib64/libasan.so.6+0xaed1f)
    #1 0x557ee4a42e81 in operator new(unsigned long) (/usr/libexec/gdb+0x74ce81)
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/usr/lib64/libasan.so.6+0xb0fa7) in operator delete[](void*)
==1909567==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==1909567==ABORTING

Despite the code called properly operator new[] and operator delete[].
But GDB's new-op.cc provides its own operator new[] which gets translated into
malloc() (which gets recogized as operatore new(size_t)) but as it does not
translate also operators delete[] Address Sanitizer gets confused.

The question is how many variants of the delete operator need to be provided.
There could be 14 operators new but there are only 4, GDB uses 3 of them.
There could be 16 operators delete but there are only 6, GDB uses 2 of them.
It depends on libraries and compiler which of the operators will get used.
Currently being used:
                 U operator new[](unsigned long)
                 U operator new(unsigned long)
                 U operator new(unsigned long, std::nothrow_t const&)
                 U operator delete[](void*)
                 U operator delete(void*, unsigned long)

Tested on x86_64-linux.

2 years agoasan: dlltool buffer overflow: embedded NUL in string
Alan Modra [Wed, 3 Nov 2021 05:51:42 +0000 (16:21 +1030)]
asan: dlltool buffer overflow: embedded NUL in string

yyleng gives the pattern length, xstrdup just copies up to the NUL.
So it is quite possible writing at an index of yyleng-2 overflows
the xstrdup allocated string buffer.  xmemdup quite handily avoids
this problem, even writing the terminating NUL over the trailing
quote.  Use it in ldlex.l too where we'd already had a report of this
problem and fixed it by hand, and to implement xmemdup0 in gas.

binutils/
* deflex.l (single and double quote strings): Use xmemdup.
gas/
* as.h (xmemdup0): Use xmemdup.
ld/
PR 20906
* ldlex.l (double quote string): Use xmemdup.

2 years agosim: mloop: mark a few conditionally used funcs as unused
Mike Frysinger [Wed, 3 Nov 2021 05:17:17 +0000 (01:17 -0400)]
sim: mloop: mark a few conditionally used funcs as unused

These are marked inline, so building w/gcc at higher optimization
levels will automatically discard them.  But building with -O0 will
trigger unused function warnings, so fix that.

The common before/after cover functions in the common mloop generator
are not used by all architecture ports.  Doesn't seem to be a hard
requirement, so marking them optional (i.e. unused) is fine.

The cris execute function is conditionally used depending on the
fast-build mode settings, so mark it unused too.

2 years agoasan: assert (addr_ranges) <= (start)
Alan Modra [Wed, 3 Nov 2021 04:20:18 +0000 (14:50 +1030)]
asan: assert (addr_ranges) <= (start)

That assert would be more obvious if it were reported as
"addr_ranges <= end_ranges".  Fix that by using the obvious variable
in the final loop.  Stop the assertion by using a signed comparison:
It's possible for the rounding up of the arange pointer to exceed the
end of the block when the block size is fuzzed.

* dwarf.c (display_debug_aranges): Use "end_ranges" in loop
displaying ranges rather that "start".  Simplify rounding up
to 2*address_size boundary.  Use signed comparison in loop.

2 years agosim: hoist cgen mloop rules up to common builds
Mike Frysinger [Sun, 31 Oct 2021 07:29:36 +0000 (03:29 -0400)]
sim: hoist cgen mloop rules up to common builds

These rules don't depend on the target compiler settings, so hoist
the build logic up to the common builds for better parallelization.

We have to extend the genmloop.sh logic a bit to allow outputting
to a subdir since it always assumed cwd was the right place.

We leave the cgen maintainer rules in the subdirs for now as they
aren't normally run, and they rely on cgen logic that has not yet
been generalized.

2 years agosim: hoist mn10300 & v850 igen rules up to common builds
Mike Frysinger [Sun, 31 Oct 2021 06:47:13 +0000 (02:47 -0400)]
sim: hoist mn10300 & v850 igen rules up to common builds

These rules don't depend on the target compiler settings, so hoist
the build logic up to the common builds for better parallelization.

We leave the mips rules in place as they depend on complicated
arch-specific configure logic that needs to be untangled first.

2 years agosim: hoist gencode & opc2c build rules up to common builds
Mike Frysinger [Sun, 31 Oct 2021 06:08:38 +0000 (02:08 -0400)]
sim: hoist gencode & opc2c build rules up to common builds

These rules don't depend on the target compiler settings, so hoist
the build logic up to the common builds for better parallelization.

2 years agoopcodes: d10v: simplify header includes
Mike Frysinger [Sun, 31 Oct 2021 09:11:34 +0000 (05:11 -0400)]
opcodes: d10v: simplify header includes

This file doesn't use anything from bfd (sysdep.h), so drop that
include.  This avoids an implicit dependency on the generated
config.h which can be problematic for build-time tools.

Also swap stdio.h for stddef.h.  This file isn't doing or using
any I/O structures, but it does need NULL.

2 years agoPR28523, ld.bfd created undefined symbols on ppc64
Alan Modra [Tue, 2 Nov 2021 08:31:06 +0000 (19:01 +1030)]
PR28523, ld.bfd created undefined symbols on ppc64

This patch removes any fake (linker created) function descriptor
symbol if its code entry symbol isn't dynamic, to ensure bogus dynamic
symbols are not created.  The change to func_desc_adjust requires that
it be run only once, which means ppc64_elf_tls_setup can't call it for
just a few selected symbols.

PR 28523
* elf64-ppc.c (func_desc_adjust): If a function entry sym is
not dynamic and has no plt entry, hide any associated fake
function descriptor symbol.
(ppc64_elf_edit): Move func_desc_adjust iteration over syms to..
(ppc64_elf_tls_setup): ..here.

2 years agoAutomatic date update in version.in
GDB Administrator [Wed, 3 Nov 2021 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

2 years ago[gdb/tdep, rs6000] Don't skip system call in skip_prologue
Tom de Vries [Tue, 2 Nov 2021 18:08:49 +0000 (19:08 +0100)]
[gdb/tdep, rs6000] Don't skip system call in skip_prologue

I ran into a case where a breakpoint on _exit never triggered, because it was
set past the end of the _exit prologue, past the end of the exit_group system
call (which does not return).

More concretely, the breakpoint was set at the last insn show here:
...
Dump of assembler code for function _exit:
   0x00007ffff7e42ea0 <+0>:     12 00 4c 3c     addis   r2,r12,18
   0x00007ffff7e42ea4 <+4>:     60 43 42 38     addi    r2,r2,17248
   0x00007ffff7e42ea8 <+8>:     00 00 00 60     nop
   0x00007ffff7e42eac <+12>:    f8 ff e1 fb     std     r31,-8(r1)
   0x00007ffff7e42eb0 <+16>:    78 1b 7f 7c     mr      r31,r3
   0x00007ffff7e42eb4 <+20>:    f0 ff c1 fb     std     r30,-16(r1)
   0x00007ffff7e42eb8 <+24>:    ea 00 00 38     li      r0,234
   0x00007ffff7e42ebc <+28>:    a0 8b 22 e9     ld      r9,-29792(r2)
   0x00007ffff7e42ec0 <+32>:    78 fb e3 7f     mr      r3,r31
   0x00007ffff7e42ec4 <+36>:    14 6a c9 7f     add     r30,r9,r13
   0x00007ffff7e42ec8 <+40>:    02 00 00 44     sc
   0x00007ffff7e42ecc <+44>:    26 00 00 7c     mfcr    r0
   0x00007ffff7e42ed0 <+48>:    00 10 09 74     andis.  r9,r0,4096
...

Fix this by treating system calls the same as branches in skip_prologue:
by default, don't skip, such that the breakpoint is set at 0x00007ffff7e42eb8
instead.

Tested on ppc64le-linux, on a power 8 machine.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28527

2 years ago[gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-cases
Tom de Vries [Tue, 2 Nov 2021 17:55:32 +0000 (18:55 +0100)]
[gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-cases

On powerpc64le-linux, with test-case gdb.arch/powerpc-addpcis.exp I run into
SIGILL:
...
(gdb) PASS: gdb.arch/powerpc-addpcis.exp: get hexadecimal valueof "$r3"
stepi^M
^M
Program terminated with signal SIGILL, Illegal instruction.^M
The program no longer exists.^M
(gdb) PASS: gdb.arch/powerpc-addpcis.exp: set r4
...
because it's a power9 insn, and I'm running on a power8 machine.

Fix this by handling the SIGILL.  Likewise in gdb.arch/powerpc-lnia.exp.

Tested on powerpc64le-linux.

2 years agogdb/sim: update my email address
Andrew Burgess [Tue, 2 Nov 2021 09:17:11 +0000 (09:17 +0000)]
gdb/sim: update my email address

gdb:

* MAINTAINERS (Global Maintainers): Update my address.
(Responsible Maintainers): Likewise.
(Write After Approval): Likewise.

sim:

* MAINTAINERS (Global Maintainers): Update my address.

2 years ago[gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie
Tom de Vries [Tue, 2 Nov 2021 08:27:48 +0000 (09:27 +0100)]
[gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie

When running test-case gdb.base/step-indirect-call-thunk.exp with target board
unix/-m32/-fPIE/-pie, I run into:
...
(gdb) stepi^M
0x5655552e      22      {                /* inc.1 */^M
(gdb) stepi^M
0x56555530      22      {                /* inc.1 */^M
(gdb) stepi^M
0x565555f7 in __x86.get_pc_thunk.ax ()^M
(gdb) FAIL: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
...

In contrast, with unix/-m32 we have instead:
...
(gdb) stepi^M
0x08048407      22      {                /* inc.1 */^M
(gdb) stepi^M
23        return x + 1;  /* inc.2 */^M
(gdb) stepi^M
0x0804840c      23        return x + 1;  /* inc.2 */^M
(gdb) stepi^M
24      }                /* inc.3 */^M
(gdb) stepi^M
0x08048410      24      }                /* inc.3 */^M
(gdb) stepi^M
0x0804848f in __x86_return_thunk ()^M
(gdb) PASS: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
...

The test-case doesn't expect to run into __x86.get_pc_thunk.ax, which is a
PIC helper function for x86_64-linux.

Fix this by insn-stepping through it.

Likewise in a few other test-cases.

Tested on x86_64-linux.

2 years agoAutomatic date update in version.in
GDB Administrator [Tue, 2 Nov 2021 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

2 years agoARM: match armeb output for unwind-pacbti-m test
Alan Modra [Sat, 30 Oct 2021 23:37:14 +0000 (10:07 +1030)]
ARM: match armeb output for unwind-pacbti-m test

* testsuite/gas/arm/unwind-pacbti-m.d: Match armeb output.

2 years ago[gdb/doc]: Updated manpages to be consistent with help
Bruno Larsen [Wed, 13 Oct 2021 12:43:13 +0000 (09:43 -0300)]
[gdb/doc]: Updated manpages to be consistent with help

Updated manpages to be consistent with help information provided by the
binary. The main changes are:

* Making all long-form options have '--', instead of a single '-';
* added most of the missing options to the manpage;
* removed the information about using '+' instead of '-', since it
  doesn't seem to be supported anymore.

This also fixes 2 upstream bugs:
* https://sourceware.org/bugzilla/show_bug.cgi?id=23965; by adding
--args to the manpage
* https://sourceware.org/bugzilla/show_bug.cgi?id=10619; by adding the
double dashes

2 years agomacho-o archive sanity checks
Alan Modra [Mon, 1 Nov 2021 08:25:19 +0000 (18:55 +1030)]
macho-o archive sanity checks

Anti-fuzzing checks.

* mach-o.c (bfd_mach_o_fat_archive_p): Sanity check entry offset
and size against file size.

2 years agoobjcopy buffer overflow
Alan Modra [Sun, 31 Oct 2021 13:50:01 +0000 (00:20 +1030)]
objcopy buffer overflow

"tocopy" in this code was an int, which when the size to be copied was
larger than MAXINT could result in tocopy being negative.  A negative
value of course is less than BUFSIZE, but when converted to
bfd_size_type is extremely large.

PR 995
* objcopy.c (copy_unknown_object): Correct calculation of "tocopy".
Use better variable types.

2 years agoarm: add armv9-a architecture to -march
Przemyslaw Wirkus [Mon, 1 Nov 2021 10:43:25 +0000 (10:43 +0000)]
arm: add armv9-a architecture to -march

Update also include:
+ New value of Tag_CPU_arch EABI attribute (22) is added.
+ Updated missing Tag_CPU_arch EABI attributes.
+ Updated how we combine archs 'v4t_plus_v6_m' as this mechanism
  have to handle new Armv9 as well.

Regression tested on `arm-none-eabi` cross Binutils and no issues.

bfd/

* archures.c: Define bfd_mach_arm_9.
* bfd-in2.h (bfd_mach_arm_9): Define bfd_mach_arm_9.
* cpu-arm.c: Add 'armv9-a' option to -march.
* elf32-arm.c (using_thumb2_bl): Update assert check.
(arch_has_arm_nop): Add TAG_CPU_ARCH_V9.
(bfd_arm_get_mach_from_attributes): Add case for TAG_CPU_ARCH_V9.
Update assert.
(tag_cpu_arch_combine): Updated table.
(v9): New table..

binutils/

* readelf.c (arm_attr_tag_CPU_arch): Update with

elfcpp/

* arm.h: Update TAG_CPU_ARCH_ enums with correct values.

gas/

* NEWS: Update docs.
* config/tc-arm.c (get_aeabi_cpu_arch_from_fset): Return Armv9-a
for -amarch=all.
(aeabi_set_public_attributes): Update assert.
* doc/c-arm.texi: Update docs.
* testsuite/gas/arm/armv9-a_arch.d: New test.
* testsuite/gas/arm/attr-march-all.d: Update test with v9.

include/

* elf/arm.h Update TAG_CPU_ARCH_ defines with correct values.
* opcode/arm.h (ARM_EXT3_V9A): New macro.
(ARM_ARCH_NONE): Updated with arm_feature_set.core size.
(FPU_NONE): Updated.
(ARM_ANY): Updated.
(ARM_ARCH_UNKNOWN): New macro.
(ARM_FEATURE_LOW): Updated.
(ARM_FEATURE_CORE): Updated.
(ARM_FEATURE_CORE_LOW): Updated.
(ARM_FEATURE_CORE_HIGH): Updated.
(ARM_FEATURE_COPROC): Updated.
(ARM_FEATURE): Updated.
(ARM_FEATURE_ALL): New macro.

opcodes/

* arm-dis.c (select_arm_features): Support bfd_mach_arm_9.
Also Update bfd_mach_arm_unknown to use new macro ARM_ARCH_UNKNOWN.

2 years agosim: iq2000: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:58:05 +0000 (00:58 -0400)]
sim: iq2000: reduce -Wno-error scope

Clean up the warnings in sim-if, then reduce the -Werror disable to
the files that still aren't clean that now that we require GNU make
and can set variables on a per-object basis.

2 years agosim: lm32: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:56:52 +0000 (00:56 -0400)]
sim: lm32: reduce -Wno-error scope

Clean up some warnings in dv-lm32cpu, and all in sim-if, then reduce
the -Werror disable to the files that still aren't clean that now that
we require GNU make and can set variables on a per-object basis.

2 years agosim: frv: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:56:35 +0000 (00:56 -0400)]
sim: frv: reduce -Wno-error scope

Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.

2 years agosim: m32r: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:56:08 +0000 (00:56 -0400)]
sim: m32r: reduce -Wno-error scope

Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.

2 years agosim: mips: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:55:27 +0000 (00:55 -0400)]
sim: mips: reduce -Wno-error scope

Fix a few printf warnings in sim-main.c, and then we're left with only
one file in here still generating warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.

2 years agosim: erc32: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:55:02 +0000 (00:55 -0400)]
sim: erc32: reduce -Wno-error scope

Only one file in here still generates warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.

2 years agosim: cris: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:54:36 +0000 (00:54 -0400)]
sim: cris: reduce -Wno-error scope

Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.

2 years agosim: sh: reduce -Wno-error scope
Mike Frysinger [Mon, 1 Nov 2021 04:53:38 +0000 (00:53 -0400)]
sim: sh: reduce -Wno-error scope

Only one file in here still generates warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.

2 years agosim: or1k: build with -Werror
Mike Frysinger [Mon, 1 Nov 2021 04:52:52 +0000 (00:52 -0400)]
sim: or1k: build with -Werror

The only warnings left in this port are a few maybe-uninitialized,
but we don't abort the build for them, so turn on -Werror everywhere.

2 years agosim: igen: minor build output alignment fix
Mike Frysinger [Mon, 1 Nov 2021 04:27:49 +0000 (00:27 -0400)]
sim: igen: minor build output alignment fix

The custom echo was off by one space relative to all the others.

2 years agosim: ppc: fix the printf fix for 32-bit systems
Mike Frysinger [Mon, 1 Nov 2021 04:25:13 +0000 (00:25 -0400)]
sim: ppc: fix the printf fix for 32-bit systems

The time delta is a 64-bit value too.

2 years agosim: m68hc11: clean up pointer casts
Mike Frysinger [Mon, 1 Nov 2021 04:07:15 +0000 (00:07 -0400)]
sim: m68hc11: clean up pointer casts

The void *data field is used to past arbitrary data between event
handlers, and these are using it to pass an integer.  Fix up the
casts to avoid using (long) to cast to/from pointers since there
is no guarantee that's the right size.

2 years agosim: d10v: clean up pointer casts
Mike Frysinger [Mon, 1 Nov 2021 04:05:15 +0000 (00:05 -0400)]
sim: d10v: clean up pointer casts

Use %p to print pointers instead of trying to cast them to longs.

2 years agosim: bfin: cast pointers using uintptr_t
Mike Frysinger [Mon, 1 Nov 2021 03:55:51 +0000 (23:55 -0400)]
sim: bfin: cast pointers using uintptr_t

We can't assume that sizeof(long) == sizeof(void*), so change all
these casts over to uintptr_t.

2 years agosim: ppc: clean up printf format handling
Mike Frysinger [Mon, 1 Nov 2021 03:32:26 +0000 (23:32 -0400)]
sim: ppc: clean up printf format handling

Don't blindly cast every possible type to (long).  Change to the right
printf format specifier whether it be a 64-bit type or a pointer.

2 years agosim: ppc: switch core types to stdint.h types
Mike Frysinger [Mon, 1 Nov 2021 03:48:16 +0000 (23:48 -0400)]
sim: ppc: switch core types to stdint.h types

There's no need to define these ourselves anymore, so switch to the
stdint.h types.  This will be important when we start using PRI*
defines with printf formats.

2 years agosim: mn10300: clean up pointer casts
Mike Frysinger [Mon, 1 Nov 2021 03:21:36 +0000 (23:21 -0400)]
sim: mn10300: clean up pointer casts

The void *data field is used to past arbitrary data between event
handlers, and these are using it to pass an enum.  Fix up the casts
to avoid using (long) to cast to/from pointers since there is no
guarantee that's the right size.

2 years agosim: events: clean up trace casts
Mike Frysinger [Mon, 1 Nov 2021 02:57:42 +0000 (22:57 -0400)]
sim: events: clean up trace casts

Don't blindly cast every possible type to (long).  Change to the right
printf format specifier whether it be a 64-bit type or a pointer.

2 years agosim: ppc: handle \r in igen inputs [PR sim/28476]
Mike Frysinger [Mon, 1 Nov 2021 02:35:41 +0000 (22:35 -0400)]
sim: ppc: handle \r in igen inputs [PR sim/28476]

Make sure we consume & ignore \r bytes in inputs in case the file
encodings are from a non-LF systems (e.g. Windows).

2 years agosim: ppc: constify strings in igen tooling
Mike Frysinger [Mon, 1 Nov 2021 00:40:01 +0000 (20:40 -0400)]
sim: ppc: constify strings in igen tooling

2 years agoAutomatic date update in version.in
GDB Administrator [Mon, 1 Nov 2021 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

2 years agoFix latent bug in DWARF test case
Tom Tromey [Fri, 29 Oct 2021 23:04:09 +0000 (17:04 -0600)]
Fix latent bug in DWARF test case

On my branch that replaces the DWARF psymtab reader,
dw2-stack-boundary.exp started failing.  However, when I look at the
output in gdb.log, it is correct:

    file /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary
    Reading symbols from /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary...
    During symbol reading: location description stack overflow
    During symbol reading: location description stack underflow

What happens to cause the failure is that the two branches in
gdb_test_multiple appear in this order:

    -re "\r\nDuring symbol reading: location description stack underflow" {
    [...]
    -re "\r\nDuring symbol reading: location description stack overflow" {

The first one will match the above, without causing the second one to
ever match -- leading to a spurious failure.

Anchoring the regexps seems to fix the problem, and works for the
current gdb as well.

2 years agoFix unittest.exp failure due to 'set debuginfod' addition
Tom Tromey [Sun, 31 Oct 2021 17:34:06 +0000 (11:34 -0600)]
Fix unittest.exp failure due to 'set debuginfod' addition

The 'set debuginfod' change caused a regression in unittest.exp:

    Running selftest help_doc_invariants.
    help doc broken invariant: command 'info set debuginfod' help doc first line is not terminated with a '.' character
    help doc broken invariant: command 'set debuginfod' help doc first line is not terminated with a '.' character
    help doc broken invariant: command 'show debuginfod' help doc first line is not terminated with a '.' character
    Self test failed: self-test failed at ../../binutils-gdb/gdb/unittests/command-def-selftests.c:100

This patch fixes the problem.  I'm checking it in.

2 years agosim: ppc: use silent build rules here too
Mike Frysinger [Sun, 31 Oct 2021 09:25:22 +0000 (05:25 -0400)]
sim: ppc: use silent build rules here too

The ppc codebase is unique and doesn't leverage common/, so have to
add silent rules to it specifically.

2 years agosim: rl78: drop obsolete manual dependency rules
Mike Frysinger [Sun, 31 Oct 2021 09:05:49 +0000 (05:05 -0400)]
sim: rl78: drop obsolete manual dependency rules

We have GNU make generate these for us automatically now, so there's
no need to manually specify any deps.

2 years agosim: drop unused targ-vals.h includes
Mike Frysinger [Wed, 7 Jul 2021 03:56:13 +0000 (23:56 -0400)]
sim: drop unused targ-vals.h includes

This is used in a few places where it's not needed.  Drop the include
to avoid the build-time generated header file as we move to drop it.

2 years agosim: unify callback.o building
Mike Frysinger [Wed, 7 Jul 2021 03:44:38 +0000 (23:44 -0400)]
sim: unify callback.o building

Now that the use of TARGET_xxx defines have been removed, we can move
this to the common logic so we only build it once for multi-targets.

2 years agosim: nltvals: pull target open flags out into a dedicated source file
Mike Frysinger [Wed, 7 Jul 2021 03:37:56 +0000 (23:37 -0400)]
sim: nltvals: pull target open flags out into a dedicated source file

Like we just did for pulling out the errno & signal maps, pull out the
open flag map into a dedicated common file.  All newlib ports are using
the same map which makes it easy.

2 years agosim: nltvals: localize TARGET_<open> defines
Mike Frysinger [Wed, 7 Jul 2021 03:21:20 +0000 (23:21 -0400)]
sim: nltvals: localize TARGET_<open> defines

Code should not be using these directly, instead they should be
resolving these dynamically via the open_map.  Rework the common
callback code that was using the defines to use symbolic names
instead, and localize some of the defines in the ARM code (since
it's a bit unclear how many different APIs it supports currently),
then remove the defines out of the header so no new code can rely on
them.

2 years agosim: nltvals: pull target signal out into a dedicated source file
Mike Frysinger [Wed, 7 Jul 2021 02:43:10 +0000 (22:43 -0400)]
sim: nltvals: pull target signal out into a dedicated source file

Like we just did for pulling out the errno map, pull out the signal
map into a dedicated common file.  All newlib ports are using the
same signal map which makes it easy.

2 years agosim: nltvals: pull target errno out into a dedicated source file
Mike Frysinger [Wed, 7 Jul 2021 02:10:53 +0000 (22:10 -0400)]
sim: nltvals: pull target errno out into a dedicated source file

The current system maintains a list of target errno constants in the
nltvals.def file, then runs a build-time tool to turn that into a C
file.  This list of errno values is the same for all arches, so we
don't need the arch-specific flexibility.  Further, these are only
for newlib/libgloss environments, which makes it confusing to support
other userland runtimes (like Linux).  Let's simplify to make this
easier to understand & build.  We don't namespace the variables yet,
but sets up the framework for it.

Create a new target-newlib-errno.c template file.  The template file
is hand written, but the inline map is still automatically generated.

This allows us to move it to the common set of objects so it's only
built once in a multi-target build.

Now we can remove the output from the gentmap build-time tool since
it's checked into the tree.

Then we stop including the errno lists in nltvals.def since nothing
uses it.

2 years agosim: erc32: use silent build rules with sis linkage
Mike Frysinger [Sun, 31 Oct 2021 08:19:41 +0000 (04:19 -0400)]
sim: erc32: use silent build rules with sis linkage

2 years agosim: erc32: fix a few more build warnings
Mike Frysinger [Sun, 31 Oct 2021 08:17:28 +0000 (04:17 -0400)]
sim: erc32: fix a few more build warnings

Tweak the if indentation & brace style to avoid ambiguous warnings.

Add ATTRIBUTE_UNUSED to UART functions that aren't used when FAST_UART
is defined (which is the default).

2 years agosim: erc32: fix signedness compatibility and redefinition warnings
Orgad Shaneh [Fri, 29 Oct 2021 06:42:15 +0000 (06:42 +0000)]
sim: erc32: fix signedness compatibility and redefinition warnings

2 years agosim: add arch-specific conditional logic
Mike Frysinger [Sun, 31 Oct 2021 06:03:16 +0000 (02:03 -0400)]
sim: add arch-specific conditional logic

This will make it easy to include arch-specific logic (build files)
as we migrate ports to the common top level build.

2 years agosim: v850: delete old gencode logic
Mike Frysinger [Sun, 31 Oct 2021 05:49:17 +0000 (01:49 -0400)]
sim: v850: delete old gencode logic

The v850 port used to have a gencode helper, but it was deleted long
ago.  Clean up the settings that no longer make sense w/out it.

2 years agosim: common: merge multiple clean commands
Mike Frysinger [Sun, 31 Oct 2021 05:17:10 +0000 (01:17 -0400)]
sim: common: merge multiple clean commands

This provides a minor speedup when cleaning in a multi-target build.

2 years agosim: m32c: tighten up opc2c build output
Mike Frysinger [Sun, 31 Oct 2021 05:11:41 +0000 (01:11 -0400)]
sim: m32c: tighten up opc2c build output

Drop the single debugging line that repeats the command line option,
and use the silent build helpers to tighten up output.

2 years agosim: tighten up build regen rules
Mike Frysinger [Sun, 31 Oct 2021 05:08:05 +0000 (01:08 -0400)]
sim: tighten up build regen rules

Update the makefile & configure related rules to use the silent
build helpers.

2 years agosim: tighten up gencode output
Mike Frysinger [Sun, 31 Oct 2021 05:05:27 +0000 (01:05 -0400)]
sim: tighten up gencode output

Update the gencode rules to use the silent build helpers.

2 years agosim: igen: tighten up build output
Mike Frysinger [Sun, 31 Oct 2021 04:55:50 +0000 (00:55 -0400)]
sim: igen: tighten up build output

Add a new stamp helper for quiet builds, and don't dump the command
line options when it runs.  That isn't standard tool behavior, and
doesn't really seem necessary in any way.

2 years agosim: tighten up stamp rules
Mike Frysinger [Sun, 31 Oct 2021 04:49:39 +0000 (00:49 -0400)]
sim: tighten up stamp rules

Add a new ECHO_STAMP helper and convert existing stamp code over
to it.  This is mostly common rules and cgen mloop rules.

2 years agosim: silence stamp touch rules
Mike Frysinger [Sun, 31 Oct 2021 04:42:35 +0000 (00:42 -0400)]
sim: silence stamp touch rules

We pretty much never care about these stamp touches, so silence them.
Also switch to using $@ when it makes sense.

2 years agosim: standardize move-if-change rules
Mike Frysinger [Sun, 31 Oct 2021 04:28:44 +0000 (00:28 -0400)]
sim: standardize move-if-change rules

Use the srcroot path and make them all silent.

2 years agosim: mips/v850: remove redundant variable setup
Mike Frysinger [Sun, 31 Oct 2021 04:23:36 +0000 (00:23 -0400)]
sim: mips/v850: remove redundant variable setup

The common/Make-common.in fragment already provides these variables.

2 years agosim: fix compilation on mingw64 [PR sim/28476]
Orgad Shaneh [Thu, 28 Oct 2021 09:07:46 +0000 (09:07 +0000)]
sim: fix compilation on mingw64 [PR sim/28476]

...by reordering includes.

1. sim-utils.c

sim/mips/sim-main.h defines UserMode, while there is a struct in winnt.h
which has UserMode as a member. So if sim-main.h is included before winnt.h,
compilation fails.

2. ppc

registers.h defines CR, which is used as a member in winnt.h.

winsock2.h is included by sys/time.h, so sys/time.h has to be included
before registers.h.

Bug: https://sourceware.org/PR28476

2 years agoDon't include coff/pe.h in coff-x86_64.c
Alan Modra [Sat, 30 Oct 2021 23:38:15 +0000 (10:08 +1030)]
Don't include coff/pe.h in coff-x86_64.c

This (and other) code from coffcode.h is broken for x86_64_coff_vec,
and has been ever since support was added in 2006 commit 99ad839030c1
Here, bfd_coff_aoutsz must match coff_swap_aouthdr_out otherwise we
end up writing garbage.

      /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
 include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)).  */
      char * buff;
      bfd_size_type amount = bfd_coff_aoutsz (abfd);

      buff = (char *) bfd_malloc (amount);
      if (buff == NULL)
return false;

      coff_swap_aouthdr_out (abfd, & internal_a, buff);
      amount = bfd_bwrite (buff, amount, abfd);

We have removed support for --target=x86_64-coff, likely because it
never worked properly, but still produce coff-x86_64.o with
--enable-targets=all.  This means objcopy can recognize x86_64 COFF
files but will write garbage to the output file, a fact found by
fuzzers.  I suspect x86_64 COFF is still broken after this fix, and
mention of coff-x86_64.* should be removed from bfd/Makefile.am.

* coff-x86_64.c: Don't include coff/pe.h.
(COFF_WITH_pex64): Don't define here.
* pe-x86_64.c: Include coff/pe.h and other headers.
(PEI_HEADERS): Define.

2 years agoRe: PR28420, ecoff fuzzing failures
Alan Modra [Sat, 30 Oct 2021 08:49:13 +0000 (19:19 +1030)]
Re: PR28420, ecoff fuzzing failures

sym_ptr_ptr NULL results in segfaults.

PR 28420
* ecoff.c (ecoff_slurp_reloc_table): Don't leave sym_ptr_ptr NULL.

2 years agoubsan: alpha-vms: undefined shift
Alan Modra [Sat, 30 Oct 2021 08:24:53 +0000 (18:54 +1030)]
ubsan: alpha-vms: undefined shift

* vms-alpha.c (evax_bfd_print_image): Shift left 1u.

2 years agoPR28518: signed integer overflow & free on unmalloced address
Alan Modra [Sat, 30 Oct 2021 08:12:00 +0000 (18:42 +1030)]
PR28518: signed integer overflow & free on unmalloced address

PR 28518
* vms-alpha.c (build_module_list): Don't lose malloc buffer address.
Use unsigned variables.

2 years agoAutomatic date update in version.in
GDB Administrator [Sun, 31 Oct 2021 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

2 years agogdb: fix gdb.gdb/unittest.exp with C++17 compiler
Simon Marchi [Sat, 30 Oct 2021 02:15:55 +0000 (22:15 -0400)]
gdb: fix gdb.gdb/unittest.exp with C++17 compiler

On a machine with gcc 11, I get:

    FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_v" (second tab) (timeout)
    FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_vie" (timeout)

That's because when compiling with C++ >= 17, we use the standard
version of string_view, and don't have a selftest for it.  So the list
of selftests shown by the tab completion when completing "string_v"
differs.

Change the test to use the copy_* tests instead.

Change-Id: I85f6aa44ee5fc9652b9bd4451e0506b89773526b

2 years agogdb.texinfo: Expand documentation for debuginfod
Aaron Merey [Sat, 30 Oct 2021 00:49:29 +0000 (20:49 -0400)]
gdb.texinfo: Expand documentation for debuginfod

Add section describing GDB's usage of debuginfod.

Refer to this new section in the description of the '--with-debuginfod'
configure option.

Mention debuginfod in the 'Separate Debug Files' section.

2 years agogdb: add set/show commands for managing debuginfod
Aaron Merey [Fri, 29 Oct 2021 23:55:57 +0000 (19:55 -0400)]
gdb: add set/show commands for managing debuginfod

Add 'set debuginfod' command.  Accepts 'on', 'off' or 'ask' as an
argument.  'on' enables debuginfod for the current session.  'off'
disables debuginfod for the current session.  'ask' will prompt
the user to either enable or disable debuginfod when the next query
is about to be performed:

    This GDB supports auto-downloading debuginfo from the following URLs:
    <URL1> <URL2> ...
    Enable debuginfod for this session? (y or [n]) y
    Debuginfod has been enabled.
    To make this setting permanent, add 'set debuginfod on' to .gdbinit.

For interactive sessions, 'ask' is the default.  For non-interactive
sessions, 'off' is the default.

Add 'show debuginfod status' command.  Displays whether debuginfod
is set to 'on', 'off' or 'ask'.

Add 'set/show debuginfod urls' commands. Accepts a string of
space-separated debuginfod server URLs to be queried.  The default
value is copied from the DEBUGINFOD_URLS environment variable.

Finally add 'set/show debuginfod verbose' commands to control whether
debuginfod-related output is displayed.  Verbose output is enabled
by default.

    (gdb) run
    Starting program: /bin/sleep 5
    Download failed: No route to host.  Continuing without debug info for /lib64/libc.so.6.

If GDB is not built with debuginfod then these commands will just display

    Support for debuginfod is not compiled into GDB.

2 years agoAutomatic date update in version.in
GDB Administrator [Sat, 30 Oct 2021 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in

2 years agogdb: remove TYPE_FIELD_DWARF_BLOCK
Simon Marchi [Mon, 27 Sep 2021 01:08:36 +0000 (21:08 -0400)]
gdb: remove TYPE_FIELD_DWARF_BLOCK

Remove TYPE_FIELD_DWARF_BLOCK, replace with type::field +
field::loc_dwarf_block.

Change-Id: I10af9410bb5f46d342b8358a7956998c7e804b64

2 years agogdb: remove TYPE_FIELD_STATIC_PHYSADDR
Simon Marchi [Mon, 27 Sep 2021 01:07:04 +0000 (21:07 -0400)]
gdb: remove TYPE_FIELD_STATIC_PHYSADDR

Remove TYPE_FIELD_STATIC_PHYSADDR replace with type::field +
field::loc_physaddr.

Change-Id: Ica9bc4a48f34750ec82ec86c298d3ecece81bcbd

2 years agogdb: remove TYPE_FIELD_STATIC_PHYSNAME
Simon Marchi [Mon, 27 Sep 2021 01:06:12 +0000 (21:06 -0400)]
gdb: remove TYPE_FIELD_STATIC_PHYSNAME

Remove TYPE_FIELD_STATIC_PHYSNAME, replace with type::field +
field::loc_physname.

Change-Id: Ie35d446b67dd1d02f39998b406001bdb7e6d5abb

2 years agogdb: remove TYPE_FIELD_ENUMVAL
Simon Marchi [Sun, 26 Sep 2021 20:38:02 +0000 (16:38 -0400)]
gdb: remove TYPE_FIELD_ENUMVAL

Remove TYPE_FIELD_ENUMVAL, replace with type::field +
field::loc_enumval.

Change-Id: I2ada73e4635aad3363ce2eb22c1dc52698ee2072

2 years agogdb: remove TYPE_FIELD_BITPOS
Simon Marchi [Sun, 26 Sep 2021 20:36:15 +0000 (16:36 -0400)]
gdb: remove TYPE_FIELD_BITPOS

Remove TYPE_FIELD_BITPOS, replace its uses with type::field +
field::loc_bitpos.

Change-Id: Iccd8d5a77e5352843a837babaa6bd284162e0320

2 years agogdb: remove TYPE_FIELD_LOC_KIND
Simon Marchi [Sun, 26 Sep 2021 20:34:28 +0000 (16:34 -0400)]
gdb: remove TYPE_FIELD_LOC_KIND

Remove TYPE_FIELD_LOC_KIND, replace its uses with type::field +
field::loc_kind.

Change-Id: Ib124a26365df82ac1d23df7962d954192913bd90

2 years agogdb: remove FIELD_DWARF_BLOCK macro
Simon Marchi [Fri, 24 Sep 2021 03:51:40 +0000 (23:51 -0400)]
gdb: remove FIELD_DWARF_BLOCK macro

Remove FIELD_DWARF_BLOCK, replace its uses with field::loc_dwarf_block.

Change-Id: I66b7d6a960cb5e341e61e21bd3cc9a6ac26de6a8