title: How to get value of a data member in gdb?
body: <p>Hi I am currently debugging my code base in linux machine through GDB. I am currently facing an issue in getting value of a data member from object ptr of a class. To print the location for object ptr we can use either "p" (print) or "display" command.</p>
  
  <p>For Eg: I have class like this</p>
  
  <pre><code>class abc
  {
      string a;
  };
  </code></pre>
  
  <p>So in my code if I am using a pointer for class abc, then </p>
  
  <pre><code>abc* objPtr = new abc();
  </code></pre>
  
  <p>so after breaking at above line i will get objPtr and now I want to check value of datamember a (abc::a) value. how I could do that?</p>
  
  <pre><code>(gdb) p objPtr
  $2 = {px = 0x3ba6430690, pn = {pi_ = 0x3ba6430698}}
  </code></pre>
  
  <p>Moreover Is there a different way to check a data member which is a list / vector ?</p>