问题 In GDB, I can turn logging on with "set logging on", but this only logs the results of my commands, and not the command itself. It would be useful if I could see the command typed as well. Is there any way to log the command typed? 回答1: Try man script . See also this ancient bug. The fact that this hasn't been fixed in 10 years makes me believe that it's unlikely to ever be fixed. Most GDB developers use emacs , run GDB from inside of emacs , and get the functionality you desire "for free".