`grub-probe` queries device info so GRUB can use upon booting your computer.
It starts with the normal OS-specific init, (mostly) zeroing out certain values, & parsing commandline flags. Then it considers setting $debug to "all", validates the `--device` flag, inits/finalizes various GRUB subsystems, determines which delimiter to use, invokes the core logic in one of 2 ways, possibly outputs a newline, & cleans up.
As for that core logic...
1/2?
The core logic fills in a default filepath & validates device names are given, branching depending on the commandline flags, iterates over the given devices to pull info on it & counting the number of devices, allocates an array & iterates again to populate that array, branches over that commandline flag some more, iterates over harddrives, & cleans up. For each harddrive it opens the device with logging, & branches over that commandline flag some more.
2/4?