Commit Graph

41 Commits

Author SHA1 Message Date
Jeff Roberson
0f33b907d5 - Remove ksethrcmdname. 2008-03-12 11:51:01 +00:00
Dag-Erling Smørgrav
60e15db992 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
2008-02-23 01:01:49 +00:00
John Baldwin
0460d3516d Only use sockoptname() to parse socket option names for SOL_SOCKET
requests.

MFC after:	3 days
Reported by:	Michiel Boland  michiel boland.org
2008-01-07 18:50:25 +00:00
John Baldwin
b850a685ce Add several missing comma's in the fancy syscall parsing case before
some arguments that are parsed (e.g., semctl command names).

MFC after:	3 days
2007-12-06 08:49:43 +00:00
John Baldwin
1db0049fa1 Fix alignment of context switch traces.
MFC after:	1 week
Approved by:	re (rwatson: "I like simple patches.")
2007-07-10 00:01:30 +00:00
Peter Wemm
cae1120adf kdump has knowledge of lseek() and mmap() arg decoding. Teach it about
the new mmap and lseek syscalls.

Approved by:  re (kensmith)
2007-07-04 23:32:49 +00:00
Ed Maste
24be4e6248 Remove static ptrace_ops array and extract ptrace op names from
sys/ptrace.h with mksubr.
2007-04-09 19:16:24 +00:00
John Baldwin
1f4b63f824 Add various utrace's for use with ktrace to the ELF runtime linker. To
activate the traces, set the LD_UTRACE (or LD_32_UTRACE) environment
variable.  This also includes code in kdump(8) to parse the traces.

Reviewed by:	kan, jdp
MFC after:	2 weeks
2007-01-09 17:50:05 +00:00
John Baldwin
670b9e9fda Add code to parse the utrace(2) entries generated by malloc(3) in a more
human-readable format.  Note that we report 'realloc(p, 0)' as 'free(p)'
since both cases are encoded the same way and 'free()' is more common
than a realloc() to 0.

MFC after:	1 week
2007-01-05 21:04:37 +00:00
Craig Rodrigues
8bc31d836f Add sockipprotoname() function. Decode the third parameter (protocol)
of a socket() call with sockipprotoname() if the first parameter (domain)
is PF_INET or PF_INET6.

Old parsing behavior before this change:
ping6    CALL  socket(PF_INET6,SOCK_RAW,0x3a)

New behavior after this change:
ping6    CALL  socket(PF_INET6,SOCK_RAW,IPPROTO_ICMPV6)
2007-01-04 04:46:59 +00:00
Maxim Konovalov
5a3e0a1b99 o Fix some printf(3) format nits in my patch I submitted to kib@.
Submitted by:	ru
2006-07-12 13:36:08 +00:00
Konstantin Belousov
fd6afe791c Check that the signal number is in range.
Submitted by:	maxim
MFC after:	1 week
Approved by:	pjd (mentor)
2006-07-12 12:41:56 +00:00
Alexander Leidinger
98a68a586f Change kdump to print more useful information, i.e. it changes from
32229 telnet   CALL  mmap(0,0x8000,0x3,0x1002,0xffffffff,0,0,0)
 32229 telnet   CALL  open(0x2807bc28,0,0x1b6)
 32229 telnet   CALL  socket(0x2,0x2,0)
to
 32229 telnet   CALL mmap(0,0x8000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0,0)
 32229 telnet   CALL  open(0x2807bc28,O_RDONLY,<unused>0x1b6)
 32229 telnet   CALL  socket(PF_INET,SOCK_DGRAM,0)

David wanted to implement the suggestions which came up at the review from
arch@ too, but real life rejected this proposal. So I commit what we already
got and let another volunteer pick the remaining work from the ideas list.

Submitted by:	"David Kirchner" <dpk@dpk.net>
Suggested by:	FreeBSD ideas list page
Reviewed by:	arch
2006-05-20 14:27:22 +00:00
Robert Watson
df0c8868b1 Add "-s" argument to kdump to suppress the display of I/O data.
MFC after:	1 week
2005-11-12 14:21:48 +00:00
Robert Watson
a9ac598b36 Add a "-H" argument to kdump, which causes kdump to print an additional
field holding the threadid.  This is more useful for libthr than
libpthread, but still quite useful in libpthread as it can be used to
process interlaced records from multiple threads over the course of a
system call.

Detect old ktr_buffer values using the heuristic "if it's negative,
then it must not be a valid threadid".  This may leave something to be
desired.

