sleeping_thread_to_gdb_regs(9)
π€ sleeping_thread_to_gdb_regs β the manual page, but make it make sense π
okay bestie, so this is sleeping_thread_to_gdb_regs(9) from the Kernel API Manual, and honestly? it's giving "niche but iconic" π
let's get into it.
β¨ NAME β¨
sleeping_thread_to_gdb_regs β literally just converts ptrace regs to GDB regs, no cap π¦
πΈ SYNOPSIS πΈ
void sleeping_thread_to_gdb_regs (unsigned long *gdb_regs , struct
task_struct *p );
that's the whole signature, bestie β she's short and she knows it β¨
π©· ARGUMENTS π©·
gdb_regsβ a pointer to hold the registers in the order GDB wants. like, GDB has opinions about ordering and we're respecting them π«Άpβ thestruct task_structof the desired process. the one you're snooping on π
π DESCRIPTION π
okay so the whole vibe here:
Convert the register values of the sleeping process in p to the format that GDB expects. that's the job. that's the assignment. periodt π
This function is called when kgdb does not have access to the struct pt_regs β like, it's just not available, tragic, we move β and therefore it should fill the gdb registers gdb_regs with what has been saved in the struct thread_struct thread field during switch_to. that's the source of truth here, bestie, that's the stash π§
so lowkey: no pt_regs? no problem. we pull from thread_struct's thread field and vibe check it into GDB's preferred layout. slay π₯
π SEE ALSO π
Kernel file ./include/linux/kgdb.h, plus the whole kgdb friend group β they all show up together, it's a whole era:
kgdb_skipexception(9)kgdb_breakpoint(9)kgdb_arch_init(9)kgdb_arch_exit(9)pt_regs_to_gdb_regs(9)gdb_regs_to_pt_regs(9)kgdb_arch_handle_exception(9)kgdb_arch_handle_qxfer_pkt(9)kgdb_call_nmi_hook(9)kgdb_roundup_cpus(9)kgdb_arch_set_pc(9)kgdb_arch_late(9)struct kgdb_arch(9)struct kgdb_io(9)
ngl, if you're here you're probably already deep in kgdb debugging at 2am. drink some water, bestie π
and that's the whole page!! sign-off time: this one lives under ./include/linux, dated October 2026, and yes it's still part of the Kernel API Manual β mwah, go debug something iconic πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms