]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Updating test case
authorWeimin Pan <weimin.pan@oracle.com>
Thu, 14 Feb 2019 22:20:36 +0000 (22:20 +0000)
committerWeimin Pan <weimin.pan@oracle.com>
Thu, 14 Feb 2019 22:27:43 +0000 (22:27 +0000)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c
gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp

index 1ee4f1bd9bb1d491be130507de55023b605f9945..d5446800523f28e73008fd71951642f01398f5c3 100644 (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
index 010b8b4edbdf26261356fba53d1dfb6dfcce92ce..66ca76f847729d398cfbbdad408b5c105be480dc 100644 (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;
 }
index f6bee02b0ce3b262bd84d4679b51a872ed48bc40..3edbb146f0585053965bcd5cd8f6d3adb3724c80 100644 (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 $" {