kdbnearsym(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

kdbnearsym β€” bestie, this is the function that finds you the name of the symbol with the nearest address that's less than whatever addr you throw at it. It's giving "who's your closest neighbor but make it hexadecimal." πŸ’…


✨ SYNOPSIS ✨

int kdbnearsym (unsigned long addr , kdb_symtab_t *symtab );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • addr β€” the address you wanna check for a nearby symbol. This is your starting point, your main character address, the one you're asking about. πŸ‘‘
  • symtab β€” a structure that receives the results. Think of it as the little gift bag that gets filled with symbol info once the function does its thing. 🎁

πŸ’… DESCRIPTION πŸ’…

⚠️ WARNING, BESTIE, READ THIS ⚠️ This function may return a pointer to a single statically allocated buffer called namebuf. That's right β€” one buffer, shared, no duplicates. kdb's unusual calling context saves the day here: it's single threaded and all other CPUs are halted, so we've got more than enough locking for this to be safe. The only constraint the static buffer imposes? You gotta consume any previous reply before you call it again to look up a new symbol. No hoarding old results, okay? 🫢

Now, here's the tea: strictly speaking, some architectures might re-enter the kdb trap if the system turns out to be very badly damaged. And yeah, that breaks the single-threaded assumption above. 😭 In those circumstances, successfully continuing and exiting from the inner trap is unlikely to work, and any user attempting this gets a prominent warning before being allowed to progress. We stay memory safe though β€” because namebuf[KSYM_NAME_LEN-1] will never change from ' ' (that's a space, bestie). We do tolerate the possibility of garbled symbol display from the outer kdb trap, though. It's giving "messy but survivable." πŸ’€βœ¨


🌈 RETURN 🌈

  • 0 β€” no sections contain this address, and symtab is zero filled. It's an empty vibe. πŸ™ˆ
  • 1 β€” address mapped to module/symbol/section, and the data is in symtab. Slay, it worked. πŸ‘‘

πŸ‘€ SEE ALSO πŸ‘€

  • Kernel file ./kernel/debug/kdb/kdb_support.c β€” go read it, iykyk. πŸ“–

This iconic little page comes from ./kernel/debug/kdb and was dated October 2026. Stay curious, stay caffeinated, and remember: static buffers are shared, so consume your reply before asking again. Mwah! πŸ’–πŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from