This is an archive of the discontinued LLVM Phabricator instance.

[lldb-mi] Fix expansion of anonymous structures and unions
ClosedPublic

Authored by evgeny777 on Oct 21 2015, 8:30 AM.

Details

Summary

Suppose we have the following type

struct S {
   union {
       int            i1;
       unsigned u1;
   };
   union {
       int            i2;
       unsigned u2;
   };
};

Current revision makes it impossible to evaluate it using MI, because MI assigns '??' as variable name to each of the unnamed unions after "-var-list-children" command. Also '??' incorrectly goes to 'exp' field which is treated by IDE as a structure field name and is displayed in watch window.

The patch fixes this returning empty string as type name for unnamed union and assigning $N to variable name, where N is the field number in the parent entity.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 38017.Oct 21 2015, 8:30 AM
evgeny777 retitled this revision from to [lldb-mi] Fix expansion of anonymous structures and unions.
evgeny777 updated this object.
evgeny777 added reviewers: ki.stfu, abidh.
evgeny777 added subscribers: lldb-commits, KLapshin.
clayborg accepted this revision.Oct 21 2015, 11:29 AM
clayborg edited edge metadata.
This revision is now accepted and ready to land.Oct 21 2015, 11:29 AM
abidh accepted this revision.Oct 22 2015, 2:40 AM
abidh edited edge metadata.

LGTM. Thanks for doing it. For this case, the output of the lldb-mi looks more sensible then gdb.

This revision was automatically updated to reflect the committed changes.