Updating test case

gdb.arch/aarch64-dbreg-contents.exp:
 * Replaced "run" with "runto_main + continue".
 * Replaced "gdb_compile + clean_restart" with "prepare_for_testing".
 * Added comment for case "exited with code 01".

gdb.arch/aarch64-dbreg-contents.c:
 * Removed SET_WATCHPOINT marco.
 * Removed redundent cleanup ().
 * Cleaned up comment.
This commit is contained in:
Weimin Pan 2019-02-14 22:20:36 +00:00
parent abc163a464
commit 9d70ffbc5b
3 changed files with 17 additions and 13 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -27,8 +27,6 @@ cleanup (void)
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)
@ -64,7 +62,7 @@ set_watchpoint (pid_t pid, volatile void *addr, unsigned len_mask)
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;
@ -110,7 +108,7 @@ main (void)
/* 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);
@ -128,6 +126,5 @@ main (void)
}
assert (WSTOPSIG (status) == SIGTRAP);
cleanup ();
return 0;
}

View File

@ -17,7 +17,7 @@
#
# 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.
@ -28,16 +28,15 @@ if {![is_aarch64_target]} {
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 $" {