110032 Commits

Author SHA1 Message Date
6dc7160b2d gdb/testsuite: fix testsuite regressions for unix/-m32 board
This commit fixes two regressions introduced by
891e4190ba705373eec7b374209478215fff5401.

Reason for the failures was, that on a 32 bit machine the maximum
array length as well as the maximum allocatable memory for arrays
(in bytes) both seem to be limited by the maximum value of a 4
byte (signed) Fortran integer.  This lead to compiler errors/unexpected
behavior when compiling/running the test with the -m32 board.  This
behavior is compiler dependent and can differ for different compiler
implementations, but generally, it seemed like a good idea to simply
avoid such situations.

The affected tests check for GDB's overflow behavior when using KIND
parameters with GDB implemented Fortran intrinsic functions.  If these
KIND parameters are too small to fit the actual intrinsic function's
result, an overflow is expected.  This was done for 1, 2, and 4
byte overflows.  The last one caused problems, as it tried to allocate
arrays of length/byte-size bigger than the 4 byte signed integers which
would then be used with the LBOUND/UBOUND/SIZE intrinsics.

The tests were adapted to only execute the 4 byte overflow tests when
running on targets with 64 bit.  For this, the compiled tests evaluate the
byte size of a C_NULL_PTR via C_SIZEOF, both defined in the ISO_C_BINDING
module.  The ISO_C_BINDING constant C_NULL_PTR is a Fortran 2003, the
C_SIZEOF a Fortran 2008 extension.  Both have been implemented in their
respective compilers for while (e.g. C_SIZEOF is available since
gfortran 4.6).  If this byte size evaluates to less than 8 we skip the
4 byte overflow tests in the compiled tests of size.f90 and
lbound-ubound.f90.  Similarly, in the lbound-ubound.exp testsfile we skip
the 4 byte overflow tests if the procedure is_64_target evaluates to false.

In size.f90, additionally, the to-be-allocated amount of bytes did not
fit into 4 byte signed integers for some of the arrays, as it was
approximately 4 times the maximum size of a 4 byte signed integer.  We
adapted the dimensions of the arrays in question as the meaningfulness
of the test does not suffer from this.

With this patch both test run fine with the unix/-m32 board and
gcc/gfortran (9.4) as well as the standard board file.

We also thought about completely removing the affected test from the
testsuite.  We decided against this as the 32 bit identification comes
with Fortran 2008 and removing tests would have decreased coverage.

A last change that happened with this patch was due to gfortran's and
ifx's type resolution when assigning big constants to Fortran Integer*8
variables.  Before the above changes this happened in a parameter
statement.  Here, both compilers happily accepted a line like

  integer*8, parameter :: var = 2147483647 + 5.

After this change the assignment is not done as a parameter
anymore, as this triggered compile time overflow errors.  Instead,
the assignment is done dynamically, depending on the kind of machine one
is on.  Sadly, just changing this line to

  integer*8 :: var
  var = 2147483647 + 5

does not work with ifx (or flang for that matter, they behave similarly
here).  It will create an integer overflow in the addition as ifx deduces
the type the additon is done in as Integer*4.  So var will actually
contain the value -2147483644 after this.  The lines

  integer*8 :: var
  var = 2147483652

on the other hand fail to compile with gfortran (9.4.0) as the compiler
identifies an Integer overflow here.  Finally, to make this work with
all three compilers an additional parameter has been introduced

  integer*8, parameter :: helper = 2147483647
  integer*8 :: var
  var = helper + 5.

This works on all 3 compilers as expected.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29053
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29054
2022-05-10 14:54:46 +02:00
62b33fde9c Move non-dependent gdb::observers::observable::visit_state outside template
The other day, while looking at the symbols that end up in a GDB
index, I noticed that the gdb::observers::observable::visit_state enum
class appears a number of times:

 $ grep VISIT gdb-index-symbol-names.txt
 gdb::observers::observable<bpstat*, int>::visit_state::NOT_VISITED
 gdb::observers::observable<bpstat*, int>::visit_state::VISITED
 gdb::observers::observable<bpstat*, int>::visit_state::VISITING
 gdb::observers::observable<breakpoint*>::visit_state::NOT_VISITED
 gdb::observers::observable<breakpoint*>::visit_state::VISITED
 gdb::observers::observable<breakpoint*>::visit_state::VISITING
 gdb::observers::observable<char const*, char const*>::visit_state::NOT_VISITED
 gdb::observers::observable<char const*, char const*>::visit_state::VISITED
 gdb::observers::observable<char const*, char const*>::visit_state::VISITING
 gdb::observers::observable<char const*>::visit_state::NOT_VISITED
 gdb::observers::observable<char const*>::visit_state::VISITED
 gdb::observers::observable<char const*>::visit_state::VISITING
 gdb::observers::observable<enum_flags<user_selected_what_flag> >::visit_state::NOT_VISITED
 gdb::observers::observable<enum_flags<user_selected_what_flag> >::visit_state::VISITED
 gdb::observers::observable<enum_flags<user_selected_what_flag> >::visit_state::VISITING
 gdb::observers::observable<frame_info*, int>::visit_state::NOT_VISITED
 gdb::observers::observable<frame_info*, int>::visit_state::VISITED
 gdb::observers::observable<frame_info*, int>::visit_state::VISITING
 gdb::observers::observable<gdbarch*>::visit_state::NOT_VISITED
 gdb::observers::observable<gdbarch*>::visit_state::VISITED
 gdb::observers::observable<gdbarch*>::visit_state::VISITING
 gdb::observers::observable<gdb_signal>::visit_state::NOT_VISITED
 gdb::observers::observable<gdb_signal>::visit_state::VISITED
 gdb::observers::observable<gdb_signal>::visit_state::VISITING
 [... snip ...]

 $ grep VISIT gdb-index-symbol-names.txt | wc -l
 72

enum class visit_state is defined inside the class template
observable, but it doesn't have to be, as it does not depend on the
template parameters.  This commit moves it out, so that only one such
type exists.  This reduces the size of a -O0 -g3 build for me by
around 0.6%, like so:

 $ du -b gdb.before gdb.after
 164685280       gdb.before
 163707424       gdb.fixed

and codesize by some 0.5%.

Change-Id: I405f4ef27b8358fdd22158245b145d849b45658e
2022-05-10 13:40:57 +01:00
b773a1808d Fix compiling binutils/resbin.c with Clang version 14 2022-05-10 12:41:56 +01:00
83bec4829b gprofng: include percentages in default metrics list
gprofng/ChangeLog
2022-05-09  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/gprofng.rc: Include percentages in default metrics list.
2022-05-09 22:42:09 -07:00
e3154ef69c gprof: remove use of PTR
* basic_blocks.c: Replace uses of PTR with void * throughout.
	* cg_arcs.c: Likewise.
	* cg_print.c: Likewise.
	* hist.c: Likewise.
	* source.h: Likewise.
	* symtab.c: Likewise.
2022-05-10 11:21:37 +09:30
2ec4ffc1c6 gas: remove use of PTR
* config/obj-evax.c (evax_symbol_new_hook): Don't cast to PTR.
2022-05-10 11:21:37 +09:30
d64336e655 opcodes: remove use of PTR
The non-cgen parts of opcodes.

	* cr16-dis.c (print_arg): Replace PTR with void *.
	* crx-dis.c (print_arg): Likewise.
	* rl78-dis.c (print_insn_rl78_common): Don't use PTR cast.
	* rx-dis.c (print_insn_rx): Likewise.
	* visium-dis.c (print_insn_visium): Likewise.
	* z8k-dis.c (print_insn_z8k): Likewise.
2022-05-10 11:21:37 +09:30
f3b9cfd195 bfd: remove use of PTR
* coffcode.h (coff_write_object_contents): Don't cast to PTR.
	* elf32-csky.c (csky_elf_link_hash_traverse): Remove use of PTR
	and PARAMS.
	(csky_allocate_dynrelocs): Don't use PTR cast.
	* elf32-nios2.c (adjust_dynrelocs, allocate_dynrelocs): Replace
	PTR with void *.
	* elf32-visium.c (visium_elf_howto_parity_reloc): Likewise.
	* elfxx-ia64.c (ia64_elf_reloc): Likewise.
	* plugin.c (bfd_plugin_bfd_print_private_bfd_data): Likewise.
2022-05-10 11:21:37 +09:30
c2dae75149 include: remove use of PTR
* hashtab.h (HTAB_EMPTY_ENTRY): Replace PTR with void *.
	(HTAB_DELETED_ENTRY): Likewise.
