#include <kern/debug.h>

kern/debug.h Kernel.framework

includes: kern/kcdata.h, sys/appleapiopts.h, sys/cdefs.h, Kernel/stdint.h, Kernel/stdarg.h, uuid/uuid.h, Kernel/mach/boolean.h, Kernel/mach/kern_return.h, mach/vm_types.h, kern/panic_call.h, TargetConditionals.h
16 macros · 9 structs · 8 enums · 6 typedefs · 1 function · 1 variable

structthread_snapshot

An old-style snapshot for a thread. See `struct microstackshot_thread` for microstackshot-specific fields. XXX This is ABI for tools and the order of its fields must not change.
size 316, align 1 · packed
uint32_tsnapshot_magic
uint32_tnkern_frames
uint32_tnuser_frames
uint64_twait_event
uint64_tcontinuation
uint64_tthread_id
uint64_tuser_time
uint64_tsystem_time
int32_tstate
int32_tprioritystatic priority
int32_tsched_prischeduled (current) priority
int32_tsched_flagsscheduler flags
charss_flags
charts_qoseffective qos
charts_rqosrequested qos
charts_rqos_overriderequested qos override
chario_tier
char[3]_reservedpad for 4 byte alignement packing
uint64_tdisk_reads_count
uint64_tdisk_reads_size
uint64_tdisk_writes_count
uint64_tdisk_writes_size
uint64_t[4]io_priority_count
uint64_t[4]io_priority_size
uint64_tpaging_count
uint64_tpaging_size
uint64_tnon_paging_count
uint64_tnon_paging_size
uint64_tdata_count
uint64_tdata_size
uint64_tmetadata_count
uint64_tmetadata_size
uint64_tvoucher_identifierobfuscated voucher identifier
uint64_ttotal_syscalls
char[64]pth_name

structtask_snapshot

An old-style snapshot for a task. See `struct microstackshot_task` for the microstackshot-specific field meanings. XXX This is ABI for tools and the order of its fields must not change.
size 293, align 1 · packed
uint32_tsnapshot_magic
int32_tpid
uint64_tuniqueid
uint64_tuser_time_in_terminated_threads
uint64_tsystem_time_in_terminated_threads
uint8_t[16]shared_cache_identifier
uint64_tshared_cache_slide
uint32_tnloadinfos
intsuspend_count
inttask_sizepages
intfaultsnumber of page faults
intpageinsnumber of actual pageins
intcow_faultsnumber of copy-on-write faults
uint32_tss_flags
uint64_tp_start_secfrom the bsd proc struct
uint64_tp_start_usecfrom the bsd proc struct
char[17]p_commWe restrict ourselves to a statically defined (current as of 2009) length for the p_comm string, due to scoping issues (osfmk/bsd and user/kernel binary compatibility).
uint32_twas_throttled
uint32_tdid_throttle
uint32_tlatency_qos
uint64_tdisk_reads_countI/O Statistics XXX: These fields must be together.
uint64_tdisk_reads_size
uint64_tdisk_writes_count
uint64_tdisk_writes_size
uint64_t[4]io_priority_count
uint64_t[4]io_priority_size
uint64_tpaging_count
uint64_tpaging_size
uint64_tnon_paging_count
uint64_tnon_paging_size
uint64_tdata_count
uint64_tdata_size
uint64_tmetadata_count
uint64_tmetadata_size
uint32_tdonating_pid_count

structmicro_snapshot

size 27, align 1 · packed
uint32_tsnapshot_magic
uint32_tms_cpucpu number this snapshot was recorded on
uint64_tms_timetime at sample (seconds)
uint64_tms_time_microsecs
uint8_tms_flags
uint16_tms_opaque_flagsmanaged by external entity, e.g. fdrmicrod

struct_dyld_cache_header

mirrors the dyld_cache_header struct defined in dyld_cache_format.h from dyld source code
size 224, align 8
char[16]magice.g. "dyld_v0 i386"
uint32_tmappingOffsetfile offset to first dyld_cache_mapping_info
uint32_tmappingCountnumber of dyld_cache_mapping_info entries
uint32_timagesOffsetfile offset to first dyld_cache_image_info
uint32_timagesCountnumber of dyld_cache_image_info entries
uint64_tdyldBaseAddressbase address of dyld when cache was built
uint64_tcodeSignatureOffsetfile offset of code signature blob
uint64_tcodeSignatureSizesize of code signature blob (zero means to end of file)
uint64_tslideInfoOffsetfile offset of kernel slid info
uint64_tslideInfoSizesize of kernel slid info
uint64_tlocalSymbolsOffsetfile offset of where local symbols are stored
uint64_tlocalSymbolsSizesize of local symbols information
uint8_t[16]uuidunique value for each shared cache file
uint64_tcacheType0 for development, 1 for production
uint32_tbranchPoolsOffsetfile offset to table of uint64_t pool addresses
uint32_tbranchPoolsCountnumber of uint64_t entries
uint64_taccelerateInfoAddr(unslid) address of optimization info
uint64_taccelerateInfoSizesize of optimization info
uint64_timagesTextOffsetfile offset to first dyld_cache_image_text_info
uint64_timagesTextCountnumber of dyld_cache_image_text_info entries
uint64_tdylibsImageGroupAddr(unslid) address of ImageGroup for dylibs in this cache
uint64_tdylibsImageGroupSizesize of ImageGroup for dylibs in this cache
uint64_totherImageGroupAddr(unslid) address of ImageGroup for other OS dylibs
uint64_totherImageGroupSizesize of oImageGroup for other OS dylibs
uint64_tprogClosuresAddr(unslid) address of list of program launch closures
uint64_tprogClosuresSizesize of list of program launch closures
uint64_tprogClosuresTrieAddr(unslid) address of trie of indexes into program launch closures
uint64_tprogClosuresTrieSizesize of trie of indexes into program launch closures
uint32_tplatformplatform number (macOS=1, etc)
uint32_t:8formatVersiondyld3::closure::kFormatVersion
uint32_t:1dylibsExpectedOnDiskdyld should expect the dylib exists on disk and to compare inode/mtime to see if cache is valid
uint32_t:1simulatorfor simulator of specified platform
uint32_t:1locallyBuiltCache0 for B&I built cache, 1 for locally built cache
uint32_t:21paddingTBD

struct_dyld_cache_image_text_info

mirrors the dyld_cache_image_text_info struct defined in dyld_cache_format.h from dyld source code
size 32, align 8
uuid_tuuid
uint64_tloadAddressunslid address of start of __TEXT
uint32_ttextSegmentSize
uint32_tpathOffsetoffset from start of cache file

enummicro_snapshot_flags

underlying type unsigned int
kPageGrabRecord2triggered by a page grab
kUserMode4interrupted user space
kIORecord8triggered by I/O writes
kPMIRecord16triggered by a CPU Performance Monitor Interrupt
kMACFRecord32armed by MACF policy
kKernelThread64sampled a kernel thread
kVMFaultRecord128triggered by VM fault
kInterruptRecord1triggered by a timer interrupt
kTimerArmingRecord2triggered by arming a timer, repurposed

enumgeneric_snapshot_flags

Flags used in the following assortment of snapshots.
underlying type unsigned int
kUser64_p1Userspace uses 64 bit pointers
kKernel64_p2The kernel uses 64 bit pointers

macroVM_PRESSURE_TIME_WINDOW

#define VM_PRESSURE_TIME_WINDOW 5
seconds

enumstackshot_flags_t

underlying type uint64_t
STACKSHOT_GET_DQ1
STACKSHOT_SAVE_LOADINFO2
STACKSHOT_GET_GLOBAL_MEM_STATS4
STACKSHOT_SAVE_KEXT_LOADINFO8
STACKSHOT_ACTIVE_KERNEL_THREADS_ONLY256
STACKSHOT_GET_BOOT_PROFILE512
STACKSHOT_DO_COMPRESS1024
STACKSHOT_SAVE_IMP_DONATION_PIDS8192
STACKSHOT_SAVE_IN_KERNEL_BUFFER16384
STACKSHOT_RETRIEVE_EXISTING_BUFFER32768
STACKSHOT_KCDATA_FORMAT65536
STACKSHOT_ENABLE_BT_FAULTING131072
STACKSHOT_COLLECT_DELTA_SNAPSHOT262144
STACKSHOT_COLLECT_SHAREDCACHE_LAYOUT524288
STACKSHOT_TRYLOCK1048576
STACKSHOT_ENABLE_UUID_FAULTING2097152
STACKSHOT_FROM_PANIC4194304
STACKSHOT_NO_IO_STATS8388608
STACKSHOT_THREAD_WAITINFO16777216
STACKSHOT_THREAD_GROUP33554432
STACKSHOT_SAVE_JETSAM_COALITIONS67108864
STACKSHOT_INSTRS_CYCLES134217728
STACKSHOT_ASID268435456
STACKSHOT_PAGE_TABLES536870912
STACKSHOT_DISABLE_LATENCY_INFO1073741824
STACKSHOT_SAVE_DYLD_COMPACTINFO2147483648
STACKSHOT_INCLUDE_DRIVER_THREADS_IN_KERNEL4294967296
STACKSHOT_EXCLAVES8589934592
STACKSHOT_SKIP_EXCLAVES17179869184
STACKSHOT_MTEINFO34359738368

