find_data_type(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… find_data_type(9) β€” from the Kernel API Manual, bestie

Okay so real talk, this one's from the kernel API manual and it's genuinely iconic: find_data_type is the function that ✨finds✨ the data type sitting at a location. That's it. That's the whole vibe. Let's get into it 🫢


🌸 NAME 🌸

find_data_type β€” returns a data type at the location πŸ’–


✨ SYNOPSIS ✨

struct annotated_data_type * find_data_type (struct data_loc_info *dloc );

That's the whole signature, no cap. Returns a struct annotated_data_type *, takes one struct data_loc_info * called dloc. Slay.


πŸŽ€ ARGUMENTS πŸŽ€

  • dloc β€” the data location, periodt. That's what you're passing in, and that's what it's gonna go dig through πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the way this works is so cute: the function goes searching through the debug information of the binary to figure out the data type it accesses. Like it's literally snooping through the debug info to find your type. Obsessed.

Now, how the location gets expressed depends on what you're pointing at:

  • For pointer variables, the exact location is expressed by (ip, reg, offset) β€” yes, all three, in that order 🎯
  • For global variables, it's expressed by (ip, addr) β€” just the two, way simpler 🌈
Heads up bestie: global variables might update dloc->type_offset after it finds the start of the variable. So like, don't be surprised if that field comes back with a lil glow-up πŸ‘‘

And if it can't find a global variable by address? It'll try to find a declaration of the variable using var_name instead β€” main character problem-solving energy fr fr. In that case, dloc->offset won't be updated. Not a bug, just how it is πŸ™ˆ

It returns NULL if not found. That's the signal that it came up empty 😭


πŸ”₯ SEE ALSO πŸ”₯


πŸ’– that's the whole page, you ate it πŸ’–

Cute lil sign-off: this one lives over in ./tools/perf/util, and it's dated October 2026. Bye bestie πŸŽ€πŸ¦‹β­

πŸ“¦ where this page comes from