Commit Graph

108255 Commits

Author SHA1 Message Date
Simon Marchi
333f35b631 gdb: rework "set debuginfod" commands
As discussed here [1], do some re-work in the "set debuginfod commands".

First, use "set debuginfod enabled on/off/ask" instead of "set
debuginfod on/off/ask".  This is more MI-friendly, and it gives an
output that makes more sense in "info set", for example.

Then, make the show commands not call "error" when debuginfod support is
not compiled in.  This makes the commands "show" and "show debuginfod"
stop early, breaking gdb.base/default.exp:

    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/default.exp ...
    FAIL: gdb.base/default.exp: info set
    FAIL: gdb.base/default.exp: show

 - Make the "debuginfod enabled" setting default to "off" when debuginfod
   support is not compiled in, and "ask" otherwise.
 - Make the setter of "debuginfod enabled" error out when debuginfod
   support is not compiled in, so that "debuginfod enabled" will always
   remain "off" in that case.
 - Make the setter of "debuginfod verbose" work in any case.  I don't
   see the harm in letting the user change that setting, since the user will
   hit an error if they try to enable the use of debuginfod.
 - I would do the same for the "debuginfod urls" setter, but because
   this one needs to see the DEBUGINFOD_URLS_ENV_VAR macro, provided by
   libdebuginfod, I made that one error out as well if debuginfod
   support is not compiled it (otherwise, I would have left it like
   "debuginfod verbose".  Alternatively, we could hard-code
   "DEBUGINFOD_URLS" in the code (in fact, it was prior to this patch,
   but I think it was an oversight, as other spots use
   DEBUGINFOD_URLS_ENV_VAR), or use a dummy string to store the setting,
   but I don't really see the value in that.

Rename debuginfod_enable to debuginfod_enabled, just so it matches the
setting name.

[1] https://sourceware.org/pipermail/gdb-patches/2021-October/182937.html

Change-Id: I45fdb2993f668226a5639228951362b7800f09d5
Co-Authored-By: Aaron Merey <amerey@redhat.com>
2021-11-15 21:47:27 -05:00
Simon Marchi
aa70a99eb0 gdb: adjust gdbarch_tdep calls in nat files
Commit 345bd07cce ("gdb: fix gdbarch_tdep ODR violation") forgot to
update the gdbarch_tdep calls in the native files other than x86-64
Linux.  This patch updates them all (to the best of my knowledge).
These are the files I was able to build-test:

  aarch64-linux-nat.c
  amd64-bsd-nat.c
  arm-linux-nat.c
  ppc-linux-nat.c
  windows-nat.c
  xtensa-linux-nat.c

And these are the ones I could not build-test:

  aix-thread.c
  arm-netbsd-nat.c
  ppc-fbsd-nat.c
  ppc-netbsd-nat.c
  ia64-tdep.c (the part that needs libunwind)
  ppc-obsd-nat.c
  rs6000-nat.c

If there are still some build problems related to gdbarch_tdep in them,
they should be pretty obvious to fix.

Change-Id: Iaa3d791a850e4432973757598e634e3da6061428
2021-11-15 21:39:16 -05:00
Simon Marchi
39cdfdb261 gdb: remove unused variables in xtensa-linux-nat.c
While build-testing this file, the compiler complained about these two
unused variables, remove them.

Change-Id: I3c54f779f12c16ef6184af58aca75eaad042ce4e
2021-11-15 21:38:44 -05:00
Simon Marchi
2d2bb0d3f2 gdb: add arc-newlib-tdep.c to ALL_TARGET_OBS
This file is currently not compiled in an --enable-targets=all build,
but it should be.  Add it to ALL_TARGET_OBS.

Update the gdbarch_tdep call that commit 345bd07cce ("gdb: fix
gdbarch_tdep ODR violation") forgot to update.

Change-Id: I86248a01493eea5e70186e9c46a298ad3994b034
2021-11-15 21:21:29 -05:00
Jim Wilson
a66ddb5899 Update my email address.
I've left SiFive and have a new gmail account because it is convenient
to use with git send-email.  I'm planning to use this for my RISC-V
work.  My tuliptree address still works, it just isn't as convenient.

	binutils:
	* MAINTAINERS (RISC-V): Update my address.
2021-11-15 16:51:05 -08:00
GDB Administrator
00855fe7cd Automatic date update in version.in 2021-11-16 00:00:06 +00:00
Tom de Vries
636ae5bb4b [gdb] Don't use gdb_stdlog for inferior-events
The test-case gdb.base/foll-vfork.exp contains:
...
if [gdb_debug_enabled] {
    untested "debug is enabled"
    return 0
}
...

To understand what it does, I disabled this bit and ran with GDB_DEBUG=infrun,
like so:
...
$ cd $build/gdb/testsuite
$ make check GDB_DEBUG=infrun RUNTESTFLAGS=gdb.base/foll-vfork.exp
...
and ran into:
...
(gdb) PASS: gdb.base/foll-vfork.exp: exec: \
  vfork parent follow, through step: set follow-fork parent
next^M
33        if (pid == 0) {^M
(gdb) FAIL: gdb.base/foll-vfork.exp: exec: \
  vfork parent follow, through step: step
...

The problem is that the test-case expects:
...
(gdb) PASS: gdb.base/foll-vfork.exp: exec: \
  vfork parent follow, through step: set follow-fork parent
next^M
[Detaching after vfork from child process 28169]^M
33        if (pid == 0) {^M
(gdb) PASS: gdb.base/foll-vfork.exp: exec: \
  vfork parent follow, through step: step
...
but the "Detaching" line has been redirected to
$outputs/gdb.base/foll-vfork/gdb.debug.

I looked at the documentation of "set logging debugredirect [on|off]":
...
  By default, GDB debug output will go to both the terminal and the logfile.
  Set debugredirect if you want debug output to go only to the log file.
...
and my interpretation of it was that "debug output" did not match the
"messages" description of inferior-events:
...
The set print inferior-events command allows you to enable or disable printing
of messages when GDB notices that new inferiors have started or that inferiors
have exited or have been detached.
...

Fix the discrepancy by not using gdb_stdlog for inferior-events.

Update the gdb.base/foll-vfork.exp test-case to not require
gdb_debug_enabled == 0.

Tested on x86_64-linux.

Tested test-case gdb.base/foll-vfork.exp with and without GDB_DEBUG=infrun.
2021-11-15 22:55:02 +01:00
Roland McGrath
d029b54d9c ld: Fix testsuite failures under --enable-textrel-check=error
ld/
	* testsuite/ld-aarch64/dt_textrel.d: Pass explicit -z notext in
	case ld was configured with --enable-textrel-check=error.
	* testsuite/ld-aarch64/pr22764.d: Likewise.
	* testsuite/ld-aarch64/pr20402.d: Likewise.
2021-11-15 11:09:17 -08:00
Luis Machado
37989733d8 Extend the prologue analyzer to handle the bti instruction
Handle the BTI instruction in the prologue analyzer. The patch handles all
the variations of the BTI instruction.
2021-11-15 16:00:01 -03:00
Simon Marchi
345bd07cce gdb: fix gdbarch_tdep ODR violation
I would like to be able to use non-trivial types in gdbarch_tdep types.
This is not possible at the moment (in theory), because of the one
definition rule.

To allow it, rename all gdbarch_tdep types to <arch>_gdbarch_tdep, and
make them inherit from a gdbarch_tdep base class.  The inheritance is
necessary to be able to pass pointers to all these <arch>_gdbarch_tdep
objects to gdbarch_alloc, which takes a pointer to gdbarch_tdep.

These objects are never deleted through a base class pointer, so I
didn't include a virtual destructor.  In the future, if gdbarch objects
deletable, I could imagine that the gdbarch_tdep objects could become
owned by the gdbarch objects, and then it would become useful to have a
virtual destructor (so that the gdbarch object can delete the owned
gdbarch_tdep object).  But that's not necessary right now.

It turns out that RISC-V already has a gdbarch_tdep that is
non-default-constructible, so that provides a good motivation for this
change.

Most changes are fairly straightforward, mostly needing to add some
casts all over the place.  There is however the xtensa architecture,
doing its own little weird thing to define its gdbarch_tdep.  I did my
best to adapt it, but I can't test those changes.

Change-Id: Ic001903f91ddd106bd6ca09a79dabe8df2d69f3b
2021-11-15 11:29:39 -05:00
Clément Chigot
eae06bb301 COFF: avoid modifications over C_FILE filename aux entries.
Commit e86fc4a5bc ("PR 28447: implement multiple parameters for .file
on XCOFF") introduces C_FILE entries which can store additional
information.
However, some modifications are needed by them but not by the original
C_FILE entries, usually representing the filename.
This patch ensures that filename entries are kept as is, in order to
protect targets not supporting the additional entries.

	* coffgen.c (coff_write_symbol): Protect filename entries
	(coff_write_symbols): Likewise.
	(coff_print_symbol): Likewise.
2021-11-15 23:07:11 +10:30
Eric Botcazou
f9402ccaa9 Deal with full path in .file 0 directive
Gas uses the directory part, if present, of the .file 0 directive to set
entry 0 of the directory table in DWARF 5, which represents the "current
directory".

Now Gas also uses the file part of the same directive to set entry 0 of the
file table, which represents the "current compilation file".  But the latter
need not be located in the former so GCC will use a full path in the file
part when it is passed a full path:

gcc -c /full/path/test.c -save-temps

yields:

 .file 0 "/current/directory" "/full/path/test.c"

in the assembly file and:

 The Directory Table (offset 0x22, lines 2, columns 1):
  Entry Name
  0     (indirect line string, offset: 0x25): /current/directory
  1     (indirect line string, offset: 0x38): /full/path

 The File Name Table (offset 0x30, lines 2, columns 2):
  Entry Dir     Name
  0     0       (indirect line string, offset: 0x43): /full/path/test.c

in the object file.  Note the full path and the questionable Dir value in
the 0 entry of the file table.
2021-11-15 12:56:10 +01:00
Mike Frysinger
e6c46d0772 sim: cris: make error message test a little more flexible
The point of this test is to just make sure the usage text is shown,
not the exact details of the usage text.  So shorten the output test
to match the beginning.  This fixes breakage when the output changed
slightly to include [--].
2021-11-15 03:34:36 -05:00
Mike Frysinger
7770da9714 sim: run: fix crash in argc==0 error situation
The new argv processing code assumed that we were always passed a
command line.  If we weren't, make sure we don't crash before we
get a chance to output an error message about incorrect usage.
2021-11-15 03:32:26 -05:00
Mike Frysinger
145a603abc sim: cris: touch up rvdummy handling
Add quiet build support and make sure it's removed with `make clean`.
2021-11-15 03:00:05 -05:00
Mike Frysinger
565cbe4b91 sim: cris: replace custom "dest" test field with new --argv0
The #dest field used in the cris testsuite is a bit of hack to set the
argv[0] for the tests to read out later on.  Now that the sim has an
option to set argv[0] explicitly, we don't need this custom field, so
let's drop it to harmonize the testsuites a little.
2021-11-15 02:53:31 -05:00
Mike Frysinger
852016f921 sim: run: add --argv0 option to control argv[0]
We default argv[0] to the program we run which is a standard *NIX
convention, but sometimes we want to be able to control the argv[0]
setting independently (especially for programs that inspect argv[0]
to change their behavior or output).  Add an option to control it.
2021-11-15 02:53:31 -05:00
Mike Frysinger
e8f20a28b1 sim: split program path out of argv vector
We use the program argv to both find the program to run (argv[0]) and
to hold the arguments to the program.  Most of the time this is fine,
but if we want to let programs specify argv[0] independently (which is
possible in standard *NIX programs), this double duty doesn't work.

So let's split the path to the program to run out into a separate
field by itself.  This simplifies the various sim_open funcs too.

By itself, this code is more of a logical cleanup than something that
is super useful.  But it will open up customization of argv[0] in a
follow up commit.  Split the changes to make it easier to review.
2021-11-15 02:53:29 -05:00
Mike Frysinger
7b2ec4e46f sim: bfin: fix mach/xfail usage in tests
Set the mach to the right value all the time, and update xfail to
say the test fails on all targets.  WIth multitarget testing, the
idea of target here doesn't make much sense.
2021-11-15 01:35:49 -05:00
Alan Modra
daad0428f2 -Waddress fixes for gold testsuite
Current mainline gcc.
common_test_1.c: In function 'main':
common_test_1.c:56:14: error: comparison between two arrays [-Werror=array-compare]
   56 |   assert (c5 > c4);
      |              ^
common_test_1.c:56:14: note: use '&c5[0] > &c4[0]' to compare the addresses

	* testsuite/common_test_1.c: Avoid -Waddress warnings.
	* testsuite/common_test_1_v1.c: Likewise.
	* testsuite/common_test_1_v2.c: Likewise.
	* testsuite/script_test_2.cc: Likewise.
2021-11-15 13:26:17 +10:30
Alan Modra
7aba54da42 PowerPC64 @notoc in non-power10 code
R_PPC64_REL24_P9NOTOC is a variant of R_PPC64_REL24_NOTOC for use on
@notoc cals from non-power10 code in the rare case that using such a
construct is useful.  R_PPC64_REL24_P9NOTOC will be emitted by gas
rather than R_PPC64_REL24_NOTOC when @notoc is used in a branch
instruction if power10 instructions are not enabled at that point.
The new relocation tells the linker to not use power10 instructions on
any stub emitted for that branch, unless overridden by
--power10-stubs=yes.

The current linker heuristic of only generating power10 instructions
for stubs if power10-only relocations are detected, continues to be
used.

include/
	* elf/ppc64.h (R_PPC64_REL24_P9NOTOC): Define.
bfd/
	* reloc.c (BFD_RELOC_PPC64_REL24_P9NOTOC): Define.
	* elf64-ppc.c (ppc64_elf_howto_raw): Add entry for new reloc.
	(ppc64_elf_reloc_type_lookup): Handle it.
	(enum ppc_stub_type): Delete.
	(enum ppc_stub_main_type, ppc_stub_sub_type): New.
	(struct ppc_stub_type): New.
	(struct ppc_stub_hash_entry): Use the above new type.
	(struct ppc_link_hash_table): Update stub_count.
	(is_branch_reloc, ppc64_elf_check_relocs),
	(toc_adjusting_stub_needed): Handle new reloc.
	(stub_hash_newfunc, select_alt_stub, ppc_merge_stub),
	(ppc_type_of_stub, plt_stub_size, build_plt_stub),
	(build_tls_get_addr_head, build_tls_get_addr_tail),
	(ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_size_stubs),
	(ppc64_elf_build_stubs, ppc64_elf_relocate_section): Handle new
	reloc.  Modify stub handling to suit new scheme.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
gas/
	* config/tc-ppc.c (ppc_elf_suffix): When power10 is not enabled
	return BFD_RELOC_PPC64_REL24_P9NOTOC for @notoc.
	(fixup_size, ppc_force_relocation, ppc_fix_adjustable): Handle
	BFD_RELOC_PPC64_REL24_P9NOTOC.
ld/
	* testsuite/ld-powerpc/callstub-2.s: Add .machine power10.
2021-11-15 12:20:13 +10:30
Alan Modra
64f5c8167b Regenerate a couple of files
A couple of files changed on my latest --enable-maintainer-mode
build.  ld/Makefile.in had a missing dependency but better sorting of
the loongson entries.

intl/
	* configure: Regenerate.
ld/
	* Makefile.am: Sort loongson entries.
	* Makefile.in: Regenerate.
2021-11-15 12:20:12 +10:30
Pedro Alves
da7ee7f9ce Fix build with current GCC: EL_EXPLICIT(location) always non-NULL
Compiling GDB with current GCC (1b4a63593b) runs into this:

  src/gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
  src/gdb/location.c:963:38: error: the address of 'event_location::<unnamed union>::explicit_loc' will never be NULL [-Werror=address]
    963 |       return (EL_EXPLICIT (location) == NULL
	|                                      ^
  src/gdb/location.c:57:30: note: 'event_location::<unnamed union>::explicit_loc' declared here
     57 |     struct explicit_location explicit_loc;
	|                              ^~~~~~~~~~~~

GCC is right, EL_EXPLICIT is defined as returning the address of an
union field:

      /* An explicit location.  */
      struct explicit_location explicit_loc;
  #define EL_EXPLICIT(P) (&((P)->u.explicit_loc))

and thus must always be non-NULL.

Change-Id: Ie74fee7834495a93affcefce03c06e4d83ad8191
2021-11-14 19:20:20 -05:00
GDB Administrator
cb2e519a5e Automatic date update in version.in 2021-11-15 00:00:22 +00:00
Lancelot SIX
cc81bc2dfb [PR gdb/16238] Add completer for the show user command
The 'show user' command (which shows the definition of non-python/scheme
user defined commands) is currently missing a completer. This is
mentioned in PR 16238.  Having one can improve the user experience.

In this commit I propose an implementation for such completer as well as
the associated tests.

Tested on x86_64 GNU/Linux.

All feedbacks are welcome.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16238
2021-11-14 13:50:30 +00:00
Alan Modra
b431e7a3fe sync libbacktrace from gcc 2021-11-14 18:07:50 +10:30
GDB Administrator
9d6a1a6496 Automatic date update in version.in 2021-11-14 00:00:13 +00:00
H.J. Lu
08ca783430 Sync Makefile.tpl with GCC
* Makefile.tpl: Sync with GCC.
	* Makefile.in: Regenerate.
2021-11-13 09:04:03 -08:00
Mike Frysinger
35f7d33dd9 sim: sh: fix switch-bool warnings
This code triggers -Werror=switch-bool warnings with <=gcc-5 versions.
Rework it to use if statements instead as it also simplifies a bit.
2021-11-13 00:57:00 -05:00
Mike Frysinger
dc5a462160 sim: sh: rework carry checks to not rely on integer overflows
In <=gcc-7 versions, -fstrict-overflow is enabled by default, and that
triggers warnings in this code that relies on integer overflows to test
for carries.  Change the logic to test against the limit directly.
2021-11-13 00:57:00 -05:00
GDB Administrator
b9252d079a Automatic date update in version.in 2021-11-13 00:00:24 +00:00
Carl Love
b626a80342 Fix gdb.base/sigstep.exp test for ppc
The test stops at <signal_handler called> which is the call to the handler
rather than in the handler as intended.  This patch replaces the
gdb_test "$enter_cmd to handler" with a gdb_test_multiple test.  The multiple
test looks for the stop at <signal_handler called>.  If found, the command
is issued again.  The test passes if gdb stops in the handler as expected.

(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step
from handler: continue to signal
stepi
<signal handler called>
1: x/i $pc
=> 0x7ffff7f80440 <__kernel_start_sigtramp_rt64>:       bctrl
(gdb) stepi
handler (sig=551) at sigstep.c:32
32      {
1: x/i $pc
=> 0x10000097c <handler>:       addis   r2,r12,2
(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler,
step from handler: stepi to handler

Patch has been tested on x86_64-linux and ppc64le-linux with no test failures.
2021-11-12 14:56:16 -06:00
Tom de Vries
1f28b70def [gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp
On OBS I ran into:
...
(gdb) PASS: gdb.base/foll-vfork.exp: exit: \
  vfork relations in info inferiors: continue to child exit
info inferiors^M
  Num  Description       Connection           Executable        ^M
  1    <null>                                 foll-vfork-exit ^M
* 2    <null>                                 foll-vfork-exit ^M
(gdb) I'm the proud parent of child #5044!^M
FAIL: gdb.base/foll-vfork.exp: exit: vfork relations in info inferiors: \
  vfork relation no longer appears in info inferiors (timeout)
...

Fix this by removing the '$' anchor in the corresponding '$gdb_prompt $'
regexps.

Tested on x86_64-linux.
2021-11-12 17:12:56 +01:00
Alan Modra
0b32f05bac Don't compile some opcodes files when bfd is 32-bit only
* Makefile.am (TARGET_LIBOPCODES_CFILES): Split into..
	(TARGET64_LIBOPCODES_CFILES): ..this and..
	(TARGET32_LIBOPCODES_CFILES): ..this.
	(ALL_MACHINES): Likewise split to
	(ALL64_MACHINES, ALL32_MACHINES): ..this.
	* disassemble.c: Define some ARCH_* when ARCH_all only if BFD64.
	* configure.ac (BFD_MACHINES): Defined depending on BFD_ARCH_SIZE.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2021-11-12 19:02:12 +10:30
Alan Modra
be472decb2 Import Makefile.def from gcc
* Makefile.def: Import from gcc.
	* Makefile.in: Regenerate.
2021-11-12 19:02:12 +10:30
Alan Modra
0d64622696 Fix demangle style usage info
Extract allowed styles from libiberty, so we don't have to worry about
our help messages getting out of date.  The function probably belongs
in libiberty/cplus-dem.c but it can be here for a while to iron out
bugs.

	PR 28581
	* demanguse.c: New file.
	* demanguse.h: New file.
	* nm.c (usage): Break up output.  Use display_demangler_styles.
	* objdump.c (usage): Use display_demangler_styles.
	* readelf.c (usage): Likewise.
	* Makefile.am: Add demanguse.c and demanguse.h.
	* Makefile.in: Regenerate.
	* po/POTFILESin: Regenerate.
2021-11-12 14:33:31 +10:30
GDB Administrator
d31028e8cc Automatic date update in version.in 2021-11-12 00:00:17 +00:00
Simon Marchi
4d772ea24d gdb: fix "set scheduler-locking" thread exit hang
GDB hangs when doing this:

 - launch inferior with multiple threads
 - multiple threads hit some breakpoint(s)
 - one breakpoint hit is presented as a stop, the rest are saved as
   pending wait statuses
 - "set scheduler-locking on"
 - resume the currently selected thread (because of scheduler-locking,
   it's the only one resumed), let it execute until exit
 - GDB hangs, not showing the prompt, impossible to interrupt with ^C

When the resumed thread exits, we expect the target to return a
TARGET_WAITKIND_NO_RESUMED event, and that's what we see:

    [infrun] fetch_inferior_event: enter
      [infrun] scoped_disable_commit_resumed: reason=handling event
      [infrun] random_pending_event_thread: None found.
    [Thread 0x7ffff7d9c700 (LWP 309357) exited]
      [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
      [infrun] print_target_wait_results:   -1.0.0 [process -1],
      [infrun] print_target_wait_results:   status->kind = no-resumed
      [infrun] handle_inferior_event: status->kind = no-resumed
      [infrun] handle_no_resumed: TARGET_WAITKIND_NO_RESUMED (ignoring: found resumed)
      [infrun] prepare_to_wait: prepare_to_wait
      [infrun] reset: reason=handling event
      [infrun] maybe_set_commit_resumed_all_targets: not requesting commit-resumed for target native, no resumed threads
    [infrun] fetch_inferior_event: exit

The problem is in handle_no_resumed: we check if some other thread is
actually resumed, to see if we should ignore that event (see comments in
that function for more info).  If this condition is true:

    (thread->executing () || thread->has_pending_waitstatus ())

... then we ignore the event.  The problem is that there are some non-resumed
threads with a pending event, which makes us ignore the event.  But these
threads are not resumed, so we end up waiting while nothing executes, hence
waiting for ever.

My first fix was to change the condition to:

    (thread->executing ()
     || (thread->resumed () && thread->has_pending_waitstatus ()))

... but then it occured to me that we could simply check for:

    (thread->resumed ())

Since "executing" implies "resumed", checking simply for "resumed"
covers threads that are resumed and executing, as well as threads that
are resumed with a pending status, which is what we want.

Change-Id: Ie796290f8ae7f34c026ca3a8fcef7397414f4780
2021-11-11 13:28:10 -05:00
Tom de Vries
fdf95218bc [gdb/build] Fix Wimplicit-exception-spec-mismatch in clang build
When building with clang 13 (and -std=gnu++17 to work around an issue in
string_view-selftests.c), we run into a few Wimplicit-exception-spec-mismatch
warnings:
...
src/gdbsupport/new-op.cc:102:1: error: function previously declared with an \
  explicit exception specification redeclared with an implicit exception \
  specification [-Werror,-Wimplicit-exception-spec-mismatch]
operator delete (void *p)
^
/usr/include/c++/11/new:130:6: note: previous declaration is here
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
     ^
...

These are due to recent commit 5fff6115fe "Fix
LD_PRELOAD=/usr/lib64/libasan.so.6 gdb".

Fix this by adding the missing noexcept.

Build on x86_64-linux, using gcc 7.5.0 and clang 13.0.0.
2021-11-11 11:22:39 +01:00
Tom de Vries
b038b53f1f [gdb/build] Fix build with -std=c++11
When building with -std=c++11, we run into two Werror=missing-declarations:
...
new-op.cc: In function 'void operator delete(void*, std::size_t)':
new-op.cc:114:1: error: no previous declaration for \
  'void operator delete(void*, std::size_t)' [-Werror=missing-declarations]
 operator delete (void *p, std::size_t) noexcept
 ^~~~~~~~
new-op.cc: In function 'void operator delete [](void*, std::size_t)':
new-op.cc:132:1: error: no previous declaration for \
  'void operator delete [](void*, std::size_t)' [-Werror=missing-declarations]
 operator delete[] (void *p, std::size_t) noexcept
 ^~~~~~~~
...

These are due to recent commit 5fff6115fe "Fix
LD_PRELOAD=/usr/lib64/libasan.so.6 gdb".

The declarations are provided by <new> (which is included) for c++14 onwards,
but they are missing for c++11.

Fix this by adding the missing declarations.

Tested on x86_64-linux, with gcc 7.5.0, both without (implying -std=gnu++14) and
with -std=c++11.
2021-11-11 11:22:39 +01:00
Tom de Vries
585d6e39eb [gdb/testsuite] Add gdb.arch/ppc64-break-on-_exit.exp
Add a regression test-case for commit a50bdb99af "[gdb/tdep, rs6000] Don't
skip system call in skip_prologue":
- set a breakpoint on a local copy of glibc's _exit, and
- verify that it triggers.

The test-case uses an assembly file by default, but also has the possibility
to use a C source file instead.

Tested on ppc64le-linux.  Verified that the test-case fails without
aforementioned commit, and passes with the commit.  Both with assembly
and C source.
2021-11-11 10:48:50 +01:00
Nelson Chu
f786c359c1 RISC-V: Dump objects according to the elf architecture attribute.
For now we should always generate the elf architecture attribute both for
elf and linux toolchains, so that we could dump the objects correctly
according to the generated architecture string.  This patch resolves the
problem that we probably dump an object with c.nop instructions, but
in fact the c extension isn't allowed.  Consider the following case,

nelson@LAPTOP-QFSGI1F2:~/test$ cat temp.s
.option norvc
.option norelax
.text
add     a0, a0, a0
.byte   0x1
.balign 16
nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-as temp.s -o temp.o
nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-objdump -d temp.o

temp.o:     file format elf32-littleriscv

Disassembly of section .text:

00000000 <.text>:
   0:   00a50533                add     a0,a0,a0
   4:   01                      .byte   0x01
   5:   00                      .byte   0x00
   6:   0001                    nop
   8:   00000013                nop
   c:   00000013                nop
nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-readelf -A temp.o
Attribute Section: riscv
File Attributes
  Tag_RISCV_arch: "rv32i2p0_m2p0_a2p0_f2p0_d2p0"

The c.nop at address 0x6 is generated for alignment, but since the rvc isn't
allowed for this object, dump it as a c.nop instruction looks wrong.  After
applying this patch, I get the following result,

nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-objdump -d temp.o

temp.o:     file format elf32-littleriscv

Disassembly of section .text:

00000000 <.text>:
   0:   00a50533                add     a0,a0,a0
   4:   01                      .byte   0x01
   5:   00                      .byte   0x00
   6:   0001                    .2byte  0x1
   8:   00000013                nop
   c:   00000013                nop

For the current objdump, we dump data to .byte/.short/.word/.dword, and
dump the unknown or unsupported instructions to .2byte/.4byte/.8byte, which
respectively are 2, 4 and 8 bytes instructions.  Therefore, we shouldn't
dump the 0x0001 as a c.nop instruction in the above case, we should dump
it to .2byte 0x1 as a unknown instruction, since the rvc is disabled.

However, consider that some people may use the new objdump to dump the old
objects, which don't have any elf attributes.  We usually set the default
architecture string to rv64g by bfd/elfxx-riscv.c:riscv_set_default_arch.
But this will cause rvc instructions to be unrecognized.  Therefore, we
set the default architecture string to rv64gc for disassembler, to keep
the previous behavior.

This patch pass the riscv-gnu-toolchain gcc/binutils regressions for
rv32emc-elf, rv32gc-linux, rv32i-elf, rv64gc-elf and rv64gc-linux
toolchains.  Also, tested by --enable-targets=all and can build
riscv-gdb successfully.

bfd/
	* elfnn-riscv.c (riscv_merge_arch_attr_info): Tidy the
	codes for riscv_parse_subset_t setting.
	* elfxx-riscv.c (riscv_get_default_ext_version): Updated.
	(riscv_subset_supports): Moved from gas/config/tc-riscv.c.
	(riscv_multi_subset_supports): Likewise.
	* elfxx-riscv.h: Added extern for riscv_subset_supports and
	riscv_multi_subset_supports.
gas/
	* config/tc-riscv.c (riscv_subset_supports): Moved to
	bfd/elfxx-riscv.c.
	(riscv_multi_subset_supports): Likewise.
	(riscv_rps_as): Defined for architectrue parser.
	(riscv_set_arch): Updated.
	(riscv_set_abi_by_arch): Likewise.
	(riscv_csr_address): Likewise.
	(reg_lookup_internal): Likewise.
	(riscv_ip): Likewise.
	(s_riscv_option): Updated.
	* testsuite/gas/riscv/mapping-04b.d: Updated.
	* testsuite/gas/riscv/mapping-norelax-03b.d: Likewise.
	* testsuite/gas/riscv/mapping-norelax-04b.d: Likewise.
opcodes/
	* riscv-dis.c: Include elfxx-riscv.h since we need the
	architecture parser.  Also removed the cpu-riscv.h, it
	is already included in elfxx-riscv.h.
	(default_isa_spec): Defined since the parser need this
	to set the default architecture string.
	(xlen): Moved out from riscv_disassemble_insn as a global
	variable, it is more convenient to initialize riscv_rps_dis.
	(riscv_subsets): Defined to recoed the supported
	extensions.
	(riscv_rps_dis): Defined for architectrue parser.
	(riscv_disassemble_insn): Call riscv_multi_subset_supports
	to make sure if the instructions are valid or not.
	(print_insn_riscv): Initialize the riscv_subsets by parsing
	the elf architectrue attribute.  Otherwise, set the default
	architectrue string to rv64gc.
2021-11-11 16:59:13 +08:00
Mike Frysinger
efe113047d sim: testsuite: drop sim_compile cover function
Most code isn't using this, and the only call site (in one cris file)
can use target_compile directly.  So switch it over to simplify.
2021-11-11 02:07:10 -05:00
Mike Frysinger
f0f2906ca0 sim: cris: stop testing a.out explicitly [ld/13900]
Since gcc dropped support for a.out starting with 4.4.0 in 2009, it's
been impossible to verify this code actually still works.  Since it
crashes in ld, and it uses a config option that no other tests uses
and we want to remove, drop the test to avoid all the trouble.
2021-11-11 00:38:53 -05:00
Mike Frysinger
40f6466678 sim: io: tweak compiler workaround with error output
Outputting an extra space broke a cris test.  Change the workaround
to use %s with an empty string to avoid the compiler warning but not
output an extra space.
2021-11-11 00:16:33 -05:00
Mike Frysinger
bebe33486c sim: testsuite: delete unused arm remote host logic
There's no need to sync testutils.inc with remote hosts.  The one
we have in the source tree is all we need and only thing we test.
Delete it to simplify.
2021-11-10 21:58:08 -05:00
Mike Frysinger
23ec4a527d sim: synacor: simplify test generation
Objcopy was used to create a binary file of just the executable code
since the environment requires code to based at address 0.  We can
accomplish the same thing with the -Ttext=0 flag, so switch to that
to get rid of custom logic.
2021-11-10 21:45:43 -05:00
GDB Administrator
2ec453b566 Automatic date update in version.in 2021-11-11 00:00:35 +00:00
Tom Tromey
0c7af29227 Handle PIE in .debug_loclists
Simon pointed out that my recent patches to .debug_loclists caused
some regressions.  After a brief discussion we realized it was because
his system compiler defaults to PIE.

This patch changes this code to unconditionally apply the text offset
here.  It also changes loclist_describe_location to work more like
dwarf2_find_location_expression.

I tested this by running the gdb.dwarf2 tests both with and without
-pie.
2021-11-10 12:16:40 -07:00
Przemyslaw Wirkus
14f458590a arm: enable Cortex-A710 CPU
This patch is adding support for Cortex-A710 CPU in Arm.

bfd/

	* cpu-arm.c (processors): Add cortex-a710.

gas/

	* NEWS: Update docs.
	* config/tc-arm.c (arm_cpus): Add cortex-a710 to -mcpu.
	* doc/c-arm.texi: Update docs.
	* testsuite/gas/arm/cpu-cortex-a710.d: New test.
2021-11-10 14:09:05 +00:00