2022-05-10 11:21:37 +09:30
9abf92d229 Automatic date update in version.in 2022-05-10 00:00:17 +00:00
0cfd6cffde IBM zSystems: Accept (. - 0x100000000) PCRel32 operands
as does not accept instructions like brasl %r0,.-0x100000000, because
of two problems with the generic overflow check:

1. PCRel32 operands are signed, but are treated as unsigned.

2. The allowed range for these operands is [-(1 << 32), (1 << 32) - 1],
   and not [-(1 << 31), (1 << 31) - 1].

Fix both by disabling the generic overflow check - it's not needed,
because s390_insert_operand () performs its own.

gas/

        * config/tc-s390.c (md_gather_operands): Set fx_no_overflow.
        * testsuite/gas/s390/s390.exp: Add zarch-z900-err.
        * testsuite/gas/s390/esa-z900.d: New test.
        * testsuite/gas/s390/esa-z900.s: New test.
        * testsuite/gas/s390/zarch-z900-err.l: New test.
        * testsuite/gas/s390/zarch-z900-err.s: New test.
2022-05-09 21:59:59 +02:00
77399b5298 gdb/testsuite: fix occasional failure in gdb.mi/mi-multi-commands.exp
In bug PR gdb/29036, another failure was reported for the test
gdb.mi/mi-multi-commands.exp.  This test sends two commands to GDB as
a single write, and then checks that both commands are executed.

The problem that was encountered here is that the output of the first
command, which looks like this:

  ^done,value="\"FIRST COMMAND\""

Is actually produced in parts, first the '^done' is printed, then the
',value="\"FIRST COMMAND\"" is printed.

What was happening is that some characters from the second command
were being echoed after the '^done' had been printed, but before the
value part had been printed.  To avoid this issue I've relaxed the
pattern that checks for the first command a little.  With this fix in
place the occasional failure in this test is no longer showing up.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29036
2022-05-09 16:57:20 +01:00
f3c75b2cbe [gdb] Update syscalls/{amd64,i386}-linux.xml
- Add a script syscalls/gen-header.py, based on syscalls/arm-linux.py.
- Add a script syscalls/update-linux.sh (alongside update-freebsd.sh and
  update-netbsd.sh).
- Use syscalls/update-linux.sh to update syscalls/{amd64,i386}-linux.xml.in.
- Regenerate syscalls/{amd64,i386}-linux.xml using syscalls/Makefile.

In gdb/syscalls/i386-linux.xml.in, updating has the following notable effect:
...
-  <syscall name="madvise1" number="220"/>
-  <syscall name="getdents64" number="221"/>
-  <syscall name="fcntl64" number="222"/>
+  <syscall name="getdents64" number="220"/>
+  <syscall name="fcntl64" number="221"/>
...

I've verified in ./arch/x86/entry/syscalls/syscall_32.tbl that the numbers are
correct.

