Created attachment 8199 [details] an example, gdb and gcc information The Eclipse CDT C++ uses the "-var-info-path-expression" command from “mi” to obtain the expression for a certain variable. After that the expression is evaluated by using the "-data-evaluate-expression" command from mi and finally the result will be displayed in the detail panel from Variable/Expression View. Let's have an example: class A { public: A():_a(1) {} private: int _a; }; class B: public A { public: B(double b); private: double _b; }; B::B(double b):A() { _b = b; // line 23 in test.cpp is here ! } The reproducible steps are below: 1) The command line to compile the test case g++ -O0 -g -o test.elf test.cpp 2) Start the gdb gdb test.elf 3) Set a break-point at line 23 in the test.cpp file (gdb) b test.cpp:23 4) run (gdb) run 5) Create a variable for "this" and explore the member of class; after that try to evaluate the expression obtained from the "-var-info-path-expression" command (gdb) interpreter-exec mi "-var-create --thread 1 --frame 0 - * this" response from gdb == > ^done,name="var1",numchild="2",value="0x7fffffffe860",type="B * const",thread-id="1",has_more="0" (gdb) interpreter-exec mi "-var-list-children var1" response from gdb == > ^done,numchild="2",children=[child={name="var1.A",exp="A",numchild="1",type="A",thread-id="1"},child={name="var1.private",exp="private",numchild="1",thread-id="1"}],has_more="0" (gdb) interpreter-exec mi "-var-list-children var1.A" response from gdb == > ^done,numchild="1",children=[child={name="var1.A.private",exp="private",numchild="1",thread-id="1"}],has_more="0" (gdb) interpreter-exec mi "-var-info-path-expression var1.A" response from gdb == > ^done,path_expr="(*(class A*) this)" (gdb) print (*(class A*) this) response from gdb == > This context has class, union or enum A, not a struct. (gdb) print (*(struct A*) this) response from gdb == > This context has class, union or enum A, not a struct. (gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0 "(*(struct A*) this)"' response from gdb == > ^error,msg="This context has class, union or enum A, not a struct." Here you can see the first type of C++ expression that cannot be evaluated! (gdb) interpreter-exec mi "-var-list-children var1.A.private" response from gdb == > ^done,numchild="1",children=[child={name="var1.A.private._a",exp="_a",numchild="0",type="int",thread-id="1"}],has_more="0" (gdb) interpreter-exec mi "-var-list-children var1.A.private._a" response from gdb == > ^done,numchild="0",has_more="0" (gdb) interpreter-exec mi "-var-info-path-expression var1.A.private._a" response from gdb == > ^done,path_expr="(((*(class A*) this))._a)" (gdb) print (((*(class A*) this))._a) response from gdb == > This context has class, union or enum A, not a struct. (gdb) print (((*(struct A*) this))._a) response from gdb == > This context has class, union or enum A, not a struct. (gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0 "(((*(class A*) this))._a)"' response from gdb == > ^error,msg="This context has class, union or enum A, not a struct." Here you can see the second type of C++ expression that cannot be evaluated!
This is fixed since 7.10: (gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0 "(*(struct A*) this)"' ^done,value="{_a = 1}" (gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0 "(((*(class A*) this))._a)"' ^done,value="1"