Bug 28621 - Watchpoint followed by catchpoint misreports watchpoint
Summary: Watchpoint followed by catchpoint misreports watchpoint
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Pedro Alves
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-23 17:36 UTC by Pedro Alves
Modified: 2022-03-21 17:32 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Alves 2021-11-23 17:36:23 UTC
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)
Comment 1 Pedro Alves 2021-11-23 17:36:51 UTC
I've got a patch.
Comment 2 Pedro Alves 2022-03-21 17:32:33 UTC
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)