Go to file
Tom de Vries ea6929aaac [gdb/tdep] Fix s390_linux_nat_target::stopped_by_watchpoint
On s390x-linux, I run into:
...
(gdb) continue^M
Continuing.^M
breakpoint.c:5784: internal-error: bpstat_stop_status_nowatch: \
  Assertion `!target_stopped_by_watchpoint ()' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
FAIL: gdb.threads/watchpoint-fork.exp: parent: singlethreaded: \
  breakpoint after the first fork (GDB internal error)
...

What happens is the follow:
- a watchpoint event triggers
- the event is processed, s390_linux_nat_target::stopped_by_watchpoint is called and
  it returns true, as expected
- the watchpoint event is reported by gdb, and gdb stops
- we issue a continue command
- a fork event triggers
- the event is processed, and during processing that event
  s390_linux_nat_target::stopped_by_watchpoint is called again, and returns
  true
- the assertion fails, because the function is expected to return false

The function s390_linux_nat_target::stopped_by_watchpoint returns true the
second time, because it looks at the exact same data that was looked at when
it was called the first time, and that data hasn't changed.

There's code in the same function that intends to prevent that from happening:
...
      /* Do not report this watchpoint again.  */
      memset (&per_lowcore, 0, sizeof (per_lowcore));
      if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea, 0) < 0)
       perror_with_name (_("Couldn't clear watchpoint status"));
...
and that probably used to work for older kernels, but no longer does since
linux kernel commit 5e9a26928f55 ("[S390] ptrace cleanup").

Fix this by copying this:
...
  siginfo_t siginfo;
  if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
    return false;
  if (siginfo.si_signo != SIGTRAP
      || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
    return false;
...
from aarch64_linux_nat_target::stopped_data_address and remove the
obsolete watchpoint status clearing code.

Tested on s390x-linux.

Approved-By: Ulrich Weigand <uweigand@de.ibm.com>
2022-12-13 18:41:12 +01:00
bfd asan: mips_hi16_list segfault in bfd_get_section_limit_octets 2022-12-13 11:31:43 +10:30
binutils PR29893, buffer overflow in display_debug_addr 2022-12-13 00:36:08 +10:30
config
contrib
cpu
elfcpp
etc
gas gas: re-work line number tracking for macros and their expansions 2022-12-13 09:11:53 +01:00
gdb [gdb/tdep] Fix s390_linux_nat_target::stopped_by_watchpoint 2022-12-13 18:41:12 +01:00
gdbserver [aarch64] Add TPIDR2 register support for Linux 2022-12-09 13:41:15 +00:00
gdbsupport
gnulib
gold gold: Remove BND from 64-bit x86-64 IBT PLT 2022-12-13 09:02:36 -08:00
gprof
gprofng
include libsframe: rename API sframe_fde_func_info to sframe_fde_create_func_info 2022-12-09 10:25:31 -08:00
intl
ld x86-64: Remove BND from 64-bit IBT PLT 2022-12-08 08:05:45 -08:00
libbacktrace testsuite: support mold linker 2022-12-05 15:52:51 +01:00
libctf libctf: remove unnecessary zstd constructs 2022-12-12 10:53:39 -08:00
libdecnumber
libiberty
libsframe libsframe: rename API sframe_fde_func_info to sframe_fde_create_func_info 2022-12-09 10:25:31 -08:00
opcodes x86: further re-work insn/suffix recognition to also cover MOVSX 2022-12-12 14:01:02 +01:00
readline
sim
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore
ar-lib
ChangeLog
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
setup.com
src-release.sh src-release.sh: Fix gdb source tarball build failure due to libsframe 2022-11-30 07:32:58 +04:00
symlink-tree
test-driver
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.