KDUMP(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 β±οΈ-ftrfile β Display the specified file instead ofktrace.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,0will be printed. (yes, literally0. 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 π-mmaxdata β Display at most maxdata bytes when decoding I/O. boundaries, bestie. we love them π-nβ Suppress ad hoc translations. Normallykdumptries to decode many system calls into a more human readable format. For example,ioctl(2)values are replaced with the macro name anderrnovalues are replaced with thestrerror(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 π§-ppid β 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 decodingSTRUrecords, 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. β-ttrstr β See the-toption ofktrace(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 argumentsRETβ return from syscall β fourth field: syscall name and return valueNAMIβ file name lookup β fourth field: path to fileGIOβ general I/O β fourth field: fd, read/write, number of bytesPSIGβ signal β fourth field: signal name, handler, mask, codeCSWβ context switch β fourth field: stop/resume user/kernel wmesgUSERβ data from user process β fourth field: the dataSTRUβ various syscalls β fourth field: structureSCTLβsysctl(3)requests β fourth field: MIB namePFLTβ enter page fault β fourth field: fault address and typePRETβ 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
- Copyright (c) 1990, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms