Simplify gdb.threads/wp-replication.exp on counting HW watchpoints
Nowadays, test gdb.threads/wp-replication.exp uses a while loop to
repeatedly insert HW watchpoint, resume and check no error message
coming out, in order to count HW watchpoints There are some
drawbacks in this way,
- the loop could be endless. I think this is use to making trouble
to S/390, since we had such comment
# Some targets (like S/390) behave as though supporting
# unlimited hardware watchpoints. In this case we just take a
# safe exit out of the loop.
I hit this today too because a GDB internal error is triggered
on "continue" in the loop, and $done is 0 invariantly, so the loop
can't end.
- the code counting hardware watchpoint is too complicated. We can
use "set breakpoint always-inserted on" to get the result of inserting
HW watchpoint without resuming the inferior. In this way,
watch_count_done and empty_cycle in c file is no longer needed.
In this patch, I change to use "set breakpoint always-inserted on" trick,
and only iterate $NR_THREADS times, to count the HW watchpoint. In this
way, the loop can't be endless, and GDB doesn't need to resume the inferior.
gdb/testsuite:
2015-10-30 Yao Qi <yao.qi@linaro.org>
* gdb.threads/wp-replication.c (watch_count_done): Remove.
(empty_cycle): Remove.
(main): Don't call empty_cycle. Don't use watch_count_done.
* gdb.threads/wp-replication.exp: Don't set breakpoint on
empty_cycle. Rewrite the code counting HW watchpoints.