diff options
author | des <des@FreeBSD.org> | 2008-02-23 01:01:49 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2008-02-23 01:01:49 +0000 |
commit | df26e399aa077b14fb965be866012bccf2847bae (patch) | |
tree | f964310d3ee2e43cfebd6c2b2628bc7056a3aa02 /usr.bin/ktrace | |
parent | 78a1e4fcc29bdf9689366a67205160335e7897bd (diff) | |
download | FreeBSD-src-df26e399aa077b14fb965be866012bccf2847bae.zip FreeBSD-src-df26e399aa077b14fb965be866012bccf2847bae.tar.gz |
This patch adds a new ktrace(2) record type, KTR_STRUCT, whose payload
consists of the null-terminated name and the contents of any structure
you wish to record. A new ktrstruct() function constructs and emits a
KTR_STRUCT record. It is accompanied by convenience macros for struct
stat and struct sockaddr.
In kdump(1), KTR_STRUCT records are handled by a dispatcher function
that runs stringent sanity checks on its contents before handing it
over to individual decoding funtions for each type of structure.
Currently supported structures are struct stat and struct sockaddr for
the AF_INET, AF_INET6 and AF_UNIX families; support for AF_APPLETALK
and AF_IPX is present but disabled, as I am unable to test it properly.
Since 's' was already taken, the letter 't' is used by ktrace(1) to
enable KTR_STRUCT trace points, and in kdump(1) to enable their
decoding.
Derived from patches by Andrew Li <andrew2.li@citi.com>.
PR: kern/117836
MFC after: 3 weeks
Diffstat (limited to 'usr.bin/ktrace')
-rw-r--r-- | usr.bin/ktrace/ktrace.1 | 12 | ||||
-rw-r--r-- | usr.bin/ktrace/ktrace.h | 2 | ||||
-rw-r--r-- | usr.bin/ktrace/subr.c | 3 |
3 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/ktrace/ktrace.1 b/usr.bin/ktrace/ktrace.1 index 0260b1e..07cfc40 100644 --- a/usr.bin/ktrace/ktrace.1 +++ b/usr.bin/ktrace/ktrace.1 @@ -32,7 +32,7 @@ .\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd November 6, 2006 +.Dd February 23, 2008 .Dt KTRACE 1 .Os .Sh NAME @@ -43,11 +43,11 @@ .Op Fl aCcdi .Op Fl f Ar trfile .Op Fl g Ar pgrp | Fl p Ar pid -.Op Fl t Ar trstr +.Op Fl t Ar cnistuw .Nm .Op Fl adi .Op Fl f Ar trfile -.Op Fl t Ar trstr +.Op Fl t Ar cnistuw .Ar command .Sh DESCRIPTION The @@ -105,7 +105,7 @@ processes. Enable (disable) tracing on the indicated process id (only one .Fl p flag is permitted). -.It Fl t Ar trstr +.It Fl t Ar cnistuw The string argument represents the kernel trace points, one per letter. The following table equates the letters with the tracepoints: .Pp @@ -119,13 +119,15 @@ trace .Tn I/O .It Cm s trace signal processing +.It Cm t +trace various structures .It Cm u userland traces .It Cm w context switches .It Cm + trace the default set of trace points - -.Cm c , n , i , s , u +.Cm c , n , i , s , t , u .El .It Ar command Execute diff --git a/usr.bin/ktrace/ktrace.h b/usr.bin/ktrace/ktrace.h index 058fbd7..51d85ee 100644 --- a/usr.bin/ktrace/ktrace.h +++ b/usr.bin/ktrace/ktrace.h @@ -35,7 +35,7 @@ */ #define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \ - KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER) + KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | KTRFAC_STRUCT) #define ALL_POINTS (DEF_POINTS | KTRFAC_CSW) diff --git a/usr.bin/ktrace/subr.c b/usr.bin/ktrace/subr.c index 01d7b43..cfc4f3a 100644 --- a/usr.bin/ktrace/subr.c +++ b/usr.bin/ktrace/subr.c @@ -74,6 +74,9 @@ getpoints(char *s) case 's': facs |= KTRFAC_PSIG; break; + case 't': + facs |= KTRFAC_STRUCT; + break; case 'u': facs |= KTRFAC_USER; break; |