If GDB reports a watchpoint hit, and then the next event is a catchpoint, GDB mistakenly tells the user that the watchpoint triggered. Vis, using foll-fork.c: (gdb) start ... (gdb) awatch v Hardware access (read/write) watchpoint 2: v (gdb) catch fork Catchpoint 3 (fork) (gdb) c Continuing. Hardware access (read/write) watchpoint 2: v Old value = 0 New value = 5 main () at gdb.base/foll-fork.c:16 16 pid = fork (); (gdb) Continuing. Hardware access (read/write) watchpoint 2: v <<<< <<<< these lines are spurious Value = 5 <<<< Catchpoint 3 (forked process 1712369), arch_fork (ctid=0x7ffff7fa4810) at arch-fork.h:49 49 arch-fork.h: No such file or directory. (gdb)
I've got a patch.
Fix merged: commit d37e084783a04c63ae137f953ebdb58bb6f7f704 Author: Pedro Alves <pedro@palves.net> AuthorDate: Tue Nov 23 14:19:07 2021 +0000 Commit: Pedro Alves <pedro@palves.net> CommitDate: Mon Mar 21 17:27:17 2022 +0000 Watchpoint followed by catchpoint misreports watchpoint (PR gdb/28621)