Commit Graph

113022 Commits

Author SHA1 Message Date
Tom Tromey
bd3014572d Fix 'make TAGS' in gdbserver
PR build/29003 points out that "make TAGS" is broken in gdbserver.
This patch fixes the problem that is pointed out there, plus another
one I noticed while working on that -- namely that the "sed" computes
the wrong names for some source files.  Finally, a couple of obsolete
variable references are removed.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29003
2023-01-18 11:12:20 -07:00
Carl Love
b986eec55f Revert "X86: reverse-finish fix"
This reverts commit b22548ddb3.

This patch is being reverted since the patch series is causing regressions.
2023-01-18 11:13:17 -05:00
Carl Love
15d2b36c5b Revert "PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp"
This reverts commit 92e07580db.

Reverting patch as the patch series is causing regressions.
2023-01-18 11:12:13 -05:00
Jan Vrany
722e0dd9e4 gdb: care for dynamic objfiles in build_id_bfd_get ()
Accessing gdb.Objfile.build_id caused GDB to crash when objfile is
dynamic, that is created by JIT reader API.

The issue was NULL-pointer dereferencing in build_id_bfd_get () because
dynamic objfiles have no underlaying BFD structure. This commit fixes
the problem by a NULL-check in build_id_bfd_get ().
2023-01-18 11:34:37 +00:00
Nick Clifton
94e76498c3 Speed up objcopy's note merging.
PR 29993
  * objcopy.c (merge_gnu_build_notes): Remember the last non-deleted note in order to speed up the scan for matching notes.
2023-01-18 11:32:21 +00:00
Mike Frysinger
1b1be68b9b sim: ppc: drop local psim link
This has never been installed, and it's not clear anyone cares about
it in the local build dir (when the main program is sim/ppc/run), so
drop all the logic to simplify.
2023-01-17 23:29:23 -05:00
Mark Harmstone
87a5cf5c0e Use subsystem to distinguish between pei-arm-little and pei-arm-wince-little
Running objdump against a 32-bit ARM PE file currently needs
disambiguation, as it gets picked up by both pei-arm-little and
pei-arm-wince-little.

This adds a check in pe_bfd_object_p so that the subsystem in the PE
header is used to do the disambiguation for us, so that WinCE images get
assigned to pei-arm-wince-little, and everything else to pei-arm-little.
2023-01-18 03:56:35 +00:00
Vladimir Mezentsev
47f72fdba3 Revert "gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'"
This reverts commit c2a5d74050.
2023-01-17 19:10:22 -08:00
GDB Administrator
493ca3758b Automatic date update in version.in 2023-01-18 00:00:17 +00:00
Tom Tromey
2c01dcdb5a Remove two unused fields from gdbarch
When I converted gdbarch to use the registry, I forgot to remove the
two fields that were used to implement the previous approach.  This
patch removes them.  Tested by rebuilding.
2023-01-17 12:45:11 -07:00
Tom Tromey
ef497b7411 Use require in paramless.exp
The new paramless.exp test was not converted to the new "require"
approach.  This patch fixes the problem.
2023-01-17 11:47:21 -07:00
Carl Love
92e07580db PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp
PR record/29927 - reverse-finish requires two reverse next instructions to
reach previous source line

PowerPC uses two entry points called the local entry point (LEP) and the
global entry point (GEP).  Normally the LEP is used when calling a
function.  However, if the table of contents (TOC) value in register 2 is
not valid the GEP is called to setup the TOC before execution continues at
the LEP.  When executing in reverse, the function finish_backward sets the
break point at the alternate entry point (GEP).  However if the forward
execution enters via the normal entry point (LEP), the reverse execution
never sees the break point at the GEP of the function.  Reverse execution
continues until the next break point is encountered or the end of the
recorded log is reached causing gdb to stop at the wrong place.

This patch adds a new address to struct execution_control_state to hold the
address of the alternate function start address, known as the GEP on
PowerPC.  The finish_backwards function is updated.  If the stopping point
is between the two entry points (the LEP and GEP on PowerPC), the stepping
range is set to execute back to the alternate entry point (GEP on PowerPC).
Otherwise, a breakpoint is inserted at the normal entry point (LEP on
PowerPC).

Function process_event_stop_test checks uses a stepping range to stop
execution in the caller at the first instruction of the source code line.
Note, on systems that only support one entry point, the address of the two
entry points are the same.