typedefstackshot_flags_t

typedef enum stackshot_flags_t stackshot_flags_t;

enummicrostackshot_flags_t

underlying type uint32_t
STACKSHOT_GET_KERNEL_MICROSTACKSHOT8
STACKSHOT_GET_MICROSTACKSHOT16
STACKSHOT_GLOBAL_MICROSTACKSHOT_ENABLE32
STACKSHOT_GLOBAL_MICROSTACKSHOT_DISABLE64
STACKSHOT_SET_MICROSTACKSHOT_MARK128

typedefmicrostackshot_flags_t

typedef enum microstackshot_flags_t microstackshot_flags_t;

enumtelemetry_notice_t

underlying type uint32_t
TELEMETRY_NOTICE_BASE0
TELEMETRY_NOTICE_KERNEL_MICROSTACKSHOT1

typedeftelemetry_notice_t

typedef enum telemetry_notice_t telemetry_notice_t;

macroSTACKSHOT_THREAD_SNAPSHOT_MAGIC

#define STACKSHOT_THREAD_SNAPSHOT_MAGIC 0xfeedface

macroSTACKSHOT_TASK_SNAPSHOT_MAGIC

#define STACKSHOT_TASK_SNAPSHOT_MAGIC 0xdecafbad

macroSTACKSHOT_MEM_AND_IO_SNAPSHOT_MAGIC

#define STACKSHOT_MEM_AND_IO_SNAPSHOT_MAGIC 0xbfcabcde

macroSTACKSHOT_MICRO_SNAPSHOT_MAGIC

#define STACKSHOT_MICRO_SNAPSHOT_MAGIC 0x31c54011

macroSTACKSHOT_PAGETABLES_MASK_ALL

#define STACKSHOT_PAGETABLES_MASK_ALL ~0

enumkf_override_flag_t

underlying type uint32_t
KF_SERIAL_OVRD2
KF_PMAPV_OVRD4
KF_MATV_OVRD8
KF_STACKSHOT_OVRD16
KF_COMPRSV_OVRD32
KF_INTERRUPT_MASKED_DEBUG_OVRD64
KF_TRAPTRACE_OVRD128
KF_IOTRACE_OVRD256
KF_INTERRUPT_MASKED_DEBUG_STACKSHOT_OVRD512
KF_SCHED_HYGIENE_DEBUG_PMC_OVRD1024
KF_MACH_ASSERT_OVRD2048
KF_MADVISE_FREE_DEBUG_OVRD4096
KF_DISABLE_FP_POPC_ON_PGFLT8192
KF_DISABLE_PROD_TRC_VALIDATION16384
KF_IO_TIMEOUT_OVRD32768
KF_PREEMPTION_DISABLED_DEBUG_OVRD65536
KF_DISABLE_PROCREF_TRACKING_OVRD131072

typedefkf_override_flag_t

typedef enum kf_override_flag_t kf_override_flag_t;

functionkern_feature_override

boolean_t kern_feature_override(kf_override_flag_t fmask)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/debug.c
Returns TRUE if every bit in fmask is set in the kernel feature override mask, initialized from the validation_disables boot-arg (with serverperfmode=1 implying KF_SERVER_PERF_MODE_OVRD). Kernel subsystems use it to check whether a debugging or validation feature has been overridden (disabled) for this boot; the kf_override_flag_t bits include KF_SERIAL_OVRD, KF_STACKSHOT_OVRD, KF_INTERRUPT_MASKED_DEBUG_OVRD, KF_MACH_ASSERT_OVRD, KF_IO_TIMEOUT_OVRD and others declared in kern/debug.h.

enumeph_panic_flags_t

