Right when I am at fflush(stdout) and I break there in GDB, can I know what is there in stdout before I actually print it?
How can I know what is there in stdout at any point in time?
If you allocate a buffer yourself and pass it to setvbuf, I suppose you can access it before a flush, since it's yours to begin with.
EDIT: Your comment made your intent more clear, but what you want won't be easy:
stdout,From then on, gdb will break each time anything accesses stdout, and you can check your buffer for changes, weird output, etc.
That said, that's not an ideal solution at all. A far better approach would be using a logging-enabled output function everywhere in your code.
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