I would like to know what library is used to programmatically read custom variable structure information in ELF files?

The ELF file contains debug info, then the types of variables, structures, and great many other kinds of info can be extracted from that binary.Theoretically possible, but I don't know how to program the implementation by c language

For example if I have an embedded struct and variable like this:

typedef struct

{

    unsigned int varA;

    unsigned int varB;

}T_myStruct; 

T_myStruct data;

I want to get the address and type of not only data, but preferably data.varA and data.varB. I used segger ELFlib without success, and I was wondering if there was a more suitable library.