Q:

Get variable name by address

I have a dialog that displays an array of bytes, for the purpose of hex editing them. It is possible to switch displayed memory regions. But while some regions are internally arrays, there are a few regions that are structs, and I'm displaying certain elements from them (consecutively).
I want to add a kind of symbolic name feature, where selecting an address gives you its name. For actual arrays it's done by the user, who calls them whatever he wants, and it's saved in file. But those internal structs are not supposed to have user-defined names, instead I want to give them hard-coded names.
The question: is it possible to get their names by knowing their address? Like, byte X of struct Y is referring to the variable Z, when selecting cell X, display it's name as "Z". Or I also have to create name lists and use them regularly?
EDIT:
Simplifying the question: Is there a backward analog of offsetof()? Normally you pass it a pointer and a variable, and it gives you the offset to that variable. So I need to pass a pointer and an offset, and get the variable (structure member) name (and then stringify it with #).

A:

Ended up with making a vector of symbolic name structs (array pointer, start, size, name) and manually adding a bunch of names to it.