Test finish-reverse-next.exp is updated to include tests for the
reverse-finish command when the function is entered via the normal entry
point (i.e. the LEP) and the alternate entry point (i.e. the GEP).

The patch has been tested on X86 and PowerPC with no regressions.
2023-01-17 11:39:42 -05:00
Carl Love
b22548ddb3 X86: reverse-finish fix
PR record/29927  - reverse-finish requires two reverse next instructions to
reach previous source line

Currently on X86, when executing the finish command in reverse, gdb does a
single step from the first instruction in the callee to get back to the
caller.  GDB stops on the last instruction in the source code line where
the call was made.  When stopped at the last instruction of the source code
line, a reverse next or step command will stop at the first instruction
of the same source code line thus requiring two step/next commands to
reach the previous source code line.  It should only require one step/next
command to reach the previous source code line.

By contrast, a reverse next or step command from the first line in a
function stops at the first instruction in the source code line where the
call was made.

This patch fixes the reverse finish command so it will stop at the first
instruction of the source line where the function call was made.  The
behavior on X86 for the reverse-finish command now matches doing a
reverse-next from the beginning of the function.

The proceed_to_finish flag in struct thread_control_state is no longer
used.  This patch removes the declaration, initialization and setting of
the flag.

This patch requires a number of regression tests to be updated.  Test
gdb.mi/mi-reverse.exp no longer needs to execute two steps to get to the
previous line.  The gdb output for tests gdb.reverse/until-precsave.exp
and gdb.reverse/until-reverse.exp changed slightly.  The expected result in
tests gdb.reverse/amd64-failcall-reverse.exp and
gdb.reverse/singlejmp-reverse.exp are updated to the correct expected
result.

This patch adds a new test gdb.reverse/finish-reverse-next.exp to test the
reverse-finish command when returning from the entry point and from the
body of the function.

The step_until proceedure in test gdb.reverse/step-indirect-call-thunk.exp
was moved to lib/gdb.exp and renamed cmd_until.

The patch has been tested on X86 and PowerPC to verify no additional
regression failures occured.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29927
2023-01-17 11:39:32 -05:00
Simon Marchi
4e2a80ba60 gdb/testsuite: expect SIGSEGV from top GDB spawn id
When testing with the native-extended-gdbserver, I get:

    Thread 1 "xgdb" received signal SIGSEGV, Segmentation fault.
    0x00007ffff6d828f2 in GC_find_limit_with_bound () from /usr/lib/x86_64-linux-gnu/libgc.so.1
    (gdb) FAIL: gdb.gdb/selftest.exp: xgdb is at prompt

