This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] mi/10586

On 11/14/2011 10:17 AM, Tom Tromey wrote:
It also seems like it will do the wrong thing for -var-info-expression and

Hmm. Yeah, those will need special handling.


struct a
  struct {
    int b;
  struct {
    int c;

-var-create a * a
-var-list-children a = "public" (if c++)
-var-list-children a.public = "0_anonymous", "1_anonymous"
-var-list-children a.public.0_anonymous = "b" (via "public" if c++)
-var-list-children a.public.1_anonymous = "c" (via "public" if c++)

So far, so good, I think.


-var-info-expression a = "a"
-var-info-expression a.public = "public"
-var-info-expression a.public.0_anonymous = "0_anonymous"
-var-info-expression a.public.0_anonymous.b = "b"

According to the documentation, -var-info-expression is supposed to return a name of the variable/child which is to be presented to the user. I don't think we want to present "0_anonymous". GCC uses "<anonymous struct>", and that seems like a reasonable convention to follow.

-var-info-path-expression a = "a"
-var-info-path-expression a.public = ""
-var-info-path-expression a.public.0_anonymous = "((a).2_anonymous)"
-var-info-path-expression a.public.0_anonymous.b = "((((a).0_anonymous)).b)"

The documentation on this command says that it should return a valid expression that may be used, e.g., to create another varobj or to set a watchpoint.

Clearly the two last elements dealing with 0_anonymous are incorrect. I believe these should be:
-var-info-path-expression a.public.0_anonymous = ""
-var-info-path-expression a.public.0_anonymous.b = "((a).b)"

If we can agree what to do, I shall set about implementing the desired change.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]