From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D64683834E27; Mon, 12 Dec 2022 03:14:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D64683834E27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670814899; bh=MayNH0hkEdUbXlnFW7f/rb/yN4BJdeBYRBRe7NIniFM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ptlwtX6SGJzpUz5MaSPkzmf15/4tTa/JpJfSft7tuboFGSZsPf7brw3v9qyYa6ci0 fyohMSRmY1c8mrzm671iQAMpeKDWj1EFECe8U8U9jfJyMknOHCCvjEfQKOF4Bqg1x2 0giSFZJt2YRZvPXslzS22BBzRk5jdZyl0vte1fzA= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/29868] [gdb/tdep, s390x] breakpoint.c:5784: internal-error: bpstat_stop_status_nowatch: Assertion `!target_stopped_by_watchpoint ()' Date: Mon, 12 Dec 2022 03:14:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc component short_desc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29868 Tom de Vries changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arnez at linux dot ibm.com, | |ulrich.weigand at de dot i= bm.com Component|gdb |tdep Summary|[gdb, s390x] |[gdb/tdep, s390x] |breakpoint.c:5784: |breakpoint.c:5784: |internal-error: |internal-error: |bpstat_stop_status_nowatch: |bpstat_stop_status_nowatch: |Assertion |Assertion |`!target_stopped_by_watchpo |`!target_stopped_by_watchpo |int ()' |int ()' --- Comment #2 from Tom de Vries --- I've added some code for debugging: ... diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 96833e804e9..654a62545f3 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -602,6 +602,9 @@ s390_linux_nat_target::low_forget_process (pid_t pid) } } +static void +s390_show_debug_regs (int tid, const char *where); + /* linux_nat_new_fork hook. */ void @@ -625,6 +628,12 @@ s390_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid) child_state->watch_areas =3D parent_state->watch_areas; child_state->break_areas =3D parent_state->break_areas; + + if (show_debug_regs) + { + s390_show_debug_regs (parent_pid, "fork -- parent"); + s390_show_debug_regs (child_pid, "fork -- child"); + } } /* Dump PER state. */ @@ -656,6 +665,10 @@ s390_show_debug_regs (int tid, const char *where) per_info.lowcore.words.perc_atmid, per_info.lowcore.words.address, per_info.lowcore.words.access_id); + + int result =3D (per_info.lowcore.bits.perc_storage_alteration =3D=3D 1 + && per_info.lowcore.bits.perc_store_real_address =3D=3D 0); + debug_printf (" stopped_by_watchpoint: %d\n", result); } bool @@ -688,6 +701,8 @@ s390_linux_nat_target::stopped_by_watchpoint () 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")); + if (show_debug_regs) + s390_show_debug_regs (s390_inferior_tid (), "clear"); } return result; ... and then get the following log: ... $ gdbh -q -batch -ex "set trace-commands on" -x gdb.in +file /suse/tdevries/gdb/build/s390x/gdb/testsuite/outputs/gdb.threads/watchpoint= -fork/watchpoint-fork-parent-st +set follow-fork-mode parent +start Temporary breakpoint 1 at 0x1000810: file /suse/tdevries/gdb/src/gdb/testsuite/gdb.threads/watchpoint-fork-st.c, line= 49. Temporary breakpoint 1, main () at /suse/tdevries/gdb/src/gdb/testsuite/gdb.threads/watchpoint-fork-st.c:49 49 marker (); +watch var Hardware watchpoint 2: var +break marker Breakpoint 3 at 0x10007da: file /suse/tdevries/gdb/src/gdb/testsuite/gdb.threads/watchpoint-fork-st.c, line= 33. +info break Num Type Disp Enb Address What 2 hw watchpoint keep y var 3 breakpoint keep y 0x00000000010007da in marker at /suse/tdevries/gdb/src/gdb/testsuite/gdb.threads/watchpoint-fork-st.c:33 +maint set show-debug-regs 1 +continue PER (debug) state for 55488 -- resume cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 40f0 address: 10006a4 PAID: 0 stopped_by_watchpoint: 0 PER (debug) state for 55488 -- stop cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 40f0 address: 10006a4 PAID: 0 stopped_by_watchpoint: 0 Breakpoint 3, marker () at /suse/tdevries/gdb/src/gdb/testsuite/gdb.threads/watchpoint-fork-st.c:33 33 } +continue PER (debug) state for 55488 -- resume cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 40f0 address: 10006a4 PAID: 0 stopped_by_watchpoint: 0 PER (debug) state for 55488 -- stop cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 40f0 address: 10006a4 PAID: 0 stopped_by_watchpoint: 0 PER (debug) state for 55488 -- stop cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 40f0 address: 10006a4 PAID: 0 stopped_by_watchpoint: 0 PER (debug) state for 55488 -- stop cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 20f0 address: 1000820 PAID: 0 stopped_by_watchpoint: 1 PER (debug) state for 55488 -- clear cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 20f0 address: 1000820 PAID: 0 stopped_by_watchpoint: 1 Hardware watchpoint 2: var Old value =3D 0 New value =3D 1 main () at /suse/tdevries/gdb/src/gdb/testsuite/gdb.threads/watchpoint-fork-st.c:52 52 forkoff (1); +continue PER (debug) state for 55488 -- resume cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 20f0 address: 1000820 PAID: 0 stopped_by_watchpoint: 1 PER (debug) state for 55488 -- fork -- parent cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 20f0 address: 1000820 PAID: 0 stopped_by_watchpoint: 1 PER (debug) state for 55490 -- fork -- child cr9-11: 0 0 0 start, end: 0 0 code/ATMID: 0 address: 0 PAID: 0 stopped_by_watchpoint: 0 PER (debug) state for 55488 -- stop cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 20f0 address: 1000820 PAID: 0 stopped_by_watchpoint: 1 PER (debug) state for 55488 -- clear cr9-11: 20200000 100203c 100203f start, end: 100203c 100203f code/ATMID: 20f0 address: 1000820 PAID: 0 stopped_by_watchpoint: 1 /suse/tdevries/gdb/src/gdb/breakpoint.c:5784: internal-error: bpstat_stop_status_nowatch: Assertion `!target_stopped_by_watchpoint ()' failed. ... So, the watchpoint triggers, and we try to clear the watch point status in s390_linux_nat_target::stopped_by_watchpoint to make sure that we "Do not report this watchpoint again". That doesn't seem to have any effect though, and when we stop for the fork s390_linux_nat_target::stopped_by_watchpoint still returns true, causing the assert. --=20 You are receiving this mail because: You are on the CC list for the bug.=