underlying type uint64_t
EMBEDDED_PANIC_HEADER_FLAG_COREDUMP_COMPLETE1
EMBEDDED_PANIC_HEADER_FLAG_STACKSHOT_SUCCEEDED2
EMBEDDED_PANIC_HEADER_FLAG_STACKSHOT_FAILED_DEBUGGERSYNC4
EMBEDDED_PANIC_HEADER_FLAG_STACKSHOT_FAILED_ERROR8
EMBEDDED_PANIC_HEADER_FLAG_STACKSHOT_FAILED_INCOMPLETE16
EMBEDDED_PANIC_HEADER_FLAG_STACKSHOT_FAILED_NESTED32
EMBEDDED_PANIC_HEADER_FLAG_NESTED_PANIC64
EMBEDDED_PANIC_HEADER_FLAG_BUTTON_RESET_PANIC128
EMBEDDED_PANIC_HEADER_FLAG_COMPANION_PROC_INITIATED_PANIC256
EMBEDDED_PANIC_HEADER_FLAG_COREDUMP_FAILED512
EMBEDDED_PANIC_HEADER_FLAG_COMPRESS_FAILED1024
EMBEDDED_PANIC_HEADER_FLAG_STACKSHOT_DATA_COMPRESSED2048
EMBEDDED_PANIC_HEADER_FLAG_ENCRYPTED_COREDUMP_SKIPPED4096
EMBEDDED_PANIC_HEADER_FLAG_KERNEL_COREDUMP_SKIPPED_EXCLUDE_REGIONS_UNAVAILABLE8192
EMBEDDED_PANIC_HEADER_FLAG_COREFILE_UNLINKED16384
EMBEDDED_PANIC_HEADER_FLAG_INCOHERENT_PANICLOG32768
EMBEDDED_PANIC_HEADER_FLAG_EXCLAVE_PANIC65536
EMBEDDED_PANIC_HEADER_FLAG_USERSPACE_INITIATED_PANIC131072
EMBEDDED_PANIC_HEADER_FLAG_INTEGRATED_COPROC_INITIATED_PANIC262144

typedefeph_panic_flags_t

typedef enum eph_panic_flags_t eph_panic_flags_t;

macroMAX_PANIC_INITIATOR_SIZE

#define MAX_PANIC_INITIATOR_SIZE 256

macroEMBEDDED_PANIC_HEADER_CURRENT_VERSION

#define EMBEDDED_PANIC_HEADER_CURRENT_VERSION 8

macroEMBEDDED_PANIC_MAGIC

#define EMBEDDED_PANIC_MAGIC 0x46554E4B
FUNK

macroEMBEDDED_PANIC_HEADER_OSVERSION_LEN

#define EMBEDDED_PANIC_HEADER_OSVERSION_LEN 32

structembedded_panic_header

Any updates to this header should be also updated in astris as it can not grab this header from the SDK. NOTE: DO NOT REMOVE OR CHANGE THE MEANING OF ANY FIELDS FROM THIS STRUCTURE. Any modifications should add new fields at the end, bump the version number and be done alongside astris and DumpPanic changes.
size 225, align 1 · packed
uint32_teph_magicEMBEDDED_PANIC_MAGIC if valid
uint32_teph_crcCRC of everything following the ph_crc in the header and the contents
uint32_teph_versionembedded_panic_header version
eph_panic_flags_teph_panic_flagsFlags indicating any state or relevant details
uint32_teph_panic_log_offsetOffset of the beginning of the panic log from the beginning of the header
uint32_teph_panic_log_lenlength of the panic log
uint32_teph_stackshot_offsetOffset of the beginning of the panic stackshot from the beginning of the header
uint32_teph_stackshot_lenlength of the panic stackshot (0 if not valid )
uint32_teph_other_log_offsetOffset of the other log (any logging subsequent to the stackshot) from the beginning of the header
uint32_teph_other_log_lenlength of the other log
char[32]eph_os_version
char[32]eph_macos_version
uuid_string_teph_bootsessionuuid_stringboot session UUID
uint64_teph_roots_installedbitmap indicating which roots are installed on this system
uint32_teph_ext_paniclog_offset
uint32_teph_ext_paniclog_len
uint32_teph_panic_initiator_offset
uint32_teph_panic_initiator_len
char[16]eph_device_target_typeDevice-specific target type buffer
char[32]eph_device_model_typeDevice-specific model type buffer

macroMACOS_PANIC_HEADER_CURRENT_VERSION

