]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Decode kevent structures logged via ktrace(2) in kdump.
authorjhb <jhb@FreeBSD.org>
Sat, 25 Nov 2017 04:49:12 +0000 (04:49 +0000)
committerjhb <jhb@FreeBSD.org>
Sat, 25 Nov 2017 04:49:12 +0000 (04:49 +0000)
commitbac78aa2a49020f1e67b0d1b05e5daf2213879ae
tree75a35ef938a00ad51fde67ebfcb8b9847d4ae207
parentda95c18cf4a4cf3b3276256ab8f967d616940914
Decode kevent structures logged via ktrace(2) in kdump.

- Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of
  structures.

  The structure name in the record payload is preceded by a size_t
  containing the size of the individual structures.  Use this to
  replace the previous code that dumped the kevent arrays dumped for
  kevent().  kdump is now able to decode the kevent structures rather
  than dumping their contents via a hexdump.

  One change from before is that the 'changes' and 'events' arrays are
  not marked with separate 'read' and 'write' annotations in kdump
  output.  Instead, the first array is the 'changes' array, and the
  second array (only present if kevent doesn't fail with an error) is
  the 'events' array.  For kevent(), empty arrays are denoted by an
  entry with an array containing zero entries rather than no record.

- Move kevent decoding tables from truss to libsysdecode.

  This adds three new functions to decode members of struct kevent:
  sysdecode_kevent_filter, sysdecode_kevent_flags, and
  sysdecode_kevent_fflags.

  kdump uses these helper functions to pretty-print kevent fields.

- Move structure definitions for freebsd11 and freebsd32 kevent
  structures to <sys/event.h> so that they can be shared with userland.
  The 32-bit structures are only exposed if _WANT_KEVENT32 is defined.
  The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is
  defined.  The 32-bit freebsd11 structure requires both.

- Decode freebsd11 kevent structures in truss for the compat11.kevent()
  system call.

- Log 32-bit kevent structures via ktrace for 32-bit compat kevent()
  system calls.

- While here, constify the 'void *data' argument to ktrstruct().

Reviewed by: kib (earlier version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12470
16 files changed:
lib/libsysdecode/Makefile
lib/libsysdecode/flags.c
lib/libsysdecode/mktables
lib/libsysdecode/sysdecode.3
lib/libsysdecode/sysdecode.h
lib/libsysdecode/sysdecode_kevent.3 [new file with mode: 0644]
sys/compat/freebsd32/freebsd32.h
sys/compat/freebsd32/freebsd32_misc.c
sys/kern/kern_event.c
sys/kern/kern_ktrace.c
sys/sys/event.h
sys/sys/ktrace.h
usr.bin/kdump/kdump.c
usr.bin/ktrace/ktrace.h
usr.bin/truss/syscall.h
usr.bin/truss/syscalls.c