]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: fix completion of anonymous struct members
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 24 Apr 2025 15:13:37 +0000 (11:13 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 24 Apr 2025 16:50:20 +0000 (12:50 -0400)
commita163e2015a4e2f9b6701832d3c40f848524e4793
tree34048802165176437c80e34939afbfb9f1380f9c
parent93e6a942e9707e0f229d61772651ae6cf38200c5
gdb: fix completion of anonymous struct members

Completing fields inside an anonymous struct does not work.  With:

    struct commit_counters_hot {
     union {
     struct {
     long owner;
     };
     char padding[16];
     };
    };

I get:

    (gdb) complete print cc_hot.
    print cc_hot.padding

After this patch, I get:

    (gdb) complete print cc_hot.
    print cc_hot.owner
    print cc_hot.padding

Update break1.c to include an anonymous struct.  The tests that complete
"z_field" inside gdb.base/completion.exp would start to fail without the
fix.

Change-Id: I46b65a95ad16b0825de58dfa241777fe57acc361
Reviewed-By: Keith Seitz <keiths@redhat.com>
gdb/eval.c
gdb/testsuite/gdb.base/break1.c