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:
parent
abc163a464
commit
9d70ffbc5b
|
@ -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>
|
2019-02-12 Weimin Pan <weimin.pan@oracle.com>
|
||||||
|
|
||||||
PR breakpoints/21870
|
PR breakpoints/21870
|
||||||
|
|
|
@ -27,8 +27,6 @@ cleanup (void)
|
||||||
child = 0;
|
child = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SET_WATCHPOINT set_watchpoint
|
|
||||||
|
|
||||||
/* Macros to extract fields from the hardware debug information word. */
|
/* Macros to extract fields from the hardware debug information word. */
|
||||||
#define AARCH64_DEBUG_NUM_SLOTS(x) ((x) & 0xff)
|
#define AARCH64_DEBUG_NUM_SLOTS(x) ((x) & 0xff)
|
||||||
#define AARCH64_DEBUG_ARCH(x) (((x) >> 8) & 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);
|
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 << 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;
|
dreg_state.dbg_regs[0].addr = (uintptr_t) addr;
|
||||||
|
|
||||||
iov.iov_base = &dreg_state;
|
iov.iov_base = &dreg_state;
|
||||||
|
@ -110,7 +108,7 @@ main (void)
|
||||||
/* Add a watchpoint to check.
|
/* Add a watchpoint to check.
|
||||||
Restart the child. It will write to check.
|
Restart the child. It will write to check.
|
||||||
Check child has stopped on the watchpoint. */
|
Check child has stopped on the watchpoint. */
|
||||||
SET_WATCHPOINT (child, &check, 0x02);
|
set_watchpoint (child, &check, 0x02);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
l = ptrace (PTRACE_CONT, child, 0l, 0l);
|
l = ptrace (PTRACE_CONT, child, 0l, 0l);
|
||||||
|
@ -128,6 +126,5 @@ main (void)
|
||||||
}
|
}
|
||||||
assert (WSTOPSIG (status) == SIGTRAP);
|
assert (WSTOPSIG (status) == SIGTRAP);
|
||||||
|
|
||||||
cleanup ();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#
|
#
|
||||||
# This test checks that GDB does not alter watchpoints set by an inferior.
|
# 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 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.
|
# See PR breakpoints/21870.
|
||||||
|
|
||||||
|
@ -28,16 +28,15 @@ if {![is_aarch64_target]} {
|
||||||
|
|
||||||
standard_testfile .c
|
standard_testfile .c
|
||||||
|
|
||||||
if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
|
if { [prepare_for_testing "failed to prepare" ${testfile}] } {
|
||||||
untested "failed to compile"
|
return
|
||||||
return -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_restart $testfile
|
runto_main
|
||||||
|
set test "continue to exit"
|
||||||
set test "run to exit"
|
gdb_test_multiple "continue" "$test" {
|
||||||
gdb_test_multiple "run" "$test" {
|
|
||||||
-re "exited with code 01.*$gdb_prompt $" {
|
-re "exited with code 01.*$gdb_prompt $" {
|
||||||
|
# For case that the PTRACE_SETREGSET call fails.
|
||||||
pass "$test"
|
pass "$test"
|
||||||
}
|
}
|
||||||
-re "exited normally.*$gdb_prompt $" {
|
-re "exited normally.*$gdb_prompt $" {
|
||||||
|
|
Loading…
Reference in New Issue