Hide Forgot
+++ This bug was initially created as a clone of Bug #1261564 +++ Description of problem: ISTM that sometimes hardware watchpoints are not set correctly on armv8. #1 - kernel Bug 1342821: aarch64: ptrace: BAS: Support any contiguous range GDB can return false positive hardware watchpoints (rwatch+awatch) TCMS 118567: /tools/gdb/Sanity/basic-smoke-test https://tcms.engineering.redhat.com/case/118567/ --- Additional comment from Martin Cermak on 2016-05-16 16:56:22 CEST --- So I've been testing with gdb-7.6.1-91.el7.aarch64. However, there is yet another QA testcase linked to this bug, which, I believe, originally spotted this bug: http://pkgs.devel.redhat.com/cgit/tests/gdb/tree/Sanity/basic-smoke-test. This testcase still fails. The scenario using the aforementioned files is as follows: ======= gcc -o testcase testcase.c -g export ARCH=${ARCH:-"`uname -n`"} ./use-case.exp ======= --- Additional comment from Jan Kratochvil on 2016-05-25 00:11:21 CEST --- FSF GDB trunk also does FAIL: GNU gdb (GDB) 7.11.50.20160524-git The testcase http://pkgs.devel.redhat.com/cgit/tests/gdb/plain/Sanity/basic-smoke-test/use-case.exp http://pkgs.devel.redhat.com/cgit/tests/gdb/plain/Sanity/basic-smoke-test/testcase.c has never been tested/ported to aarch64. It needs: perl -pi-orig -e 's/&& \$arch!="ppc64le"/$& && \$arch!="aarch64"/' use-case.exp Although it correctly found out there is a hardware watchpoint bug on aarch64: Aarch64: watchpoints set on non-8-byte-aligned addresses are always missed https://sourceware.org/bugzilla/show_bug.cgi?id=19806 Without the 'perl' substitution above: -=x86_64 +=aarch64 One can see it on: Hardware read watchpoint 6: r^M ^M Value = 8^M -0x00000000004006bf in main () at testcase.c:60^M -60 d=r;^M +main () at testcase.c:59^M +59 d=p;^M x86_64 is right, aarch64 is wrong, there is no 'r' variable read to stop at line 59 (on line 58 variable 'r' is written to, not read from). This can be reproduced in a simplified test reusing 'testcase.c': cat >cmd2 <<EOH set verbose set pagination off b 56 run p &p p &r watch p rwatch r continue # delete 2 continue EOH gcc -o testcase testcase.c -g -Wall gdb -x cmd2 ./testcase $1 = (int *) 0x42002c <p> $2 = (int *) 0x420028 <r> Hardware watchpoint 2: p Hardware read watchpoint 3: r Hardware watchpoint 2: p Old value = 1 New value = 2 main () at testcase.c:58 58 r=d; Hardware read watchpoint 3: r Value = 8 main () at testcase.c:59 59 d=p; (gdb) testcase.c: int p,r,d,e,l; -> long p,r,d,e,l; $1 = (long *) 0x420040 <p> $2 = (long *) 0x420038 <r> Hardware watchpoint 2: p Hardware read watchpoint 3: r Hardware watchpoint 2: p Old value = 1 New value = 2 main () at testcase.c:58 58 r=d; Hardware read watchpoint 3: r Value = 8 0x00000000004007cc in main () at testcase.c:60 60 d=r; (gdb) By changing int->long we workaround the GDB bug of a shared 8-byte aligned memory location by two variables 'p' and 'r' and so the false stopping at line 59 no longer occurs. One can also workaround the bug affecting the 'r' watchpoint by deleting the 'p' watchpoint at that cmd2 line: # delete 2 #2 - Upstream GDB Bug: GDB can miss a watchpoint (watch): https://sourceware.org/ml/gdb-patches/2016-06/msg00315.html Version-Release number of selected component (if applicable): gdb-7.6.1-78.el7.aarch64 gdb-7.6.1-91.el7.aarch64 kernel-4.2.0-0.rc6.19.el7.aarch64 How reproducible: always
Posted upstream but not yet approved there so postponing to: RHEL-7.5 [patch] aarch64: PR 19806: watchpoints: false negatives + PR 20207 contiguous ones https://sourceware.org/ml/gdb-patches/2017-03/msg00470.html Message-ID: <20170327210753.GA29656@host1.jankratochvil.net>
The post upstream is still not approved, therefore postponing it to: RHEL-7.6
Approved now upstream: Re: [patch] aarch64: PR 19806: watchpoints: false negatives + PR 20207 contiguous ones https://sourceware.org/ml/gdb-patches/2018-05/msg00095.html
gdb-8.1-15.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-2abc0d29f2
gdb-8.1-15.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-2abc0d29f2
gdb-8.1-15.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.
Reproduced against gdb-7.6.1-110.el7 and verified against gdb-7.6.1-113.el7.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:3080