binutils-gdb.git
12 months agosvp64: sync specifiers svp64-nopr
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
svp64: sync specifiers

12 months agoppc/svp64: support optional operands disassembly
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: support optional operands disassembly

12 months agoppc/svp64: disassemble branch mode
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: disassemble branch mode

12 months agoppc/svp64: disassemble CR op mode
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: disassemble CR op mode

12 months agoppc/svp64: disassemble ld/st idx mode
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: disassemble ld/st idx mode

12 months agoppc/svp64: disassemble ld/st imm mode
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: disassemble ld/st imm mode

12 months agoppc/svp64: disassemble normal mode
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: disassemble normal mode

12 months agoppc/svp64: disassemble SVP64 operands
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: disassemble SVP64 operands

12 months agoppc/svp64: disassemble SVP64 name
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: disassemble SVP64 name

12 months agoppc/svp64: obtain SVP64 disassembly context
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: obtain SVP64 disassembly context

12 months agoppc/svp64: share SVP64 context via libopcodes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: share SVP64 context via libopcodes

12 months agoppc/svp64: introduce SVP64 opcode lookup
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc/svp64: introduce SVP64 opcode lookup

12 months agoppc: decouple print_insn_powerpc_opcode routine
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:26 +0000 (21:27 +0300)]
ppc: decouple print_insn_powerpc_opcode routine

12 months agoppc/svp64: reuse md_parse_name in md_operand
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: reuse md_parse_name in md_operand

12 months agoppc/svp64: introduce alias for 1<<%r3 predicate
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: introduce alias for 1<<%r3 predicate

12 months agoppc/svp64: allow predicate macro expansion
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: allow predicate macro expansion

12 months agoppc/svp64: introduce SVP64 name parser
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: introduce SVP64 name parser

12 months agoppc/svp64: allow w/dw/sw macro expansion
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: allow w/dw/sw macro expansion

12 months agoppc/svp64: remap operands and build instructions
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: remap operands and build instructions

12 months agoppc/svp64: support SVP64 vectors
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support SVP64 vectors

12 months agoppc: refactor assembly logic
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc: refactor assembly logic

12 months agoppc/svp64: validate and fix modes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: validate and fix modes

12 months agoppc/svp64: validate SVP64 context
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: validate SVP64 context

12 months agoppc/svp64: support svm mode
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support svm mode

12 months agoppc/svp64: support crm mode
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support crm mode

12 months agoppc/svp64: support mr/mrr modes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support mr/mrr modes

12 months agoppc/svp64: support ff/pr modes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support ff/pr modes

12 months agoppc/svp64: support zz/dz/sz specifier
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support zz/dz/sz specifier

12 months agoppc/svp64: support sat specifier
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support sat specifier

12 months agoppc/svp64: support sea specifier
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:25 +0000 (21:27 +0300)]
ppc/svp64: support sea specifier

12 months agoppc/svp64: support els specifier
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support els specifier

12 months agoppc/svp64: support w/dw/sw modes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support w/dw/sw modes

12 months agoppc/svp64: support vec2/vec3/vec4 modes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support vec2/vec3/vec4 modes

12 months agoppc/svp64: support m/dm/sm modes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support m/dm/sm modes

12 months agoppc/svp64: introduce svp64_decode stub
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: introduce svp64_decode stub

12 months agoppc/svp64: setup SVP64 opcodes table
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: setup SVP64 opcodes table

12 months agoopcodes: introduce SVP64 sources
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
opcodes: introduce SVP64 sources

12 months agoopcodes: introduce SVP64 headers
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
opcodes: introduce SVP64 headers

12 months agoppc/svp64: introduce svp64_assemble stub
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: introduce svp64_assemble stub

12 months agoppc: share pd_reg definition via libopcodes
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc: share pd_reg definition via libopcodes

12 months agoppc/svp64: support shadd/shadduw instructions
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support shadd/shadduw instructions

12 months agoppc/svp64: support divmod2du instruction
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support divmod2du instruction

12 months agoppc/svp64: support maddedu instruction
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support maddedu instruction

12 months agoppc/svp64: support fptrans instructions
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:24 +0000 (21:27 +0300)]
ppc/svp64: support fptrans instructions

12 months agoppc/svp64: support bmask instruction
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support bmask instruction

12 months agoppc/svp64: support absd instructions
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support absd instructions

12 months agoppc/svp64: support cprop instructions
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support cprop instructions

12 months agoppc/svp64: support avgadd instructions
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support avgadd instructions

12 months agoppc/svp64: support min/max instructions
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support min/max instructions

