title: Get address of member of struct using pyelftools
body: <p>I am using the pyelftools to read an elf file. How can I get an offset value or address of a member in a struct? For example, say I have the following struct in C.</p>
  <pre><code>typedef struct 
  {
      int valA;
  } TsA;
  
  typedef struct
  {
      int valB;
  } TsB;
  
  typedef struct 
  {
      int valC;
      TsB b;
  } TsC;
  
  typedef struct
  {
      TsA a;
      TsC c;
  } TsStruct;
  
  TsStrcut myStruct;
  </code></pre>
  <p>How can I get an address of <code>myStruct.c.b.valB</code>? I found a similar question <a href="https://stackoverflow.com/questions/24143326/extract-detailed-symbol-information-struct-members-from-elf-file-compiled-with">here</a> but did not find any good answer.</p>