Jan Beulich [Fri, 20 Jan 2023 09:18:40 +0000 (10:18 +0100)]
x86: split i386-gen's opcode hash entry struct
All glibc malloc() implementations I've checked have a smallest
allocation size worth of 3 pointers, with an increment worth of 2
pointers. Hence mnemonics with multiple templates can be stored more
efficiently when maintaining the shared "name" field only in the actual
hash entry. (To express the shared nature, also convert "name" to by
pointer-to-const.)
While doing the conversation also pull out common code from the involved
if/else construct in expand_templates().
Jan Beulich [Fri, 20 Jan 2023 09:18:17 +0000 (10:18 +0100)]
x86: embed register and alike names in disassembler
Register names are (including their nul terminators) on average almost 4
bytes long. Otoh no register name is longer than 8 bytes. Hence even for
32-bit builds using a pointer is only slightly more space efficient than
embedding the strings. A level of indirection can be also avoided by
embedding the names as an array of 8 characters directly in the arrays,
and the number of base relocations in libopcodes.so (or PIE builds of
statically linked executables) goes down as well.
To amortize for the otherwise reduced folding of string literals by the
linker, use att_names_seg[] in place of string literals in append_seg()
and OP_ESreg().
Jan Beulich [Fri, 20 Jan 2023 09:17:53 +0000 (10:17 +0100)]
x86: embed register names in reg_entry
Register names are (including their nul terminators) on average almost 4
bytes long. Otoh no register name is longer than 7 bytes. Hence even for
32-bit builds using a pointer is only slightly more space efficient than
embedding the strings. A level of indirection can be also avoided by
embedding the names as an array of 8 characters directly in the struct,
and the number of base relocations in PIE builds of gas goes down as
well.
Jan Beulich [Fri, 20 Jan 2023 09:17:23 +0000 (10:17 +0100)]
x86: avoid strcmp() in a few places
Now that we have identifiers for the mnemonic strings we can avoid
strcmp() in a number of places, comparing the offsets into the mnemonic
string table instead. While doing this also
- convert a leftover strncmp() to startswith() (apparently an oversight
when rebasing the original patch introducing the startswith() uses),
- use the new shorthand for current_templates->start also elsewhere in
md_assemble() (valid up to the point where match_template() is
called).
Jan Beulich [Fri, 20 Jan 2023 09:16:56 +0000 (10:16 +0100)]
x86: absorb allocation in i386-gen
When generating the mnemonic string table we already set up an
identifier for the following entry in a number of cases. Re-use that on
the next loop iteration rather than re-doing allocation and conversion.
Jan Beulich [Fri, 20 Jan 2023 09:16:17 +0000 (10:16 +0100)]
x86: re-use insn mnemonic strings as much as possible
Compact the mnemonic string table such that the tails of longer
mnemonics are re-used for shorter ones, going beyond what compilers
would typically do, but matching what ELF linkers may do when processing
SHF_MERGE|SHF_STRINGS sections. This reduces table size by about 12.5%.
Jan Beulich [Fri, 20 Jan 2023 09:15:48 +0000 (10:15 +0100)]
x86: move insn mnemonics to a separate table
Using full pointers to reference the insn mnemonic strings is not very
efficient. With overall string size presently just slightly over 20k,
even a 16-bit value would suffice. Use "unsigned int" for now, as
there's no good use we could presently make of the otherwise saved 16
bits.
For 64-bit builds this reduces table size by 6.25% (prior to the recent
ISA extension additions it would have been 12.5%), with a similar effect
on cache occupation of table entries accessed. For PIE builds of gas
this also reduces the number of base relocations quite a bit (obviously
independent of bitness).
Jan Beulich [Fri, 20 Jan 2023 09:14:46 +0000 (10:14 +0100)]
x86: abstract out obtaining of a template's mnemonic
In preparation for changing the representation of the "name" field
introduce a wrapper function. This keeps the mechanical change separate
from the functional one.
GDB Administrator [Fri, 20 Jan 2023 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 19 Jan 2023 18:26:53 +0000 (11:26 -0700)]
Use "maint ignore-probes" in no-libstdcxx-probe.exp
While looking at some test output, I saw that no-libstdcxx-probe.exp
was not being run. However, it occurred to me that Tom de Vries' new
"maint ignore-probes" command could be used to enable this test
unconditionally.
Reviewed-by: Tom de Vries <tdevries@suse.de>
Rainer Orth [Thu, 19 Jan 2023 21:48:58 +0000 (13:48 -0800)]
i386: Don't emit unsupported TLS relocs on Solaris
Emit R_386_TLS_LE and R_386_TLS_IE, instead of R_386_TLS_LE_32 and
R_386_TLS_IE_32, on Solaris.
PR ld/13671
* elf32-i386.c (elf_i386_tls_transition): Only emit R_386_TLS_LE,
R_386_TLS_IE on Solaris.
(elf_i386_relocate_section): Only use R_386_TLS_GD->R_386_TLS_LE
transition on Solaris.
Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Andrew Burgess [Thu, 19 Jan 2023 21:15:56 +0000 (21:15 +0000)]
GDB/testsuite: Expand for character string limiting options
Modify test cases that verify the operation of the array element limit
with character strings such that they are executed twice, once with the
`set print characters' option set to `elements' and the limit controlled
with the `set print elements' option, and then again with the limit
controlled with the `set print characters' option instead. Similarly
with the `-elements' and `-characters' options for the `print' command.
Additionally verify that said `print' command options combined yield the
expected result.
Verify correct $_gdb_setting and $_gdb_setting_str values for the `print
characters' setting, in particular the `void' value for the `elements'
default, which has no corresponding integer value exposed.
Add Guile and Python coverage for the `print characters' GDB setting.
There are new tests for Ada and Pascal, as the string printing code for
these languages is different than the generic string printing code used
by other languages. Modula2 also has different string printing code,
but (a) this is similar to Pascal, and (b) there are no existing modula2
tests written in Modula2, so I'm not sure how I'd even test the Modula2
string printing.
Co-Authored-By: Maciej W. Rozycki <macro@embecosm.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Andrew Burgess [Thu, 19 Jan 2023 21:15:56 +0000 (21:15 +0000)]
GDB: Add a character string limiting option
This commit splits the `set/show print elements' option into two. We
retain `set/show print elements' for controlling how many elements of an
array we print, but a new `set/show print characters' setting is added
which is used for controlling how many characters of a string are
printed.
The motivation behind this change is to allow users a finer level of
control over how data is printed, reflecting that, although strings can
be thought of as arrays of characters, users often want to treat these
two things differently.
For compatibility reasons by default the `set/show print characters'
option is set to `elements', which makes the limit for character strings
follow the setting of the `set/show print elements' option, as it used
to. Using `set print characters' with any other value makes the limit
independent from the `set/show print elements' setting, however it can
be restored to the default with the `set print characters elements'
command at any time.
A corresponding `-characters' option for the `print' command is added,
with the same semantics, i.e. one can use `elements' to make a given
`print' invocation follow the limit of elements, be it set with the
`-elements' option also given with the same invocation or taken from the
`set/show print elements' setting, for characters as well regardless of
the current setting of the `set/show print characters' option.
The GDB changes are all pretty straightforward, just changing references
to the old 'print_max' to use a new `get_print_max_chars' helper which
figures out which of the two of `print_max' and `print_max_chars' values
to use.
Likewise, the documentation is just updated to reference the new setting
where appropriate.
To make people's life easier the message shown by `show print elements'
now indicates if the setting also applies to character strings:
(gdb) set print characters elements
(gdb) show print elements
Limit on string chars or array elements to print is 200.
(gdb) set print characters unlimited
(gdb) show print elements
Limit on array elements to print is 200.
(gdb)
and the help text shows the dependency as well:
(gdb) help set print elements
Set limit on array elements to print.
"unlimited" causes there to be no limit.
This setting also applies to string chars when "print characters"
is set to "elements".
(gdb)
In the testsuite there are two minor updates, one to add `-characters'
to the list of completions now shown for the `print' command, and a bare
minimum pair of checks for the right handling of `set print characters'
and `show print characters', copied from the corresponding checks for
`set print elements' and `show print elements' respectively.
Co-Authored-By: Maciej W. Rozycki <macro@embecosm.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Maciej W. Rozycki [Thu, 19 Jan 2023 21:15:56 +0000 (21:15 +0000)]
GDB: Allow arbitrary keywords in integer set commands
Rather than just `unlimited' allow the integer set commands (or command
options) to define arbitrary keywords for the user to use, removing
hardcoded arrangements for the `unlimited' keyword.
Remove the confusingly named `var_zinteger', `var_zuinteger' and
`var_zuinteger_unlimited' `set'/`show' command variable types redefining
them in terms of `var_uinteger', `var_integer' and `var_pinteger', which
have the range of [0;UINT_MAX], [INT_MIN;INT_MAX], and [0;INT_MAX] each.
Following existing practice `var_pinteger' allows extra negative values
to be used, however unlike `var_zuinteger_unlimited' any number of such
values can be defined rather than just `-1'.
The "p" in `var_pinteger' stands for "positive", for the lack of a more
appropriate unambiguous letter, even though 0 obviously is not positive;
"n" would be confusing as to whether it stands for "non-negative" or
"negative".
Add a new structure, `literal_def', the entries of which define extra
keywords allowed for a command and numerical values they correspond to.
Those values are not verified against the basic range supported by the
underlying variable type, allowing extra values to be allowed outside
that range, which may or may not be individually made visible to the
user. An optional value translation is possible with the structure to
follow the existing practice for some commands where user-entered 0 is
internally translated to UINT_MAX or INT_MAX. Such translation can now
be arbitrary. Literals defined by this structure are automatically used
for completion as necessary.
So for example:
const literal_def integer_unlimited_literals[] =
{
{ "unlimited", INT_MAX, 0 },
{ nullptr }
};
defines an extra `unlimited' keyword and a user-visible 0 value, both of
which get translated to INT_MAX for the setting to be used with.
Similarly:
const literal_def zuinteger_unlimited_literals[] =
{
{ "unlimited", -1, -1 },
{ nullptr }
};
defines the same keyword and a corresponding user-visible -1 value that
is used for the requested setting. If the last member were omitted (or
set to `{}') here, then only the keyword would be allowed for the user
to enter and while -1 would still be used internally trying to enter it
as a part of a command would result in an "integer -1 out of range"
error.
Use said error message in all cases (citing the invalid value requested)
replacing "only -1 is allowed to set as unlimited" previously used for
`var_zuinteger_unlimited' settings only rather than propagating it to
`var_pinteger' type. It could only be used for the specific case where
a single extra `unlimited' keyword was defined standing for -1 and the
use of numeric equivalents is discouraged anyway as it is for historical
reasons only that they expose GDB internals, confusingly different
across variable types. Similarly update the "must be >= -1" Guile error
message.
Redefine Guile and Python parameter types in terms of the new variable
types and interpret extra keywords as Scheme keywords and Python strings
used to communicate corresponding parameter values. Do not add a new
PARAM_INTEGER Guile parameter type, however do handle the `var_integer'
variable type now, permitting existing parameters defined by GDB proper,
such as `listsize', to be accessed from Scheme code.
With these changes in place it should be trivial for a Scheme or Python
programmer to expand the syntax of the `make-parameter' command and the
`gdb.Parameter' class initializer to have arbitrary extra literals along
with their internal representation supplied.
Update the testsuite accordingly.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Indu Bhagat [Thu, 19 Jan 2023 20:40:44 +0000 (12:40 -0800)]
libsframe: Use AM_SILENT_RULES macro in configure.ac
Silence 'make' by default.
libsframe/
* configure.ac: Use AM_SILENT_RULES.
* configure: Regenerate.
Tom Tromey [Thu, 19 Jan 2023 18:08:06 +0000 (11:08 -0700)]
Remove some unused includes
I noticed a few spots that include gnu-stabs.h but that do not need
to. This patch removes these unnecessary includes. Tested by
rebuilding.
Tom de Vries [Thu, 19 Jan 2023 13:05:08 +0000 (14:05 +0100)]
[gdb/tdep, aarch64] Remove fp and sp reg aliases, add x31 reg alias
In aarch64-tdep.c we find these register aliases:
...
{
/* 64-bit register names. */
{"fp", AARCH64_FP_REGNUM},
{"lr", AARCH64_LR_REGNUM},
{"sp", AARCH64_SP_REGNUM},
...
The sp alias is superfluous, because the canonical name of x31 is already sp.
The fp alias is superfluous, because it's already taken by the default meaning
of fp, assigned here in _initialize_frame_reg:
...
user_reg_add_builtin ("fp", value_of_builtin_frame_fp_reg, NULL);
...
Fix this by removing the fp and sp aliases.
While we're at it, add an x31 alias for sp.
Approved-By: Luis Machado <luis.machado@arm.com>
Tested on aarch64-linux.
PR tdep/30012
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30012
Tom de Vries [Thu, 19 Jan 2023 12:44:13 +0000 (13:44 +0100)]
[gdb/testsuite] Fix gdb.python/py-value-cc.exp for big endian
On s390x-linux, I run into:
...
(gdb) python print(u[u_fields[0]])^M
99^M
(gdb) PASS: gdb.python/py-value-cc.exp: u's first field via field
python print(u[u_fields[1]])^M
0 '\000'^M
(gdb) FAIL: gdb.python/py-value-cc.exp: u's second field via field
...
There's a var u of this type:
...
union U {
int a;
char c;
};
...
and after assigning 99 to u.a, the test-case expects u.c to contain 99 (which
it does on x86_64), but instead it contains 0.
Fix this by instead assigning 0x63636363, to ensure that u.c == 99 for both
little and big endian.
Tested on x86_64-linux and s390x-linux.
Alan Modra [Wed, 18 Jan 2023 23:10:20 +0000 (09:40 +1030)]
Reinitialise macro_nest
* input-scrub.c (input_scrub_begin): Init macro_nest.
Alan Modra [Wed, 18 Jan 2023 23:04:56 +0000 (09:34 +1030)]
PR 30022, concurrent builds can fail
So let's not copy .libs/libbfd.a to libbfd.a now that nothing in the
binutils-gdb source tries to link against it.
PR 30022
* Makefile.am (noinst_LIBRARIES, libbfd_a_SOURCES, stamp-lib),
(libbfd.a): Delete rules.
(CLEANFILES): Adjust to suit.
Indu Bhagat [Thu, 19 Jan 2023 07:17:49 +0000 (23:17 -0800)]
toplevel: Makefile.def: add install-strip dependency on libsframe
As noted in PR libsframe/30014 - FTBFS: install-strip fails because
bfdlib relinks and fails to find libsframe, the install time
dependencies of libbfd need to be updated.
PR libsframe/30014
* Makefile.def: Reflect that libsframe needs to installed before
libbfd. Reorder a bit to better track libsframe dependencies.
* Makefile.in: Regenerate.
Alan Modra [Tue, 17 Jan 2023 11:23:00 +0000 (21:53 +1030)]
The fuzzers have found the reloc special functions in coff-aarch64.c
All of them need a bfd_reloc_offset_in_range check before accessing
data + reloc_entry->address. This patch adds the missing checks and
sanity checks reloc offsets in coff_pe_aarch64_relocate_section too.
All of them also need changing to support objdump -W calls to
bfd_simple_get_relocated_section_contents. At least, secrel_reloc
needs the support, the others might not be present in dwarf debug
sections.
* coff-aarch64.c (coff_aarch64_rel21_reloc): Range check
reloc offset. Support final-linking.
(coff_aarch64_po12l_reloc): Likewise.
(coff_aarch64_addr32nb_reloc): Likewise.
(coff_aarch64_secrel_reloc): Likewise.
(coff_pe_aarch64_relocate_section): Range check reloc offset.
Alan Modra [Sat, 14 Jan 2023 11:43:30 +0000 (22:13 +1030)]
Correct coff-aarch64 howtos and delete unnecessary special functions
The remaining special functions are still broken except when called
by gas bfd_install_relocation.
* coff-aarch64.c (coff_aarch64_addr64_reloc),
(coff_aarch64_addr32_reloc, coff_aarch64_branch26_reloc),
(coff_aarch64_branch19_reloc, coff_aarch64_branch14_reloc),
(coff_aarch64_po12a_reloc): Delete.
(HOWTO_INSTALL_ADDEND): Define as 1.
(HOW): Remove pcrel_off. Correct all the howtos.
(CALC_ADDEND): Define.
(coff_aarch64_rtype_to_howto): New function.
(coff_rtype_to_howto): Define.
Alan Modra [Fri, 13 Jan 2023 06:11:54 +0000 (16:41 +1030)]
coff-aarch64.c howtos
This is just a patch to fix overlong lines. Wrapping the HOWTO macro
in a new HOW macro helps in this. No functional changes here.
* coff-aarch64.c (HOW): Define and use for reloc howtos.
Alan Modra [Mon, 16 Jan 2023 02:19:03 +0000 (12:49 +1030)]
howto install_addend
This adds a new flag to the reloc howtos that can be used to
incrementally change targets over to simple bfd_install_relocation
that just installs the addend without any weird adjustments.
I've made a few other changes to bfd_install_relocation, removing dead
code and comments that are really only applicable to
bfd_perform_relocation.
There is also a reloc offset bounds check change. I've moved the
check to where data is accessed, as it seems reasonable to me to not
perform the check unless it is needed. There is precedence for this;
Relocations against absolute symbols already avoided the check.
I also tried always performing the reloc offset check, and ran into
testsuite failures due to _NONE and _ALIGN relocs at the end of
sections. These likely would be fixed if all such reloc howtos had
size set to zero, but I would rather not edit lots of files when it
involves checking that target code does not use the size.
* reloc.c (struct reloc_howto_struct): Add install_addend.
(HOWTO_INSTALL_ADDEND): Define.
(HOWTO): Init new field with HOWTO_INSTALL_ADDEND.
(bfd_install_relocation): Remove comments copied from
bfd_perform_relocation that aren't applicable here. Remove
code dealing with output_offset and output_section. Just set
relocation to addend if install_addend. Move reloc offset
bounds check to just before section data is accessed, avoiding
the check when data is not accessed.
* bfd-in2.h: Regenerate.
Mike Frysinger [Thu, 19 Jan 2023 01:14:54 +0000 (20:14 -0500)]
sim: info: convert verbose field to a bool
The verbose argument has always been an int treated as a bool, so
convert it to an explicit bool. Further, update the API docs to
match the reality that the verbose value is actually used by some
of the internal modules.
Mike Frysinger [Thu, 19 Jan 2023 00:26:58 +0000 (19:26 -0500)]
sim: unify sim-signal.o building
Now that sim-main.h has been reduced significantly, we can remove it
from sim-signal.c and unify it across all boards since it compiles to
the same code.
Mike Frysinger [Thu, 19 Jan 2023 00:11:38 +0000 (19:11 -0500)]
sim: v850: reduce extra header inclusion to igen files
Limit these extra header includes to only when specific igen files
include us until we can move the includes to the igen fils directly.
Mike Frysinger [Thu, 19 Jan 2023 00:07:19 +0000 (19:07 -0500)]
sim: v850: drop redundant define
This is already in v850/local.mk, so we can drop it from sim-main.h.
Mark Wielaard [Sun, 15 Jan 2023 19:24:06 +0000 (20:24 +0100)]
sim: mn10300: minimize mn10300-sim.h include in sim-main.h
sim-main.h is special since it is one of the files automatically
included in igen generated files. But this means anything including
sim-main.h might get everything included just for the igen files.
To prevent clashing symbols/defines only include sim-fpu.h,
sim-signal.h, mn10300-sim.h from sim-main.h if it is included
from one of the generated igen C files. Add explicit includes
of mn10300-sim.h, sim-fpu.h and/or sim-signal.h to dv-mn103cpu.c,
interp.c and op_utils.c.
GDB Administrator [Thu, 19 Jan 2023 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 18 Jan 2023 23:38:50 +0000 (23:38 +0000)]
GDB: Add references to erased args in cli-decode.c
Complement commit
1d7fe7f01b93 ("gdb: Introduce setting construct within
cmd_list_element") and commit
702991711a91 ("gdb: Have setter and getter
callbacks for settings") and update inline documentation accordingly for
`add_set_or_show_cmd' and `add_setshow_cmd_full_erased', documenting the
`args' parameter and removing references to `var', `set_setting_func'
and `get_setting_func'.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Maciej W. Rozycki [Wed, 18 Jan 2023 23:23:00 +0000 (23:23 +0000)]
GDB: Add missing inline documentation for `add_setshow_cmd_full'
Complement commit
1d7fe7f01b93 ("gdb: Introduce setting construct
within cmd_list_element") and add missing description for
`add_setshow_cmd_full'.
Maciej W. Rozycki [Wed, 18 Jan 2023 23:23:00 +0000 (23:23 +0000)]
GDB: Correct inline documentation for `add_setshow_cmd_full_erased'
Use proper English in the description of SET_LIST and SHOW_LIST.
Maciej W. Rozycki [Wed, 18 Jan 2023 21:54:37 +0000 (21:54 +0000)]
GDB: Fix documentation for `theclass' parameters in cli-decode.c
Rename CLASS to THECLASS in the documentation for `theclass' parameters
throughout cli-decode.c, complementing commit
fe978cb071b4 ("C++ keyword
cleanliness, mostly auto-generated").
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Tom Tromey [Fri, 23 Dec 2022 20:28:20 +0000 (13:28 -0700)]
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
Carl Love [Wed, 18 Jan 2023 16:13:17 +0000 (11:13 -0500)]
Revert "X86: reverse-finish fix"
This reverts commit
b22548ddb30bfb167708e82d3bb932461c1b703a.
This patch is being reverted since the patch series is causing regressions.
Carl Love [Wed, 18 Jan 2023 16:12:13 +0000 (11:12 -0500)]
Revert "PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp"
This reverts commit
92e07580db6a5572573d5177ca23933064158f89.
Reverting patch as the patch series is causing regressions.
Jan Vrany [Wed, 18 Jan 2023 11:34:37 +0000 (11:34 +0000)]
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 ().
Nick Clifton [Wed, 18 Jan 2023 11:32:21 +0000 (11:32 +0000)]
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.
Mike Frysinger [Wed, 18 Jan 2023 04:21:31 +0000 (23:21 -0500)]
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.
Mark Harmstone [Wed, 11 Jan 2023 18:32:04 +0000 (18:32 +0000)]
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.
Vladimir Mezentsev [Wed, 18 Jan 2023 02:53:38 +0000 (18:53 -0800)]
Revert "gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'"
This reverts commit
c2a5d74050ea9d7897b4122ef57c627d395683b3.
GDB Administrator [Wed, 18 Jan 2023 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 17 Jan 2023 19:45:11 +0000 (12:45 -0700)]
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.
Tom Tromey [Tue, 17 Jan 2023 18:45:40 +0000 (11:45 -0700)]
Use require in paramless.exp
The new paramless.exp test was not converted to the new "require"
approach. This patch fixes the problem.
Carl Love [Fri, 13 Jan 2023 22:59:33 +0000 (17:59 -0500)]
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.
Carl Love [Mon, 19 Dec 2022 17:48:54 +0000 (12:48 -0500)]
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
Simon Marchi [Sat, 14 Jan 2023 01:08:41 +0000 (20:08 -0500)]
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>
Tom Tromey [Wed, 14 Dec 2022 21:37:41 +0000 (14:37 -0700)]
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
Tom Tromey [Thu, 15 Dec 2022 16:38:05 +0000 (09:38 -0700)]
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.
Tom Tromey [Wed, 14 Dec 2022 14:20:49 +0000 (07:20 -0700)]
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.
Tom Tromey [Tue, 13 Dec 2022 19:03:34 +0000 (12:03 -0700)]
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.
Stam Markianos-Wright [Tue, 17 Jan 2023 13:37:40 +0000 (13:37 +0000)]
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
Stam Markianos-Wright [Tue, 17 Jan 2023 12:57:47 +0000 (12:57 +0000)]
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.
Nick Clifton [Tue, 17 Jan 2023 12:55:33 +0000 (12:55 +0000)]
Fix snafu in previous delta for elf32-csky.c
Xianmiao Qu [Tue, 17 Jan 2023 11:43:16 +0000 (11:43 +0000)]
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.
GDB Administrator [Tue, 17 Jan 2023 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in
Enze Li [Sat, 14 Jan 2023 03:33:48 +0000 (11:33 +0800)]
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.
Alan Modra [Sat, 14 Jan 2023 11:42:48 +0000 (22:12 +1030)]
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.
Alan Modra [Sat, 14 Jan 2023 11:43:54 +0000 (22:13 +1030)]
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.
Alan Modra [Mon, 16 Jan 2023 10:05:33 +0000 (20:35 +1030)]
Leftover hack from i960-coff
* reloc.c (bfd_perform_relocation, bfd_install_relocation): Remove
i960-coff target hack.
Alan Modra [Mon, 16 Jan 2023 04:53:21 +0000 (15:23 +1030)]
COFF CALC_ADDEND comment
Old COFF (and AOUT) targets have unusual relocation addends.
* coffcode.h (<Reading relocations>): Describe COFF addends.
Alan Modra [Thu, 12 Jan 2023 23:09:19 +0000 (09:39 +1030)]
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.
Nick Clifton [Mon, 16 Jan 2023 11:31:39 +0000 (11:31 +0000)]
Update release making howto
Nick Clifton [Mon, 16 Jan 2023 10:45:38 +0000 (10:45 +0000)]
Updated translations for the gas and binutils sub-directories
Mike Frysinger [Mon, 16 Jan 2023 09:42:47 +0000 (04:42 -0500)]
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.
Mike Frysinger [Mon, 16 Jan 2023 09:35:48 +0000 (04:35 -0500)]
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.
Mike Frysinger [Mon, 16 Jan 2023 09:22:10 +0000 (04:22 -0500)]
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.
Mike Frysinger [Mon, 16 Jan 2023 01:48:28 +0000 (20:48 -0500)]
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.
GDB Administrator [Mon, 16 Jan 2023 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Mark Wielaard [Sat, 14 Jan 2023 21:54:20 +0000 (22:54 +0100)]
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.
Mike Frysinger [Sun, 15 Jan 2023 07:05:06 +0000 (02:05 -0500)]
sim: m32r: fix typos in stamp depends
Copying & pasting the first rule missed updating the dep to the right
stamp file.
Mike Frysinger [Sun, 15 Jan 2023 02:55:31 +0000 (21:55 -0500)]
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).
Mike Frysinger [Tue, 3 Jan 2023 00:08:14 +0000 (19:08 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 05:11:00 +0000 (00:11 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 21:46:14 +0000 (16:46 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 19:38:01 +0000 (14:38 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 19:34:52 +0000 (14:34 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 19:15:02 +0000 (14:15 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 05:08:56 +0000 (00:08 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 05:06:34 +0000 (00:06 -0500)]
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.
Mike Frysinger [Mon, 2 Jan 2023 04:02:28 +0000 (23:02 -0500)]
sim: build: drop AM_MAKEFLAGS settings
We don't have any recursive builds anymore, so we can drop this logic.
GDB Administrator [Sun, 15 Jan 2023 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 14 Jan 2023 19:42:30 +0000 (12:42 -0700)]
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.
Nick Clifton [Sat, 14 Jan 2023 15:37:20 +0000 (15:37 +0000)]
Update how-to-make-a-release file now that the 2.40 release is out
GDB Administrator [Sat, 14 Jan 2023 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Mon, 2 Jan 2023 03:58:35 +0000 (22:58 -0500)]
sim: build: delete Make-common.in logic
Now that all (other than ppc) build in the top-level, this logic is
unused, so punt it all.
Tom Tromey [Sun, 8 Jan 2023 19:42:29 +0000 (12:42 -0700)]
Rename to allow_tui_tests
This changes skip_tui_tests to invert the sense, and renames it to
allow_tui_tests. It also rewrites this function to use the output of
"gdb --configuration", and it adds a note about the state of the TUI
to that output.
Tom Tromey [Sun, 8 Jan 2023 19:01:33 +0000 (12:01 -0700)]
Rename to allow_guile_tests
This changes skip_guile_tests to invert the sense, and renames it to
allow_guile_tests. It also rewrites this proc to check the output of
"gdb --configuration", as was done for Python. Then it changes the
code to use "require" where possible.
Tom Tromey [Sun, 8 Jan 2023 18:54:47 +0000 (11:54 -0700)]
Rename to allow_hw_breakpoint_tests
This changes skip_hw_breakpoint_tests to invert the sense, and renames
it to allow_hw_breakpoint_tests. This also converts some tests to use
"require" -- I missed this particular check in the first series.
Tom Tromey [Sun, 8 Jan 2023 18:48:57 +0000 (11:48 -0700)]
Rename to allow_tsx_tests
This changes skip_tsx_tests to invert the sense, and renames it to
allow_tsx_tests.
Tom Tromey [Sun, 8 Jan 2023 18:47:51 +0000 (11:47 -0700)]
Rename to allow_shlib_tests
This changes skip_shlib_tests to invert the sense, and renames it to
allow_shlib_tests.
Tom Tromey [Sun, 8 Jan 2023 18:46:36 +0000 (11:46 -0700)]
Rename to allow_rust_tests
This changes skip_rust_tests to invert the sense, and renames it to
allow_rust_tests.
Tom Tromey [Sun, 8 Jan 2023 18:46:05 +0000 (11:46 -0700)]
Rename to allow_python_tests
This changes skip_python_tests to invert the sense, and renames it to
allow_python_tests.
Tom Tromey [Sun, 8 Jan 2023 18:43:09 +0000 (11:43 -0700)]
Rename to allow_perf_tests
This changes skip_perf_tests to invert the sense, and renames it to
allow_perf_tests.
Tom Tromey [Sun, 8 Jan 2023 18:42:26 +0000 (11:42 -0700)]
Rename to allow_opencl_tests
This changes skip_opencl_tests to invert the sense, and renames it to
allow_opencl_tests.
Tom Tromey [Sun, 8 Jan 2023 18:41:19 +0000 (11:41 -0700)]
Rename to allow_ifunc_tests
This changes skip_ifunc_tests to invert the sense, and renames it to
allow_ifunc_tests.
Tom Tromey [Sun, 8 Jan 2023 18:40:32 +0000 (11:40 -0700)]
Rename to allow_hw_watchpoint_tests
This changes skip_hw_watchpoint_tests to invert the sense, and renames
it to allow_hw_watchpoint_tests.
Tom Tromey [Sun, 8 Jan 2023 17:57:35 +0000 (10:57 -0700)]
Rename to allow_hw_watchpoint_multi_tests
This changes skip_hw_watchpoint_multi_tests to invert the sense, and
renames it to allow_hw_watchpoint_multi_tests.