diff options
author | Weimin Pan <weimin.pan@oracle.com> | 2019-02-14 22:20:36 +0000 |
---|---|---|
committer | Weimin Pan <weimin.pan@oracle.com> | 2019-02-14 22:27:43 +0000 |
commit | 9d70ffbc5ba41c766ce629447af8e72a5ceba229 (patch) | |
tree | b0fad52ffd787626ced8625b8bf03aa56dc0f2ed /gdb | |
parent | abc163a4647f77bfa449e09da4a85a71e747cf4c (diff) | |
download | gdb-9d70ffbc5ba41c766ce629447af8e72a5ceba229.zip gdb-9d70ffbc5ba41c766ce629447af8e72a5ceba229.tar.gz gdb-9d70ffbc5ba41c766ce629447af8e72a5ceba229.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp | 15 |
3 files changed, 17 insertions, 13 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1ee4f1b..d544680 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -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 diff --git a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c index 010b8b4..66ca76f 100644 --- a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c +++ b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c @@ -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; } diff --git a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp index f6bee02..3edbb14 100644 --- a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp +++ b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp @@ -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 $" { |