且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

GDB 打印到文件而不是标准输出

更新时间:2023-12-04 10:38:52

您需要启用日志记录:

(gdb) set logging on

现在 GDB 将登录到 ./gdb.txt.你可以告诉它使用哪个文件:

Now GDB will log to ./gdb.txt. You can tell it which file to use:

(gdb) set logging file my_god_object.log

您可以检查当前的日志配置:

And you can examine the current logging configuration:

(gdb) show logging