In gdb currently I can print the contents of a container, such as std::list, which contains a structure type. This type, however, is quite large and I need only values of some selected fields in every item from the container. So, let's say, I have a structure that contains about 100 fields and I have 3 items in the container and need to display the type
field. So:
(gdb) p items
will display lots of noise, while
(gdb) p items[0].type
won't work with std::list
, moreover, with list I can easily display the value of only the first item (other require lots of spaghetti with typecasts, fields reaching etc.), while I need someting, say:
(gdb-maybe) p {foreach i: items} i.type
which would display every item just like the container printer does normally, except that the displayed values will only contain the type
field.
Is there any way to achieve anything like this, or maybe some method to provide such a solution using a script?