This is because the -re that is supposed to match this SIGSEGV is after
`-i $inferior_spawn_id`.  On native, the top and bottom GDB are on the
same spawn id, so it ends up working.  But with a gdbserver board,
that's not the case.  Move the SIGSEGV -re before the `-i
$inferior_spawn_id` line, such that it matches what the top GDB outputs.

Do the same fix in gdb.gdb/python-helper.exp.

Change-Id: I3291630e218a5a3a6a47805b999ddbc9b968c927
Approved-By: Tom Tromey <tom@tromey.com>
2023-01-17 11:22:22 -05:00
Tom Tromey
ac37b79cc4 Fix parameter-less template regression in new DWARF reader
PR c++/29896 points out a regression in the new DWARF reader.  It does
not properly handle a case like "break fn", where "fn" is a template
function.

This happens because the new index uses strncasecmp to compare.
However, to make this work correctly, we need a custom function that
ignores template parameters.

This patch adds a custom comparison function and fixes the bug.  A new
test case is included.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29896
2023-01-17 07:03:26 -07:00
Tom Tromey
5a89072f36 Move hash_entry and eq_entry into cooked_index::do_finalize
I was briefly confused by the hash_entry and eq_entry functions in the
cooked index.  They are only needed in a single method, and that
method already has a couple of local lambdas for a different hash
table.  So, it seemed cleaner to move these there as well.
2023-01-17 07:03:26 -07:00
Tom Tromey
1a6191f1a6 Don't erase empty indices in DWARF reader
The DWARF reader has some code to remove empty indices.  However, I
think this code has been obsolete since some earlier changes to
parallel_for_each.  This patch removes this code.
2023-01-17 07:03:26 -07:00
Tom Tromey
63078a0498 Avoid submitting empty tasks in parallel_for_each
I found that parallel_for_each would submit empty tasks to the thread
pool.  For example, this can happen if the number of tasks is smaller
than the number of available threads.  In the DWARF reader, this
resulted in the cooked index containing empty sub-indices.  This patch
arranges to instead shrink the result vector and process the trailing
entries in the calling thread.
2023-01-17 07:03:26 -07:00
Stam Markianos-Wright
55e0daa3a3 gas: arm: Change warning message to not reference specific A-class architecture revision
We noticed that a warning message about the use of scalar fp16
instructions being UNPREDICTABLE when conditionalized in an IT
block referenced the specific A-class architecture revision
ARMv8.2-A.
Many of these instructions are now also part of ARMv8.1-M, so
the warning message had become misleading.  Here we just change
the message to not specify an architecture revision at all and
update all testing accordingly.  This was done with a simple
find-n-replace within the binutils sources.  No tests have
regressed for the arm target.

gas/ChangeLog:

        * config/tc-arm.c (do_scalar_fp16_v82_encode): Remove
        ARMv8.2-A from the warning message.
        (do_neon_movhf): Likewise
        * testsuite/gas/arm/armv8-2-fp16-scalar-bad.l: Likewise
        * testsuite/gas/arm/mve-vaddsub-it-bad.l: Likewise
        * testsuite/gas/arm/mve-vcvtne-it-bad.l: Likewise
        * testsuite/gas/arm/mve-vcvtne-it.d: Likewise
2023-01-17 13:38:47 +00:00
Stam Markianos-Wright
656412a7a4 gas: arm: Fix a further IT-predicated vcvt issue in the presense of MVE vcvtn
Previously we had experienced issues with assembling a "VCVTNE" instruction
in the presence of the MVE architecture extension, because it could be
interpreted both as:

* The base instruction VCVT + NE for IT predication when inside an IT block.
* The MVE instruction VCVTN + E in the Else of a VPT block.

Given a C reproducer of:
```
int test_function(float value)
{
  int ret_val = 10;
  if (value != 0.0)
  {
    ret_val = (int) value;
  }
  return ret_val;
}
```
GCC generates a VCVTNE instruction based on the `truncsisf2_vfp`
pattern, which will look like:
`vcvtne.s32.f32 s-reg, s-reg`
This still triggers an error due to being misidentified as "vcvtn+e"
Similar errors were found with other type combinations and instruction
patterns (these have all been added to the testing of this patch).

This class of errors was previously worked around by:
https://sourceware.org/pipermail/binutils/2020-August/112728.html
which addressed this by looking at the operand types, however,
that isn't adequate to cover all the extra cases that have been
found.  Instead, we add some special-casing logic earlier when
the instructions are parsed that is conditional on whether we are
in a VPT block or not, when the instruction is parsed.

gas/ChangeLog:

	* config/tc-arm.c (opcode_lookup): Add special vcvtn handling.
	* testsuite/gas/arm/mve-vcvtne-it-bad.l: Add further testing.
	* testsuite/gas/arm/mve-vcvtne-it-bad.s: Likewise.
	* testsuite/gas/arm/mve-vcvtne-it.d: Likewise.
	* testsuite/gas/arm/mve-vcvtne-it.s: Likewise.
2023-01-17 13:38:47 +00:00
Nick Clifton
13023445a3 Fix snafu in previous delta for elf32-csky.c 2023-01-17 12:55:33 +00:00
Xianmiao Qu
fd1b3e0e8d C-SKY: Fix machine flag.
* elf32-csky.c (elf32_csky_merge_attributes): Don't save and restore the ARCH attribute, it will actually clear the ARCH attribute. (csky_elf_merge_private_bfd_data): Store the machine flag correctly.
2023-01-17 11:43:16 +00:00
GDB Administrator
1609cd6c5b Automatic date update in version.in 2023-01-17 00:00:36 +00:00
Enze Li
24669c55ae libctf: update regexp to allow makeinfo to build document
While trying to build gdb on latest openSUSE Tumbleweed, I noticed the
following warning,

 checking for makeinfo... makeinfo --split-size=5000000
 configure: WARNING:
 *** Makeinfo is too old. Info documentation will not be built.

then I checked the version of makeinfo, it said,
======
$ makeinfo --version
texi2any (GNU texinfo) 7.0.1

Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
======

After digging a little bit, it became quite obvious that a dot is
missing in regexp that makes it impossible to match versions higher than
7.0, and here's the solution:

-       | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9][0-9])' >/dev/null 2>&1; then
+       | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9]\.[0-9])' >/dev/null 2>&1; then

However, Eli pointed out that the solution above has another problem: it
will stop working when Texinfo 10.1 will be released.  Meanwhile, he
suggested to solve this problem permanently.  That is, we don't care
about the minor version for Texinfo > 6.9, we only care about the major
version.

In this way, the problem will be resolved permanently, thanks to Eli.

libctf/ChangeLog:

	* configure: Regenerated.
	* configure.ac: Update regexp to match versions higher than 7.0.
2023-01-16 23:18:38 +08:00
Alan Modra
5293666148 Correct ld-pe/aarch64.d test output
"foo" is at 0x2010.  This corrects the expected output for .long and
.word referencing foo, showing a problem with relocation handling.

	* testsuite/ld-pe/aarch64.d: Correct expected output.
2023-01-16 23:25:32 +10:30
Alan Modra
6eb099ae93 Tidy gas/expr.c static state
* expr.c (seen, nr_seen): Make file scope.
	(expr_begin): Clear seen, nr_seen, and expr_symbol_lines.
	(expr_end): New function.
	* expr.h (expr_end): Declare.
	* output-file.c (output_file_close): Call expr_end.
	* config/tc-hppa.c (expr_end): Rename to expr_parse_end.
	* config/tc-mips.c: Likewise.
	* config/tc-riscv.c: Likewise.
	* config/tc-sparc.c: Likewise.
2023-01-16 23:25:32 +10:30
Alan Modra
6e4b74e9a9 Leftover hack from i960-coff
* reloc.c (bfd_perform_relocation, bfd_install_relocation): Remove
	i960-coff target hack.
2023-01-16 23:25:32 +10:30
Alan Modra
4a3ab0855d COFF CALC_ADDEND comment
Old COFF (and AOUT) targets have unusual relocation addends.

	* coffcode.h (<Reading relocations>): Describe COFF addends.
2023-01-16 23:25:26 +10:30
Alan Modra
5999477d92 PR29991, MicroMIPS flag erased after align directives
PR 29991
	* config/tc-mips.c (s_align): Call file_mips_check_options and
	mips_mark_labels.
	* testsuite/gas/mips/align-after-label.s,
	* testsuite/gas/mips/mips-align-after-label.d,
	* testsuite/gas/mips/micromips-align-after-label.d: New test.
	* testsuite/gas/mips/mips.exp: Run it.
2023-01-16 23:22:48 +10:30
Nick Clifton
f75c8fc014 Update release making howto 2023-01-16 11:31:39 +00:00
Nick Clifton
69373ba164 Updated translations for the gas and binutils sub-directories 2023-01-16 10:45:38 +00:00
Mike Frysinger
da8c966399 sim: assume sys/stat.h always exists (via gnulib)
We have many uses of sys/stat.h that are unprotected by HAVE_SYS_STAT_H,
so this is more formalizing the reality that we require this header.
Since we switched to gnulib, it guarantees that a sys/stat.h exists
for us to include, so we're doubly OK.
2023-01-16 04:42:47 -05:00
Mike Frysinger
4cd7de783b sim: formally assume unistd.h always exists (via gnulib)
We have many uses of unistd.h that are unprotected by HAVE_UNISTD_H,
so this is more formalizing the reality that we require this header.
Since we switched to gnulib, it guarantees that a unistd.h exists
for us to include, so we're doubly OK.
2023-01-16 04:35:48 -05:00
Mike Frysinger
e9bf6a4a20 sim: build: stop probing system extensions (ourselves)
This logic was added in order to expose the strsignal prototype for
nrun.c.  Since then, we've migrated to gnulib as our portability layer,
and it takes care of probing system extensions for us, so there's no
need to duplicate the work.
2023-01-16 04:22:10 -05:00
Mike Frysinger
109a0a7e90 sim: modules.c: fix generation after recent refactors
Add explicit arch-specific modules.c rules to keep the build from
generating an incorrect common/modules.c.  Otherwise the pattern
rules would cascade such that it'd look for $arch/modules.o which
turned into common/modules.c which triggered the gen rule.

My local testing of this code didn't catch this bug because of how
Automake manages .Po (dependency files) in incremental builds -- it
was adding extra rules that override the pattern rules which caused
the build to generate correct modules.c files.  But when building
from a cold cache, the pattern rules would force common/modules.c to
be used leading to crashes at runtime.
2023-01-15 20:55:48 -05:00
GDB Administrator
8cf531c3db Automatic date update in version.in 2023-01-16 00:00:08 +00:00
Mark Wielaard
ad6adc6657 sim: microblaze, mn10300: remove signal.h include in interp.c
signal.h isn't needed in microblaze and mn10300 interp.c
so don't include it.
2023-01-15 18:45:07 +01:00
Mike Frysinger
2025c82b95 sim: m32r: fix typos in stamp depends
Copying & pasting the first rule missed updating the dep to the right
stamp file.
2023-01-15 02:07:44 -05:00
Mike Frysinger
9a7472d7c5 sim: igen: simplify build logic a little
Now that all ports (that use igen) build in the top-level and depend
on igen, we can move the conditional logic out of configure.  We also
switch from noinst_LIBRARIES to EXTRA_LIBRARIES so that the library
is only built when needed (i.e. the igen tool is used).
2023-01-15 02:07:43 -05:00
Mike Frysinger
eaa13962f2 sim: build: drop depdir subdir hack
Now that all the ports compile some C files in their arch dirs, Automake
guarantees creating the depdir for us, so we can drop our configure hack.
2023-01-14 21:02:12 -05:00
Mike Frysinger
1b907fc09f sim: common: simplify modules.c deps
Now that all ports (other than ppc) build in the top-level, we don't
need to expand all the modules.c targets as a recursive dep.  Each
port depends on their respective file now, and the ppc port doesn't
use it at all.
2023-01-14 21:01:33 -05:00
Mike Frysinger
72be276fff sim: common: move modules.c to source tracking
This makes sure the arch-specific modules.c wildcard is matched and
not the common/%.c so that we compile it correctly.  It also makes
sure each subdir has depdir logic enabled.
2023-01-14 20:53:13 -05:00
Mike Frysinger
4df7470704 sim: common: move libcommon.a dep to ppc code
Rather than force this to be built ahead of time for all targets,
move the dep to the ppc code since it's the only user of it now.
2023-01-14 20:51:53 -05:00
Mike Frysinger
ee3134d028 sim: build: drop most recursive build deps
Now that we build these objects in the top dir & generate modules.c
there, we don't need to generate them all first -- we can let the
normal dependency graph take care of building things in parallel.
2023-01-14 20:50:36 -05:00
Mike Frysinger
eac2fbdc4b sim: common: move libcommon.a objects to sources
This simplifies the build logic and avoids an Automake bug where the
common_libcommon_a_OBJECTS variable isn't set in the arch libsim.a
DEPENDENCIES for targets that, alphabetically, come before "common".
We aren't affected by that bug with the current code, but as we move
things out of SIM_ALL_RECURSIVE_DEPS and rely on finer dependencies,
we will trip over it.
2023-01-14 20:48:49 -05:00
Mike Frysinger
0e7c397dbf sim: igen: simplify build dep
Now that all ports (other than ppc) build in the top-level, we don't
need to mark the igen tool as a recursive dep.  Each port depends on
the tool if it actually uses it, and ppc doesn't use it at all.
2023-01-14 20:46:00 -05:00
Mike Frysinger
49444feaef sim: common: simplify hw-config.h deps
Now that all ports (other than ppc) build in the top-level, we don't
need to expand all the hw-config.h targets as a recursive dep.  Each
port depends on their respective header now, and the ppc port doesn't
use it at all.
2023-01-14 20:44:40 -05:00
Mike Frysinger
068b723abc sim: build: drop AM_MAKEFLAGS settings
We don't have any recursive builds anymore, so we can drop this logic.
2023-01-14 20:41:24 -05:00
GDB Administrator
936b119d43 Automatic date update in version.in 2023-01-15 00:00:45 +00:00
Tom Tromey
856cd0786c Pass internal gdb flags to --configuration invocations
The test suite uses the --configuration flag to feature-test gdb.
However, when I added this, I neglected to pass the internal gdbflags
to this, causing an error, which then caused failures in the test
suite (which would not be seen if you'd ever run "make install").

This patch fixes the bug.  Tested by removing my install tree first,
to verify that I could reproduce the failure.
2023-01-14 12:47:17 -07:00