Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/kernel/arch/amd64 Synchronize struct dbreg with FreeBS...



details:   https://anonhg.NetBSD.org/src/rev/2e8af6d64d47
branches:  trunk
changeset: 351571:2e8af6d64d47
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Feb 18 04:30:34 2017 +0000

description:
Synchronize struct dbreg with FreeBSD - rename field member .dbregs to .dr

Currently this code is disabled in HEAD and the dbreg struct has to be
committed first in order to be used. Before enabling it I'm working on
reducing needless differences with FreeBSD and Linux.

Sponsored by <The NetBSD Foundation>

diffstat:

 tests/kernel/arch/amd64/t_ptrace_wait.c |  280 ++++++++++++++++----------------
 1 files changed, 140 insertions(+), 140 deletions(-)

diffs (truncated from 577 to 300 lines):

diff -r d311ce07ed1b -r 2e8af6d64d47 tests/kernel/arch/amd64/t_ptrace_wait.c
--- a/tests/kernel/arch/amd64/t_ptrace_wait.c   Sat Feb 18 02:28:21 2017 +0000
+++ b/tests/kernel/arch/amd64/t_ptrace_wait.c   Sat Feb 18 04:30:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.13 2017/02/18 02:28:21 kamil Exp $ */
+/*     $NetBSD: t_ptrace_wait.c,v 1.14 2017/02/18 04:30:34 kamil Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.13 2017/02/18 02:28:21 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.14 2017/02/18 04:30:34 kamil Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -209,8 +209,8 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r, 0) != -1);
 
        printf("State of the debug registers:\n");
-       for (i = 0; i < __arraycount(r.dbregs); i++)
-               printf("r[%zu]=%#lx\n", i, r.dbregs[i]);
+       for (i = 0; i < __arraycount(r.dr); i++)
+               printf("r[%zu]=%#lx\n", i, r.dr[i]);
 
        printf("Before resuming the child process where it left off and "
            "without signal to be sent\n");
@@ -251,8 +251,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -277,15 +277,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[0] = (long)(intptr_t)&watchme;
-       printf("Set DR0 (r1.dbregs[0]) to new value %#lx\n", r1.dbregs[0]);
+       r1.dr[0] = (long)(intptr_t)&watchme;
+       printf("Set DR0 (r1.dr[0]) to new value %#lx\n", r1.dr[0]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -335,8 +335,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -361,15 +361,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[1] = (long)(intptr_t)&watchme;
-       printf("Set DR1 (r1.dbregs[1]) to new value %#lx\n", r1.dbregs[1]);
+       r1.dr[1] = (long)(intptr_t)&watchme;
+       printf("Set DR1 (r1.dr[1]) to new value %#lx\n", r1.dr[1]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -419,8 +419,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -445,15 +445,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[2] = (long)(intptr_t)&watchme;
-       printf("Set DR2 (r1.dbregs[2]) to new value %#lx\n", r1.dbregs[2]);
+       r1.dr[2] = (long)(intptr_t)&watchme;
+       printf("Set DR2 (r1.dr[2]) to new value %#lx\n", r1.dr[2]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -503,8 +503,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -529,15 +529,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[3] = (long)(intptr_t)&watchme;
-       printf("Set DR3 (r1.dbregs[3]) to new value %#lx\n", r1.dbregs[3]);
+       r1.dr[3] = (long)(intptr_t)&watchme;
+       printf("Set DR3 (r1.dr[3]) to new value %#lx\n", r1.dr[3]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -588,8 +588,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -614,15 +614,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[0] = (long)(intptr_t)&watchme;
-       printf("Set DR0 (r1.dbregs[0]) to new value %#lx\n", r1.dbregs[0]);
+       r1.dr[0] = (long)(intptr_t)&watchme;
+       printf("Set DR0 (r1.dr[0]) to new value %#lx\n", r1.dr[0]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -678,8 +678,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -704,15 +704,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[1] = (long)(intptr_t)&watchme;
-       printf("Set DR1 (r1.dbregs[1]) to new value %#lx\n", r1.dbregs[1]);
+       r1.dr[1] = (long)(intptr_t)&watchme;
+       printf("Set DR1 (r1.dr[1]) to new value %#lx\n", r1.dr[1]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -768,8 +768,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -794,15 +794,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[2] = (long)(intptr_t)&watchme;
-       printf("Set DR2 (r1.dbregs[2]) to new value %#lx\n", r1.dbregs[2]);
+       r1.dr[2] = (long)(intptr_t)&watchme;
+       printf("Set DR2 (r1.dr[2]) to new value %#lx\n", r1.dr[2]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -858,8 +858,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+       ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -884,15 +884,15 @@
        ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
        printf("State of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-       r1.dbregs[3] = (long)(intptr_t)&watchme;
-       printf("Set DR3 (r1.dbregs[3]) to new value %#lx\n", r1.dbregs[3]);
+       r1.dr[3] = (long)(intptr_t)&watchme;
+       printf("Set DR3 (r1.dr[3]) to new value %#lx\n", r1.dr[3]);
 
        printf("New state of the debug registers (r1):\n");
-       for (i = 0; i < __arraycount(r1.dbregs); i++)
-               printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+       for (i = 0; i < __arraycount(r1.dr); i++)
+               printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
        printf("Call SETDBREGS for the child process (r1)\n");
        ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -948,8 +948,8 @@
 
        printf("Assert that known number of Debug Registers (%zu) is valid\n",
            len);
-       ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-       ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+       ATF_REQUIRE_EQ(__arraycount(r1.dr), len);



Home | Main Index | Thread Index | Old Index