+2019-02-13 Weimin Pan <weimin.pan@oracle.com>
+
+ PR breakpoints/21870
+ * gdb.arch/aarch64-dbreg-contents.exp: Use runto_main + continue
+ and prepare_for_testing. Add comment.
+ * gdb.arch/aarch64-dbreg-contents.c: Remove SET_WATCHPOINT and
+ redundant cleanup call. Clean up comment.
+
2019-02-12 Weimin Pan <weimin.pan@oracle.com>
PR breakpoints/21870
child = 0;
}
-#define SET_WATCHPOINT set_watchpoint
-
/* Macros to extract fields from the hardware debug information word. */
#define AARCH64_DEBUG_NUM_SLOTS(x) ((x) & 0xff)
#define AARCH64_DEBUG_ARCH(x) (((x) >> 8) & 0xff)
assert (DR_CONTROL_LENGTH (dreg_state.dbg_regs[0].ctrl) == len_mask);
dreg_state.dbg_regs[0].ctrl |= 2 << 3; // write
- dreg_state.dbg_regs[0].ctrl |= 2 << 1; // GDB: ???: enabled at el0
+ dreg_state.dbg_regs[0].ctrl |= 2 << 1; // enabled at el0
dreg_state.dbg_regs[0].addr = (uintptr_t) addr;
iov.iov_base = &dreg_state;
/* Add a watchpoint to check.
Restart the child. It will write to check.
Check child has stopped on the watchpoint. */
- SET_WATCHPOINT (child, &check, 0x02);
+ set_watchpoint (child, &check, 0x02);
errno = 0;
l = ptrace (PTRACE_CONT, child, 0l, 0l);
}
assert (WSTOPSIG (status) == SIGTRAP);
- cleanup ();
return 0;
}
#
# This test checks that GDB does not alter watchpoints set by an inferior.
# It sets a watchpoint on memory then writes to the watched memory.
-# It will exit with 1 if the watchpoint is not reached.
+# It will exit with 2 if the watchpoint is not reached.
#
# See PR breakpoints/21870.
standard_testfile .c
-if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
- untested "failed to compile"
- return -1
+if { [prepare_for_testing "failed to prepare" ${testfile}] } {
+ return
}
-clean_restart $testfile
-
-set test "run to exit"
-gdb_test_multiple "run" "$test" {
+runto_main
+set test "continue to exit"
+gdb_test_multiple "continue" "$test" {
-re "exited with code 01.*$gdb_prompt $" {
+ # For case that the PTRACE_SETREGSET call fails.
pass "$test"
}
-re "exited normally.*$gdb_prompt $" {