kernel/debug/kdb/kdb_bt.c
Source file repositories/reference/linux-study-clean/kernel/debug/kdb/kdb_bt.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/debug/kdb/kdb_bt.c- Extension
.c- Size
- 5039 bytes
- Lines
- 219
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ctype.hlinux/string.hlinux/kernel.hlinux/sched/signal.hlinux/sched/debug.hlinux/kdb.hlinux/nmi.hkdb_private.h
Detected Declarations
function Copyrightfunction kdb_bt1function kdb_bt_cpufunction kdb_btfunction for_each_online_cpufunction for_each_process_threadfunction for_each_online_cpu
Annotated Snippet
for_each_online_cpu(cpu) {
p = curr_task(cpu);
if (kdb_bt1(p, mask, btaprompt))
return 0;
}
/* Now the inactive tasks */
for_each_process_thread(g, p) {
if (KDB_FLAG(CMD_INTERRUPT))
return 0;
if (task_curr(p))
continue;
if (kdb_bt1(p, mask, btaprompt))
return 0;
}
} else if (strcmp(argv[0], "btp") == 0) {
struct task_struct *p;
unsigned long pid;
if (argc != 1)
return KDB_ARGCOUNT;
diag = kdbgetularg((char *)argv[1], &pid);
if (diag)
return diag;
p = find_task_by_pid_ns(pid, &init_pid_ns);
if (p)
return kdb_bt1(p, "A", false);
kdb_printf("No process with pid == %ld found\n", pid);
return 0;
} else if (strcmp(argv[0], "btt") == 0) {
if (argc != 1)
return KDB_ARGCOUNT;
diag = kdbgetularg((char *)argv[1], &addr);
if (diag)
return diag;
return kdb_bt1((struct task_struct *)addr, "A", false);
} else if (strcmp(argv[0], "btc") == 0) {
unsigned long cpu = ~0;
if (argc > 1)
return KDB_ARGCOUNT;
if (argc == 1) {
diag = kdbgetularg((char *)argv[1], &cpu);
if (diag)
return diag;
}
if (cpu != ~0) {
kdb_bt_cpu(cpu);
} else {
/*
* Recursive use of kdb_parse, do not use argv after
* this point.
*/
argv = NULL;
kdb_printf("btc: cpu status: ");
kdb_parse("cpu\n");
for_each_online_cpu(cpu) {
kdb_bt_cpu(cpu);
touch_nmi_watchdog();
}
}
return 0;
} else {
if (argc) {
nextarg = 1;
diag = kdbgetaddrarg(argc, argv, &nextarg, &addr,
&offset, NULL);
if (diag)
return diag;
kdb_show_stack(kdb_current_task, (void *)addr);
return 0;
} else {
return kdb_bt1(kdb_current_task, "A", false);
}
}
/* NOTREACHED */
return 0;
}
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/string.h`, `linux/kernel.h`, `linux/sched/signal.h`, `linux/sched/debug.h`, `linux/kdb.h`, `linux/nmi.h`, `kdb_private.h`.
- Detected declarations: `function Copyright`, `function kdb_bt1`, `function kdb_bt_cpu`, `function kdb_bt`, `function for_each_online_cpu`, `function for_each_process_thread`, `function for_each_online_cpu`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.