KDUMP(1)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… KDUMP(1) β€” the general commands manual, bestie edition πŸŽ€

okay so real talk: this is kdump, from the General Commands Manual, and she's about to make your kernel trace files make sense. πŸ¦‹

✨ NAME ✨

kdump β€” display kernel trace data. that's it. that's the vibe. she reads the tea that ktrace spilled. πŸ’–

🌸 SYNOPSIS 🌸

kdump [-dEnlHRSsTA] [-f trfile] [-m maxdata] [-p pid] [-t trstr]

πŸ’œ DESCRIPTION πŸ’œ

the kdump command displays the kernel trace files produced with ktrace(1) in human readable format. like, it takes the raw ✨vibes✨ the kernel scribbled down and translates them into actual sentences you can read. by default, the file ktrace.out in the current directory is displayed. no cap. πŸ‘‘

the options are as follows, and yes we're going through every single one because that's the whole point:

  • -A β€” Display the ABI of the traced process. gotta know what era this process is from 🫢
  • -c β€” Display the CPU number with each trace entry. which core was doing the thing? now you know πŸ’…
  • -d β€” Display all numbers in decimal. no hex brainrot. just base-10 clarity ✨
  • -E β€” Display elapsed timestamps (time since beginning of trace). like a stopwatch for the whole saga ⏱️
  • -f trfile β€” Display the specified file instead of ktrace.out. your file, your rules πŸŽ€
  • -H β€” List the thread ID (tid) of the thread with each trace record, if available. If no thread ID is available, 0 will be printed. (yes, literally 0. she's doing her best 😭)
  • -l β€” Loop reading the trace file, once the end-of-file is reached, waiting for more data. she's not leaving the group chat, she's just lurking for the next message πŸ‘€
  • -m maxdata β€” Display at most maxdata bytes when decoding I/O. boundaries, bestie. we love them πŸ’–
  • -n β€” Suppress ad hoc translations. Normally kdump tries to decode many system calls into a more human readable format. For example, ioctl(2) values are replaced with the macro name and errno values are replaced with the strerror(3) string. Suppressing this feature yields a more consistent output format and is easily amenable to further processing. basically: raw mode, for when you're piping her into something and need her to be professional 🧚
  • -p pid β€” Display only trace events that correspond to the process or thread pid. This may be useful when there are multiple processes or threads recorded in the same trace file. selective listening, iconic behavior πŸ™ˆ
  • -R β€” Display relative timestamps (time since previous entry). how long since the last message? ⏳
  • -r β€” When decoding STRU records, display structure members such as UIDs, GIDs, dates etc. symbolically instead of numerically. names not numbers, we love a glow-up 🌈
  • -S β€” Display system call numbers. the digits behind the drama πŸ”₯
  • -s β€” Suppress display of I/O data. sometimes you just don't need to see the receipts πŸ’€
  • -T β€” Display absolute timestamps for each entry (seconds since epoch). the big clock. the real clock. ⭐
  • -t trstr β€” See the -t option of ktrace(1). go ask her sister, she explains it better 🫢

πŸ¦‹ the output format, explained like we're on FaceTime πŸ¦‹

the output format of kdump is line oriented with several fields. the example below shows a section of a kdump generated by the following commands:

?> ktrace echo "ktrace"

?> kdump

 85045 echo     CALL  writev(0x1,0x804b030,0x2)
 85045 echo     GIO   fd 1 wrote 7 bytes
       "ktrace
       "
 85045 echo     RET   writev 7

so let's break down the fields, because they're lowkey doing a lot:

  • the first field is the PID of the process being traced. 🏷️
  • the second field is the name of the program being traced.
  • the third field is the operation that the kernel performed on behalf of the process.
  • also, if thread IDs are being printed, then an additional thread ID column will be added to the output between the PID field and program name field. surprise extra column! 🎁

In the first line above, the kernel executes the writev(2) system call on behalf of the process so this is a CALL operation. the fourth field shows the system call that was executed, including its arguments. the writev(2) system call takes a file descriptor, in this case 1, or standard output, then a pointer to the iovector to write, and the number of iovectors that are to be written. 🧠✨

In the second line we see the operation was GIO, for general I/O, and that file descriptor 1 had seven bytes written to it. This is followed by the seven bytes that were written, the string "ktrace" with a carriage return and line feed. (the lil line break in the quotes? that's the carriage return and line feed living their truth πŸ’…)

the last line is the RET operation, showing a return from the kernel, what system call we are returning from, and the return value that the process received. Seven bytes were written by the writev(2) system call, so 7 is the return value. she ate and left no crumbs. πŸ“


πŸ‘‘ the possible operations πŸ‘‘

these are the operations you might catch in the wild, plus what shows up in the fourth field:

  • CALL β€” enter syscall β€” fourth field: syscall name and arguments
  • RET β€” return from syscall β€” fourth field: syscall name and return value
  • NAMI β€” file name lookup β€” fourth field: path to file
  • GIO β€” general I/O β€” fourth field: fd, read/write, number of bytes
  • PSIG β€” signal β€” fourth field: signal name, handler, mask, code
  • CSW β€” context switch β€” fourth field: stop/resume user/kernel wmesg
  • USER β€” data from user process β€” fourth field: the data
  • STRU β€” various syscalls β€” fourth field: structure
  • SCTL β€” sysctl(3) requests β€” fourth field: MIB name
  • PFLT β€” enter page fault β€” fourth field: fault address and type
  • PRET β€” return from page fault β€” fourth field: fault result

πŸ‘€ SEE ALSO πŸ‘€

ktrace(1) β€” the other half of this duo, go say hi 🫢

🌈 HISTORY 🌈

The kdump command appeared in 4.4BSD. vintage. antique. elder icon. she's been serving since before you were born πŸ’œ


ngl bestie, if you ever get confused: just run kdump and let her narrate. she literally explains the kernel to you. main character energy fr fr πŸ’…βœ¨

that's the whole page! this edition shipped from Debian and is dated July 16, 2022 β€” big love to the packagers, mwah πŸŽ€

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms