In bash, I can use the script
command, which dumps everything that shows on the shell to a file, including:
- commands typed
- PS1 line
- stdout and stderr of commands
What is the equivalent in gdb?
I tried to run shell script
from inside GDB, but after I hit return, I was in the shell and lost the shell prompt and could not run command any more. Moreover I could not use ctrl+c or ctrl+\ to exit. I needed to force kill the /bin/login tty2
to exit.
Best Answer
If you want to log GDB's output, you can use the GDB logging output commands, eg.
If you want to redirect your program's output to a file, you can use a redirect, eg.
see the chapter on program IO in the GDB manual for more information