#define MACOS_PANIC_HEADER_CURRENT_VERSION 3

macroMACOS_PANIC_MAGIC

#define MACOS_PANIC_MAGIC 0x44454544
DEED

enummph_panic_flags_t

underlying type uint64_t
MACOS_PANIC_HEADER_FLAG_NESTED_PANIC1
MACOS_PANIC_HEADER_FLAG_COMPANION_PROC_INITIATED_PANIC2
MACOS_PANIC_HEADER_FLAG_STACKSHOT_SUCCEEDED4
MACOS_PANIC_HEADER_FLAG_STACKSHOT_DATA_COMPRESSED8
MACOS_PANIC_HEADER_FLAG_STACKSHOT_FAILED_DEBUGGERSYNC16
MACOS_PANIC_HEADER_FLAG_STACKSHOT_FAILED_ERROR32
MACOS_PANIC_HEADER_FLAG_STACKSHOT_FAILED_INCOMPLETE64
MACOS_PANIC_HEADER_FLAG_STACKSHOT_FAILED_NESTED128
MACOS_PANIC_HEADER_FLAG_COREDUMP_COMPLETE256
MACOS_PANIC_HEADER_FLAG_COREDUMP_FAILED512
MACOS_PANIC_HEADER_FLAG_STACKSHOT_KERNEL_ONLY1024
MACOS_PANIC_HEADER_FLAG_STACKSHOT_FAILED_COMPRESS2048
MACOS_PANIC_HEADER_FLAG_ENCRYPTED_COREDUMP_SKIPPED4096
MACOS_PANIC_HEADER_FLAG_KERNEL_COREDUMP_SKIPPED_EXCLUDE_REGIONS_UNAVAILABLE8192
MACOS_PANIC_HEADER_FLAG_COREFILE_UNLINKED16384
MACOS_PANIC_HEADER_FLAG_INCOHERENT_PANICLOG32768
MACOS_PANIC_HEADER_FLAG_USERSPACE_INITIATED_PANIC65536
MACOS_PANIC_HEADER_FLAG_INTEGRATED_COPROC_INITIATED_PANIC131072

typedefmph_panic_flags_t

typedef enum mph_panic_flags_t mph_panic_flags_t;

structmacos_panic_header

size 56, align 1 · packed
uint32_tmph_magicMACOS_PANIC_MAGIC if valid
uint32_tmph_crcCRC of everything following mph_crc in the header and the contents
uint32_tmph_versionmacos_panic_header version
uint32_tmph_paddingunused
mph_panic_flags_tmph_panic_flagsFlags indicating any state or relevant details
uint32_tmph_panic_log_offsetOffset of the panic log from the beginning of the header
uint32_tmph_panic_log_lenlength of the panic log
uint32_tmph_stackshot_offsetOffset of the panic stackshot from the beginning of the header
uint32_tmph_stackshot_lenlength of the panic stackshot
uint32_tmph_other_log_offsetOffset of the other log (any logging subsequent to the stackshot) from the beginning of the header
uint32_tmph_other_log_lenlength of the other log
uint64_tmph_roots_installedbitmap indicating which roots are installed on this system
char[]mph_datapanic data -- DO NOT ACCESS THIS FIELD DIRECTLY. Use the offsets above relative to the beginning of the header

structefi_aurr_panic_header

size 24, align 1 · packed
uint32_tefi_aurr_magic
uint32_tefi_aurr_crc
uint32_tefi_aurr_version
uint32_tefi_aurr_reset_cause
uint32_tefi_aurr_reset_log_offset
uint32_tefi_aurr_reset_log_len
char[]efi_aurr_panic_data

macroEXTENDED_DEBUG_BUF_SIZE

EXTENDED_/DEBUG_BUF_SIZE can't grow without updates to SMC and iBoot to store larger panic logs on co-processor systems
#define EXTENDED_DEBUG_BUF_SIZE 0x0013ff80

macroEFI_AURR_PANIC_STRING_MAX_LEN

#define EFI_AURR_PANIC_STRING_MAX_LEN 112

structefi_aurr_extended_panic_log

size 1310464, align 1 · packed
char[1310456]efi_aurr_extended_log_buf
uint32_tefi_aurr_log_tailCircular buffer indices
uint32_tefi_aurr_log_headditto..

variableecc_panic_physical_address

If non-zero, this physical address had an ECC error that led to a panic.
extern uint64_t ecc_panic_physical_address