12 months agoppc/svp64: support fishmv instruction
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support fishmv instruction

12 months agoppc/svp64: support fmvis instruction
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support fmvis instruction

12 months agoppc/svp64: support svshape2 instruction
Dmitry Selyutin [Tue, 11 Apr 2023 18:27:23 +0000 (21:27 +0300)]
ppc/svp64: support svshape2 instruction

https://libre-soc.org/openpower/sv/
https://libre-soc.org/openpower/sv/remap/#svshape
https://libre-soc.org/openpower/sv/remap/#svshape2
https://libre-soc.org/openpower/isa/simplev/

12 months agoUpdated debug architecture version checks for fbsd
Luis Machado [Tue, 25 Apr 2023 08:22:09 +0000 (09:22 +0100)]
Updated debug architecture version checks for fbsd

There are two new debug architecture version entries.  I updated the
code for Linux, but fbsd also needs updating.

This patch does this, and should be pretty straightforward.

I can't test this on native fbsd, but I'm fairly confident it should
work.

Signed-off-by: Luis Machado <luis.machado@arm.com>
12 months agoAdd new debug architecture version
Luis Machado [Tue, 25 Apr 2023 08:17:43 +0000 (09:17 +0100)]
Add new debug architecture version

Teach gdb about a new debug architecture version for AArch64 (0x11).

No user-visible changes.

Regression-tested on aarch64-linux Ubuntu 20.04/22.04.

Signed-off-by: Luis Machado <luis.machado@arm.com>
12 months agoi386-dis.c UB shift and other tidies
Alan Modra [Wed, 26 Apr 2023 01:01:01 +0000 (10:31 +0930)]
i386-dis.c UB shift and other tidies

1) i386-dis.c:12055:11: runtime error: left shift of negative value -1
Bit twiddling is best done unsigned, due to UB on overflow of signed
expressions.  Fix this by using bfd_vma rather than bfd_signed_vma
everywhere in i386-dis.c except print_displacement.

2) Return get32s and get16 value in a bfd_vma, reducing the need for
temp variables.

3) Introduce get16s and get8s functions to simplify the code.

4) With some optimisation options gcc-13 legitimately complains about
a fall-through in OP_I.  Fix that.  OP_I also doesn't need to use
"mask" which was wrong for w_mode anyway.

5) Masking with & 0xffffffff is better than casting to unsigned.  We
don't know for sure that unsigned int is 32-bit.

6) We also don't know that unsigned char is 8 bits.  Mask codep
accesses everywhere.  I don't expect binutils will work on anything
other than an 8-bit char host, but if we are masking codep accesses in
some places we might as well be consistent.  (Better would be to use
stdint.h types more in binutils.)

12 months agobinutils runtest $CC
Alan Modra [Wed, 26 Apr 2023 00:29:40 +0000 (09:59 +0930)]
binutils runtest $CC

I noticed in the binutile Makefile that runtest is being invoked with
CC, CC_FOR_BUILD and other compiler related flags in the environment.
That doesn't work.  Those variables ought to be passed on the runtest
command line.

After fixing that I had some fails due to binutils testprog.c now
being compiled with the default "-g -O2" picked up in
CFLAGS_FOR_TARGET.  Hack around that by passing -O0.

Also, with the binutils testsuite now taking notice of CC_FOR_TARGET,
I found a couple of debuginfod.exp fails with one of my compilers that
happened to be built without --debug-id being enabled by default.

* Makefile.am (check-DEJAGNU): Pass $CC and other variable on
the runtest command line rather than futilely in the
environment.  Add -O0 to CFLAGS_FOR_TARGET.
* Makefile.in: Regenerate.
* testsuite/binutils-all/debuginfod.exp: Compile testprog.c
with -Wl,--build-id.

12 months agoAvoid another -Werror=dangling-pointer
Alan Modra [Tue, 25 Apr 2023 03:56:12 +0000 (13:26 +0930)]
Avoid another -Werror=dangling-pointer

write.c:415:7: error: dangling pointer ‘prev_frag’ to ‘dummy’ may be used

* write.c (chain_frchains_together_1): Rewrite loop as a do
while to avoid false positive -Wdangling-pointer.

12 months agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Apr 2023 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

12 months agoUse scoped_restore in varobj.c
Tom Tromey [Mon, 24 Apr 2023 18:25:53 +0000 (12:25 -0600)]
Use scoped_restore in varobj.c

One spot in varobj.c should use scoped_restore to save and restore
input_radix.  Note that the current code may fail to restore it on
error, so this patch fixes a latent bug.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
12 months agoRemove some "goto"s from parse.c
Tom Tromey [Mon, 24 Apr 2023 19:03:03 +0000 (13:03 -0600)]
Remove some "goto"s from parse.c

parser_state::push_dollar has some unnecessary "goto"s.  Replacing
them cleans up the code.  Regression tested on x86-64 Fedora 36.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
12 months agosection-select: Fix performance problem (PR30367)
Michael Matz [Tue, 18 Apr 2023 14:16:01 +0000 (16:16 +0200)]
section-select: Fix performance problem (PR30367)

when using many wild-statements with non-wildcard filenames we
were running into quadraticness via repeatedly using lookup_name
on a long list of loaded files.  I've originally retained using
lookup_name because that preserved existing behaviour most obviously.
In particular in matching wild-statements when using a non-wildcard
filename it matches against local_sym_name, not the filename member.
If the wildspec would have an archive-spec or a wildcard it would use
the filename member, though.  Also it would load the named file
(and ignore it, as being not equal to the currently considered
input-statement).

Rewrite this to not use lookup_name but retain the comparison
against local_sym_name with a comment to that effect.

PR 30367
* ldlang.c (walk_wild_section_match): Don't use lookup_name
but directly compare spec and local_sym_name.

12 months agoRISC-V: adjust logic to avoid register name symbols
Jan Beulich [Tue, 25 Apr 2023 09:19:18 +0000 (11:19 +0200)]
RISC-V: adjust logic to avoid register name symbols

Special casing GPR names in my_getSmallExpression() leads to a number of
inconsistencies. Generalize this by utilizing the md_parse_name() hook,
limited to when instruction operands are being parsed (really: probed).
Then both the GPR lookup there and the yet more ad hoc workaround for
PR/gas 29940 can be removed (including its extension needed for making
the compressed form JAL work again).

12 months agoRISC-V: test for expected / no unexpected symbols
Jan Beulich [Tue, 25 Apr 2023 09:18:49 +0000 (11:18 +0200)]
RISC-V: test for expected / no unexpected symbols

Both the temporary workaround for PR/gas 29940 and the existing special
casing of GPRs in my_getSmallExpression() aren't really tested anywhere
(i.e. with the workarounds remove testing would still succeed). Nor is
there any test for uses of symbols with names matching GPRs, where such
is permitted. Before altering how this is to be dealt with, install two
testcases covering the expected behavior. (For now this includes only
known affected insns; re-ordering of entries in riscv_opcodes[] could,
however, yield more of them.)

12 months agoRISC-V: don't recognize bogus relocations
Jan Beulich [Tue, 25 Apr 2023 09:17:19 +0000 (11:17 +0200)]
RISC-V: don't recognize bogus relocations

With my_getSmallExpression() consistently and silently failing on
relocation operators not fitting an insn, it is no longer necessary to
hand it percent_op_itype[] "just in case" (i.e. to avoid errors when a
subsequent parsing attempt for another operand combination might
succeed). This also eliminates the latent problem of percent_op_itype[]
and percent_op_stype[] growing a non-identical set of recognized
relocation operators.

12 months agoRISC-V: avoid redundant and misleading/wrong error messages
Jan Beulich [Tue, 25 Apr 2023 09:16:44 +0000 (11:16 +0200)]
RISC-V: avoid redundant and misleading/wrong error messages

The use of a wrong (for the insn) relocation operator (or a future one
which simply isn't recognized by older gas yet) doesn't render the (rest
of the) expression "bad". Furthermore alongside the error from
expression() in most cases the parser would emit another error then
anyway. Suppress the call to my_getExpression() in such a case,
arranging for a guaranteed subsequent error message by marking the
expression "illegal".

12 months agoRISC-V: drop "percent_op" parameter from my_getOpcodeExpression()
Jan Beulich [Tue, 25 Apr 2023 09:16:07 +0000 (11:16 +0200)]
RISC-V: drop "percent_op" parameter from my_getOpcodeExpression()

Both callers check for no relocations, so there's no point parsing for
some. Have the function pass percent_op_null into
my_getSmallExpression(). Note that there's no point passing
percent_op_itype: Elsewhere, especially when processing compressed alias
insns ahead of non-alias ones, this has the effect of avoiding "bad
expression" errors when another parsing pass may follow (and succeed).
Here, however, all alternative forms of an insn type will again start
with the same O4 or O2, so avoiding errors earlier on doesn't really
help. Plus constructs with a relocation specifier (as percent_op_itype
would permit) can't be specified anyway, as the scrubber eats the
whitespace between .insn's type and the O4 or O2 expression when that
starts with % or ( - i.e. these will be seen as e.g. "i%lo(x)", and
riscv_ip() looks only for whitespace when finding the end of a mnemonic.

12 months agoRISC-V: minor effort reduction in relocation specifier parsing
Jan Beulich [Tue, 25 Apr 2023 09:15:25 +0000 (11:15 +0200)]
RISC-V: minor effort reduction in relocation specifier parsing

The sole caller of parse_relocation() has already checked for the %
prefix, so there's no need to check for it again in the strncasecmp()
and there's also no reason to make the involved string literals longer
than necessary.

12 months ago[gdb/testsuite] Fix timeout in gdb.tui/empty.exp
Tom de Vries [Tue, 25 Apr 2023 06:33:57 +0000 (08:33 +0200)]
[gdb/testsuite] Fix timeout in gdb.tui/empty.exp

In test-case gdb.tui/empty.exp we run into:
...
WARNING: timeout in accept_gdb_output
PASS: gdb.tui/empty.exp: src: 90x40: box 1
...

We timeout here in Term::resize:
...
# Due to the strange column resizing behavior, and because we
# don't care about this intermediate resize, we don't check
# the size here.
wait_for "@@ resize done $_resize_count"
...
because the string we're trying to match is split over two lines:
...
25 -----------------------------------------------------------------------------+No
26 ne No process In:                                               L??   PC: ?? @@
27 resize done 0, size = 79x40
28 (gdb)
...

Fix this by dropping the "@@ " prefix.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Fix timeout in gdb.tui/completion.exp
Tom de Vries [Tue, 25 Apr 2023 06:33:57 +0000 (08:33 +0200)]
[gdb/testsuite] Fix timeout in gdb.tui/completion.exp

With test-case gdb.tui/completion.exp, we run into:
...
WARNING: timeout in accept_gdb_output
PASS: gdb.tui/completion.exp: check focus completions
...

The timeout happens in this command:
...
Term::command "layout src"
...
which waits for:
- "(gdb) layout src", and then
- "(gdb) ".

Because the "layout src" command enables the TUI there's just a prompt.

Fix this by using Term::command_no_prompt_prefix.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Fix timeout in gdb.tui/new-layout.exp
Tom de Vries [Tue, 25 Apr 2023 06:33:57 +0000 (08:33 +0200)]
[gdb/testsuite] Fix timeout in gdb.tui/new-layout.exp

In test-case gdb.tui/new-layout.exp we run into:
...
WARNING: timeout in accept_gdb_output
PASS: gdb.tui/new-layout.exp: layout=cmd_only {cmd 1} {} {}: \
  bottom of cmd window is blank
...

The timeout happens here:
...
    Term::command "layout src"
...

Before the "layout src" command we have:
...
Screen Dump (size 80 columns x 24 rows, cursor at column 46, row 7):
    0 +-tui-layout.c-------------------------+(gdb) layout example3
    1 |       20 {                           |(gdb) layout src
    2 |       21   return 0;                 |(gdb) winheight cmd 8
    3 |       22 }                           |(gdb) layout example4
    4 |       23                             |(gdb) layout src
    5 |       24                             |(gdb) winheight cmd 8
    6 |       25                             |(gdb) layout example5
    7 |       26                             |(gdb)
    8 |       27                             |
    9 |       28                             |
   10 |       29                             |
   11 |       30                             |
   12 |       31                             |
   13 |       32                             |
   14 |       33                             |
   15 |       34                             |
   16 |       35                             |
   17 |       36                             |
   18 |       37                             |
   19 |       38                             |
   20 |       39                             |
   21 |       40                             |
   22 +--------------------------------------+
   23 exec No process In:                                                L??   PC: ??
...
and after:
...
Screen Dump (size 80 columns x 24 rows, cursor at column 6, row 16):
    0 +-tui-layout.c-----------------------------------------------------------------+
    1 |       20 {                                                                   |
    2 |       21   return 0;                                                         |
    3 |       22 }                                                                   |
    4 |       23                                                                     |
    5 |       24                                                                     |
    6 |       25                                                                     |
    7 |       26                                                                     |
    8 |       27                                                                     |
    9 |       28                                                                     |
   10 |       29                                                                     |
   11 |       30                                                                     |
   12 |       31                                                                     |
   13 |       32                                                                     |
   14 +------------------------------------------------------------------------------+
   15 exec No process In:                                                L??   PC: ??
   16 (gdb)
   17
   18
   19
   20
   21
   22
   23
...

The Term::command "layout src" is waiting to match:
- "(gdb) layout src", and then
- "(gdb) ".

The first part fails to match on a line:
...
|       26                             |(gdb) layout src
...
because it expects the prompt at the start of the line.

Fix this by allowing the prompt at the start of a window as well.

Tested by x86_64-linux.

12 months ago[gdb/testsuite] Fix timeout in gdb.tui/main.exp
Tom de Vries [Tue, 25 Apr 2023 06:33:57 +0000 (08:33 +0200)]
[gdb/testsuite] Fix timeout in gdb.tui/main.exp

With test-case gdb.tui/main.exp we run into:
...
WARNING: timeout in accept_gdb_output
PASS: gdb.tui/main.exp: show main after file
...

The problem is that this command:
...
Term::command "file [standard_output_file $testfile]"
...
tries to match "(gdb) $cmd", but due to the long file name, $cmd is split up
over two lines:
...
   16 (gdb) file /data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.tui/main/ma
   17 in
   18 Reading symbols from /data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.t
   19 ui/main/main...
   20 (gdb)
...

Fix this by matching "Reading symbols from" instead.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Fix timeout in gdb.tui/corefile-run.exp
Tom de Vries [Tue, 25 Apr 2023 06:33:57 +0000 (08:33 +0200)]
[gdb/testsuite] Fix timeout in gdb.tui/corefile-run.exp

With test-case gdb.tui/corefile-run.exp we run into:
...
WARNING: timeout in accept_gdb_output
PASS: gdb.tui/corefile-run.exp: load corefile
...

The timeout happens in this command:
...
Term::command "core-file $core"
...
because it tries to match "(gdb) $cmd" but $cmd is split over two lines:
...
   16 (gdb) core-file /data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.tui/co
   17 refile-run/corefile-run.core
   18 [New LWP 5370]
   19 Core was generated by `/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb
   20 .tui/corefile-run/coref'.
   21 Program terminated with signal SIGTRAP, Trace/breakpoint trap.
   22 #0  main () at tui-layout.c:21
   23 (gdb)
...

Fix this by using send_gdb "$cmd\n" and wait_for "Program terminated" instead.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Add debug prints in Term::wait_for
Tom de Vries [Tue, 25 Apr 2023 06:33:56 +0000 (08:33 +0200)]
[gdb/testsuite] Add debug prints in Term::wait_for

The semantics of wait_for are non-trivial, and a bit hard to understand
sometimes.

Add some debug prints in wait_for that make it clear:
- what regexps we're trying to match,
- what strings we compare to the regexps, and
- whether there's a match or mismatch.

I've added this ad-hoc a couple of times, and it seems that it's worth having
readily available.

The debug prints are enabled by adding DEBUG_TUI_MATCHING=1 to the
RUNTESTFLAGS:
...
$ make check RUNTESTFLAGS="gdb.tui/empty.exp DEBUG_TUI_MATCHING=1"
...

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Add warning for timeout in accept_gdb_output
Tom de Vries [Tue, 25 Apr 2023 06:33:56 +0000 (08:33 +0200)]
[gdb/testsuite] Add warning for timeout in accept_gdb_output

In accept_gdb_output we have:
...
            timeout {
                # Assume a timeout means we somehow missed the
                # expected result, and carry on.
                return 0
            }
...

The timeout is silent, and though in some places the return value is checked,
this is not done consistently, and consequently there are silent timeouts
when running the TUI testsuite (gdb.tui/*.exp and gdb.python/tui*.exp).

Each timeout is 10 seconds, and there are 5 in total in the TUI tests, taking
50 seconds overall:
...
real    1m0.275s
user    0m10.440s
sys     0m1.343s
...

With an entire testsuite run taking about 30 minutes, that is about 2.5% of
the time spent waiting in TUI tests.

Let's make the timeouts visible using a warning, such that they can be fixed.

Tested on x86_64-linux.

12 months agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Apr 2023 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

12 months ago[gdb/testsuite] Fix auto-indent in gdb.gdb/python-helper.exp
Tom de Vries [Mon, 24 Apr 2023 20:08:53 +0000 (22:08 +0200)]
[gdb/testsuite] Fix auto-indent in gdb.gdb/python-helper.exp

When editing gdb.gdb/python-helper.exp, auto-indent is broken in my editor
(emacs).

The problem is that this:
...
if { 1 } {
    foo "{" "}"<ENTER>bar
}
...
produces this:
...
if { 1 } {
    foo "{" "}"
bar
}
...

Note that this doesn't happen for "{}".

Fix this by using "\{" and "\}".

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto
Tom de Vries [Mon, 24 Apr 2023 20:08:53 +0000 (22:08 +0200)]
[gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto

On openSUSE Leap 15.4, with gcc 7.5.0, when building gdb with
-O2 -g -flto=auto, I run into:
...
FAIL: gdb.gdb/python-helper.exp: hit breakpoint in outer gdb
FAIL: gdb.gdb/python-helper.exp: print integer from DWARF info
FAIL: gdb.gdb/python-helper.exp: print *type->main_type
...

Fix the first two FAILs by using $bkptno_numopt_re.

The last FAIL is due to:
...
(outer-gdb) print *type->main_type^M
A syntax error in expression, near `->main_type'.^M
(outer-gdb) FAIL: gdb.gdb/python-helper.exp: print *type->main_type
...
because:
...
(outer-gdb) print type^M
Attempt to use a type name as an expression^M
...

Fix this by making the test unresolved if "print type" or
"print type->main_type" doesn't succeed.

On openSUSE Tumbleweed, with gcc 13.0.1, when building gdb with
-O2 -g -flto=auto, I run into timeouts due to the breakpoint in c_print_type
not hitting.  Fix this by detecting the situation and bailing out.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Fix -wrap in presence of -prompt in gdb_test_multiple
Tom de Vries [Mon, 24 Apr 2023 20:08:53 +0000 (22:08 +0200)]
[gdb/testsuite] Fix -wrap in presence of -prompt in gdb_test_multiple

While writing a gdb_test_multiple call in a test-case I tried to use -wrap in
combination with -prompt and found out that it doesn't work, because -wrap uses
"$gdb_prompt $" instead of $prompt_regexp.

Fix this by making -wrap use $prompt_regexp.

Tested on x86_64-linux.

12 months agogdb: remove end_stepping_range observable
Simon Marchi [Mon, 24 Apr 2023 19:46:00 +0000 (15:46 -0400)]
gdb: remove end_stepping_range observable

I noticed that this observable was never notified, which means we can
probably safely remove it.  The notification was removed in:

    commit 243a925328f8e3184b2356bee497181049c0174f
    Author: Pedro Alves <palves@redhat.com>
    Date:   Wed Sep 9 18:23:24 2015 +0100

        Replace "struct continuation" mechanism by something more extensible

print_end_stepping_range_reason in turn becomes unused, so remote it as
well.

Change-Id: If5da5149276c282d2540097c8c4327ce0f70431a

12 months ago[gdb/testsuite] Use -std=gnu99 for gdb.server/attach-flag.exp
Tom de Vries [Mon, 24 Apr 2023 13:02:59 +0000 (15:02 +0200)]
[gdb/testsuite] Use -std=gnu99 for gdb.server/attach-flag.exp

When using a compiler defaulting to -std=gnu90, we run into:
...
Running gdb.server/attach-flag.exp ...
gdb compile failed, attach-flag.c: In function 'main':
attach-flag.c:22:3: error: 'for' loop initial declarations are only allowed \
  in C99 or C11 mode
   for (int i = 0; i < NTHREADS; i++)
   ^~~
attach-flag.c:22:3: note: use option -std=c99, -std=gnu99, -std=c11 or \
  -std=gnu11 to compile your code
...

Fix this by using -std=gnu99.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Require GCC >= 5.x.x in gdb.base/utf8-identifiers.exp
Tom de Vries [Mon, 24 Apr 2023 12:48:06 +0000 (14:48 +0200)]
[gdb/testsuite] Require GCC >= 5.x.x in gdb.base/utf8-identifiers.exp

Test-case gdb.base/utf8-identifiers.exp compiles starting with GCC 5, so
require this.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Fix gdb.multi/multi-arch.exp on powerpc64le
Tom de Vries [Mon, 24 Apr 2023 12:48:06 +0000 (14:48 +0200)]
[gdb/testsuite] Fix gdb.multi/multi-arch.exp on powerpc64le

When running test-case gdb.multi/multi-arch.exp on powerpc64le-linux, I run into:
...
Running gdb/testsuite/gdb.multi/multi-arch.exp ...
gdb compile failed, In file included from /usr/include/features.h:399:0,
                 from /usr/include/stdio.h:27,
                 from gdb/testsuite/gdb.multi/hangout.c:18:
/usr/include/gnu/stubs.h:8:27: fatal error: gnu/stubs-32.h: \
  No such file or directory
 # include <gnu/stubs-32.h>
                           ^
compilation terminated.
...

The problem is that the test-case attempts to use gcc -m32 to produce an
executable while that's not available.

Fix this by:
- introduce a new caching proc have_compile_and_link_flag, and
- using have_compile_and_link_flag in test-case gdb.multi/multi-arch.exp.

Tested on:
- x86_64-linux (openSUSE Leap 15.4), and
- powerpc64le-linux (CentOS-7).

12 months ago[gdb/testsuite] Add basic lmap for tcl < 8.6
Tom de Vries [Mon, 24 Apr 2023 12:48:06 +0000 (14:48 +0200)]
[gdb/testsuite] Add basic lmap for tcl < 8.6

With test-case gdb.dwarf2/dw2-abs-hi-pc.exp and tcl 8.5, I run into:
...
ERROR: tcl error sourcing gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp.
ERROR: invalid command name "lmap"
    while executing
"::gdb_tcl_unknown lmap i {dw2-abs-hi-pc.c dw2-abs-hi-pc-hello.c \
  dw2-abs-hi-pc-world.c} { expr { "$srcdir/$subdir/$i" } }"
...

Fix this by adding basic lmap support for tcl version < 8.6.

Tested on x86_64-linux.

12 months ago[gdb/testsuite] Don't use string cat in gdb.dwarf2/dw2-abs-hi-pc.exp
Tom de Vries [Mon, 24 Apr 2023 12:48:06 +0000 (14:48 +0200)]
[gdb/testsuite] Don't use string cat in gdb.dwarf2/dw2-abs-hi-pc.exp

Test-case gdb.dwarf2/dw2-abs-hi-pc.exp uses string cat:
...
set sources [lmap i $sources { string cat "${srcdir}/${subdir}/" $i }]
...
but that's only supported starting tcl 8.6.

Fix this by using "expr" instead:
...
set sources [lmap i $sources { expr { "$srcdir/$subdir/$i" } }]
...

Tested on x86_64-linux.

12 months agoNew georgian translation for the bfd sub-directory
Nick Clifton [Mon, 24 Apr 2023 12:06:18 +0000 (13:06 +0100)]
New georgian translation for the bfd sub-directory

12 months agoRevert "x86: work around compiler diagnosing dangling pointer"
Alan Modra [Mon, 24 Apr 2023 11:30:00 +0000 (21:00 +0930)]
Revert "x86: work around compiler diagnosing dangling pointer"

This reverts commit 983db9932a302f9e2ae1f1d4fd7c3149560bc269.

12 months agogcc-13 i386-dis.c warning
Alan Modra [Mon, 24 Apr 2023 03:57:46 +0000 (13:27 +0930)]
gcc-13 i386-dis.c warning

opcodes/i386-dis.c: In function ‘print_insn’:
opcodes/i386-dis.c:9865:22: error: storing the address of local
variable ‘priv’ in ‘*info.private_data’ [-Werror=dangling-pointer=]

* i386-dis.c (print_insn): Clear info->private_data before
returning.

12 months agoasan: segfault in coff_mangle_symbols
Alan Modra [Mon, 24 Apr 2023 01:49:15 +0000 (11:19 +0930)]
asan: segfault in coff_mangle_symbols

The testcase managed to trigger creation of a wild pointer in
coff_slurp_symbol_table.  Stop that happening, and fix an unrelated
problem I happened to see in bfd_coff_get_syment.

* coff-bfd.c (bfd_coff_get_syment): Clear fix_value after
converting n_value from a pointer to an index.
* coffcode.h (coff_slurp_symbol_table <C_BSTAT>): Sanity check
symbol value before converting to a pointer.

12 months agoobjcopy of archives tidy
Alan Modra [Sat, 22 Apr 2023 06:31:02 +0000 (16:01 +0930)]
objcopy of archives tidy

This makes sure the input element bfd is closed before exiting the
loop copying elements.

* objcopy.c (copy_archive): Rename output_bfd to output_element.
Localise last_element.  Close this_element in more error cases.

12 months ago[gdb/testsuite] Skip dap tests for tcl 8.5
Tom de Vries [Mon, 24 Apr 2023 09:29:22 +0000 (11:29 +0200)]
[gdb/testsuite] Skip dap tests for tcl 8.5

When running the dap tests on a system with tcl 8.5, we run into:
...
ERROR: tcl error sourcing gdb/testsuite/gdb.dap/memory.exp.
ERROR: bad class "entier": must be alnum, alpha, ascii, control, boolean, \
  digit, double, false, graph, integer, list, lower, print, punct, space, \
  true, upper, wideinteger, wordchar, or xdigit
    while executing
"string is entier $num"
    (procedure "num" line 16)
    invoked from within
...

Fix this by:
- requiring tcl 8.6 in allow_dap_tests, and
- adding the missing require allow_dap_tests in gdb.dap/memory.exp.

Tested on x86_64-linux.

12 months agox86: work around compiler diagnosing dangling pointer
Jan Beulich [Mon, 24 Apr 2023 08:37:12 +0000 (10:37 +0200)]
x86: work around compiler diagnosing dangling pointer

For quite come time print_insn() has been storing the address of a local
variable into info->private_data. Since the compiler can't know that the
field won't be accessed again after print_insn() returns, it may kind of
legitimately diagnose this. And recent enough gcc does as of the
introduction of the fetch_error() return paths (replacing setjmp()-based
error handling).

Utilizing that neither prefix_name() nor i386_dis_printf() actually use
info->private_data, zap the pointer in fetch_error(), after having
retrieved it for local use.

12 months agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Apr 2023 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

12 months agoMIPS: fix loongson3 llsc workaround
YunQiang Su [Thu, 23 Mar 2023 10:49:23 +0000 (18:49 +0800)]
MIPS: fix loongson3 llsc workaround

-mfix-looongson3-llsc may add sync instructions not needed on some
asm code with lots of debug info.

PR: 30153
* gas/config/tc-mips.c(fix_loongson3_llsc): clear logistic.

12 months agoMIPS: default output r6 obj if the triple is r6
YunQiang Su [Tue, 18 Apr 2023 13:49:22 +0000 (21:49 +0800)]
MIPS: default output r6 obj if the triple is r6

If the triple is mipsisa32r6* or mipsisa64r6*, ld/as should output
r6 objects by default.
The triples with vendor `img` should do same.

The examples include:
as xx.s -o xx.o
ld -r -b binary xx.dat -o xx.o

12 months agoMIPS: support mips*64 as CPU and gnuabi64 as ABI
YunQiang Su [Tue, 18 Apr 2023 13:27:04 +0000 (21:27 +0800)]
MIPS: support mips*64 as CPU and gnuabi64 as ABI

For MIPS64r6 ports, Debian as an example, `mipsisa64r6el` is
used as the cpu name in triple.
Let's recognize them by `mips*64*(el)`.

For 64bit Ports, like Debian's mips64el and mips64r6el ports,
`gnuabi64` is used as the abi section.
Let's use N64 abi by default for the triple with gnuabi64.

12 months agoLoongArch: Fix loongarch32 test fails
mengqinggang [Sun, 23 Apr 2023 01:55:46 +0000 (09:55 +0800)]
LoongArch: Fix loongarch32 test fails

Regenerated macro_op_32.d and add skip loongarch64-*-*.

gas/ChangeLog:

* testsuite/gas/loongarch/macro_op_32.d: Regenerated.

ld/ChangeLog:

* testsuite/ld-loongarch-elf/macro_op_32.d: Regenerated.

12 months agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Apr 2023 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in

12 months ago[gdb/testsuite] Remove debug prints in gdb_find_gdc
Tom de Vries [Sat, 22 Apr 2023 09:04:11 +0000 (11:04 +0200)]
[gdb/testsuite] Remove debug prints in gdb_find_gdc

When running the gdb.dlang test-cases, and forcing gdb_find_gdc to be used
rather than dejagnu's copy (mimicing what happens with an older dejagnu
without find_gdc), I run into these debug prints:
...
Tool Root: /data/vries/gdb/leap-15-4/build
CC: gdc
...

Remove these.

Tested on x86_64-linux.

12 months agogdb: Fix false match issue in skip_prologue_using_linetable
WANG Rui [Sat, 22 Apr 2023 05:50:08 +0000 (07:50 +0200)]
gdb: Fix false match issue in skip_prologue_using_linetable

[ Changes in v2:
  - rebase on trunk
  Changes in v3:
  - add test-case ]

We should exclude matches to the ending PC to prevent false matches with the
next function, as prologue_end is located at the end PC.

  <fun1>:
    0x00: ... <-- start_pc
    0x04: ...
    0x08: ... <-- breakpoint
    0x0c: ret
  <fun2>:
    0x10: ret <-- end_pc | prologue_end of fun2

Tested on x86_64-linux.

Co-Authored-By: WANG Rui <r@hev.cc> (fix, tiny change [1])
Co-Authored-By: Tom de Vries <tdevries@suse.de> (test-case)
Approved-by: Kevin Buettner <kevinb@redhat.com>
[1] https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html

PR symtab/30369
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30369

12 months agoAutomatic date update in version.in
GDB Administrator [Sat, 22 Apr 2023 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in