I am debugging a while
loop using conditional breakpoints in gdb. There are multiple large arrays that are getting created in while
loop. I would like to print them in a file while debugging so that I can compare using diff
later.
I am able to visualize content at the console using the following command :
(gdb) p *&ff[0]@10
where ff
is my array. Kindly tell how I can redirect them to text file.
You can use:
(gdb) set logging file large_array.txt
(gdb) set logging on
By default the logging file name is gdb.txt
You can find more details at: https://sourceware.org/gdb/onlinedocs/gdb/Logging-Output.html
There is also one WA gdb --args a.out arg1 ... |& tee gdb_out.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With