public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug tdep/31705] gdb.base/watchpoint-running.exp fails on arm Date: Fri, 21 Jun 2024 14:45:50 +0000 [thread overview] Message-ID: <bug-31705-4717-zNY0zVM7Rm@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-31705-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=31705 --- Comment #20 from Sourceware Commits <cvs-commit at gcc dot gnu.org> --- The gdb-15-branch branch has been updated by Tom de Vries <vries@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f33b87956ffa9d153d39caf625b35f29597f0326 commit f33b87956ffa9d153d39caf625b35f29597f0326 Author: Pedro Alves <pedro@palves.net> Date: Fri Jun 21 16:46:50 2024 +0200 [gdb/tdep] Fix gdb.base/watchpoint-running.exp on {arm,ppc64le}-linux When running test-case gdb.base/watchpoint-running on ppc64le-linux (and similar on arm-linux), we get: ... (gdb) watch global_var^M warning: Error when detecting the debug register interface. \ Debug registers will be unavailable.^M Watchpoint 2: global_var^M (gdb) FAIL: $exp: all-stop: hardware: watch global_var FAIL: $exp: all-stop: hardware: watchpoint hit (timeout) ... The problem is that ppc_linux_dreg_interface::detect fails to detect the hardware watchpoint interface, because the calls to ptrace return with errno set to ESRCH. This is a feature of ptrace: if a call is done while the tracee is not ptrace-stopped, it returns ESRCH. Indeed, in the test-case "watch global_var" is executed while the inferior is running, and that triggers the first call to ppc_linux_dreg_interface::detect. And because the detection failure is cached, subsequent attempts at setting hardware watchpoints will also fail, even if the tracee is ptrace-stopped. The way to fix this is to make sure that ppc_linux_dreg_interface::detect is called when we know that the thread is ptrace-stopped, which in the current setup is best addressed by using target-specific post_attach and post_startup_inferior overrides. However, as we can see in aarch64_linux_nat_target, that causes code duplication. Fix this by: - defining a new target hook low_init_process, called from linux_init_ptrace_procfs, which is called from both linux_nat_target::post_attach and linux_nat_target::post_startup_inferior, - adding implementations for ppc_linux_nat_target and arm_linux_nat_target that detect the hardware watchpoint interface, - replacing the aarch64_linux_nat_target implementations of post_attach and post_startup_inferior with a low_init_process implementation. Tested on ppc64le-linux, arm-linux, aarch64-linux and x86_64-linux. Co-Authored-By: Tom de Vries <tdevries@suse.de> Approved-By: Luis Machado <luis.machado@arm.com> PR tdep/31834 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31834 PR tdep/31705 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31705 (cherry picked from commit 50de502a4f843310e231b3174804e95a9e7de4fc) -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2024-06-21 14:45 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-06 13:19 [Bug testsuite/31705] New: New tests from g:c223d3738832011ced54e8415fa218934aebd0e4 fail " clyon at gcc dot gnu.org 2024-05-06 13:21 ` [Bug testsuite/31705] " clyon at gcc dot gnu.org 2024-05-07 10:30 ` pedro at palves dot net 2024-05-07 10:47 ` [Bug testsuite/31705] gdb.base/watchpoint-running.exp fails " pedro at palves dot net 2024-05-07 10:52 ` pedro at palves dot net 2024-05-07 10:57 ` luis.machado at arm dot com 2024-05-07 11:24 ` pedro at palves dot net 2024-05-07 11:33 ` luis.machado at arm dot com 2024-06-03 14:00 ` vries at gcc dot gnu.org 2024-06-03 14:29 ` vries at gcc dot gnu.org 2024-06-03 15:00 ` luis.machado at arm dot com 2024-06-03 15:02 ` vries at gcc dot gnu.org 2024-06-03 17:11 ` pedro at palves dot net 2024-06-03 17:44 ` luis.machado at arm dot com 2024-06-03 17:57 ` pedro at palves dot net 2024-06-03 20:29 ` vries at gcc dot gnu.org 2024-06-03 20:48 ` pedro at palves dot net 2024-06-04 12:06 ` vries at gcc dot gnu.org 2024-06-05 6:52 ` [Bug tdep/31705] " vries at gcc dot gnu.org 2024-06-07 6:39 ` vries at gcc dot gnu.org 2024-06-07 6:52 ` vries at gcc dot gnu.org 2024-06-21 13:13 ` cvs-commit at gcc dot gnu.org 2024-06-21 14:45 ` cvs-commit at gcc dot gnu.org [this message] 2024-06-21 14:47 ` vries at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-31705-4717-zNY0zVM7Rm@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).