drivers/misc/kgdbts.c
Source file repositories/reference/linux-study-clean/drivers/misc/kgdbts.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/kgdbts.c- Extension
.c- Size
- 31377 bytes
- Lines
- 1193
- Domain
- Driver Families
- Bucket
- drivers/misc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/kgdb.hlinux/ctype.hlinux/uaccess.hlinux/syscalls.hlinux/nmi.hlinux/delay.hlinux/hex.hlinux/kthread.hlinux/module.hlinux/sched/task.hlinux/kallsyms.hasm/sections.hasm/rwonce.h
Detected Declarations
struct test_structstruct test_statefunction kgdbts_unreg_threadfunction kgdbts_break_testfunction kallsyms_lookup_namefunction break_helperfunction sw_breakfunction sw_rem_breakfunction hw_breakfunction hw_rem_breakfunction hw_write_breakfunction hw_rem_write_breakfunction hw_access_breakfunction hw_rem_access_breakfunction hw_break_val_accessfunction hw_break_val_writefunction get_thread_id_continuefunction check_and_rewind_pcfunction check_single_stepfunction write_regsfunction skip_back_repeat_testfunction got_breakfunction get_cont_catchfunction put_cont_catchfunction emul_resetfunction emul_sstep_getfunction emul_sstep_putfunction final_ack_setfunction fill_get_buffunction validate_simple_testfunction run_simple_testfunction init_simple_testfunction run_plant_and_detach_testfunction run_breakpoint_testfunction run_hw_break_testfunction run_nmi_sleep_testfunction run_bad_read_testfunction run_kernel_clone_testfunction run_sys_open_testfunction run_singlestep_break_testfunction kgdbts_run_testsfunction kgdbts_option_setupfunction configure_kgdbtsfunction init_kgdbtsfunction kgdbts_get_charfunction kgdbts_put_charfunction param_set_kgdbts_varfunction kgdbts_pre_exp_handler
Annotated Snippet
device_initcall(init_kgdbts);
static int kgdbts_get_char(void)
{
int val = 0;
if (ts.run_test)
val = ts.run_test(1, 0);
return val;
}
static void kgdbts_put_char(u8 chr)
{
if (ts.run_test)
ts.run_test(0, chr);
}
static int param_set_kgdbts_var(const char *kmessage,
const struct kernel_param *kp)
{
size_t len = strlen(kmessage);
if (len >= MAX_CONFIG_LEN) {
printk(KERN_ERR "kgdbts: config string too long\n");
return -ENOSPC;
}
/* Only copy in the string if the init function has not run yet */
if (configured < 0) {
strcpy(config, kmessage);
return 0;
}
if (configured == 1) {
printk(KERN_ERR "kgdbts: ERROR: Already configured and running.\n");
return -EBUSY;
}
strcpy(config, kmessage);
/* Chop out \n char as a result of echo */
if (len && config[len - 1] == '\n')
config[len - 1] = '\0';
/* Go and configure with the new params. */
return configure_kgdbts();
}
static void kgdbts_pre_exp_handler(void)
{
/* Increment the module count when the debugger is active */
if (!kgdb_connected)
try_module_get(THIS_MODULE);
}
static void kgdbts_post_exp_handler(void)
{
/* decrement the module count when the debugger detaches */
if (!kgdb_connected)
module_put(THIS_MODULE);
}
static struct kgdb_io kgdbts_io_ops = {
.name = "kgdbts",
.read_char = kgdbts_get_char,
.write_char = kgdbts_put_char,
.pre_exception = kgdbts_pre_exp_handler,
.post_exception = kgdbts_post_exp_handler,
};
/*
* not really modular, but the easiest way to keep compat with existing
* bootargs behaviour is to continue using module_param here.
*/
module_param_call(kgdbts, param_set_kgdbts_var, param_get_string, &kps, 0644);
MODULE_PARM_DESC(kgdbts, "<A|V1|V2>[F#|S#][N#]");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/kgdb.h`, `linux/ctype.h`, `linux/uaccess.h`, `linux/syscalls.h`, `linux/nmi.h`, `linux/delay.h`, `linux/hex.h`.
- Detected declarations: `struct test_struct`, `struct test_state`, `function kgdbts_unreg_thread`, `function kgdbts_break_test`, `function kallsyms_lookup_name`, `function break_helper`, `function sw_break`, `function sw_rem_break`, `function hw_break`, `function hw_rem_break`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: integration 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.