Adding watchpoint functions to target vector vs. TARGET*WATCHPOINT macros

David Daney
Tue Sep 9 05:19:00 GMT 2008

In working on adding hardware watch register support to mips*-linux, I
have encountered a small issue.

Back in:

Daniel pointed out that all the watch related functions could be added
directly to the target vector instead of writing target specific
TARGET*WATCHPOINT macros.  While this is true, there is a small drawback.

The target vector is not installed until the inferior is started, so any
watches added before this happens end up being soft-watches.

If the various TARGET*WATCHPOINT macros are defined instead, hardware
watchpoints can be added even if the inferior has not been started.
This scares me a little as it seems that they may end up triggering in
the shell that is starting the inferior.

Ideally in when the first resume() is issued to the inferior the
watchpoints would be re-evaluated to see if some (or all) of them could
be converted to hardware watchpoints.  There might have to be an
additional target hook to allow for this.

For the short term I think I will stick to adding the watch functions to
the target vector, but I am interested in feedback on the merits of
either re-evaluating the watchpoints or using the TARGET*WATCHPOINT macros

David Daney

More information about the Gdb mailing list