MFC after:	1 month
Reviewed by:	davidxu
2005-11-01 14:48:23 +00:00
Ruslan Ermilov
7143dfdc43 Place a function prototype correctly.
Submitted by:	Divacky Roman
2004-09-19 14:54:35 +00:00
Poul-Henning Kamp
743f91743d Respect decimal flag when dumping USER type records. 2004-03-25 12:33:55 +00:00
Peter Wemm
24b648094d First pass at attempted debrucification:
- sort the -E switch into the right place.
- add previously missing -p pid in usage (from the last few commits).
- add -E to usage.
- consistently use trfile in the man page.

I knew I shouldn't have touched the man page.  If I commit to a man page,
it just makes people suspicious. :-)
2003-12-08 22:47:59 +00:00
Peter Wemm
ec13191464 Add a -E (elapsed time) flag to kdump. This is like -T, except it is
relative to start of the dump.

Approved by:  re (scottl)
2003-12-07 01:06:32 +00:00
Peter Wemm
ec4beb5d8b Two enhancements for kdump.
1) add a "-p pid", which is rather useful for selecting a single pid in
a combined trace file (eg: with ktrace -i).
2) display binary genio data in a more precise format.
2003-06-03 01:44:43 +00:00
John Baldwin
b9609ab177 Add a default case that just outputs a new line for the case of an
unknown header type.
2003-03-13 18:58:39 +00:00
John Baldwin
db53f66b42 Teach kdump(8) to handle events marked with KTR_DROP. If a record has
KTR_DROP set in its header, then we output an extra line to stdout to
indicate that events were dropped between the previous record and this
record.  It is a bit trickier because we need to always notify the user
if events are dropped even if KTR_DROP is set on a record of a type that
we aren't interested in since kdump(8) doesn't know if the dropped events
were of the types that the user has requested.  To avoid outputting
multiple events dropped notices in between actual event logs, a state
variable is set whenever a drop is logged and cleared whenever an actual
record is output.

Requested by:	phk
2003-03-13 18:46:35 +00:00
David Malone
91fbb9c1db Improve WARNS situation for kdump:
1) Define _KERNEL while including sys/time.h to get some function prototypes.
2) Add prototypes and ANSIify definitions.
3) Constness changes.
4) Remove register keyword.
5) Actually return a sensible value from main.
6) Make fread_tail take a void * instead of a char *.
7) Avoid a signedness warning by casting to a size_t. Should be safe
   enough 'cos we also check for nonnegativity.
8) Be extra chummy with sigset_t rather than passing a struct to printf
   and pretending it is an int.
2002-07-28 16:05:07 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Bruce Evans
c52c4cb57d Decode new ptrace requests PT_GETDBREGS and PT_SETDBREGS. 1999-07-17 09:27:41 +00:00
Bruce Evans
9810672047 Decode all currently supported values of the ptrace `request' arg. 1999-06-26 07:31:13 +00:00
Dmitrij Tejblum
7a6ec4cfb2 Syscall arguments are now properly aligned. Print them, and syscall return
values, as longs, instead of int.
1999-06-16 18:46:40 +00:00
Jean-Marc Zucconi
619f08032e FIx the output of long command names.
PR:		bin/10027
Submitted by:	Arne Henrik Juul <arnej@math.ntnu.no>
1999-05-21 01:09:45 +00:00
Philippe Charnier
15fc002be8 Use err(3). Correct incomplete man page. 1997-07-16 06:49:49 +00:00
Philippe Charnier
6213555ca5 Spelling correction (1 bytes' is now printed 1 byte')
PR: bin/3376
Submitted by: me
1997-05-22 06:17:44 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Bill Fenner
80844fd18a Fix arg parsing. kdump used to allow a single argument, which it
silently ignored.
1996-11-18 19:37:52 +00:00
Poul-Henning Kamp
3f8ba9ae3e Remove length field from utrace entries. 1996-09-22 18:18:20 +00:00
Poul-Henning Kamp
82e2dd32b6 For now we just hexdump the stuff in USER records. 1996-09-19 19:50:45 +00:00
Andrey A. Chernov
5ccbfb26fb Add setlocale LC_CTYPE 1995-10-26 22:16:45 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Poul-Henning Kamp
55229b5643 Absolute path to /sys again... 1994-11-21 00:53:32 +00:00
Geoff Rehmet
c1b99fe68e move #include of <sys/errno.h> so that #defining KERNEL actually has an effect,
and then also add a declaration of ernno as an extern int, because we
lose that due to having KERNEL defined while we include errno.h.
Reviewed by:	Geoff.
1994-08-22 14:28:54 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00