sleeping_thread_to_gdb_regs(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ 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 β€” the struct task_struct of 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:


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