Is there a way to grep on the output of print command in gdb? In my case, I am debugging a core dump using gdb and the object I am debugging contains hell lots of elements.
I am finding it difficult to look for a matching attribute i.e:
(gdb) print *this | grep <attribute>
(gdb) print *this | grep
The "standard" way to achieve this is to use Meta-X gdb
in emacs
.
An alternative:
(gdb) set logging on
(gdb) print *this
(gdb) set logging off
(gdb) shell grep attribute gdb.txt
The patch mentioned by cnicutar sure looks attractive compared to the above. I am guessing the reason it (or its equivalent) was never submitted is that most GDB maintainers use emacs
, and so don't have this problem in the first place.