Prepare t_ptrace_wait.h for hardware watchpoints API

Add new symbol ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS() to be protected with
the __HAVE_PTRACE_WATCHPOINTS guard.


XXX:
    Mark check_happy() with __attribute__((optimize("O0"))).
    Disabled optimization is required to make tests for hardware assisted
    traps in .text functional.

    Tested with GCC 5.4 on NetBSD 7.99.47 amd64

Sponsored by <The NetBSD Foundation>
This commit is contained in:
kamil 2016-12-15 08:57:24 +00:00
parent 1eb14748db
commit a513f40fac
1 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ptrace_wait.h,v 1.2 2016/12/05 20:10:10 christos Exp $ */
/* $NetBSD: t_ptrace_wait.h,v 1.3 2016/12/15 08:57:24 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@ -374,7 +374,13 @@ dsum(unsigned n)
return sum;
}
static int __used
/*
* XXX: Disabled optimization is required to make tests for hardware assisted
* traps in .text functional
*
* Tested with GCC 5.4 on NetBSD 7.99.47 amd64
*/
static int __used __attribute__((optimize("O0")))
check_happy(unsigned n)
{
for (;;) {
@ -418,3 +424,9 @@ check_happy(unsigned n)
#else
#define ATF_TP_ADD_TC_PT_STEP(a,b)
#endif
#if defined(__HAVE_PTRACE_WATCHPOINTS)
#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b) ATF_TP_ADD_TC(a,b)
#else
#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b)
#endif