Created attachment 10351 [details] utl1.c - test program with deliberate stack overwrite bash-3.2$ uname -a Linux DellXPS 4.10.0 #1 SMP Thu Apr 13 09:55:54 EDT 2017 x86_64 GNU/Linux build utl1.c as follows: gcc -Wall -Wno-unused-but-set-variable -g utl1.c -o0 -o utl1 # forward continue - watch break triggered gdb utl1 c-x 2 b *main # break on 1st main() instruction run record watch -l *((long *)$sp) continue # reverse continue - watch break not triggered gdb utl1 c-x 2 b *main # break on 1st main() instruction b *main+41 # break on retq instruction run record continue watch -l *((long *)$sp) reverse-continue
Thanks for reporting. I see the same behavior, hardware watchpoints don't trigger in reverse execution or in replay. As a workaround, you can use "set can-use-hw-watchpoints 0" to force the use of software watchpoints.
The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=288363c1737f93e2f7cb8c06026c11a5ff77fb58 commit 288363c1737f93e2f7cb8c06026c11a5ff77fb58 Author: Hannes Domani <ssbssa@yahoo.de> Date: Wed Dec 6 13:45:51 2023 +0100 Fix hardware watchpoints in replay mode Changes introduced by commit 9e8915c6cee5c37637521b424d723e990e06d597 caused a regression that meant hardware watchpoint stops would not trigger in reverse execution or replay mode. This was documented in PR breakpoints/21969. The problem is that record_check_stopped_by_breakpoint always overwrites record_full_stop_reason, thus loosing the TARGET_STOPPED_BY_WATCHPOINT value which would be checked afterwards. This commit fixes that by not overwriting the stop-reason in record_full_stop_reason if we're not stopped at a breakpoint. And the test for hw watchpoints in gdb.reverse/watch-reverse.exp actually tested sw watchpoints again, since "set can-use-hw-watchpoints 1" doesn't convert enabled watchpoints to use hardware. This is fixed by disabling said watchpoint while enabling hw watchpoints. The same is not done for gdb.reverse/watch-precsave.exp, since it's not possible to use hw watchpoints in restored recordings anyways. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21969 Approved-by: Guinevere Larsen <blarsen@redhat.com>
Fixed.