Gopa
Gopa

Reputation: 33

GDB 7.2 + python: how to get members of anonymous structure?

GDB 7.2 python doesn't have gdb.Type.iteritems method. Anyway I can access the members of the anonymous structure (which is within another structure of course) from gdb 7.2 ? The assumption is that I dont know know the name of the members of the anonymous structure or else I could have done gdb.parse_and_eval on them.

Upvotes: 1

Views: 358

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22519

I think you can use Type.fields to iterate over the fields.

Then, you can look at the field offset and you can compute a pointer to the anonymous field, along the lines of (type *) (((char *) obj) + offset).

This isn't ideal. There is a bug open to implement something better.

Upvotes: 1

Related Questions