Tested on x86_64-linux.
2022-05-09 17:22:23 +02:00
d9ab2743ba [gdb] Add gdb/syscalls/Makefile
Add a Makefile in gdb/syscalls that can be used to translate
gdb/syscalls/*.xml.in into gdb/syscalls/*.xml.

Calling make reveals that bfin-linux.xml is missing, so add it.

Tested on x86_64-linux.
2022-05-09 16:44:48 +02:00
0b8c95579f gdb: LoongArch: Implement the return_value gdbarch method
When execute the following command on LoongArch:

  make check-gdb TESTS="gdb.base/async.exp"

there exist the following failed testcases:

  FAIL: gdb.base/async.exp: finish& (timeout)
  FAIL: gdb.base/async.exp: jump& (timeout)
  FAIL: gdb.base/async.exp: until& (timeout)
  FAIL: gdb.base/async.exp: set exec-done-display off (GDB internal error)

we can see the following messages in gdb/testsuite/gdb.log:

  finish&
  Run till exit from #0  foo () at /home/loongson/gdb.git/gdb/testsuite/gdb.base/async.c:9
  (gdb) /home/loongson/gdb.git/gdb/gdbarch.c:2646: internal-error: gdbarch_return_value: Assertion `gdbarch->return_value != NULL' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.

In order to fix the above failed testcases, implement the return_value
gdbarch method on LoongArch.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2022-05-09 22:33:44 +08:00
205d054282 gdb: fix for gdb.base/eof-exit.exp test failures
This fix relates to PR gdb/29032, this makes the test more stable by
ensuring that the Ctrl-D is only sent once the prompt has been
displayed.  This issue was also discussed on the mailing list here:

  https://sourceware.org/pipermail/gdb-patches/2022-April/187670.html

The problem identified in the bug report is that sometimes the Ctrl-D
(that the test sends to GDB) arrives while GDB is processing a
command.  When this happens the Ctrl-D is handled differently than if
the Ctrl-D is sent while GDB is waiting for input at a prompt.

The original intent of the test was that the Ctrl-D be sent while GDB
was waiting at a prompt, and that is the case the occurs most often,
but, when the Ctrl-D arrives during command processing, then GDB will
ignore the Ctrl-D, and the test will fail.

This commit ensures the Ctrl-D is always sent while GDB is waiting at
a prompt, which makes this test stable.

But, that still leaves an open question, what should happen when the
Ctrl-D arrives while GDB is processing a command?  This commit doesn't
attempt to answer that question, which is while bug PR gdb/29032 will
not be closed once this commit is merged.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29032
2022-05-09 15:00:51 +01:00
ae13296057 [gdb] Make btrace maintainer entry more clear
Do:
...
-record btrace          <name>       <email>
+record
+  btrace               <name>       <email>
...
to clarify that the listed maintainer is only maintainer of the btrace part of
record.
2022-05-09 15:14:56 +02:00
35e48b6ee0 ansidecl.h: sync from GCC
include/ChangeLog:

	* ansidecl.h: Sync from GCC.
2022-05-09 14:00:46 +02:00
4dcb932e64 [gdb/tdep] Support catch syscall pipe2 for i386
With test-case gdb.base/catch-syscall.exp and target board unix/-m32, we run
into:
...
(gdb) catch syscall pipe2^M
Unknown syscall name 'pipe2'.^M
(gdb) FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: catch syscall pipe2
...

Fix this by:
- adding a pipe2 entry in gdb/syscalls/i386-linux.xml.in, and
- regenerating gdb/syscalls/i386-linux.xml using
  "xsltproc --output i386-linux.xml apply-defaults.xsl i386-linux.xml.in".

Tested on x86_64-linux with native and unix/-m32.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
2022-05-09 12:22:02 +02:00
5463a15c18 [gdb/testsuite] Handle pipe2 syscall in gdb.base/catch-syscall.exp
When running test-case gdb.reverse/pipe-reverse.exp on openSUSE Tumbleweed,
I run into:
...
(gdb) continue^M
Continuing.^M
^M
Catchpoint 2 (returned from syscall pipe2), in pipe () from /lib64/libc.so.6^M
(gdb) FAIL: gdb.base/catch-syscall.exp: without arguments: \
  syscall pipe has returned
...

The current glibc on Tumbleweed is 2.35, which contains commit
"linux: Implement pipe in terms of __NR_pipe2", and consequently syscall pipe2
is used instead of syscall pipe.

Fix this by detecting whether syscall pipe or pipe2 is used before running the
tests.

Tested on x86_64-linux, specifically on:
- openSUSE Tumbleweed (with glibc 2.35), and
- openSUSE Leap 15.3 (with glibc 2.31).

On openSUSE Tumbleweed + target board unix/-m32, this exposes:
...
(gdb) catch syscall pipe2^M
Unknown syscall name 'pipe2'.^M
...
which will be fixed in a folllow-up patch.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
2022-05-09 12:01:42 +02:00
cd02db09d2 [gdb/tdep] Handle pipe2 syscall for amd64
When running test-case gdb.reverse/pipe-reverse.exp on openSUSE Tumbleweed,
I run into:
...
(gdb) continue^M
Continuing.^M
Process record and replay target doesn't support syscall number 293^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0x00007ffff7daabdb in pipe () from /lib64/libc.so.6^M
(gdb) FAIL: gdb.reverse/pipe-reverse.exp: continue to breakpoint: marker2
...

The current glibc on Tumbleweed is 2.35, which contains commit
"linux: Implement pipe in terms of __NR_pipe2", and consequently syscall pipe2
is used in stead of syscall pipe.

There is already support added for syscall pipe2 for aarch64 (which only has
syscall pipe2, not syscall pipe), so enable the same for amd64, by:
- adding amd64_sys_pipe2 in enum amd64_syscall
- translating amd64_sys_pipe2 to gdb_sys_pipe2 in amd64_canonicalize_syscall

Tested on x86_64-linux, specifically on:
- openSUSE Tumbleweed (with glibc 2.35), and
- openSUSE Leap 15.3 (with glibc 2.31).

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
2022-05-09 10:42:16 +02:00
2dc60c7710 Automatic date update in version.in 2022-05-09 00:00:15 +00:00
4a43e2435b [gdb/testsuite] Fix gdb.tui/scroll.exp with read1
When running test-case gdb.tui/scroll.exp, I get:
...
Box Dump (80 x 8) @ (0, 0):
    0 $17 = 16
    1 (gdb) p 17
    2 $18 = 17
    3 (gdb) p 18
    4 $19 = 18
    5 (gdb) p 19
    6 $20 = 19
    7 (gdb)
PASS: gdb.tui/scroll.exp: check cmd window in flip layout
...
but with check-read1 I get instead:
...
Box Dump (80 x 8) @ (0, 0):
    0 (gdb) 15
    1 (gdb) p 16
    2 $17 = 16
    3 (gdb) p 17
    4 $18 = 17
    5 (gdb) p 18
    6 $19 = 18
    7 (gdb) p 19
FAIL: gdb.tui/scroll.exp: check cmd window in flip layout
...

The "p 19" command is handled by Term::command, which sends the command and then
does Term::wait_for "^$gdb_prompt [string_to_regexp $cmd]", which:
- matches the line with "(gdb) p 19", and
- tries to match the following prompt "(gdb) "

The problem is that scrolling results in reissuing output before the "(gdb) p
19", and the second matching triggers on that.  Consequently, wait_for no
longer translates gdb output into screen actions, and the screen does not
reflect the result of "p 19".

Fix this by using a new proc wait_for_region_contents, which in contrast to
wait_for can handle a multi-line regexp.

Tested on x86_64-linux with make targets check and check-read1.
2022-05-08 19:47:40 +02:00
a1aaf801d5 [gdb/testsuite] Fix gdb.cp/casts.exp with -m32
When running test-case gdb.cp/casts.exp with target board unix/-m32, I run
into:
...
(gdb) print (unsigned long long) &gd == gd_value^M
$31 = false^M
(gdb) FAIL: gdb.cp/casts.exp: print (unsigned long long) &gd == gd_value
...

With some additional printing, we can see in more detail why the comparison
fails:
...
(gdb) print /x &gd^M
$31 = 0xffffc5c8^M
(gdb) PASS: gdb.cp/casts.exp: print /x &gd
print /x (unsigned long long)&gd^M
$32 = 0xffffc5c8^M
(gdb) PASS: gdb.cp/casts.exp: print /x (unsigned long long)&gd
print /x gd_value^M
$33 = 0xffffffffffffc5c8^M
(gdb) PASS: gdb.cp/casts.exp: print /x gd_value
print (unsigned long long) &gd == gd_value^M
$34 = false^M
(gdb) FAIL: gdb.cp/casts.exp: print (unsigned long long) &gd == gd_value
...

The gd_value is set by this assignment:
...
  unsigned long long gd_value = (unsigned long long) &gd;
...

The problem here is directly casting from a pointer to a non-pointer-sized
integer.

Fix this by adding an intermediate cast to std::uintptr_t.

Tested on x86_64-linux with native and target board unix/-m32.
2022-05-08 19:38:13 +02:00
603df41b46 [gdb/testsuite] Handle init errors in gdb.mi/user-selected-context-sync.exp
In OBS, on aarch64-linux, with a gdb 11.1 based package, I run into:
...
(gdb) builtin_spawn -pty^M
new-ui mi /dev/pts/5^M
New UI allocated^M
(gdb) =thread-group-added,id="i1"^M
(gdb) ERROR: MI channel failed
warning: Error detected on fd 11^M
thread 1.1^M
Unknown thread 1.1.^M
(gdb) UNRESOLVED: gdb.mi/user-selected-context-sync.exp: mode=non-stop: \
  test_cli_inferior: reset selection to thread 1.1
...
with many more UNRESOLVED following.

The ERROR is a common problem, filed as
https://sourceware.org/bugzilla/show_bug.cgi?id=28561 .

But the many UNRESOLVEDs are due to not checking whether the setup as done in
the test_setup function succeeds or not.

Fix this by:
- making test_setup return an error upon failure
- handling test_setup error at the call site
- adding a "setup done" pass/fail to be turned into an unresolved
  in case of error during setup.

Tested on x86_64-linux, by manually triggering the error in
mi_gdb_start_separate_mi_tty.
2022-05-08 18:32:05 +02:00
c7dad3e9f9 [gdb/testsuite] Fix gdb.ada/catch_ex_std.exp with remote-gdbserver-on-localhost
When running test-case gdb.ada/catch_ex_std.exp on target board
remote-gdbserver-on-localhost, I run into:
...
(gdb) continue^M
Continuing.^M
[Inferior 1 (process 15656) exited with code 0177]^M
(gdb) FAIL: gdb.ada/catch_ex_std.exp: runto: run to main
Remote debugging from host ::1, port 49780^M
/home/vries/foo: error while loading shared libraries: libsome_package.so: \
  cannot open shared object file: No such file or directory^M
...

Fix this by adding the usual shared-library + remote-target helper
"gdb_load_shlib $sofile".

Tested on x86_64-linux with native and target board
remote-gdbserver-on-localhost.
2022-05-08 14:05:27 +02:00
efd1a8512f [gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with check-readmore
When running test-case gdb.threads/fork-plus-threads.exp with check-readmore,
I run into:
...
[Inferior 11 (process 7029) exited normally]^M
[Inferior 1 (process 6956) exited normally]^M
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
  inferior 1 exited (timeout)
...

The problem is that the regexp consuming the "Inferior exited normally"
messages:
- consumes more than one of those messages at a time, but
- counts only one of those messages.

Fix this by adopting a line-by-line approach, which deals with those messages
one at a time.

Tested on x86_64-linux with native, check-read1 and check-readmore.
2022-05-08 13:53:41 +02:00
07d9774171 Automatic date update in version.in 2022-05-08 00:00:21 +00:00
c5eab52dba Fix "catch syscall"
Simon pointed out that some recent patches of mine broke "catch
syscall".  Apparently I forgot to finish the conversion of this code
when removing init_catchpoint.  This patch completes the conversion
and fixes the bug.
2022-05-07 10:07:36 -06:00
8f3babfaf8 gdb/readline: fix extra 'quit' message problem
After these two commits:

  commit 4fb7bc4b147fd30b781ea2dad533956d0362295a
  Date:   Mon Mar 7 13:49:21 2022 +0000

      readline: back-port changes needed to properly detect EOF

  commit 91395d97d905c31ac38513e4aaedecb3b25e818f
  Date:   Tue Feb 15 17:28:03 2022 +0000

      gdb: handle bracketed-paste-mode and EOF correctly

It was observed that, if a previous command is selected at the
readline prompt using the up arrow key, then when the command is
accepted (by pressing return) an unexpected 'quit' message will be
printed by GDB.  Here's an example session:

  (gdb) p 123
  $1 = 123
  (gdb) p 123
  quit
  $2 = 123
  (gdb)

In this session the second 'p 123' was entered not by typing 'p 123',
but by pressing the up arrow key to select the previous command.  It
is important that the up arrow key is used, typing Ctrl-p will not
trigger the bug.

The problem here appears to be readline's EOF detection when handling
multi-character input sequences.  I have raised this issue on the
readline mailing list here:

  https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00012.html

a solution has been proposed here:

  https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00016.html

This patch includes a test for this issue as well as a back-port of
(the important bits of) readline commit:

  commit 2ef9cec8c48ab1ae3a16b1874a49bd1f58eaaca1
  Date:   Wed May 4 11:18:04 2022 -0400

      fix for setting RL_STATE_EOF in callback mode

That commit also includes some updates to the readline documentation
and tests that I have not included in this commit.

With this commit in place the unexpected 'quit' messages are resolved.
2022-05-07 10:49:27 +01:00
69464d2267 Fix multiple ubsan warnings in i386-dis.c
Commit 39fb369834a3 "opcodes: Make i386-dis.c thread-safe" introduced
a number of casts to bfd_signed_vma that cause undefined behaviour
with a 32-bit libbfd.  Revert those changes.

	* i386-dis.c (OP_E_memory): Do not cast disp to bfd_signed_vma
	for negation.
	(get32, get32s): Don't use bfd_signed_vma here.
2022-05-07 17:32:25 +09:30
5a91f93b98 Re: Fix new linker testsuite failures due to rwx segment test problems
Fix it some more.

bfd/
	* elfnn-loongarch.c: Remove commented out elf_backend_* defines.
ld/
	* testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Match
	arm*.  Delete loongarch.
2022-05-07 15:15:20 +09:30
29b5074f3a Automatic date update in version.in 2022-05-07 00:00:18 +00:00
29004660c9 PowerPC fix for gdb.server/sysroot.exp
On PowerPC, the stop in the printf function is of the form:

Breakpoint 2, 0x00007ffff7c6ab08 in printf@@GLIBC_2.17 () from /lib64/libc.so.6

On other architectures the output looks like:

Breakpoint 2, 0x0000007fb7ea29ac in printf () from /lib/aarch64-linux-gnu/libc.so.6

The following patch modifies the printf test by matchine any character
starting immediately after the printf.  The test now works for PowerPC
output as well as the output from other architectures.

The test has been run on a Power 10 system and and Intel x86_64 system.
2022-05-06 23:08:39 +00:00
d11c7afad3 Fix new linker testsuite failures due to rwx segment test problems 2022-05-06 20:30:06 +01:00
fed1c982de Introduce catchpoint class
This introduces a catchpoint class that is used as the base class for
all catchpoints.  init_catchpoint is rewritten to be a constructor
instead.

This changes the hierarchy a little -- some catchpoints now inherit
from base_breakpoint whereas previously they did not.  This isn't a
problem, as long as re_set is redefined in catchpoint.
2022-05-06 12:03:35 -06:00
b68f26dea7 Add initializers to tracepoint
This adds some initializers to tracepoint.  I think right now these
may not be needed, due to obscure rules about zero initialization.
However, this will change in the next patch, and anyway it is clearer
to be explicit.
2022-05-06 12:03:35 -06:00
73063f5180 Remove init_raw_breakpoint_without_location
This removes init_raw_breakpoint_without_location, replacing it with a
constructor on 'breakpoint' itself.  The subclasses and callers are
all updated.
2022-05-06 12:03:35 -06:00
3101e4a1c5 Disable copying for breakpoint
It seems to me that breakpoint should use DISABLE_COPY_AND_ASSIGN.
This patch does this.
2022-05-06 12:03:35 -06:00
1ae43feabb Add constructor to exception_catchpoint
This adds a constructor to exception_catchpoint and simplifies the
caller.
2022-05-06 12:03:35 -06:00
6c91c7de20 Add constructor to syscall_catchpoint
This adds a constructor to syscall_catchpoint and simplifies the
caller.
2022-05-06 12:03:34 -06:00
e02f53e50e Add constructor to signal_catchpoint
This adds a constructor to signal_catchpoint and simplifies the
caller.
2022-05-06 12:03:34 -06:00
4874f776ca Add constructor to solib_catchpoint
This adds a constructor to solib_catchpoint and simplifies the caller.
2022-05-06 12:03:34 -06:00
ec79815480 Add constructor to fork_catchpoint
This adds a constructor to fork_catchpoint and simplifies the caller.
2022-05-06 12:03:34 -06:00
fb9e637013 Remove unnecessary line from catch_exec_command_1
catch_exec_command_1 clears the new catchpoint's "exec_pathname"
field, but this is already done by virtue of calling "new".
2022-05-06 12:03:34 -06:00
4d1ae55893 Constify breakpoint::print_recreate
This constifies breakpoint::print_recreate.
2022-05-06 12:03:34 -06:00
b713485d66 Constify breakpoint::print_mention
This constifies breakpoint::print_mention.
2022-05-06 12:03:34 -06:00
a67bcaba1c Constify breakpoint::print_one
This constifies breakpoint::print_one.
2022-05-06 12:03:34 -06:00
7bd8631327 Constify breakpoint::print_it
This constifies breakpoint::print_it.  Doing this pointed out some
code in ada-lang.c that can be simplified a little as well.
2022-05-06 12:03:34 -06:00
5a61e17687 Move works_in_software_mode to watchpoint
works_in_software_mode is only useful for watchpoints.  This patch
moves it from breakpoint to watchpoint, and changes it to return bool.
2022-05-06 12:03:34 -06:00