1119936Sjhb/*- 2119936Sjhb * Copyright (c) 2000 John Baldwin <jhb@FreeBSD.org> 365556Sjasone * 465556Sjasone * Redistribution and use in source and binary forms, with or without 565556Sjasone * modification, are permitted provided that the following conditions 665556Sjasone * are met: 765556Sjasone * 1. Redistributions of source code must retain the above copyright 865556Sjasone * notice, this list of conditions and the following disclaimer. 965556Sjasone * 2. Redistributions in binary form must reproduce the above copyright 1065556Sjasone * notice, this list of conditions and the following disclaimer in the 1165556Sjasone * documentation and/or other materials provided with the distribution. 1265556Sjasone * 13119936Sjhb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1465556Sjasone * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1565556Sjasone * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16119936Sjhb * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17119936Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18119936Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19119936Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20119936Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21119936Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22119936Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23119936Sjhb * SUCH DAMAGE. 2465556Sjasone */ 2565556Sjasone 2665556Sjasone/* 2768420Sjhb * This module holds the global variables used by KTR and the ktr_tracepoint() 2868420Sjhb * function that does the actual tracing. 2965556Sjasone */ 3065556Sjasone 31116182Sobrien#include <sys/cdefs.h> 32116182Sobrien__FBSDID("$FreeBSD: stable/11/sys/kern/kern_ktr.c 367457 2020-11-07 18:10:59Z dim $"); 33116182Sobrien 3470035Sjhb#include "opt_ddb.h" 3568420Sjhb#include "opt_ktr.h" 36103787Sjeff#include "opt_alq.h" 3768420Sjhb 3870035Sjhb#include <sys/param.h> 39222813Sattilio#include <sys/queue.h> 40103787Sjeff#include <sys/alq.h> 4170035Sjhb#include <sys/cons.h> 42222813Sattilio#include <sys/cpuset.h> 43268186Smarcel#include <sys/kdb.h> 4470705Sjhb#include <sys/kernel.h> 4565556Sjasone#include <sys/ktr.h> 4668420Sjhb#include <sys/libkern.h> 47243046Sjeff#include <sys/lock.h> 48243046Sjeff#include <sys/malloc.h> 49243046Sjeff#include <sys/mutex.h> 5087793Sjhb#include <sys/proc.h> 51243046Sjeff#include <sys/smp.h> 5265556Sjasone#include <sys/sysctl.h> 5368420Sjhb#include <sys/systm.h> 5478784Sjhb#include <sys/time.h> 5565556Sjasone 5693503Sjake#include <machine/cpu.h> 5793503Sjake 58160312Sjhb#ifdef DDB 5970035Sjhb#include <ddb/ddb.h> 60160312Sjhb#include <ddb/db_output.h> 61160312Sjhb#endif 6270035Sjhb 63246282Savg#ifndef KTR_BOOT_ENTRIES 64246282Savg#define KTR_BOOT_ENTRIES 1024 65246282Savg#endif 66246282Savg 6778784Sjhb#ifndef KTR_ENTRIES 6878784Sjhb#define KTR_ENTRIES 1024 6978784Sjhb#endif 7078784Sjhb 71243046Sjeff/* Limit the allocations to something manageable. */ 72243046Sjeff#define KTR_ENTRIES_MAX (8 * 1024 * 1024) 73243046Sjeff 7468420Sjhb#ifndef KTR_MASK 75210337Sattilio#define KTR_MASK (0) 7668420Sjhb#endif 7768420Sjhb 78239923Sattilio#ifndef KTR_CPUMASK 79239923Sattilio#define KTR_CPUMASK CPUSET_FSET 80239923Sattilio#endif 81239923Sattilio 8293503Sjake#ifndef KTR_TIME 8393503Sjake#define KTR_TIME get_cyclecount() 8468420Sjhb#endif 8568420Sjhb 8693503Sjake#ifndef KTR_CPU 8793503Sjake#define KTR_CPU PCPU_GET(cpuid) 8870705Sjhb#endif 8970705Sjhb 90243046Sjeffstatic MALLOC_DEFINE(M_KTR, "KTR", "KTR"); 91243046Sjeff 92219028SnetchildFEATURE(ktr, "Kernel support for KTR kernel tracing facility"); 93219028Snetchild 94243046Sjeffvolatile int ktr_idx = 0; 95283283Sjhbuint64_t ktr_mask = KTR_MASK; 96283283Sjhbuint64_t ktr_compile = KTR_COMPILE; 97246282Savgint ktr_entries = KTR_BOOT_ENTRIES; 98243046Sjeffint ktr_version = KTR_VERSION; 99246282Savgstruct ktr_entry ktr_buf_init[KTR_BOOT_ENTRIES]; 100243046Sjeffstruct ktr_entry *ktr_buf = ktr_buf_init; 101243046Sjeffcpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK); 10270705Sjhb 103267992Shselaskystatic SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options"); 104267985Sgjb 105205017SjhbSYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD, 106205017Sjhb &ktr_version, 0, "Version of the KTR interface"); 10793503Sjake 108283283SjhbSYSCTL_UQUAD(_debug_ktr, OID_AUTO, compile, CTLFLAG_RD, 109243046Sjeff &ktr_compile, 0, "Bitmask of KTR event classes compiled into the kernel"); 110222813Sattilio 111222813Sattiliostatic int 112222813Sattiliosysctl_debug_ktr_cpumask(SYSCTL_HANDLER_ARGS) 113222813Sattilio{ 114222813Sattilio char lktr_cpumask_str[CPUSETBUFSIZ]; 115222813Sattilio cpuset_t imask; 116222813Sattilio int error; 117222813Sattilio 118222813Sattilio cpusetobj_strprint(lktr_cpumask_str, &ktr_cpumask); 119222813Sattilio error = sysctl_handle_string(oidp, lktr_cpumask_str, 120222813Sattilio sizeof(lktr_cpumask_str), req); 121222813Sattilio if (error != 0 || req->newptr == NULL) 122222813Sattilio return (error); 123222813Sattilio if (cpusetobj_strscan(&imask, lktr_cpumask_str) == -1) 124222813Sattilio return (EINVAL); 125222813Sattilio CPU_COPY(&imask, &ktr_cpumask); 126222813Sattilio 127222813Sattilio return (error); 128222813Sattilio} 129222813SattilioSYSCTL_PROC(_debug_ktr, OID_AUTO, cpumask, 130267992Shselasky CTLFLAG_RWTUN | CTLFLAG_MPSAFE | CTLTYPE_STRING, NULL, 0, 131222813Sattilio sysctl_debug_ktr_cpumask, "S", 132222813Sattilio "Bitmask of CPUs on which KTR logging is enabled"); 133222813Sattilio 134154933Sjhbstatic int 135154933Sjhbsysctl_debug_ktr_clear(SYSCTL_HANDLER_ARGS) 136154933Sjhb{ 137154933Sjhb int clear, error; 138154933Sjhb 139154933Sjhb clear = 0; 140154933Sjhb error = sysctl_handle_int(oidp, &clear, 0, req); 141154933Sjhb if (error || !req->newptr) 142154933Sjhb return (error); 143154933Sjhb 144154933Sjhb if (clear) { 145243046Sjeff bzero(ktr_buf, sizeof(*ktr_buf) * ktr_entries); 146154933Sjhb ktr_idx = 0; 147154933Sjhb } 148154933Sjhb 149154933Sjhb return (error); 150154933Sjhb} 151154933SjhbSYSCTL_PROC(_debug_ktr, OID_AUTO, clear, CTLTYPE_INT|CTLFLAG_RW, 0, 0, 152154933Sjhb sysctl_debug_ktr_clear, "I", "Clear KTR Buffer"); 153154933Sjhb 154243046Sjeff/* 155243046Sjeff * This is a sysctl proc so that it is serialized as !MPSAFE along with 156243046Sjeff * the other ktr sysctl procs. 157243046Sjeff */ 158243046Sjeffstatic int 159243046Sjeffsysctl_debug_ktr_mask(SYSCTL_HANDLER_ARGS) 160243046Sjeff{ 161283283Sjhb uint64_t mask; 162283283Sjhb int error; 163243046Sjeff 164243046Sjeff mask = ktr_mask; 165283283Sjhb error = sysctl_handle_64(oidp, &mask, 0, req); 166243046Sjeff if (error || !req->newptr) 167243046Sjeff return (error); 168243046Sjeff ktr_mask = mask; 169243046Sjeff return (error); 170243046Sjeff} 171243046Sjeff 172283283SjhbSYSCTL_PROC(_debug_ktr, OID_AUTO, mask, CTLTYPE_U64 | CTLFLAG_RWTUN, 0, 0, 173283283Sjhb sysctl_debug_ktr_mask, "QU", 174243046Sjeff "Bitmask of KTR event classes for which logging is enabled"); 175243046Sjeff 176246331Savg#if KTR_ENTRIES > KTR_BOOT_ENTRIES 177246282Savg/* 178246282Savg * A simplified version of sysctl_debug_ktr_entries. 179246282Savg * No need to care about SMP, scheduling, etc. 180246282Savg */ 181246282Savgstatic void 182246282Savgktr_entries_initializer(void *dummy __unused) 183246282Savg{ 184283283Sjhb uint64_t mask; 185246282Savg 186246282Savg /* Temporarily disable ktr in case malloc() is being traced. */ 187246282Savg mask = ktr_mask; 188246282Savg ktr_mask = 0; 189246282Savg ktr_buf = malloc(sizeof(*ktr_buf) * KTR_ENTRIES, M_KTR, 190246282Savg M_WAITOK | M_ZERO); 191246530Savg memcpy(ktr_buf, ktr_buf_init + ktr_idx, 192246530Savg (KTR_BOOT_ENTRIES - ktr_idx) * sizeof(*ktr_buf)); 193263651Sneel if (ktr_idx != 0) { 194246530Savg memcpy(ktr_buf + KTR_BOOT_ENTRIES - ktr_idx, ktr_buf_init, 195246530Savg ktr_idx * sizeof(*ktr_buf)); 196263651Sneel ktr_idx = KTR_BOOT_ENTRIES; 197263651Sneel } 198246282Savg ktr_entries = KTR_ENTRIES; 199246282Savg ktr_mask = mask; 200246282Savg} 201246282SavgSYSINIT(ktr_entries_initializer, SI_SUB_KMEM, SI_ORDER_ANY, 202246282Savg ktr_entries_initializer, NULL); 203246282Savg#endif 204246282Savg 205243046Sjeffstatic int 206243046Sjeffsysctl_debug_ktr_entries(SYSCTL_HANDLER_ARGS) 207243046Sjeff{ 208283283Sjhb uint64_t mask; 209283283Sjhb int entries, error; 210243046Sjeff struct ktr_entry *buf, *oldbuf; 211243046Sjeff 212243046Sjeff entries = ktr_entries; 213243046Sjeff error = sysctl_handle_int(oidp, &entries, 0, req); 214243046Sjeff if (error || !req->newptr) 215243046Sjeff return (error); 216243046Sjeff if (entries > KTR_ENTRIES_MAX) 217243046Sjeff return (ERANGE); 218243046Sjeff /* Disable ktr temporarily. */ 219243046Sjeff mask = ktr_mask; 220283283Sjhb ktr_mask = 0; 221243046Sjeff /* Wait for threads to go idle. */ 222243046Sjeff if ((error = quiesce_all_cpus("ktrent", PCATCH)) != 0) { 223243046Sjeff ktr_mask = mask; 224243046Sjeff return (error); 225243046Sjeff } 226243046Sjeff if (ktr_buf != ktr_buf_init) 227243046Sjeff oldbuf = ktr_buf; 228243046Sjeff else 229243046Sjeff oldbuf = NULL; 230243046Sjeff /* Allocate a new buffer. */ 231243046Sjeff buf = malloc(sizeof(*buf) * entries, M_KTR, M_WAITOK | M_ZERO); 232243046Sjeff /* Install the new buffer and restart ktr. */ 233243046Sjeff ktr_buf = buf; 234243046Sjeff ktr_entries = entries; 235243046Sjeff ktr_idx = 0; 236283283Sjhb ktr_mask = mask; 237243046Sjeff if (oldbuf != NULL) 238243046Sjeff free(oldbuf, M_KTR); 239243046Sjeff 240243046Sjeff return (error); 241243046Sjeff} 242243046Sjeff 243243046SjeffSYSCTL_PROC(_debug_ktr, OID_AUTO, entries, CTLTYPE_INT|CTLFLAG_RW, 0, 0, 244243046Sjeff sysctl_debug_ktr_entries, "I", "Number of entries in the KTR buffer"); 245243046Sjeff 24693503Sjake#ifdef KTR_VERBOSE 24793503Sjakeint ktr_verbose = KTR_VERBOSE; 24877900SpeterTUNABLE_INT("debug.ktr.verbose", &ktr_verbose); 24970705SjhbSYSCTL_INT(_debug_ktr, OID_AUTO, verbose, CTLFLAG_RW, &ktr_verbose, 0, ""); 25093503Sjake#endif 25168420Sjhb 252103787Sjeff#ifdef KTR_ALQ 253103787Sjeffstruct alq *ktr_alq; 254103787Sjeffchar ktr_alq_file[MAXPATHLEN] = "/tmp/ktr.out"; 255103787Sjeffint ktr_alq_cnt = 0; 256103787Sjeffint ktr_alq_depth = KTR_ENTRIES; 257103787Sjeffint ktr_alq_enabled = 0; 258103787Sjeffint ktr_alq_failed = 0; 259103787Sjeffint ktr_alq_max = 0; 260103787Sjeff 261103787SjeffSYSCTL_INT(_debug_ktr, OID_AUTO, alq_max, CTLFLAG_RW, &ktr_alq_max, 0, 262103787Sjeff "Maximum number of entries to write"); 263103787SjeffSYSCTL_INT(_debug_ktr, OID_AUTO, alq_cnt, CTLFLAG_RD, &ktr_alq_cnt, 0, 264103787Sjeff "Current number of written entries"); 265103787SjeffSYSCTL_INT(_debug_ktr, OID_AUTO, alq_failed, CTLFLAG_RD, &ktr_alq_failed, 0, 266103787Sjeff "Number of times we overran the buffer"); 267103787SjeffSYSCTL_INT(_debug_ktr, OID_AUTO, alq_depth, CTLFLAG_RW, &ktr_alq_depth, 0, 268103787Sjeff "Number of items in the write buffer"); 269103787SjeffSYSCTL_STRING(_debug_ktr, OID_AUTO, alq_file, CTLFLAG_RW, ktr_alq_file, 270103787Sjeff sizeof(ktr_alq_file), "KTR logging file"); 271103787Sjeff 272103787Sjeffstatic int 273103787Sjeffsysctl_debug_ktr_alq_enable(SYSCTL_HANDLER_ARGS) 274103787Sjeff{ 275103787Sjeff int error; 276103787Sjeff int enable; 277103787Sjeff 278103787Sjeff enable = ktr_alq_enabled; 279103787Sjeff 280154940Sjhb error = sysctl_handle_int(oidp, &enable, 0, req); 281154940Sjhb if (error || !req->newptr) 282154940Sjhb return (error); 283103787Sjeff 284103787Sjeff if (enable) { 285103787Sjeff if (ktr_alq_enabled) 286103787Sjeff return (0); 287116697Srwatson error = alq_open(&ktr_alq, (const char *)ktr_alq_file, 288145142Srwatson req->td->td_ucred, ALQ_DEFAULT_CMODE, 289145142Srwatson sizeof(struct ktr_entry), ktr_alq_depth); 290103787Sjeff if (error == 0) { 291103787Sjeff ktr_alq_cnt = 0; 292103787Sjeff ktr_alq_failed = 0; 293103787Sjeff ktr_alq_enabled = 1; 294103787Sjeff } 295103787Sjeff } else { 296103787Sjeff if (ktr_alq_enabled == 0) 297103787Sjeff return (0); 298103787Sjeff ktr_alq_enabled = 0; 299103787Sjeff alq_close(ktr_alq); 300103787Sjeff ktr_alq = NULL; 301103787Sjeff } 302103787Sjeff 303103787Sjeff return (error); 304103787Sjeff} 305103787SjeffSYSCTL_PROC(_debug_ktr, OID_AUTO, alq_enable, 306103787Sjeff CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_debug_ktr_alq_enable, 307103787Sjeff "I", "Enable KTR logging"); 308103787Sjeff#endif 309103787Sjeff 31068420Sjhbvoid 311283283Sjhbktr_tracepoint(uint64_t mask, const char *file, int line, const char *format, 31293503Sjake u_long arg1, u_long arg2, u_long arg3, u_long arg4, u_long arg5, 31393503Sjake u_long arg6) 31468420Sjhb{ 31568420Sjhb struct ktr_entry *entry; 316103787Sjeff#ifdef KTR_ALQ 317103787Sjeff struct ale *ale = NULL; 318206632Sjulian#endif 31974903Sjhb int newindex, saveindex; 320103787Sjeff#if defined(KTR_VERBOSE) || defined(KTR_ALQ) 32187793Sjhb struct thread *td; 32293503Sjake#endif 32391904Sjhb int cpu; 32468420Sjhb 325268186Smarcel if (panicstr || kdb_active) 32669880Sjhb return; 327243046Sjeff if ((ktr_mask & mask) == 0 || ktr_buf == NULL) 32868420Sjhb return; 32993503Sjake cpu = KTR_CPU; 330222813Sattilio if (!CPU_ISSET(cpu, &ktr_cpumask)) 33193503Sjake return; 332103787Sjeff#if defined(KTR_VERBOSE) || defined(KTR_ALQ) 33387793Sjhb td = curthread; 334116101Sjhb if (td->td_pflags & TDP_INKTR) 33587793Sjhb return; 336116101Sjhb td->td_pflags |= TDP_INKTR; 33793503Sjake#endif 338103787Sjeff#ifdef KTR_ALQ 339206632Sjulian if (ktr_alq_enabled) { 340206632Sjulian if (td->td_critnest == 0 && 341343545Sdelphij (TD_IS_IDLETHREAD(td)) == 0 && 342206632Sjulian td != ald_thread) { 343206632Sjulian if (ktr_alq_max && ktr_alq_cnt > ktr_alq_max) 344206632Sjulian goto done; 345206632Sjulian if ((ale = alq_get(ktr_alq, ALQ_NOWAIT)) == NULL) { 346206632Sjulian ktr_alq_failed++; 347206632Sjulian goto done; 348206632Sjulian } 349206632Sjulian ktr_alq_cnt++; 350206632Sjulian entry = (struct ktr_entry *)ale->ae_data; 351206632Sjulian } else { 352103787Sjeff goto done; 353103787Sjeff } 354103787Sjeff } else 355103787Sjeff#endif 356206632Sjulian { 357206632Sjulian do { 358206632Sjulian saveindex = ktr_idx; 359243046Sjeff newindex = (saveindex + 1) % ktr_entries; 360206632Sjulian } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); 361206632Sjulian entry = &ktr_buf[saveindex]; 362206632Sjulian } 36393503Sjake entry->ktr_timestamp = KTR_TIME; 36491904Sjhb entry->ktr_cpu = cpu; 365147278Sjeff entry->ktr_thread = curthread; 366112105Sjhb if (file != NULL) 367112105Sjhb while (strncmp(file, "../", 3) == 0) 368112105Sjhb file += 3; 36993503Sjake entry->ktr_file = file; 37068420Sjhb entry->ktr_line = line; 37193503Sjake#ifdef KTR_VERBOSE 37268420Sjhb if (ktr_verbose) { 37368782Sjhb#ifdef SMP 37493503Sjake printf("cpu%d ", cpu); 37568782Sjhb#endif 37693503Sjake if (ktr_verbose > 1) { 37793503Sjake printf("%s.%d\t", entry->ktr_file, 37893503Sjake entry->ktr_line); 37993503Sjake } 38093503Sjake printf(format, arg1, arg2, arg3, arg4, arg5, arg6); 38168420Sjhb printf("\n"); 38268420Sjhb } 38393503Sjake#endif 38468420Sjhb entry->ktr_desc = format; 38593503Sjake entry->ktr_parms[0] = arg1; 38693503Sjake entry->ktr_parms[1] = arg2; 38793503Sjake entry->ktr_parms[2] = arg3; 38893503Sjake entry->ktr_parms[3] = arg4; 38993503Sjake entry->ktr_parms[4] = arg5; 39093503Sjake entry->ktr_parms[5] = arg6; 391103787Sjeff#ifdef KTR_ALQ 392206632Sjulian if (ktr_alq_enabled && ale) 393103787Sjeff alq_post(ktr_alq, ale); 394103787Sjeffdone: 395103787Sjeff#endif 396103787Sjeff#if defined(KTR_VERBOSE) || defined(KTR_ALQ) 397116101Sjhb td->td_pflags &= ~TDP_INKTR; 39868420Sjhb#endif 39968420Sjhb} 40070035Sjhb 40170035Sjhb#ifdef DDB 40270035Sjhb 40370035Sjhbstruct tstate { 40470035Sjhb int cur; 40570035Sjhb int first; 40670035Sjhb}; 40770035Sjhbstatic struct tstate tstate; 40870035Sjhbstatic int db_ktr_verbose; 40970035Sjhbstatic int db_mach_vtrace(void); 41070035Sjhb 41172755SjhbDB_SHOW_COMMAND(ktr, db_ktr_all) 41270035Sjhb{ 413118269Sjhb 414243046Sjeff tstate.cur = (ktr_idx - 1) % ktr_entries; 41570035Sjhb tstate.first = -1; 416206632Sjulian db_ktr_verbose = 0; 417229272Sed db_ktr_verbose |= (strchr(modif, 'v') != NULL) ? 2 : 0; 418229272Sed db_ktr_verbose |= (strchr(modif, 'V') != NULL) ? 1 : 0; /* just timestap please */ 419229272Sed if (strchr(modif, 'a') != NULL) { 420160312Sjhb db_disable_pager(); 421295098Sandrew while (cncheckc() == -1) 422118269Sjhb if (db_mach_vtrace() == 0) 42372755Sjhb break; 424118269Sjhb } else { 425160312Sjhb while (!db_pager_quit) 426118269Sjhb if (db_mach_vtrace() == 0) 42772755Sjhb break; 428118269Sjhb } 42970035Sjhb} 43070035Sjhb 43170035Sjhbstatic int 43270035Sjhbdb_mach_vtrace(void) 43370035Sjhb{ 43470035Sjhb struct ktr_entry *kp; 43570035Sjhb 436243046Sjeff if (tstate.cur == tstate.first || ktr_buf == NULL) { 43770035Sjhb db_printf("--- End of trace buffer ---\n"); 43870035Sjhb return (0); 43970035Sjhb } 44070035Sjhb kp = &ktr_buf[tstate.cur]; 44170035Sjhb 44270035Sjhb /* Skip over unused entries. */ 44372755Sjhb if (kp->ktr_desc == NULL) { 44472755Sjhb db_printf("--- End of trace buffer ---\n"); 44572755Sjhb return (0); 44672755Sjhb } 447147278Sjeff db_printf("%d (%p", tstate.cur, kp->ktr_thread); 44870035Sjhb#ifdef SMP 449147278Sjeff db_printf(":cpu%d", kp->ktr_cpu); 45070035Sjhb#endif 451147278Sjeff db_printf(")"); 452206632Sjulian if (db_ktr_verbose >= 1) { 453206632Sjulian db_printf(" %10.10lld", (long long)kp->ktr_timestamp); 45493503Sjake } 455206632Sjulian if (db_ktr_verbose >= 2) { 456206632Sjulian db_printf(" %s.%d", kp->ktr_file, kp->ktr_line); 457206632Sjulian } 458147278Sjeff db_printf(": "); 45993503Sjake db_printf(kp->ktr_desc, kp->ktr_parms[0], kp->ktr_parms[1], 46093503Sjake kp->ktr_parms[2], kp->ktr_parms[3], kp->ktr_parms[4], 46193503Sjake kp->ktr_parms[5]); 46272755Sjhb db_printf("\n"); 46370035Sjhb 46470035Sjhb if (tstate.first == -1) 46570035Sjhb tstate.first = tstate.cur; 46670035Sjhb 46770035Sjhb if (--tstate.cur < 0) 468243046Sjeff tstate.cur = ktr_entries - 1; 46970035Sjhb 47070035Sjhb return (1); 47170035Sjhb} 47270035Sjhb 47370035Sjhb#endif /* DDB */ 474