Source-Changes-HG archive

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

[src/trunk]: src Add new si_code TRAP_DBREG



details:   https://anonhg.NetBSD.org/src/rev/2813a675cfe8
branches:  trunk
changeset: 821770:2813a675cfe8
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Feb 17 01:14:31 2017 +0000

description:
Add new si_code TRAP_DBREG

It replaces previous TRAP_HWWPT and is designed to be used for debug
register traps (both watchpoints and breakpoints).

TRAP_HWWPT wasn't documented in siginfo(2) neither noted in doc/CHANGES -
- document it and add new entry in CHANGES. This move is a step towards
switch the watchpoint ptrace(2) api to PT_*DBREGS.

This code was introduced recently and has no impact on stable releases.

Sponsored by <The NetBSD Foundation>

diffstat:

 doc/CHANGES                 |   3 ++-
 share/man/man2/siginfo.2    |  20 ++++++++++++++------
 sys/arch/amd64/amd64/trap.c |   6 +++---
 sys/arch/i386/i386/trap.c   |   6 +++---
 4 files changed, 22 insertions(+), 13 deletions(-)

diffs (119 lines):

diff -r 332d608da040 -r 2813a675cfe8 doc/CHANGES
--- a/doc/CHANGES       Fri Feb 17 00:51:52 2017 +0000
+++ b/doc/CHANGES       Fri Feb 17 01:14:31 2017 +0000
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:                   <$Revision: 1.2254 $>
+# LIST OF CHANGES FROM LAST RELEASE:                   <$Revision: 1.2255 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -472,3 +472,4 @@
                PT_GET_SIGMASK and PT_SET_SIGMASK [kamil 20170212]
        postfix(1): Import version 3.1.4. [christos 20170213]
        l2tp(4): Add L2TPv3 interface. [knakahara 20170216]
+       siginfo(2): Add new si_code for SIGTRAP: TRAP_DBREG [kamil 20170217]
diff -r 332d608da040 -r 2813a675cfe8 share/man/man2/siginfo.2
--- a/share/man/man2/siginfo.2  Fri Feb 17 00:51:52 2017 +0000
+++ b/share/man/man2/siginfo.2  Fri Feb 17 01:14:31 2017 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: siginfo.2,v 1.21 2017/01/14 06:55:40 kamil Exp $
+.\"    $NetBSD: siginfo.2,v 1.22 2017/02/17 01:14:31 kamil Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -231,6 +231,8 @@
 Process breakpoint
 .It TRAP_CHLD
 Process child trap
+.It TRAP_DBREG
+Process hardware debug register trap
 .It TRAP_EXEC
 Process exec trap
 .It TRAP_LWP
@@ -370,21 +372,27 @@
 extensions.
 .Pp
 The
+.Dv TRAP_CHLD ,
+.Dv TRAP_DBREG ,
 .Dv TRAP_EXEC
-signal specific reason of
+and
+.Dv TRAP_LWP
+signal specific reasons of
 .Dv SIGTRAP
-is
+are
 .Nx
-extension.
+extensions.
 .Sh HISTORY
 The
 .Nm
 functionality first appeared in
 .At V.4 .
 .Pp
-.Dv TRAP_CHLD
+.Dv TRAP_CHLD ,
+.Dv TRAP_DBREG ,
+.Dv TRAP_EXEC
 and
-.Dv TRAP_EXEC
+.Dv TRAP_LWP
 first appeared
 in
 .Nx 8 .
diff -r 332d608da040 -r 2813a675cfe8 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c       Fri Feb 17 00:51:52 2017 +0000
+++ b/sys/arch/amd64/amd64/trap.c       Fri Feb 17 01:14:31 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.90 2017/02/14 09:11:05 maxv Exp $   */
+/*     $NetBSD: trap.c,v 1.91 2017/02/17 01:14:31 kamil Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.90 2017/02/14 09:11:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.91 2017/02/17 01:14:31 kamil Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -711,7 +711,7 @@
                        ksi.ksi_signo = SIGTRAP;
                        ksi.ksi_trap = type & ~T_USER;
                        if ((wptnfo = user_trap_x86_hw_watchpoint())) {
-                               ksi.ksi_code = TRAP_HWWPT;
+                               ksi.ksi_code = TRAP_DBREG;
                                ksi.ksi_trap2 = x86_hw_watchpoint_reg(wptnfo);
                                ksi.ksi_trap3 = x86_hw_watchpoint_type(wptnfo);
                        } else if (type == (T_BPTFLT|T_USER))
diff -r 332d608da040 -r 2813a675cfe8 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Fri Feb 17 00:51:52 2017 +0000
+++ b/sys/arch/i386/i386/trap.c Fri Feb 17 01:14:31 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.282 2017/01/18 05:11:59 kamil Exp $ */
+/*     $NetBSD: trap.c,v 1.283 2017/02/17 01:14:31 kamil Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.282 2017/01/18 05:11:59 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.283 2017/02/17 01:14:31 kamil Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -701,7 +701,7 @@
                        ksi.ksi_signo = SIGTRAP;
                        ksi.ksi_trap = type & ~T_USER;
                        if ((wptnfo = user_trap_x86_hw_watchpoint())) {
-                               ksi.ksi_code = TRAP_HWWPT;
+                               ksi.ksi_code = TRAP_DBREG;
                                ksi.ksi_trap2 = x86_hw_watchpoint_reg(wptnfo);
                                ksi.ksi_trap3 = x86_hw_watchpoint_type(wptnfo);
                        } else if (type == (T_BPTFLT|T_USER))



Home | Main Index | Thread Index | Old Index